Documentation ¶
Overview ¶
Package asana is a client for Asana API.
Index ¶
- Variables
- type CFEnumOptions
- type Client
- func (c *Client) AddProject(ctx context.Context, taskID int64, mu MembershipUpdate, opts *Filter) error
- func (c *Client) AddProjectByExternalID(ctx context.Context, externalID string, mu MembershipUpdate, opts *Filter) error
- func (c *Client) AddTag(ctx context.Context, taskID int64, tagID int64, opts *Filter) error
- func (c *Client) AddTagByExternalID(ctx context.Context, externalID string, tagID int64, opts *Filter) error
- func (c *Client) CreateSection(ctx context.Context, fields map[string]interface{}, opts *Filter) (Section, error)
- func (c *Client) CreateTask(ctx context.Context, fields map[string]interface{}, opts *Filter) (Task, error)
- func (c *Client) CreateWebhook(ctx context.Context, id int64, target string) (Webhook, error)
- func (c *Client) DeleteSection(ctx context.Context, id int64, opt *Filter) error
- func (c *Client) DeleteSectionByExternalID(ctx context.Context, externalID string, opt *Filter) error
- func (c *Client) DeleteTask(ctx context.Context, id int64, opt *Filter) error
- func (c *Client) DeleteTaskByExternalID(ctx context.Context, externalID string, opt *Filter) error
- func (c *Client) DeleteWebhook(ctx context.Context, id int64) error
- func (c *Client) GetAuthenticatedUser(ctx context.Context, opt *Filter) (User, error)
- func (c *Client) GetSection(ctx context.Context, id int64, opt *Filter) (Section, error)
- func (c *Client) GetSectionByExternalID(ctx context.Context, externalID string, opt *Filter) (Section, error)
- func (c *Client) GetTask(ctx context.Context, id int64, opt *Filter) (Task, error)
- func (c *Client) GetTaskByExternalID(ctx context.Context, externalID string, opt *Filter) (Task, error)
- func (c *Client) GetUserByID(ctx context.Context, id int64, opt *Filter) (User, error)
- func (c *Client) GetWebhook(ctx context.Context, id int64) (Webhook, error)
- func (c *Client) ListProjectSections(ctx context.Context, projectID int64, opt *Filter) ([]Section, error)
- func (c *Client) ListProjectTasks(ctx context.Context, projectID int64, opt *Filter) ([]Task, error)
- func (c *Client) ListProjects(ctx context.Context, opt *Filter) ([]Project, error)
- func (c *Client) ListTags(ctx context.Context, opt *Filter) ([]Tag, error)
- func (c *Client) ListTaskStories(ctx context.Context, taskID int64, opt *Filter) ([]Story, error)
- func (c *Client) ListTasks(ctx context.Context, opt *Filter) ([]Task, error)
- func (c *Client) ListUsers(ctx context.Context, opt *Filter) ([]User, error)
- func (c *Client) ListWebhooks(ctx context.Context, opt *Filter) ([]Webhook, error)
- func (c *Client) ListWorkspaces(ctx context.Context, opt *Filter) ([]Workspace, error)
- func (c *Client) RemoveProject(ctx context.Context, taskID int64, mu MembershipUpdate, opts *Filter) error
- func (c *Client) RemoveProjectByExternalID(ctx context.Context, externalID string, mu MembershipUpdate, opts *Filter) error
- func (c *Client) RemoveTag(ctx context.Context, taskID int64, tagID int64, opts *Filter) error
- func (c *Client) RemoveTagByExternalID(ctx context.Context, externalID string, tagID int64, opts *Filter) error
- func (c *Client) Request(ctx context.Context, path string, opt *Filter, v interface{}) error
- func (c *Client) UpdateSection(ctx context.Context, id int64, su SectionUpdate, opt *Filter) (Section, error)
- func (c *Client) UpdateSectionByExternalID(ctx context.Context, externalID string, su SectionUpdate, opt *Filter) (Section, error)
- func (c *Client) UpdateTask(ctx context.Context, id int64, tu TaskUpdate, opt *Filter) (Task, error)
- func (c *Client) UpdateTaskByExternalID(ctx context.Context, externalID string, tu TaskUpdate, opt *Filter) (Task, error)
- type CustomField
- type Doer
- type DoerFunc
- type Error
- type Errors
- type Event
- type EventSummary
- type External
- type Filter
- type Heart
- type Membership
- type MembershipUpdate
- type NextPage
- type Project
- type Resource
- type Response
- type Section
- type SectionUpdate
- type Story
- type Tag
- type Task
- type TaskUpdate
- type User
- type Webhook
- type Workspace
Constants ¶
This section is empty.
Variables ¶
var ( errors.New("asana: unauthorized") )ErrUnauthorized =
Functions ¶
This section is empty.
Types ¶
type CFEnumOptions ¶
type Client ¶
func NewClient ¶
NewClient created new asana client with doer. If doer is nil then http.DefaultClient used intead.
func (*Client) AddProject ¶
func (c *Client) AddProject(ctx context.Context, taskID int64, mu MembershipUpdate, opts *Filter) error
AddProject adds a project to a task.
func (*Client) AddProjectByExternalID ¶
func (c *Client) AddProjectByExternalID(ctx context.Context, externalID string, mu MembershipUpdate, opts *Filter) error
AddProjectByExternalID adds a project to a task.
func (*Client) AddTagByExternalID ¶
func (c *Client) AddTagByExternalID(ctx context.Context, externalID string, tagID int64, opts *Filter) error
AddTagByExternalID adds a tag to a task.
func (*Client) CreateSection ¶
func (c *Client) CreateSection(ctx context.Context, fields map[string]interface{}, opts *Filter) (Section, error)
CreateSection creates a section.
func (*Client) CreateTask ¶
func (c *Client) CreateTask(ctx context.Context, fields map[string]interface{}, opts *Filter) (Task, error)
CreateTask creates a task.
func (*Client) CreateWebhook ¶
CreateWebhook creates a webhook.
func (*Client) DeleteSection ¶
DeleteSection deletes a section.
func (*Client) DeleteSectionByExternalID ¶
func (c *Client) DeleteSectionByExternalID(ctx context.Context, externalID string, opt *Filter) error
DeleteSectionByExternalID deletes a section.
func (*Client) DeleteTask ¶
DeleteTask deletes a task.
func (*Client) DeleteTaskByExternalID ¶
DeleteTaskByExternalID deletes a task.
func (*Client) DeleteWebhook ¶
DeleteWebhook deletes a webhook.
func (*Client) GetAuthenticatedUser ¶
func (*Client) GetSection ¶
GetSection gets a section.
https://asana.com/developers/api-reference/sections#get-single
func (*Client) GetSectionByExternalID ¶
func (c *Client) GetSectionByExternalID(ctx context.Context, externalID string, opt *Filter) (Section, error)
GetSectionByExternalID gets a section with an external-ID.
https://asana.com/developers/api-reference/sections#get-single
func (*Client) GetTaskByExternalID ¶
func (c *Client) GetTaskByExternalID(ctx context.Context, externalID string, opt *Filter) (Task, error)
GetTaskByExternalID gets a task with an external-ID.
func (*Client) GetUserByID ¶
func (*Client) GetWebhook ¶
GetWebhook gets a webhook.
https://asana.com/developers/api-reference/webhooks#get-single
func (*Client) ListProjectSections ¶
func (c *Client) ListProjectSections(ctx context.Context, projectID int64, opt *Filter) ([]Section, error)
ListProjectSections gets sections in the project.
https://asana.com/developers/api-reference/sections#find-project
func (*Client) ListProjectTasks ¶
func (c *Client) ListProjectTasks(ctx context.Context, projectID int64, opt *Filter) ([]Task, error)
ListProjectTasks gets tasks in the project.
func (*Client) ListProjects ¶
func (*Client) ListTaskStories ¶
func (*Client) ListWebhooks ¶
ListWebhooks gets webhooks.
func (*Client) ListWorkspaces ¶
func (*Client) RemoveProject ¶
func (c *Client) RemoveProject(ctx context.Context, taskID int64, mu MembershipUpdate, opts *Filter) error
RemoveProject removes a project to a task.
func (*Client) RemoveProjectByExternalID ¶
func (c *Client) RemoveProjectByExternalID(ctx context.Context, externalID string, mu MembershipUpdate, opts *Filter) error
RemoveProjectByExternalID removes a project to a task.
func (*Client) RemoveTagByExternalID ¶
func (c *Client) RemoveTagByExternalID(ctx context.Context, externalID string, tagID int64, opts *Filter) error
RemoveTagByExternalID removes a tag to a task.
func (*Client) UpdateSection ¶
func (c *Client) UpdateSection(ctx context.Context, id int64, su SectionUpdate, opt *Filter) (Section, error)
UpdateSection updates a section.
func (*Client) UpdateSectionByExternalID ¶
func (c *Client) UpdateSectionByExternalID(ctx context.Context, externalID string, su SectionUpdate, opt *Filter) (Section, error)
UpdateSectionByExternalID updates a section.
func (*Client) UpdateTask ¶
func (c *Client) UpdateTask(ctx context.Context, id int64, tu TaskUpdate, opt *Filter) (Task, error)
UpdateTask updates a task.
func (*Client) UpdateTaskByExternalID ¶
func (c *Client) UpdateTaskByExternalID(ctx context.Context, externalID string, tu TaskUpdate, opt *Filter) (Task, error)
UpdateTaskByExternalID updates a task.
type CustomField ¶
type CustomField struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Type string `json:"type,omitempty"` EnumOptions []CFEnumOptions `json:"enum_options,omitempty"` Precision int64 `json:"precision,omitempty"` TextValue string `json:"text_value,omitempty"` NumberValue int64 `json:"number_value,omitempty"` EnumValue CFEnumOptions `json:"enum_value,omitempty"` }
type Doer ¶
Doer interface used for doing http calls. Use it as point of setting Auth header or custom status code error handling.
type DoerFunc ¶
DoerFunc implements Doer interface. Allow to transform any appropriate function "f" to Doer instance: DoerFunc(f).
type Error ¶
type Event ¶
type Event struct { // User who triggered the event. // Read-only. // NOTE: The event may be triggered by a different user than the subscriber. // For example, if user A subscribes to a task and user B modified it, the event’s user will be user B. // NOTE: Some events are generated by the system, and will have null as the user. // API consumers should make sure to handle this case. User User `json:"user,omitempty"` // Resource the event occurred on. // Read-only. // NOTE: The resource that triggered the event may be different from the one that the events were requested for. // For example, a subscription to a project will contain events for tasks contained within the project. Resource Resource `json:"resource,omitempty"` // Type of the resource that generated the event. // Read-only. // NOTE: Currently, only tasks, projects and stories generate events. Type string `json:"type,omitempty"` // Action taken that triggered the event. // Read-only. Action string `json:"action,omitempty"` // Parent that resource was added to or removed from. null for other event types. // Read-only. Parent Resource `json:"parent,omitempty"` // Timestamp when the event occurred. // Read-only. CreatedAt time.Time `json:"created_at,omitempty"` }
type EventSummary ¶
type EventSummary struct { // User who triggered the event. // Read-only. // NOTE: The event may be triggered by a different user than the subscriber. // For example, if user A subscribes to a task and user B modified it, the event’s user will be user B. // NOTE: Some events are generated by the system, and will have null as the user. // API consumers should make sure to handle this case. UserID int64 `json:"user,omitempty"` // Resource the event occurred on. // Read-only. // NOTE: The resource that triggered the event may be different from the one that the events were requested for. // For example, a subscription to a project will contain events for tasks contained within the project. ResourceID int64 `json:"resource,omitempty"` // Type of the resource that generated the event. // Read-only. // NOTE: Currently, only tasks, projects and stories generate events. Type string `json:"type,omitempty"` // Action taken that triggered the event. // Read-only. Action string `json:"action,omitempty"` // Parent that resource was added to or removed from. null for other event types. // Read-only. ParentID *int64 `json:"parent,omitempty"` // Timestamp when the event occurred. // Read-only. CreatedAt time.Time `json:"created_at,omitempty"` }
type External ¶
type External struct { ID string `json:"id,omitempty"` Data interface{} `json:"data,omitempty"` }
type Filter ¶
type Filter struct { Archived bool `url:"archived,omitempty"` Assignee int64 `url:"assignee,omitempty"` Project int64 `url:"project,omitempty"` Workspace int64 `url:"workspace,omitempty"` CompletedSince string `url:"completed_since,omitempty"` ModifiedSince string `url:"modified_since,omitempty"` OptFields []string `url:"opt_fields,comma,omitempty"` OptExpand []string `url:"opt_expand,comma,omitempty"` Offset string `url:"offset,omitempty"` Limit uint32 `url:"limit,omitempty"` }
type Membership ¶
type MembershipUpdate ¶
type SectionUpdate ¶
type SectionUpdate struct {
Name *string `json:"name,omitempty"`
}
type Task ¶
type Task struct { ID int64 `json:"id,omitempty"` Assignee *User `json:"assignee,omitempty"` AssigneeStatus string `json:"assignee_status,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` CreatedBy User `json:"created_by,omitempty"` // Undocumented field, but it can be included. Completed bool `json:"completed,omitempty"` CompletedAt time.Time `json:"completed_at,omitempty"` CustomFields []CustomField `json:"custom_fields,omitempty"` Name string `json:"name,omitempty"` Hearts []Heart `json:"hearts,omitempty"` Notes string `json:"notes,omitempty"` ParentTask *Task `json:"parent,omitempty"` Projects []Project `json:"projects,omitempty"` DueOn string `json:"due_on,omitempty"` DueAt string `json:"due_at,omitempty"` Followers []User `json:"followers,omitempty"` Liked bool `json:"liked,omitempty"` NumHearts int64 `json:"num_hearts,omitempty"` Hearted bool `json:"hearted,omitempty"` ModifiedAt time.Time `json:"modified_at,omitempty"` NumLikes int64 `json:"num_likes,omitempty"` Tags []Tag `json:"tags,omitempty"` Memberships []Membership `json:"memberships,omitempty"` // "workspace": map[string]interface {}{"id":13218399566047.000000,"name":"wacul.co.jp"}, External External `json:"external,omitempty"` }
type TaskUpdate ¶
type TaskUpdate struct { Assignee *string `json:"assignee,omitempty"` Name *string `json:"name,omitempty"` Notes *string `json:"notes,omitempty"` Hearted *bool `json:"hearted,omitempty"` Completed *bool `json:"completed,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` CustomFields map[int64]interface{} `json:"custom_fields,omitempty"` }
TaskUpdate is used to update a task.