Documentation
¶
Index ¶
- func Bool(b bool) *bool
- func Int(i int) *int
- func Ints(is ...int) *[]int
- func String(s string) *string
- type Attachment
- type Client
- func (cl *Client) CloseTask(id int) error
- func (cl *Client) CloseTaskWithOptions(id int, opts *CloseTaskOptions) error
- func (cl *Client) CreateLabel(name string) (*Label, error)
- func (cl *Client) CreateLabelWithOptions(name string, opts *CreateLabelOptions) (*Label, error)
- func (cl *Client) CreateProject(name string) (*Project, error)
- func (cl *Client) CreateProjectComment(projectID int, content string) (*Comment, error)
- func (cl *Client) CreateProjectCommentWithOptions(projectID int, content string, opts *CreateProjectCommentOptions) (*Comment, error)
- func (cl *Client) CreateProjectWithOptions(name string, opts *CreateProjectOptions) (*Project, error)
- func (cl *Client) CreateSection(name string, projectID int) (*Section, error)
- func (cl *Client) CreateSectionWithOptions(name string, projectID int, opts *CreateSectionOptions) (*Section, error)
- func (cl *Client) CreateTask(content string) (*Task, error)
- func (cl *Client) CreateTaskComment(taskID int, content string) (*Comment, error)
- func (cl *Client) CreateTaskCommentWithOptions(taskID int, content string, opts *CreateTaskCommentOptions) (*Comment, error)
- func (cl *Client) CreateTaskWithOptions(content string, opts *CreateTaskOptions) (*Task, error)
- func (cl *Client) DeleteComment(id int) error
- func (cl *Client) DeleteCommentWithOptions(id int, opts *DeleteCommentOptions) error
- func (cl *Client) DeleteLabel(id int) error
- func (cl *Client) DeleteLabelWithOptions(id int, opts *DeleteLabelOptions) error
- func (cl *Client) DeleteProject(id int) error
- func (cl *Client) DeleteProjectWithOptions(id int, opts *DeleteProjectOptions) error
- func (cl *Client) DeleteSection(id int) error
- func (cl *Client) DeleteSectionWithOptions(id int, opts *DeleteSectionOptions) error
- func (cl *Client) DeleteTask(id int) error
- func (cl *Client) DeleteTaskWithOptions(id int, opts *DeleteTaskOptions) error
- func (cl *Client) GetCollaborators(projectID int) (Users, error)
- func (cl *Client) GetComment(id int) (*Comment, error)
- func (cl *Client) GetLabel(id int) (*Label, error)
- func (cl *Client) GetLabels() (Labels, error)
- func (cl *Client) GetProject(id int) (*Project, error)
- func (cl *Client) GetProjectComments(projectID int) (Comments, error)
- func (cl *Client) GetProjects() (Projects, error)
- func (cl *Client) GetSection(id int) (*Section, error)
- func (cl *Client) GetSections() (Sections, error)
- func (cl *Client) GetSectionsWithOptions(opts *GetSectionsOptions) (Sections, error)
- func (cl *Client) GetTask(id int) (*Task, error)
- func (cl *Client) GetTaskComments(taskID int) (Comments, error)
- func (cl *Client) GetTasks() (Tasks, error)
- func (cl *Client) GetTasksWithOptions(opts *GetTasksOptions) (Tasks, error)
- func (cl *Client) ReopenTask(id int) error
- func (cl *Client) ReopenTaskWithOptions(id int, opts *ReopenTaskOptions) error
- func (cl *Client) UpdateComment(id int, content string) error
- func (cl *Client) UpdateCommentWithOptions(id int, content string, opts *UpdateCommentOptions) error
- func (cl *Client) UpdateLabelWithOptions(id int, opts *UpdateLabelOptions) error
- func (cl *Client) UpdateProjectWithOptions(id int, opts *UpdateProjectOptions) error
- func (cl *Client) UpdateSection(id int, name string) error
- func (cl *Client) UpdateSectionWithOptions(id int, name string, opts *UpdateSectionOptions) error
- func (cl *Client) UpdateTaskWithOptions(id int, opts *UpdateTaskOptions) error
- type CloseTaskOptions
- type Comment
- type Comments
- type CreateAttachmentOptions
- type CreateLabelOptions
- type CreateProjectCommentOptions
- type CreateProjectOptions
- type CreateSectionOptions
- type CreateTaskCommentOptions
- type CreateTaskOptions
- type DeleteCommentOptions
- type DeleteLabelOptions
- type DeleteProjectOptions
- type DeleteSectionOptions
- type DeleteTaskOptions
- type Due
- type GetSectionsOptions
- type GetTasksOptions
- type Label
- type Labels
- type Project
- type Projects
- type ReopenTaskOptions
- type RequestError
- type Section
- type Sections
- type Task
- type Tasks
- type UpdateCommentOptions
- type UpdateLabelOptions
- type UpdateProjectOptions
- type UpdateSectionOptions
- type UpdateTaskOptions
- type User
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attachment ¶
type Attachment struct {
// The type of the file (for example image, video, audio, file, etc.)
ResourceType string `json:"resource_type"`
// The name of the file.
FileName *string `json:"file_name"`
// The size of the file in bytes.
FileSize *int `json:"file_size"`
// MIME type (i.e. text/plain, image/png).
FileType *string `json:"file_type"`
// The URL where the file is located (a string value representing an HTTP URL).
// Note that we don't cache the remote content on our servers and stream or expose files directly from third party resources.
// In particular this means that you should avoid providing links to non-encrypted (plain HTTP) resources, as exposing this files in Todoist may issue a browser warning.
FileURL *string `json:"file_url"`
// If you upload an audio file, you may provide an extra attribute file_duration (duration of the audio file in seconds, which takes an integer value).
FileDuration *int `json:"file_duration"`
// Upload completion state (either pending or completed).
UploadState *string `json:"upload_state"`
// Image file URL.
Image *string `json:"image"`
// Image width.
ImageWidth *int `json:"image_width"`
// Image height.
ImageHeight *int `json:"image_height"`
// Large thumbnail (a list that contains the URL, the width and the height of the thumbnail).
TnL []interface{} `json:"tn_l"`
// Medium thumbnail (a list that contains the URL, the width and the height of the thumbnail).
TnM []interface{} `json:"tn_m"`
// Small thumbnail (a list that contains the URL, the width and the height of the thumbnail).
TnS []interface{} `json:"tn_s"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for Todoist REST API.
func (*Client) CloseTaskWithOptions ¶
func (cl *Client) CloseTaskWithOptions(id int, opts *CloseTaskOptions) error
Closes a task with options.
func (*Client) CreateLabel ¶
Creates a label.
func (*Client) CreateLabelWithOptions ¶
func (cl *Client) CreateLabelWithOptions(name string, opts *CreateLabelOptions) (*Label, error)
Creates a label with options.
func (*Client) CreateProject ¶
Creates a new project and returns it.
func (*Client) CreateProjectComment ¶
Creates a comment for a project.
func (*Client) CreateProjectCommentWithOptions ¶
func (cl *Client) CreateProjectCommentWithOptions(projectID int, content string, opts *CreateProjectCommentOptions) (*Comment, error)
Creates a comment for a project with options.
func (*Client) CreateProjectWithOptions ¶
func (cl *Client) CreateProjectWithOptions(name string, opts *CreateProjectOptions) (*Project, error)
Creates a new project with options and returns it.
func (*Client) CreateSection ¶
Creates a new section and returns it.
func (*Client) CreateSectionWithOptions ¶
func (cl *Client) CreateSectionWithOptions(name string, projectID int, opts *CreateSectionOptions) (*Section, error)
Creates a new section with options and returns it.
func (*Client) CreateTask ¶
Creates a new task and returns it.
func (*Client) CreateTaskComment ¶
Creates a comment for a task.
func (*Client) CreateTaskCommentWithOptions ¶
func (cl *Client) CreateTaskCommentWithOptions(taskID int, content string, opts *CreateTaskCommentOptions) (*Comment, error)
Creates a comment for a task with options.
func (*Client) CreateTaskWithOptions ¶
func (cl *Client) CreateTaskWithOptions(content string, opts *CreateTaskOptions) (*Task, error)
Creates a new task with options and returns it.
func (*Client) DeleteCommentWithOptions ¶
func (cl *Client) DeleteCommentWithOptions(id int, opts *DeleteCommentOptions) error
Deletes a comment with options.
func (*Client) DeleteLabelWithOptions ¶
func (cl *Client) DeleteLabelWithOptions(id int, opts *DeleteLabelOptions) error
Deletes a label with options.
func (*Client) DeleteProjectWithOptions ¶
func (cl *Client) DeleteProjectWithOptions(id int, opts *DeleteProjectOptions) error
Deletes a project with options.
func (*Client) DeleteSectionWithOptions ¶
func (cl *Client) DeleteSectionWithOptions(id int, opts *DeleteSectionOptions) error
Deletes a section with options.
func (*Client) DeleteTaskWithOptions ¶
func (cl *Client) DeleteTaskWithOptions(id int, opts *DeleteTaskOptions) error
Deletes a task with options.
func (*Client) GetCollaborators ¶
Get list of all collaborators of a shared project.
func (*Client) GetProjectComments ¶
Gets list of all comments for a project.
func (*Client) GetProjects ¶
Gets list of all user projects.
func (*Client) GetSections ¶
Gets list of all sections.
func (*Client) GetSectionsWithOptions ¶
func (cl *Client) GetSectionsWithOptions(opts *GetSectionsOptions) (Sections, error)
Gets list of all sections with options.
func (*Client) GetTaskComments ¶
Gets list of all comments for a task.
func (*Client) GetTasksWithOptions ¶
func (cl *Client) GetTasksWithOptions(opts *GetTasksOptions) (Tasks, error)
Gets list of all active tasks with options.
func (*Client) ReopenTaskWithOptions ¶
func (cl *Client) ReopenTaskWithOptions(id int, opts *ReopenTaskOptions) error
Reopens a task with options.
func (*Client) UpdateComment ¶
Updates a comment.
func (*Client) UpdateCommentWithOptions ¶
func (cl *Client) UpdateCommentWithOptions(id int, content string, opts *UpdateCommentOptions) error
Updates a comment with options.
func (*Client) UpdateLabelWithOptions ¶
func (cl *Client) UpdateLabelWithOptions(id int, opts *UpdateLabelOptions) error
Updates a label with options.
func (*Client) UpdateProjectWithOptions ¶
func (cl *Client) UpdateProjectWithOptions(id int, opts *UpdateProjectOptions) error
Updates a project.
func (*Client) UpdateSection ¶
Updates a section.
func (*Client) UpdateSectionWithOptions ¶
func (cl *Client) UpdateSectionWithOptions(id int, name string, opts *UpdateSectionOptions) error
Updates a section with options.
func (*Client) UpdateTaskWithOptions ¶
func (cl *Client) UpdateTaskWithOptions(id int, opts *UpdateTaskOptions) error
Updates a task.
type CloseTaskOptions ¶
type CloseTaskOptions struct {
RequestID *string `json:"-"`
}
Options for closing a task.
type Comment ¶
type Comment struct {
// Comment ID.
ID int `json:"id"`
// Comment's task ID (for task comments).
TaskID *int `json:"task_id"`
// Comment's project ID (for project comments).
ProjectID *int `json:"project_id"`
// Date and time when comment was added, RFC3339 (https://www.ietf.org/rfc/rfc3339.txt) format in UTC.
Posted string `json:"posted"`
// Comment content.
// This value may contain markdown-formatted text and hyperlinks.
// Details on markdown support can be found in the Text Formatting article in the Help Center.
Content string `json:"content"`
// Attachment file.
Attachment *Attachment `json:"attachment"`
}
type CreateAttachmentOptions ¶
type CreateAttachmentOptions struct {
ResourceType *string `json:"resource_type,omitempty"`
FileName *string `json:"file_name,omitempty"`
FileURL *string `json:"file_url,omitempty"`
FileType *string `json:"file_type,omitempty"`
}
Options for creating attachment.
type CreateLabelOptions ¶
type CreateLabelOptions struct {
RequestID *string `json:"-"`
// Label order.
Order *int `json:"order,omitempty"`
// A numeric ID representing the color of the label icon.
// Refer to the id column in the Colors (https://developer.todoist.com/guides/#colors) guide for more info.
Color *int `json:"color,omitempty"`
// Whether the label is a favorite (a true or false value).
Favorite *bool `json:"favorite,omitempty"`
}
Options for creating a label.
type CreateProjectCommentOptions ¶
type CreateProjectCommentOptions struct {
RequestID *string `json:"-"`
// Object for attachment object.
Attachment *CreateAttachmentOptions `json:"attachment,omitempty"`
}
Options for creating a comment for a project.
type CreateProjectOptions ¶
type CreateProjectOptions struct {
RequestID *string `json:"-"`
// Parent project ID.
ParentID *int `json:"parent_id,omitempty"`
// A numeric ID representing the color of the project icon.
// Refer to the id column in the Colors guide (https://developer.todoist.com/guides/#colors) for more info.
Color *int `json:"color,omitempty"`
// Whether the project is a favorite (a true or false value).
Favorite *bool `json:"favorite,omitempty"`
}
Options for creating a project.
type CreateSectionOptions ¶
type CreateSectionOptions struct {
RequestID *string `json:"-"`
// Order among other sections in a project.
Order *int `json:"order,omitempty"`
}
Options for creating a section.
type CreateTaskCommentOptions ¶
type CreateTaskCommentOptions struct {
RequestID *string `json:"-"`
// Object for attachment object.
Attachment *CreateAttachmentOptions `json:"attachment,omitempty"`
}
Options for creating a comment for a task.
type CreateTaskOptions ¶
type CreateTaskOptions struct {
RequestID *string `json:"-"`
// A description for the task.
// This value may contain markdown-formatted text and hyperlinks.
// Details on markdown support can be found in the Text Formatting article (https://todoist.com/help/articles/text-formatting) in the Help Center.
Description *string `json:"description,omitempty"`
// Task project ID.
// If not set, task is put to user's Inbox.
ProjectID *int `json:"project_id,omitempty"`
// ID of section to put task into.
SectionID *int `json:"section_id,omitempty"`
// Parent task ID.
ParentID *int `json:"parent_id,omitempty"`
// Non-zero integer value used by clients to sort tasks under the same parent.
Order *int `json:"order,omitempty"`
// IDs of labels associated with the task.
LabelIDs *[]int `json:"label_ids,omitempty"`
// Task priority from 1 (normal) to 4 (urgent).
Priority *int `json:"priority,omitempty"`
// Human defined (https://todoist.com/help/articles/due-dates-and-times) task due date (ex.: "next Monday", "Tomorrow"). Value is set using local (not UTC) time.
DueString *string `json:"due_string,omitempty"`
// Specific date in YYYY-MM-DD format relative to user’s timezone.
DueDate *string `json:"due_date,omitempty"`
// Specific date and time in RFC3339 (https://www.ietf.org/rfc/rfc3339.txt) format in UTC.
DueDatetime *string `json:"due_datetime,omitempty"`
// 2-letter code specifying language in case due_string is not written in English.
DueLang *string `json:"due_lang,omitempty"`
// The responsible user ID (if set, and only for shared tasks).
Assignee *int `json:"assignee,omitempty"`
}
Options for creating a task.
type DeleteCommentOptions ¶
type DeleteCommentOptions struct {
RequestID *string `json:"-"`
}
Options for deleting a comment.
type DeleteLabelOptions ¶
type DeleteLabelOptions struct {
RequestID *string `json:"-"`
}
Options for deleting a label.
type DeleteProjectOptions ¶
type DeleteProjectOptions struct {
RequestID *string `json:"-"`
}
Options for deleting a project.
type DeleteSectionOptions ¶
type DeleteSectionOptions struct {
RequestID *string `json:"-"`
}
Options for deleting a section.
type DeleteTaskOptions ¶
type DeleteTaskOptions struct {
RequestID *string `json:"-"`
}
Options for deleting a task.
type Due ¶
type Due struct {
// Human defined date in arbitrary format.
String string `json:"string"`
// Date in format YYYY-MM-DD corrected to user's timezone.
Date string `json:"date"`
// Whether the task has a recurring due date (https://todoist.com/help/articles/set-a-recurring-due-date).
Recurring bool `json:"recurring"`
// Only returned if exact due time set (i.e. it's not a whole-day task), date and time in RFC3339 (https://www.ietf.org/rfc/rfc3339.txt) format in UTC.
Datetime *string `json:"datetime"`
// Only returned if exact due time set, user's timezone definition either in tzdata-compatible format ("Europe/Berlin") or as a string specifying east of UTC offset as "UTC±HH:MM" (i.e. "UTC-01:00").
Timezone *string `json:"timezone"`
}
type GetSectionsOptions ¶
type GetSectionsOptions struct {
// Filter sections by project ID.
ProjectID *int `url:"project_id,omitempty"`
}
Options for getting a sections.
type GetTasksOptions ¶
type GetTasksOptions struct {
// Filter tasks by project ID.
ProjectID *int `url:"project_id,omitempty"`
// Filter tasks by section ID.
SectionID *int `url:"section_id,omitempty"`
// Filter tasks by label.
LabelID *int `url:"label_id,omitempty"`
// Filter by any supported filter (https://todoist.com/help/articles/205248842).
Filter *string `url:"filter,omitempty"`
// IETF language tag defining what language filter is written in, if differs from default English.
Lang *string `url:"lang,omitempty"`
// A list of the task IDs to retrieve, this should be a comma separated list.
IDs *[]int `url:"ids,comma,omitempty"`
}
Options for getting a tasks.
type Label ¶
type Label struct {
// Label ID.
ID int `json:"id"`
// Label name.
Name string `json:"name"`
// A numeric ID representing the color of the label icon.
// Refer to the id column in the Colors (https://developer.todoist.com/guides/#colors) guide for more info.
Color int `json:"color"`
// Number used by clients to sort list of labels.
Order int `json:"order"`
// Whether the label is a favorite (a true or false value).
Favorite bool `json:"favorite"`
}
type Project ¶
type Project struct {
// Project ID.
ID int `json:"id"`
// Project name.
Name string `json:"name"`
// A numeric ID representing the color of the project icon.
// Refer to the id column in the Colors guide (https://developer.todoist.com/guides/#colors) for more info.
Color int `json:"color"`
// ID of parent project (read-only, absent for top-level projects).
ParentID *int `json:"parent_id"`
// Project position under the same parent (read-only).
Order int `json:"order"`
// Number of project comments.
CommentCount int `json:"comment_count"`
Shared bool `json:"shared"`
// Whether the project is a favorite (a true or false value).
Favorite bool `json:"favorite"`
// Whether the project is Inbox (read-only, true or otherwise this property is not sent).
InboxProject bool `json:"inbox_project"`
// Whether the project is TeamInbox (read-only, true or otherwise this property is not sent).
TeamInbox bool `json:"team_inbox"`
// Identifier to find the match between different copies of shared projects.
// When you share a project, its copy has a different ID for your collaborators.
// To find a project in a different account that matches yours, you can use the "sync_id" attribute.
// For non-shared projects the attribute is set to 0.
SyncID int `json:"sync_id"`
// URL to access this project in the Todoist web or mobile applications.
URL string `json:"url"`
}
type ReopenTaskOptions ¶
type ReopenTaskOptions struct {
RequestID *string `json:"-"`
}
Options for reopening a task.
type RequestError ¶
type RequestError struct {
// Error response status code.
StatusCode int
// Error response body.
Body io.Reader
}
func (RequestError) Error ¶
func (err RequestError) Error() string
type Task ¶
type Task struct {
// Task ID.
ID int `json:"id"`
// Task's project ID (read-only).
ProjectID int `json:"project_id"`
// ID of section task belongs to.
SectionID int `json:"section_id"`
// Task content.
// This value may contain markdown-formatted text and hyperlinks.
// Details on markdown support can be found in the Text Formatting article (https://todoist.com/help/articles/text-formatting) in the Help Center.
Content string `json:"content"`
// A description for the task.
// This value may contain markdown-formatted text and hyperlinks.
// Details on markdown support can be found in the Text Formatting article (https://todoist.com/help/articles/text-formatting) in the Help Center.
Description string `json:"description"`
// Flag to mark completed tasks.
Completed bool `json:"completed"`
// Array of label IDs, associated with a task.
LabelIDs []int `json:"label_ids"`
// ID of parent task (read-only, absent for top-level tasks).
ParentID *int `json:"parent_id"`
// Position under the same parent or project for top-level tasks (read-only).
Order int `json:"order"`
// Task priority from 1 (normal, default value) to 4 (urgent).
Priority int `json:"priority"`
// object representing task due date/time.
Due *Due `json:"due"`
// URL to access this task in the Todoist web or mobile applications.
URL string `json:"url"`
// Number of task comments.
CommentCount int `json:"comment_count"`
// The responsible user ID (if set, and only for shared tasks).
Assignee *int `json:"assignee"`
// The ID of the user who assigned the task. 0 if the task is unassigned.
Assigner int `json:"assigner"`
}
type UpdateCommentOptions ¶
type UpdateCommentOptions struct {
RequestID *string `json:"-"`
}
Options for updating a comment.
type UpdateLabelOptions ¶
type UpdateLabelOptions struct {
RequestID *string `json:"-"`
// New name of the label.
Name *string `json:"name,omitempty"`
// Number that is used by clients to sort list of labels.
Order *int `json:"order,omitempty"`
// A numeric ID representing the color of the label icon.
// Refer to the id column in the Colors (https://developer.todoist.com/guides/#colors) guide for more info.
Color *int `json:"color,omitempty"`
// Whether the label is a favorite (a true or false value).
Favorite *bool `json:"favorite,omitempty"`
}
Options for updating a label.
type UpdateProjectOptions ¶
type UpdateProjectOptions struct {
RequestID *string `json:"-"`
// Name of the project.
Name *string `json:"name,omitempty"`
// A numeric ID representing the color of the project icon.
// Refer to the id column in the Colors guide (https://developer.todoist.com/guides/#colors) for more info.
Color *int `json:"color,omitempty"`
// Whether the project is a favorite (a true or false value).
Favorite *bool `json:"favorite,omitempty"`
}
Options for updating a project.
type UpdateSectionOptions ¶
type UpdateSectionOptions struct {
RequestID *string `json:"-"`
}
Options for updating a section.
type UpdateTaskOptions ¶
type UpdateTaskOptions struct {
RequestID *string `json:"-"`
// Task content.
// This value may contain markdown-formatted text and hyperlinks.
// Details on markdown support can be found in the Text Formatting article (https://todoist.com/help/articles/text-formatting) in the Help Center.
Content *string `json:"content,omitempty"`
// A description for the task.
// This value may contain markdown-formatted text and hyperlinks.
// Details on markdown support can be found in the Text Formatting article (https://todoist.com/help/articles/text-formatting) in the Help Center.
Description *string `json:"description,omitempty"`
// IDs of labels associated with the task.
LabelIDs *[]int `json:"label_ids,omitempty"`
// Task priority from 1 (normal) to 4 (urgent).
Priority *int `json:"priority,omitempty"`
// Human defined (https://todoist.com/help/articles/due-dates-and-times) task due date (ex.: "next Monday", "Tomorrow"). Value is set using local (not UTC) time.
DueString *string `json:"due_string,omitempty"`
// Specific date in YYYY-MM-DD format relative to user’s timezone.
DueDate *string `json:"due_date,omitempty"`
// Specific date and time in RFC3339 (https://www.ietf.org/rfc/rfc3339.txt) format in UTC.
DueDatetime *string `json:"due_datetime,omitempty"`
// 2-letter code specifying language in case due_string is not written in English.
DueLang *string `json:"due_lang,omitempty"`
// The responsible user ID or 0 to unset (for shared tasks).
Assignee *int `json:"assignee,omitempty"`
}
Options for updating a task.