Version: v0.0.0-...-6c0cb70 Latest Latest

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

Go to latest
Published: Oct 15, 2016 License: MIT Imports: 11 Imported by: 6



Package asana is a client for Asana API.



This section is empty.


View Source
var (
	// ErrUnauthorized can be returned on any call on response status code 401.
	ErrUnauthorized = errors.New("asana: unauthorized")


This section is empty.


type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string
	// contains filtered or unexported fields

func NewClient

func NewClient(doer Doer) *Client

NewClient created new asana client with doer. If doer is nil then http.DefaultClient used intead.

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, fields map[string]string, opts *Filter) (Task, error)

CreateTask creates a task.

func (*Client) GetAuthenticatedUser

func (c *Client) GetAuthenticatedUser(ctx context.Context, opt *Filter) (User, error)

func (*Client) GetTask

func (c *Client) GetTask(ctx context.Context, id int64, opt *Filter) (Task, error)

func (*Client) GetUserByID

func (c *Client) GetUserByID(ctx context.Context, id int64, opt *Filter) (User, error)

func (*Client) ListProjectTasks

func (c *Client) ListProjectTasks(ctx context.Context, projectID int64, opt *Filter) ([]Task, error)

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, opt *Filter) ([]Project, error)

func (*Client) ListTags

func (c *Client) ListTags(ctx context.Context, opt *Filter) ([]Tag, error)

func (*Client) ListTaskStories

func (c *Client) ListTaskStories(ctx context.Context, taskID int64, opt *Filter) ([]Story, error)

func (*Client) ListTasks

func (c *Client) ListTasks(ctx context.Context, opt *Filter) ([]Task, error)

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, opt *Filter) ([]User, error)

func (*Client) ListWorkspaces

func (c *Client) ListWorkspaces(ctx context.Context) ([]Workspace, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, path string, opt *Filter, v interface{}) error

func (*Client) UpdateTask

func (c *Client) UpdateTask(ctx context.Context, id int64, tu TaskUpdate, opt *Filter) (Task, error)

UpdateTask updates a task.

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)

Doer interface used for doing http calls. Use it as point of setting Auth header or custom status code error handling.

type DoerFunc

type DoerFunc func(req *http.Request) (resp *http.Response, err error)

DoerFunc implements Doer interface. Allow to transform any appropriate function "f" to Doer instance: DoerFunc(f).

func (DoerFunc) Do

func (f DoerFunc) Do(req *http.Request) (resp *http.Response, err error)

type Error

type Error struct {
	Phrase  string `json:"phrase,omitempty"`
	Message string `json:"message,omitempty"`

func (Error) Error

func (e Error) Error() string

type Errors

type Errors []Error

Errors always has at least 1 element when returned.

func (Errors) Error

func (e Errors) Error() string

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"`

type Heart

type Heart struct {
	ID   int64 `json:"id,omitempty"`
	User User  `json:"user,omitempty"`

Heart represents a ♥ action by a user.

type Project

type Project struct {
	ID       int64  `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Archived bool   `json:"archived,omitempty"`
	Color    string `json:"color,omitempty"`
	Notes    string `json:"notes,omitempty"`

type Response

type Response struct {
	Data   interface{} `json:"data,omitempty"`
	Errors Errors      `json:"errors,omitempty"`

type Story

type Story struct {
	ID        int64     `json:"id,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	CreatedBy User      `json:"created_by,omitempty"`
	Hearts    []Heart   `json:"hearts,omitempty"`
	Text      string    `json:"text,omitempty"`
	Type      string    `json:"type,omitempty"` // E.g., "comment", "system".

type Tag

type Tag struct {
	ID    int64  `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Color string `json:"color,omitempty"`
	Notes string `json:"notes,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"`
	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"`

type TaskUpdate

type TaskUpdate struct {
	Notes   *string `json:"notes,omitempty"`
	Hearted *bool   `json:"hearted,omitempty"`

TaskUpdate is used to update a task.

type User

type User struct {
	ID         int64             `json:"id,omitempty"`
	Email      string            `json:"email,omitempty"`
	Name       string            `json:"name,omitempty"`
	Photo      map[string]string `json:"photo,omitempty"`
	Workspaces []Workspace       `json:"workspaces,omitempty"`

type Workspace

type Workspace struct {
	ID           int64  `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Organization bool   `json:"is_organization,omitempty"`

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL