asana

package module
v0.0.0-...-2945f6e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2021 License: MIT Imports: 21 Imported by: 0

README

asana-go

Documentation

Overview

Package asana provides a client for the Asana API

Index

Constants

View Source
const (
	Currency   = "currency"
	Identifier = "identifier"
	Percentage = "percentage"
	Custom     = "custom"
	None       = "none"
)
View Source
const (
	// BaseURL is the default URL used to access the Asana API
	BaseURL = "https://app.asana.com/api/1.0"
)

Variables

This section is empty.

Functions

func IsAuthError

func IsAuthError(err error) bool

IsAuthError checks if the provided error represents a 401 Authorization error response from the API

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError checks if the provided error represents a 404 not found response from the API

func IsPayloadTooLarge

func IsPayloadTooLarge(err error) bool

IsRateLimited returns true if the error was a rate limit error

func IsRateLimited

func IsRateLimited(err error) bool

IsRateLimited returns true if the error was a rate limit error

func IsRecoverableError

func IsRecoverableError(err error) bool

func RetryAfter

func RetryAfter(err error) time.Duration

RetryAfter returns a Duration indicating after how many seconds a rate-limited requests may be retried or nil if the error was not a rate limit error

Types

type AddCustomFieldSettingRequest

type AddCustomFieldSettingRequest struct {
	CustomField  string `json:"custom_field"`
	Important    bool   `json:"is_important,omitempty"`
	InsertBefore string `json:"insert_before,omitempty"`
	InsertAfter  string `json:"insert_after,omitempty"`
}

type AddDependenciesRequest

type AddDependenciesRequest struct {
	// Required: An array of task IDs that this task should depend on.
	Dependencies []string `json:"dependencies"`
}

AddDependenciesRequest

type AddDependentsRequest

type AddDependentsRequest struct {
	// Required: An array of task IDs that this task should depend on.
	Dependents []string `json:"dependents"`
}

AddDependentsRequest

type AddProjectRequest

type AddProjectRequest struct {
	Project      string // Required: The project to add the task to.
	InsertAfter  string // A task in the project to insert the task after, or "-" to insert at the beginning of the list.
	InsertBefore string // A task in the project to insert the task before, or "-" to insert at the end of the list.
	Section      string // A section in the project to insert the task into. The task will be inserted at the bottom of the section.
}

AddProjectRequest defines the location a task should be added to a project

type App

type App struct {
	// contains filtered or unexported fields
}

App represents an Asana client application

func NewApp

func NewApp(config *AppConfig) *App

NewApp creates a new App with the provided configuration

func (*App) AuthCodeURL

func (a *App) AuthCodeURL(state string) string

see oauth2 package

func (*App) Exchange

func (a *App) Exchange(code string) (*oauth2.Token, error)

see oauth2 package

func (*App) NewClient

func (a *App) NewClient(token *oauth2.Token) *Client

NewClient creates a new Asana client using the provided credentials

type AppConfig

type AppConfig struct {
	ClientID     string
	ClientSecret string
	RedirectURL  string
}

AppConfig provides the details needed to authenticate users with Asana on behalf of an Asana client application

type Attachment

type Attachment struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	// Read-only. The task this object is attached to.
	Parent *Task `json:"parent,omitempty"`

	// Read-only. The time at which this object was created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// Read-only. The URL containing the content of the attachment.
	//
	// Note: May be null if the attachment is hosted by box. If present, this
	// URL may only be valid for 1 hour from the time of retrieval. You should
	// avoid persisting this URL somewhere and just refresh it on demand to
	// ensure you do not keep stale URLs.
	DownloadURL string `json:"download_url,omitempty"`

	// Read-only. The service hosting the attachment. Valid values are asana,
	// dropbox, gdrive and box.
	Host string `json:"host,omitempty"`

	// Read-only. The URL where the attachment can be viewed, which may be
	// friendlier to users in a browser than just directing them to a raw
	// file.
	ViewURL string `json:"view_url,omitempty"`

	// Undocumented. A permanent asana.com link which should be a permalink
	PermanentURL string `json:"permanent_url,omitempty"`
}

Attachment represents any file attached to a task in Asana, whether it’s an uploaded file or one associated via a third-party service such as Dropbox or Google Drive.

type Change

type Change struct {
	Action       string      `json:"action"`
	AddedValue   interface{} `json:"added_value"`
	NewValue     interface{} `json:"new_value"`
	RemovedValue interface{} `json:"removed_value"`
	Field        string      `json:"field"`
}

Change represents Information about the type of change that has occurred. This field is only present when the value of the property action, describing the action taken on the resource, is "changed"

type Client

type Client struct {
	BaseURL    *url.URL
	HTTPClient *http.Client

	Debug          bool
	Verbose        []bool
	DefaultOptions Options
}

Client is the root client for the Asana API. The nested HTTPClient should provide Authorization header injection.

func NewClient

func NewClient(httpClient *http.Client) *Client

NewClient instantiates a new Asana client with the given HTTP client and the default base URL

func NewClientWithAccessToken

func NewClientWithAccessToken(accessToken string) *Client

NewClientWithAccessToken creates a new instance of the Asana client which uses a Personal Access Token for authentication

func (*Client) AllWorkspaces

func (c *Client) AllWorkspaces(options ...*Options) ([]*Workspace, error)

AllWorkspaces repeatedly pages through all available workspaces for a client

func (*Client) CreateCustomField

func (c *Client) CreateCustomField(request *CreateCustomFieldRequest) (*CustomField, error)

func (*Client) CreateProject

func (c *Client) CreateProject(project *CreateProjectRequest) (*Project, error)

CreateProject adds a new project to a workspace

func (*Client) CreateTask

func (c *Client) CreateTask(task *CreateTaskRequest) (*Task, error)

CreateTask creates a new task in the given project

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(webhook *CreateWebhookRequest) (*Webhook, error)

CreateWebhook creates a new webhook

func (*Client) CurrentUser

func (c *Client) CurrentUser() (*User, error)

CurrentUser gets the currently authorized user

func (*Client) GetProject

func (client *Client) GetProject(id string, opts ...*Options) (*Project, error)

GetProject returns the complete project record for a single project. duplicates of Fetch function

func (*Client) GetTask

func (c *Client) GetTask(id string, opts ...*Options) (*Task, error)

GetTask returns complete task record for a single task. duplicates of Fetch function

func (*Client) GetTeam

func (client *Client) GetTeam(id string, opts ...*Options) (*Team, error)

GetTeam returns the complete team record for a single team. duplicates of Fetch function

func (*Client) GetUserTaskList

func (c *Client) GetUserTaskList(id, workspaceID string) (*UserTaskList, error)

GetUserTaskList returns the full record for a user's task list.

func (*Client) GetWebhooks

func (c *Client) GetWebhooks(workspaceID, resource string, opts ...*Options) ([]*Webhook, *NextPage, error)

GetWebhooks get all webhooks of workspace workspaceID

func (*Client) QueryTasks

func (c *Client) QueryTasks(query *TaskQuery, opts ...*Options) ([]*Task, *NextPage, error)

QueryTasks returns the compact task records for some filtered set of tasks. Use one or more of the parameters provided to filter the tasks returned. You must specify a project or tag if you do not specify assignee and workspace.

func (*Client) UserTeams

func (c *Client) UserTeams(uid string, options ...*Options) ([]*Team, *NextPage, error)

UserTeams the compact records for all teams to which the given user is assigned The workspace field of options is mandatory

func (*Client) Workspaces

func (c *Client) Workspaces(options ...*Options) ([]*Workspace, *NextPage, error)

Workspaces returns workspaces and organizations accessible to the currently authorized account

type CreateCustomFieldRequest

type CreateCustomFieldRequest struct {
	CustomFieldBase

	// Required: The workspace to create a custom field in.
	Workspace string `json:"workspace"`

	// The discrete values the custom field can assume.
	// Required if the custom field is of type ‘enum’.
	EnumOptions []*EnumValueBase `json:"enum_options,omitempty"`
}

type CreateMembership

type CreateMembership struct {
	Project string `json:"project"`
	Section string `json:"section"`
}

type CreateProjectRequest

type CreateProjectRequest struct {
	ProjectBase

	Workspace    string                 `json:"workspace,omitempty"`
	Team         string                 `json:"team,omitempty"`
	Owner        string                 `json:"owner,omitempty"`
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
}

CreateProjectRequest represents a request to create a new project

type CreateTaskRequest

type CreateTaskRequest struct {
	TaskBase

	Assignee  string   `json:"assignee,omitempty"`  // User to which this task is assigned, or null if the task is unassigned.
	Followers []string `json:"followers,omitempty"` // Array of users following this task.

	Workspace    string                 `json:"workspace,omitempty"`
	Parent       string                 `json:"parent,omitempty"`
	Projects     []string               `json:"projects,omitempty"`
	Memberships  []*CreateMembership    `json:"memberships,omitempty"`
	Tags         []string               `json:"tags,omitempty"`
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
}

CreateTaskRequest represents a request to create a new Task

func (*CreateTaskRequest) Validate

func (t *CreateTaskRequest) Validate() error

Validate checks the task data and fixes any problems

type CreateWebhookRequest

type CreateWebhookRequest struct {
	Filters  []WebhookFilter `json:"filters,omitempty"`
	Target   string          `json:"target"`
	Resource string          `json:"resource"`
}

CreateWebhookRequest represents a request to create a new Webhook

type CustomField

type CustomField struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	CustomFieldBase

	// Only relevant for custom fields of type ‘Enum’. This array specifies
	// the possible values which an enum custom field can adopt.
	EnumOptions []*EnumValue `json:"enum_options,omitempty"`
}

Custom Fields store the metadata that is used in order to add user- specified information to tasks in Asana. Be sure to reference the Custom Fields developer documentation for more information about how custom fields relate to various resources in Asana. Users in Asana can lock custom fields, which will make them read-only when accessed by other users. Attempting to edit a locked custom field will return HTTP error code 403 Forbidden.

func (*CustomField) Fetch

func (f *CustomField) Fetch(client *Client, options ...*Options) error

Fetch loads the full details for this CustomField

type CustomFieldBase

type CustomFieldBase struct {
	// ISO 4217 currency code to format this custom field. This will be null
	// if the format is not currency.
	CurrencyCode string `json:"currency_code,omitempty"`

	// This is the string that appears next to the custom field value.
	// This will be null if the format is not custom.
	CustomLabel string `json:"custom_label,omitempty"`

	// Only relevant for custom fields with custom format. This depicts where to place the custom label.
	// This will be null if the format is not custom.
	CustomLabelPosition LabelPosition `json:"custom_label_position,omitempty"`

	// The description of the custom field.
	Description string `json:"description,omitempty"`

	// Opt In. The description of the custom field.
	Enabled *bool `json:"enabled,omitempty"`

	// The format of this custom field.
	Format Format `json:"format,omitempty"`

	// Conditional. This flag describes whether a follower of a task with this
	// field should receive inbox notifications from changes to this field.
	HasNotificationsEnabled *bool `json:"has_notifications_enabled,omitempty"`

	// This flag describes whether this custom field is available to every container
	// in the workspace. Before project-specific custom fields, this field was always true.
	IsGlobalToWorkspace *bool `json:"is_global_to_workspace,omitempty"`

	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	// Only relevant for custom fields of type ‘Number’. This field dictates the number of places after
	// the decimal to round to, i.e. 0 is integer values, 1 rounds to the nearest tenth, and so on.
	// Must be between 0 and 6, inclusive.
	// For percentage format, this may be unintuitive, as a value of 0.25 has a precision of 0, while a
	// value of 0.251 has a precision of 1. This is due to 0.25 being displayed as 25%.
	// The identifier format will always have a precision of 0.
	Precision *int `json:"precision,omitempty"`

	// The type of the custom field. Must be one of the given values:
	// 'text', 'enum', 'number'
	ResourceSubtype FieldType `json:"resource_subtype"`
}

type CustomFieldSetting

type CustomFieldSetting struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	CustomField *CustomField `json:"custom_field"`

	Project *Project `json:"project,omitempty"`

	Important bool `json:"is_important,omitempty"`
}

type CustomFieldValue

type CustomFieldValue struct {
	CustomField

	// Custom fields of type text will return a text_value property containing
	// the string of text for the field.
	TextValue *string `json:"text_value,omitempty"`

	// Custom fields of type number will return a number_value property
	// containing the number for the field.
	NumberValue *float64 `json:"number_value,omitempty"`

	// Custom fields of type enum will return an enum_value property
	// containing an object that represents the selection of the enum value.
	EnumValue *EnumValue `json:"enum_value,omitempty"`
}

When a custom field is associated with a project, tasks in that project can carry additional custom field values which represent the value of the field on that particular task - for instance, the selected item from an enum type custom field. These custom fields will appear as an array in a custom_fields property of the task, along with some basic information which can be used to associate the custom field value with the custom field metadata.

type Date

type Date time.Time

Date wraps the default time.Time type with appropriate JSON formatting for the Asana API when a date is required: '2012-03-26'

func (*Date) MarshalJSON

func (d *Date) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaller interface

func (*Date) String

func (d *Date) String() string

String returns the Date in a string format

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(value []byte) error

UnmarshalJSON implements the json.Unmarshaller interface

type Dates

type Dates struct {
	DueOn   *Date      `json:"due_on,omitempty"`
	DueAt   *time.Time `json:"due_at,omitempty"`
	StartOn *Date      `json:"start_on,omitempty"`
}

type DeleteResponse

type DeleteResponse struct {
	Data interface{} `json:"data"`
}

DeleteResponse is the Response for the delete endpoint

type EnumValue

type EnumValue struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	EnumValueBase

	Enabled bool `json:"enabled"`
}

type EnumValueBase

type EnumValueBase struct {
	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	Color string `json:"color"`
}

type Error

type Error struct {
	StatusCode int
	Type       string
	Message    string        `json:"message"`
	Phrase     string        `json:"phrase"`
	Help       string        `json:"help"`
	RetryAfter time.Duration `json:"-"`
	RequestID  string        `json:"-"`
}

Error is an error message returned by the API

func IsAsanaError

func IsAsanaError(err error) (*Error, bool)

func (Error) Error

func (err Error) Error() string

type Event

type Event struct {
	Action    string     `json:"action"`
	Change    Change     `json:"change"`
	Parent    Resource   `json:"parent"`
	Resource  Resource   `json:"resource"`
	User      Resource   `json:"user"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
}

Event represents a change to a resource that was observed by an event subscription or delivered asynchronously to the target location of an active webhook

type Events

type Events struct {
	Events []Event `json:"events"`
}

Events represents the data received in a webhook payload

type ExternalData

type ExternalData struct {
	ID   string `json:"gid,omitempty"`
	Data string `json:"data,omitempty"`
}

ExternalData allows a client application to add app-specific metadata to Tasks in the API. The custom data includes a string id that can be used to retrieve objects and a data blob that can store character strings.

The blob may store unicode-safe serialized data such as JSON or YAML. The external id is capped at 1,024 characters, while data blobs are capped at 32,768 characters. Each object supporting external data can have one id and one data blob stored with it. You can also use either or both of those fields.

The external id field is a good choice to create a reference between a resource in Asana and another database, such as cross-referencing an Asana task with a customer record in a CRM, or a bug in a dedicated bug tracker. Since it is just a unicode string, this field can store numeric IDs as well as URIs, however, when using URIs extra care must be taken when forming queries that the parameter is escaped correctly. By assigning an external id you can use the notation external:custom_id to reference your object anywhere that you may use the original object id.

Note: that you will need to authenticate with Oauth, as the id and data are app-specific, and these fields are not visible in the UI. This also means that external data set by one Oauth app will be invisible to all other Oauth apps. However, the data is visible to all users of the same app that can view the resource to which the data is attached, so this should not be used for private user data.

type Feature

type Feature string
const (
	NewTaskSubtypes Feature = "new_task_subtypes"
	NewSections     Feature = "new_sections"
	StringIDs       Feature = "string_ids"
)

func (Feature) String

func (f Feature) String() string

type FieldType

type FieldType string
const (
	Text   FieldType = "text"
	Enum   FieldType = "enum"
	Number FieldType = "number"
)

FieldTypes for CustomField.Type field

type Format

type Format string

type LabelPosition

type LabelPosition string
const (
	Prefix LabelPosition = "prefix"
	Suffix LabelPosition = "suffix"
)

type Membership

type Membership struct {
	Project *Project `json:"project,omitempty"`
	Section *Section `json:"section,omitempty"`
}

Membership describes projects a task is associated with and the section it is in.

type NewAttachment

type NewAttachment struct {
	Reader      io.ReadCloser
	FileName    string
	ContentType string
}

type NextPage

type NextPage struct {
	Offset string `json:"offset"`
	Path   string `json:"path"`
	URI    string `json:"uri"`
}

type Options

type Options struct {
	// Provides the response in “pretty” output. In the case of JSON this
	// means doing proper line breaking and indentation to make it readable.
	// This will take extra time and increase the response size so it is
	// advisable only to use this during debugging.
	Pretty bool `json:"pretty,omitempty" url:"opt_pretty,omitempty"`

	// In environments that do not support the full range of HTTP verbs, this
	// can be helpful to override the request method sent by the browser,
	// allowing access to the full range of actions in the API. This should
	// only be used when absolutely necessary, as circumventing the browser’s
	// normal interpretation of the HTTP verbs can cause issues. For security
	// reasons, you cannot use this parameter from a GET request, you can only
	// use it to transform a POST request into something else (like a PUT or
	// DELETE).
	Method string `json:"method,omitempty" url:"-"`

	// Some requests return compact representations of objects, to conserve
	// resources and complete the request more efficiently. Other times
	// requests return more information than you may need. This option allows
	// you to list the exact set of fields that the API should be sure to
	// return for the objects. The field names should be provided as paths,
	// described below.   The id of included objects will always be returned,
	// regardless of the field options.
	Fields []string `json:"fields,omitempty" url:"opt_fields,omitempty,comma"`

	// Query results and sub-objects are returned in compact form by default.
	// This option can be used to expand query results or sub-objects to
	// return more detailed information. Be sure you really need the
	// information in the expanded form, as executing a query with many
	// results in expanded form can be costly and return you a lot of data to
	// consume. If the fields option is also used, it will take precedence
	// over the expand option and prevent expansion.
	Expand []string `json:"expand,omitempty" url:"opt_expand,omitempty,comma"`

	// Returns the output in JSON-P format instead of plain JSON, to allow
	// requests to come from within browsers and work around the “same origin
	// policy.” The function named as the value of the opt_jsonp parameter
	// will be called with a single argument, a JavaScript object representing
	// the response.
	JSONP string `json:"jsonp,omitempty" url:"opt_jsonp,omitempty"`

	// The number of objects to return per page. The value must be between 1 and 100.
	Limit int `json:"limit,omitempty" url:"limit,omitempty"`

	// An offset to the next page returned by the API. A pagination request
	// will return an offset token, which can be used as an input parameter to
	// the next request. If an offset is not passed in, the API will return
	// the first page of results.
	//
	// Note: You can only pass in an offset that was returned to you via a
	// previously paginated request.
	Offset string `json:"offset,omitempty" url:"offset,omitempty"`

	// Headers
	FastAPI bool      `json:"-" url:"-"`
	Enable  []Feature `json:"-" url:"-"`
	Disable []Feature `json:"-" url:"-"`

	// Filters
	Workspace    string `json:"workspace,omitempty" url:"workspace,omitempty"`
	Organization string `json:"organization,omitempty" url:"organization,omitempty"`
	Owner        string `json:"owner,omitempty" url:"owner,omitempty"`
	Archived     *bool  `json:"archived,omitempty" url:"archived,omitempty"`
}

Options - In addition to providing fields and their values in a request, you may also specify options to control how your request is interpreted and how the response is generated. For GET requests, options are specified as URL parameters prefixed with opt_. For POST or PUT requests, options are specified in the body, inside the top-level options object (a sibling of the data object).

These options can be used in combination in a single request, though some of them may conflict in their impact on the response.

func Fields

func Fields(i interface{}) *Options

Fields gets all valid JSON fields for a type

type Portfolio

type Portfolio struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`
}

type Project

type Project struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	ProjectBase

	// Read-only. The time at which this object was created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// Read-only. Array of Custom Field Settings (in compact form).
	CustomFieldSettings []*CustomFieldSetting `json:"custom_field_settings,omitempty"`

	// Read-only. Array of users who are members of this project.
	Members []*User `json:"members,omitempty"`

	// Read-only. The time at which this object was last modified.
	//
	// Note: This does not currently reflect any changes in associations such
	// as tasks or comments that may have been added or removed from the
	// object.
	ModifiedAt *time.Time `json:"modified_at,omitempty"`

	// Create-only. The workspace or organization this object is associated
	// with. Once created, objects cannot be moved to a different workspace.
	// This attribute can only be specified at creation time.
	Workspace *Workspace `json:"workspace,omitempty"`

	// Array of custom field values set on the project for a custom field applied
	// to a parent portfolio. Take care to avoid confusing these custom field values
	// with the custom field settings in the custom_field_settings property.
	//
	// Please note that the gid returned on each custom field value is identical to
	// the gid of the custom field, which allows referencing the custom field through
	// the /custom_fields/{custom_field_gid} endpoint.
	CustomFields []*CustomFieldValue `json:"custom_fields,omitempty"`

	// Read-only. Array of users following this project. Followers are a
	// subset of members who receive all notifications for a project, the
	// default notification setting when adding members to a project in-
	// product.
	Followers []*User `json:"followers,omitempty"`

	// The current owner of the project, may be null.
	Owner *User `json:"owner,omitempty"`

	// Create-only. The team that this project is shared with. This field only
	// exists for projects in organizations.
	Team *Team `json:"team,omitempty"`
}

Project represents a prioritized list of tasks in Asana. It exists in a single workspace or organization and is accessible to a subset of users in that workspace or organization, depending on its permissions.

Projects in organizations are shared with a single team. You cannot currently change the team of a project via the API. Non-organization workspaces do not have teams and so you should not specify the team of project in a regular workspace.

Followers of a project are a subset of the members of that project. Followers of a project will receive all updates including tasks created, added and removed from that project. Members of the project have access to and will receive status updates of the project. Adding followers to a project will add them as members if they are not already, removing followers from a project will not affect membership.

func (*Project) AddCustomFieldSetting

func (p *Project) AddCustomFieldSetting(client *Client, request *AddCustomFieldSettingRequest) (*CustomFieldSetting, error)

func (*Project) CreateSection

func (p *Project) CreateSection(client *Client, section *SectionBase) (*Section, error)

CreateSection creates a new section in the given project

func (*Project) Fetch

func (p *Project) Fetch(client *Client, opts ...*Options) error

Fetch loads the full details for this Project

func (*Project) InsertSection

func (p *Project) InsertSection(client *Client, request *SectionInsertRequest) error

InsertSection moves sections relative to each other in a board view. One of before_section or after_section is required.

Sections cannot be moved between projects.

At this point in time, moving sections is not supported in list views, only board views.

func (*Project) RemoveCustomFieldSetting

func (p *Project) RemoveCustomFieldSetting(client *Client, customFieldID string) error

func (*Project) Sections

func (p *Project) Sections(client *Client, opts ...*Options) ([]*Section, *NextPage, error)

Sections returns a list of sections in this project

func (*Project) Tasks

func (p *Project) Tasks(client *Client, opts ...*Options) ([]*Task, *NextPage, error)

Tasks returns a list of tasks in this project

func (*Project) Update

func (p *Project) Update(client *Client, request *UpdateProjectRequest, opts ...*Options) error

Update

When using this method, it is best to specify only those fields you wish to change, or else you may overwrite changes made by another user since you last retrieved the task.

Updates the referenced project object

type ProjectBase

type ProjectBase struct {

	// True if the project is archived, false if not. Archived projects do not
	// show in the UI by default and may be treated differently for queries.
	Archived bool `json:"archived,omitempty"`

	// Color of the object. Must be either null or one of: dark-pink, dark-
	// green, dark-blue, dark-red, dark-teal, dark-brown, dark-orange, dark-
	// purple, dark-warm-gray, light-pink, light-green, light-blue, light-red,
	// light-teal, light-yellow, light-orange, light-purple, light-warm-gray.
	Color string `json:"color,omitempty"`

	// A description of the project’s status containing a color (must be
	// either null or one of: green, yellow, red) and a short description.
	CurrentStatus *ProjectStatus `json:"current_status,omitempty"`

	// The layout (board or list view) of the project.
	DefaultView View `json:"default_view,omitempty"`

	// The day on which this project is due. This takes a date with format
	// YYYY-MM-DD.
	DueOn *Date `json:"due_on,omitempty"`

	// The notes of the text with formatting as HTML.
	HTMLNotes string `json:"html_notes,omitempty"`

	Icon string `json:"icon,omitempty"`

	// Opt In. Determines if the project is a template.
	IsTemplate bool `json:"is_template,omitempty"`

	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	// More detailed, free-form textual information associated with the
	// object.
	Notes string `json:"notes,omitempty"`

	// True if the project is public to the organization. If false, do not
	// share this project with other users in this organization without
	// explicitly checking to see if they have access.
	Public bool `json:"public,omitempty"`

	// The day on which this project starts. This takes a date with format
	// YYYY-MM-DD.
	StartOn *Date `json:"start_on,omitempty"`
}

ProjectBase contains the parts of Project which are not related to a specific instance

type ProjectStatus

type ProjectStatus struct {
	Color  string `json:"color,omitempty"`
	Text   string `json:"text,omitempty"`
	Author *User  `json:"author,omitempty"`
}

ProjectStatus is a description of the project’s status containing a color (must be either null or one of: green, yellow, red) and a short description.

type Resource

type Resource struct {
	// Read-only. Globally unique ID of the object
	ID           string `json:"gid,omitempty"`
	ResourceType string `json:"resource_type,omitempty"`
	Name         string `json:"name"`
}

Resource represents a generic Asana Resource,

containing a globally unique identifier.

type Response

type Response struct {
	Data     json.RawMessage `json:"data"`
	NextPage *NextPage       `json:"next_page"`
	Errors   []*Error        `json:"errors"`
}

An API response

func (*Response) Error

func (r *Response) Error(resp *http.Response, requestID xid.ID) error

type Section

type Section struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	SectionBase

	// Read-only. The time at which this object was created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// Read-only. The project which contains the section.
	Project *Project `json:"project,omitempty"`
}

A Section is a subdivision of a project that groups tasks together. It can either be a header above a list of tasks in a list view or a column in a board view of a project.

Sections are largely a shared idiom in Asana’s API for both list and board views of a project regardless of the project’s layout.

The ‘memberships’ property when getting a task will return the information for the section or the column under ‘section’ in the response.

func (*Section) Delete

func (s *Section) Delete(client *Client) error

func (*Section) Fetch

func (s *Section) Fetch(client *Client) error

Fetch loads the full details for this Section

func (*Section) Tasks

func (s *Section) Tasks(client *Client, opts ...*Options) ([]*Task, *NextPage, error)

Tasks returns a list of tasks in this section. Board view only.

type SectionBase

type SectionBase struct {
	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`
}

type SectionInsertRequest

type SectionInsertRequest struct {
	Project       string `json:"project_gid"`
	Section       string `json:"section"`
	BeforeSection string `json:"before_section,omitempty"`
	AfterSection  string `json:"after_section,omitempty"`
}

type SectionMigrationStatus

type SectionMigrationStatus string
const (
	NotMigrated SectionMigrationStatus = "not_migrated"
	InProgress  SectionMigrationStatus = "in_progress"
	Completed   SectionMigrationStatus = "completed"
)

type SetParentRequest

type SetParentRequest struct {
	Parent       string // Required: The new parent of the task, or null for no parent.
	InsertAfter  string // A subtask of the parent to insert the task after, or "-" to insert at the beginning of the list.
	InsertBefore string // A subtask of the parent to insert the task before, or "-" to insert at the end of the list.
}

SetParentRequest changes the parent of a task. Each task may only be a subtask of a single parent, or no parent task at all. When using insert_before and insert_after, at most one of those two options can be specified, and they must already be subtasks of the parent.

type Story

type Story struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	StoryBase

	// Read-only. The time at which this object was created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// True if the story is liked by the authorized user, false if not.
	// Note: This property only exists for stories that provide likes.
	Liked bool `json:"liked,omitempty"`

	// Read-only. Array of users who have liked this story.
	// Note: This property only exists for stories that provide likes.
	Likes []*User `json:"likes,omitempty"`

	// Read-only. The number of users who have liked this story.
	// Note: This property only exists for stories that provide likes.
	NumLikes int32 `json:"num_likes,omitempty"`

	// The user who created the story.
	CreatedBy *User `json:"created_by,omitempty"`

	// Read-only. The object this story is associated with. Currently may only
	// be a task.
	Target *Task `json:"target,omitempty"`

	// Read-only. The component of the Asana product the user used to trigger
	// the story.
	Source string `json:"source,omitempty"`

	// Read-only. The type of story. This provides fine-grained information about what
	// triggered the story’s creation. There are many story subtypes, so inspect the
	// data returned from Asana’s API to find the value for your use case.
	ResourceSubtype string `json:"resource_subtype,omitempty"`

	// A union of all possible subtype fields
	StorySubtypeFields
}

Story represents an activity associated with an object in the Asana system. Stories are generated by the system whenever users take actions such as creating or assigning tasks, or moving tasks between projects. Comments are also a form of user-generated story.

Stories are a form of history in the system, and as such they are read- only. Once generated, it is not possible to modify a story.

func (*Story) UpdateStory

func (s *Story) UpdateStory(client *Client, story *StoryBase) (*Story, error)

UpdateStory updates the story and returns the full record for the updated story. Only comment stories can have their text updated, and only comment stories and attachment stories can be pinned. Only one of text and html_text can be specified.

type StoryBase

type StoryBase struct {
	// Human-readable text for the story or comment. This will
	// not include the name of the creator. Can be edited only if the story is a comment.
	//
	// Note: This is not guaranteed to be stable for a given type of story.
	// For example, text for a reassignment may not always say “assigned to …”
	// as the text for a story can both be edited and change based on the language
	// settings of the user making the request. Use the resource_subtype property to
	// discover the action that created the story.
	Text string `json:"text,omitempty"`

	// HTML formatted text for a comment. This will not include the name of the creator.
	// Can be edited only if the story is a comment.
	//
	// Note: This field is only returned if explicitly requested using the
	// opt_fields query parameter.
	HTMLText string `json:"html_text,omitempty"`

	// Whether the story should be pinned on the resource.
	// Note: This field is only present on comment and attachment stories.
	IsPinned bool `json:"is_pinned,omitempty"`
}

StoryBase contains the text of a story, as used when creating a new comment

type StorySubtypeFields

type StorySubtypeFields struct {
	// Whether the text of the story has been edited after creation.
	// Note: This field is only present on comment stories.
	IsEdited bool `json:"is_edited,omitempty"`

	// Present for due_date_changed, dependency_due_date_changed
	NewDates *Dates `json:"new_dates,omitempty"`

	// Present for due_date_changed
	OldDates *Dates `json:"old_dates,omitempty"`

	// Present for name_changed
	OldName string `json:"old_name,omitempty"`
	NewName string `json:"new_name,omitempty"`

	// Present for resource_subtype_changed
	OldResourceSubtype string `json:"old_resource_subtype,omitempty"`
	NewResourceSubtype string `json:"new_resource_subtype,omitempty"`

	// Present for comment_liked, completion_liked
	Story *Story `json:"story,omitempty"`

	// Present for attachment_liked
	Attachment *Attachment `json:"attachment,omitempty"`

	// Present for assigned
	Assignee *User `json:"assignee,omitempty"`

	// Present for follower_added
	Follower *User `json:"follower,omitempty"`

	// Present for section_changed
	OldSection *Section `json:"old_section,omitempty"`
	NewSection *Section `json:"new_section,omitempty"`

	// Present for added_to_task, removed_from_task
	Task *Task `json:"task,omitempty"`

	// Present for added_to_project, removed_from_project
	Project *Project `json:"project,omitempty"`

	// Present for added_to_tag, removed_from_tag
	Tag *Tag `json:"tag,omitempty"`

	// Present for text_custom_field_changed, number_custom_field_changed, enum_custom_field_changed
	OldTextValue   string     `json:"old_text_value,omitempty"`
	NewTextValue   string     `json:"new_text_value,omitempty"`
	OldNumberValue float64    `json:"old_number_value,omitempty"`
	NewNumberValue float64    `json:"new_number_value,omitempty"`
	OldEnumValue   *EnumValue `json:"old_enum_value,omitempty"`
	NewEnumValue   *EnumValue `json:"new_enum_value,omitempty"`

	// Present for duplicate_merged, marked_duplicate, duplicate_unmerged
	DuplicateOf *Task `json:"duplicate_of,omitempty"`

	// Present for duplicated
	DuplicatedFrom *Task `json:"duplicated_from,omitempty"`

	// Present for dependency_added, dependency_removed, dependency_marked_complete, dependency_marked_incomplete,
	// dependency_due_date_changed
	Dependency *Task `json:"dependency,omitempty"`

	// Present for dependent_added, dependent_removed
	Dependent *Task `json:"dependent,omitempty"`
}

type Tag

type Tag struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	TagBase

	// Read-only. The time at which this object was created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// Create-only. The workspace or organization this object is associated
	// with. Once created, objects cannot be moved to a different workspace.
	// This attribute can only be specified at creation time.
	Workspace *Workspace `json:"workspace,omitempty"`

	// Read-only. Array of users following this tag. Followers are a
	// subset of members who receive all notifications for a project, the
	// default notification setting when adding members to a project in-
	// product.
	Followers []*User `json:"followers,omitempty"`
}

Tag is a label that can be attached to any task in Asana. It exists in a single workspace or organization.

Tags have some metadata associated with them, but it is possible that we will simplify them in the future so it is not encouraged to rely too heavily on it. Unlike projects, tags do not provide any ordering on the tasks they are associated with.

func (*Tag) Fetch

func (t *Tag) Fetch(client *Client, options ...*Options) error

Fetch loads the full details for this Tag

type TagBase

type TagBase struct {
	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	// More detailed, free-form textual information associated with the
	// object.
	Notes string `json:"notes,omitempty"`

	// Color of the object. Must be either null or one of: dark-pink, dark-
	// green, dark-blue, dark-red, dark-teal, dark-brown, dark-orange, dark-
	// purple, dark-warm-gray, light-pink, light-green, light-blue, light-red,
	// light-teal, light-yellow, light-orange, light-purple, light-warm-gray.
	Color string `json:"color,omitempty"`
}

TagBase contains the modifiable fields for a Tag

type Task

type Task struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	TaskBase

	// Read-only. The task this object is attached to.
	Parent *Task `json:"parent,omitempty"`

	// Read-only. The time at which this object was created.
	CreatedAt *time.Time `json:"created_at,omitempty"`

	// Read-only. The time at which this object was last modified.
	//
	// Note: This does not currently reflect any changes in associations such
	// as tasks or comments that may have been added or removed from the
	// object.
	ModifiedAt *time.Time `json:"modified_at,omitempty"`

	// Create-only. The workspace or organization this object is associated
	// with. Once created, objects cannot be moved to a different workspace.
	// This attribute can only be specified at creation time.
	Workspace *Workspace `json:"workspace,omitempty"`

	// True if the task is liked by the authorized user, false if not.
	Liked bool `json:"liked,omitempty"`

	// Read-only. Array of users who have liked this task.
	Likes []*User `json:"likes,omitempty"`

	// Read-only. The number of users who have liked this task.
	NumLikes int32 `json:"num_likes,omitempty"`

	// Read-only. Opt In. The number of subtasks on this task.
	NumSubtasks int32 `json:"num_subtasks,omitempty"`

	// Read-only. Array of users following this task. Followers are a
	// subset of members who receive all notifications for a project, the
	// default notification setting when adding members to a project in-
	// product.
	Followers []*User `json:"followers,omitempty"`

	// User to which this task is assigned, or null if the task is unassigned.
	Assignee *User `json:"assignee,omitempty"`

	// Scheduling status of this task for the user it is assigned to. This
	// field can only be set if the assignee is non-null.
	AssigneeStatus string `json:"assignee_status,omitempty"`

	// Read-only. The time at which this task was completed, or null if the
	// task is incomplete.
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	// Array of custom fields applied to the task. These custom fields
	// represent the values recorded on this task for a particular custom
	// field. For example, these fields will contain an enum_value property
	// for custom fields of type enum, a string_value property for custom
	// fields of type string, and so on. Please note that the id returned on
	// each custom field value is identical to the id of the custom field,
	// which allows referencing the custom field metadata through the
	// /custom_fields/custom_field-id endpoint.
	CustomFields []*CustomFieldValue `json:"custom_fields,omitempty"`

	// Create-only. Array of projects this task is associated with. At task
	// creation time, this array can be used to add the task to many projects
	// at once. After task creation, these associations can be modified using
	// the addProject and removeProject endpoints.
	Projects []*Project `json:"projects,omitempty"`

	// A url that points directly to the object within Asana
	PermalinkURL string `json:"permalink_url,omitempty"`

	// Create-only. Array of projects this task is associated with and the
	// section it is in. At task creation time, this array can be used to add
	// the task to specific sections. After task creation, these associations
	// can be modified using the addProject and removeProject endpoints. Note
	// that over time, more types of memberships may be added to this
	// property.
	Memberships []*Membership `json:"memberships,omitempty"`

	// Create-only. Array of tags associated with this task. This property may
	// be specified on creation using just an array of tag IDs. In order to
	// change tags on an existing task use addTag and removeTag.
	Tags []*Tag `json:"tags,omitempty"`

	// Read-only. Array of resources referencing tasks that this task depends on.
	// The objects contain only the ID of the dependency.
	Dependencies []*Task `json:"dependencies,omitempty"`

	// Read-only. Array of resources referencing tasks that depend on this task.
	// The objects contain only the ID of the dependent.
	Dependents []*Task `json:"dependents,omitempty"`
}

Task is the basic object around which many operations in Asana are centered. In the Asana application, multiple tasks populate the middle pane according to some view parameters, and the set of selected tasks determines the more detailed information presented in the details pane.

A section, at its core, is a task whose name ends with the colon character :. Sections are unique in that they will be included in the memberships field of task objects returned in the API when the task is within a section. As explained below they can also be used to manipulate the ordering of a task within a project.

Queries return a compact representation of each object which is typically the id and name fields. Interested in a specific set of fields or all of the fields? Use field selectors to manipulate what data is included in a response.

func (*Task) AddDependencies

func (t *Task) AddDependencies(client *Client, request *AddDependenciesRequest) error

AddDependencies marks a set of tasks as dependencies of this task, if they are not already dependencies. A task can have at most 15 dependencies.

func (*Task) AddDependents

func (t *Task) AddDependents(client *Client, request *AddDependentsRequest) error

AddDependents marks a set of tasks as dependents of this task, if they are not already dependents. A task can have at most 30 dependents.

func (*Task) AddProject

func (t *Task) AddProject(client *Client, request *AddProjectRequest) error

AddProject adds this task to an existing project at the provided location

func (*Task) Attachments

func (t *Task) Attachments(client *Client, opts ...*Options) ([]*Attachment, *NextPage, error)

Attachments lists all attachments attached to a task

func (*Task) CreateAttachment

func (t *Task) CreateAttachment(client *Client, request *NewAttachment) (*Attachment, error)

func (*Task) CreateComment

func (t *Task) CreateComment(client *Client, story *StoryBase) (*Story, error)

CreateComment adds a comment story to a task

func (*Task) CreateSubtask

func (t *Task) CreateSubtask(client *Client, task *Task) (*Task, error)

CreateSubtask creates a new task as a subtask of this task

func (*Task) Delete

func (t *Task) Delete(client *Client) error

func (*Task) Fetch

func (t *Task) Fetch(client *Client) error

Fetch loads the full details for this Task

func (*Task) RemoveProject

func (t *Task) RemoveProject(client *Client, projectID string) error

func (*Task) SetParent

func (t *Task) SetParent(client *Client, request *SetParentRequest) error

SetParent changes the parent of a task

func (*Task) Stories

func (t *Task) Stories(client *Client, opts ...*Options) ([]*Story, *NextPage, error)

Stories lists all stories attached to a task

func (*Task) Subtasks

func (t *Task) Subtasks(client *Client, opts ...*Options) ([]*Task, *NextPage, error)

Subtasks returns a list of tasks in this project

func (*Task) Update

func (t *Task) Update(client *Client, update *UpdateTaskRequest) error

Update applies new values to a Task record

type TaskBase

type TaskBase struct {
	// Name of the task. This is generally a short sentence fragment that
	// fits on a line in the UI for maximum readability. However, it can be longer.
	Name string `json:"name,omitempty"`

	// The type of task. Different subtypes of tasks retain many of
	// the same fields and behavior, but may render differently in Asana or
	// represent tasks with different semantic meaning.
	ResourceSubtype string `json:"resource_subtype,omitempty"`

	// More detailed, free-form textual information associated with the
	// task.
	Notes string `json:"notes,omitempty"`

	// The notes of the text with formatting as HTML.
	HTMLNotes string `json:"html_notes,omitempty"`

	// Scheduling status of this task for the user it is assigned to. This
	// field can only be set if the assignee is non-null.
	AssigneeStatus string `json:"assignee_status,omitempty"`

	// True if the task is currently marked complete, false if not.
	Completed *bool `json:"completed,omitempty"`

	// Date on which this task is due, or null if the task has no due date.
	// This takes a date with YYYY-MM-DD format and should not be used
	// together with due_at.
	DueOn *Date `json:"due_on,omitempty"`

	// Date and time on which this task is due, or null if the task has no due
	// time. This takes a UTC timestamp and should not be used together with
	// due_on.
	DueAt *time.Time `json:"due_at,omitempty"`

	// Date on which this task is due, or null if the task has no start date.
	// This field takes a date with YYYY-MM-DD format.
	// Note: due_on or due_at must be present in the request when setting or
	// unsetting the start_on parameter.
	StartOn *Date `json:"start_on,omitempty"`

	// Oauth Required. The external field allows you to store app-specific
	// metadata on tasks, including an id that can be used to retrieve tasks
	// and a data blob that can store app-specific character strings. Note
	// that you will need to authenticate with Oauth to access or modify this
	// data. Once an external id is set, you can use the notation
	// external:custom_id to reference your object anywhere in the API where
	// you may use the original object id. See the page on Custom External
	// Data for more details.
	External *ExternalData `json:"external,omitempty"`

	// Indicates whether a default task is rendered as bolded and underlined
	// when viewed in a list of subtasks or in a user’s My Tasks.
	// Requires that the NewSections deprecation is enabled.
	IsRenderedAsSeparator *bool `json:"is_rendered_as_separator,omitempty"`
}

TaskBase contains the modifiable fields for the Task object

type TaskQuery

type TaskQuery struct {
	// The assignee to filter tasks on.
	//
	// Note: If you specify assignee, you must also specify the workspace to filter on.
	//
	// May be a GID, 'me' or user email string ('14113', 'me', 'me@example.com')
	Assignee string `url:"assignee,omitempty"`

	// The project to filter tasks on
	Project string `url:"project,omitempty"`

	// The section to filter tasks on.
	//
	// Note: Currently, this is only supported in board views.
	Section string `url:"section,omitempty"`

	// The workspace or organization to filter tasks on.
	//
	// Note: If you specify workspace, you must also specify the assignee to filter on.
	Workspace string `url:"workspace,omitempty"`

	// Only return tasks that are either incomplete or that have been completed since this time.
	//
	// May be 'now' or a date string
	CompletedSince string `url:"completed_since,omitempty"`

	// Only return tasks that have been modified since the given time.
	//
	// Note: A task is considered “modified” if any of its properties change,
	// or associations between it and other objects are modified (e.g. a task
	// being added to a project). A task is not considered modified just
	// because another object it is associated with (e.g. a subtask) is
	// modified. Actions that count as modifying the task include assigning,
	// renaming, completing, and adding stories.
	//
	// May be 'now' or a date string
	ModifiedSince string `url:"modified_since,omitempty"`
}

TaskQuery specifies which tasks to return from QueryTasks

type TaskUserListGet

type TaskUserListGet struct {
	// Only return tasks that are either incomplete or that have been completed since this time.
	//
	// May be 'now' or a date string
	CompletedSince string `url:"completed_since,omitempty"`
}

TaskUserListGet specifies which tasks to return from the user list GetTasks method

type Team

type Team struct {

	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	// The description of the team with formatting as HTML.
	Description string `json:"description,omitempty"`

	// The description of the team with formatting as HTML.
	HTMLDescription string `json:"html_description,omitempty"`

	Organization *Workspace `json:"organization,omitempty"`
}

Team is used to group related projects and people together within an organization. Each project in an organization is associated with a team.

func (*Team) AllProjects

func (t *Team) AllProjects(client *Client, options ...*Options) ([]*Project, error)

AllProjects repeatedly pages through all available projects in a team

func (*Team) CreateProject

func (t *Team) CreateProject(c *Client, project *CreateProjectRequest) (*Project, error)

CreateProject adds a new project to a team

func (*Team) Fetch

func (t *Team) Fetch(client *Client) error

Fetch loads the full details for this Team

func (*Team) Projects

func (t *Team) Projects(client *Client, options ...*Options) ([]*Project, *NextPage, error)

Projects returns a list of projects in this team

type UpdateProjectRequest

type UpdateProjectRequest struct {
	ProjectBase

	Owner        string                 `json:"owner,omitempty"`
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
}

UpdateProjectRequest represents a request to update a project

type UpdateTaskRequest

type UpdateTaskRequest struct {
	TaskBase

	Assignee  string   `json:"assignee,omitempty"`  // User to which this task is assigned, or null if the task is unassigned.
	Followers []string `json:"followers,omitempty"` // Array of users following this task.
}

type User

type User struct {
	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	// Read-only. The user’s email address.
	Email string `json:"email,omitempty"`

	// Read-only. A map of the user’s profile photo in various sizes, or null
	// if no photo is set. Sizes provided are 21, 27, 36, 60, and 128. Images
	// are in PNG format.
	Photo map[string]string `json:"photo,omitempty"`

	// Read-only. Workspaces and organizations this user may access.
	//
	// Note: The API will only return workspaces and organizations that also
	// contain the authenticated user.
	Workspaces []*Workspace `json:"workspaces,omitempty"`
}

User represents an account in Asana that can be given access to various workspaces, projects, and tasks.

Like other objects in the system, users are referred to by numerical IDs. However, the special string identifier me can be used anywhere a user ID is accepted, to refer to the current authenticated user.

func (*User) Fetch

func (u *User) Fetch(client *Client, options ...*Options) error

Fetch loads the full details for this User

type UserTaskList

type UserTaskList struct {
	// Read-only. Globally unique ID of the object
	ID           string     `json:"gid,omitempty"`
	ResourceType string     `json:"resource_type,omitempty"`
	Name         string     `json:"name"`
	Owner        *User      `json:"owner"`
	Workspace    *Workspace `json:"workspace"`
}

UserTaskList represents the tasks assigned to a particular user

func (*UserTaskList) GetTasks

func (utl *UserTaskList) GetTasks(client *Client, listGet *TaskUserListGet, opts ...*Options) ([]*Task, *NextPage, error)

GetTasks returns the compact list of tasks in a user’s My Tasks list. The returned tasks will be in order within each assignee status group of Inbox, Today, and Upcoming.

type Validator

type Validator interface {
	Validate() error
}

Validator types have a Validate method which is called before posting the data to the API

type View

type View string

Layout indicates the Project layout to use

const (
	List     View = "list"
	Board    View = "board"
	Calendar View = "calendar"
	Timeline View = "timeline"
)

type Webhook

type Webhook struct {
	// Read-only. Globally unique ID of the object
	ID     string `json:"gid,omitempty"`
	Active bool   `json:"active"`
	Target string `json:"target"`

	Filters []WebhookFilter `json:"filters"`

	// Read-only. The time at which this object was created.
	CreatedAt          *time.Time `json:"created_at,omitempty"`
	LastFailureAt      *time.Time `json:"last_failure_at,omitempty"`
	LastFailureContent string     `json:"last_failure_content,omitempty"`
	LastSuccessAt      *time.Time `json:"last_success_at,omitempty"`
}

Webhook is used to be notified of changes in Asana. It is intended to provide an efficient way for integrations which react to changes of state in Asana to take action only when something has actually changed.

func (*Webhook) Delete

func (w *Webhook) Delete(client *Client) error

type WebhookFilter

type WebhookFilter struct {
	Action          string   `json:"action"`
	Fields          []string `json:"fields,omitempty"`
	ResourceType    string   `json:"resource_type,omitempty"`
	ResourceSubtype string   `json:"resource_subtype,omitempty"`
}

WebhookFilter is used to filter the types of actions that trigger delivery of an Event

type Workspace

type Workspace struct {

	// Read-only. Globally unique ID of the object
	ID string `json:"gid,omitempty"`

	// Read-only. The name of the object.
	Name string `json:"name,omitempty"`

	// Whether the workspace is an organization.
	IsOrganization bool `json:"is_organization,omitempty"`

	// Undocumented in API docs
	EmailDomains []string `json:"email_domains,omitempty"`
}

Workspace is the highest-level organizational unit in Asanc. All projects and tasks have an associated workspace.

An organization is a special kind of workspace that represents a company. In an organization, you can group your projects into teams. You can read more about how organizations work on the Asana Guide. To tell if your workspace is an organization or not, check its is_organization property.

Over time, we intend to migrate most workspaces into organizations and to release more organization-specific functionality. We may eventually deprecate using workspace-based APIs for organizations. Currently, and until after some reasonable grace period following any further announcements, you can still reference organizations in any workspace parameter.

func (*Workspace) AllCustomFields

func (w *Workspace) AllCustomFields(client *Client, options ...*Options) ([]*CustomField, error)

AllCustomFields repeatedly pages through all available custom fields in a workspace

func (*Workspace) AllFavoriteProjects

func (w *Workspace) AllFavoriteProjects(client *Client, options ...*Options) ([]*Project, error)

AllProjects repeatedly pages through all available projects in a workspace

func (*Workspace) AllProjects

func (w *Workspace) AllProjects(client *Client, options ...*Options) ([]*Project, error)

AllProjects repeatedly pages through all available projects in a workspace

func (*Workspace) AllTags

func (w *Workspace) AllTags(client *Client, options ...*Options) ([]*Tag, error)

AllTags repeatedly pages through all available tags in a workspace

func (*Workspace) AllTeams

func (w *Workspace) AllTeams(client *Client, options ...*Options) ([]*Team, error)

AllTeams repeatedly pages through all available teams in a workspace

func (*Workspace) AllUsers

func (w *Workspace) AllUsers(client *Client, options ...*Options) ([]*User, error)

AllUsers repeatedly pages through all available users in a workspace

func (*Workspace) CreateTag

func (w *Workspace) CreateTag(client *Client, tag *TagBase) (*Tag, error)

CreateTag adds a new tag to a workspace

func (*Workspace) CustomFields

func (w *Workspace) CustomFields(client *Client, options ...*Options) ([]*CustomField, *NextPage, error)

CustomFields returns the compact records for all custom fields in the workspace

func (*Workspace) FavoriteProjects

func (w *Workspace) FavoriteProjects(client *Client, options ...*Options) ([]*Project, *NextPage, error)

FavoriteProjects returns a list of the current user's favorite projects in this workspace

func (*Workspace) Fetch

func (w *Workspace) Fetch(client *Client) error

Fetch loads the full details for this Workspace

func (*Workspace) Portfolios

func (w *Workspace) Portfolios(client *Client, options ...*Options) ([]*Portfolio, *NextPage, error)

Projects returns a list of projects in this workspace

func (*Workspace) Projects

func (w *Workspace) Projects(client *Client, options ...*Options) ([]*Project, *NextPage, error)

Projects returns a list of projects in this workspace

func (*Workspace) Tags

func (w *Workspace) Tags(client *Client, options ...*Options) ([]*Tag, *NextPage, error)

Tags returns a list of tags in this workspace

func (*Workspace) Teams

func (w *Workspace) Teams(client *Client, options ...*Options) ([]*Team, *NextPage, error)

Teams returns the compact records for all teams in the organization visible to the authorized user

func (*Workspace) Users

func (w *Workspace) Users(client *Client, options ...*Options) ([]*User, *NextPage, error)

Users returns the compact records for all users in the organization visible to the authorized user

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL