Documentation
¶
Overview ¶
Package todoist is a client for the unified Todoist API v1 (https://developer.todoist.com/api/v1/).
It has no external dependencies, takes a context.Context on every call, and exposes cursor pagination both as raw pages and as range-over-function iterators.
Authentication ¶
Construct a client with a personal or OAuth2 token:
api := todoist.New(os.Getenv("TODOIST_TOKEN"))
Pagination ¶
List endpoints have two forms: a low-level page fetch (for example GetTasks) returning a Page, and an auto-paginating iterator (for example Tasks) returning an iter.Seq2 that transparently follows the cursor:
for task, err := range api.Tasks(ctx, nil) {
if err != nil {
return err
}
fmt.Println(task.Content)
}
Errors ¶
Non-2xx responses are returned as *Error, which carries the status, body, and (on HTTP 429) a RetryAfter duration.
Filters ¶
Todoist API v1 has no REST endpoints for filters; they are managed through the Sync API. See Client.Sync and NewCommand.
Index ¶
- Constants
- func NewUUID() string
- func Ptr[T any](v T) *T
- type AccessToken
- type Attachment
- type Client
- func (c *Client) AcceptWorkspaceInvitation(ctx context.Context, inviteCode string) (WorkspaceInvitation, error)
- func (c *Client) ArchiveProject(ctx context.Context, id string) error
- func (c *Client) ArchiveSection(ctx context.Context, id string) error
- func (c *Client) ArchivedProjects(ctx context.Context, args *GetProjectsArgs) iter.Seq2[Project, error]
- func (c *Client) CloseTask(ctx context.Context, id string) error
- func (c *Client) Comments(ctx context.Context, args *GetCommentsArgs) iter.Seq2[Comment, error]
- func (c *Client) CompletedByCompletionDate(ctx context.Context, args *GetCompletedTasksArgs) iter.Seq2[Task, error]
- func (c *Client) CompletedByDueDate(ctx context.Context, args *GetCompletedTasksArgs) iter.Seq2[Task, error]
- func (c *Client) CreateComment(ctx context.Context, args CreateCommentArgs) (Comment, error)
- func (c *Client) CreateFolder(ctx context.Context, args CreateFolderArgs) (Folder, error)
- func (c *Client) CreateLabel(ctx context.Context, args CreateLabelArgs) (Label, error)
- func (c *Client) CreateLocationReminder(ctx context.Context, args CreateLocationReminderArgs) (LocationReminder, error)
- func (c *Client) CreateProject(ctx context.Context, args CreateProjectArgs) (Project, error)
- func (c *Client) CreateProjectFromFile(ctx context.Context, name string, workspaceID *string, file io.Reader, ...) (ProjectImportCreateResponse, error)
- func (c *Client) CreateReminder(ctx context.Context, args CreateReminderArgs) (Reminder, error)
- func (c *Client) CreateSection(ctx context.Context, args CreateSectionArgs) (Section, error)
- func (c *Client) CreateTask(ctx context.Context, args CreateTaskArgs) (Task, error)
- func (c *Client) CreateWorkspace(ctx context.Context, args CreateWorkspaceArgs) (Workspace, error)
- func (c *Client) DeleteComment(ctx context.Context, id string) error
- func (c *Client) DeleteFolder(ctx context.Context, id string) error
- func (c *Client) DeleteLabel(ctx context.Context, id string) error
- func (c *Client) DeleteLocationReminder(ctx context.Context, id string) error
- func (c *Client) DeleteProject(ctx context.Context, id string) error
- func (c *Client) DeleteReminder(ctx context.Context, id string) error
- func (c *Client) DeleteSection(ctx context.Context, id string) error
- func (c *Client) DeleteTask(ctx context.Context, id string) error
- func (c *Client) DeleteUpload(ctx context.Context, fileURL string) error
- func (c *Client) DeleteWorkspaceInvitation(ctx context.Context, workspaceID int64, userEmail string) (WorkspaceInvitation, error)
- func (c *Client) Folders(ctx context.Context, workspaceID string, args *GetFoldersArgs) iter.Seq2[Folder, error]
- func (c *Client) GetAllWorkspaceInvitations(ctx context.Context, workspaceID string) ([]WorkspaceInvitation, error)
- func (c *Client) GetArchivedProjects(ctx context.Context, args *GetProjectsArgs) (Page[Project], error)
- func (c *Client) GetCollaborators(ctx context.Context, projectID string, args *GetProjectsArgs) (Page[Collaborator], error)
- func (c *Client) GetComment(ctx context.Context, id string) (Comment, error)
- func (c *Client) GetComments(ctx context.Context, args *GetCommentsArgs) (Page[Comment], error)
- func (c *Client) GetCompletedByCompletionDate(ctx context.Context, args *GetCompletedTasksArgs) (Page[Task], error)
- func (c *Client) GetCompletedByDueDate(ctx context.Context, args *GetCompletedTasksArgs) (Page[Task], error)
- func (c *Client) GetFolder(ctx context.Context, id string) (Folder, error)
- func (c *Client) GetFolders(ctx context.Context, workspaceID string, args *GetFoldersArgs) (Page[Folder], error)
- func (c *Client) GetLabel(ctx context.Context, id string) (Label, error)
- func (c *Client) GetLabels(ctx context.Context, args *GetLabelsArgs) (Page[Label], error)
- func (c *Client) GetLocationReminder(ctx context.Context, id string) (LocationReminder, error)
- func (c *Client) GetLocationReminders(ctx context.Context, args *GetLocationRemindersArgs) (Page[LocationReminder], error)
- func (c *Client) GetProductivityStats(ctx context.Context) (ProductivityStats, error)
- func (c *Client) GetProject(ctx context.Context, id string) (Project, error)
- func (c *Client) GetProjects(ctx context.Context, args *GetProjectsArgs) (Page[Project], error)
- func (c *Client) GetReminders(ctx context.Context, args *GetRemindersArgs) (Page[Reminder], error)
- func (c *Client) GetSection(ctx context.Context, id string) (Section, error)
- func (c *Client) GetSections(ctx context.Context, args *GetSectionsArgs) (Page[Section], error)
- func (c *Client) GetSharedLabels(ctx context.Context, args *GetSharedLabelsArgs) (Page[string], error)
- func (c *Client) GetTask(ctx context.Context, id string) (Task, error)
- func (c *Client) GetTasks(ctx context.Context, args *GetTasksArgs) (Page[Task], error)
- func (c *Client) GetTasksByFilter(ctx context.Context, args *GetTasksByFilterArgs) (Page[Task], error)
- func (c *Client) GetTemplateFile(ctx context.Context, projectID string, useRelativeDates bool) (string, error)
- func (c *Client) GetTemplateURL(ctx context.Context, projectID string, useRelativeDates bool) (FileURLResponse, error)
- func (c *Client) GetUser(ctx context.Context) (User, error)
- func (c *Client) GetWorkspace(ctx context.Context, id string) (Workspace, error)
- func (c *Client) GetWorkspaceActiveProjects(ctx context.Context, workspaceID string, args *GetProjectsArgs) (Page[Project], error)
- func (c *Client) GetWorkspaceArchivedProjects(ctx context.Context, workspaceID string, args *GetProjectsArgs) (Page[Project], error)
- func (c *Client) GetWorkspaceInvitations(ctx context.Context, workspaceID string) ([]WorkspaceInvitation, error)
- func (c *Client) GetWorkspaceUsers(ctx context.Context, args *GetWorkspaceUsersArgs) (Page[WorkspaceUser], error)
- func (c *Client) GetWorkspaces(ctx context.Context) ([]Workspace, error)
- func (c *Client) ImportIntoProjectFromFile(ctx context.Context, projectID string, file io.Reader, fileName string) (ProjectImportResponse, error)
- func (c *Client) ImportIntoProjectFromTemplateID(ctx context.Context, projectID, templateID string, locale *string) (ProjectImportResponse, error)
- func (c *Client) JoinProject(ctx context.Context, id string) error
- func (c *Client) JoinWorkspace(ctx context.Context, args JoinWorkspaceArgs) (WorkspaceUser, error)
- func (c *Client) Labels(ctx context.Context, args *GetLabelsArgs) iter.Seq2[Label, error]
- func (c *Client) LocationReminders(ctx context.Context, args *GetLocationRemindersArgs) iter.Seq2[LocationReminder, error]
- func (c *Client) MigratePersonalToken(ctx context.Context, clientID, clientSecret, personalToken, scope string) (AccessToken, error)
- func (c *Client) MoveTask(ctx context.Context, id string, args MoveTaskArgs) (Task, error)
- func (c *Client) Projects(ctx context.Context, args *GetProjectsArgs) iter.Seq2[Project, error]
- func (c *Client) QuickAddTask(ctx context.Context, text string) (Task, error)
- func (c *Client) RejectWorkspaceInvitation(ctx context.Context, inviteCode string) (WorkspaceInvitation, error)
- func (c *Client) Reminders(ctx context.Context, args *GetRemindersArgs) iter.Seq2[Reminder, error]
- func (c *Client) RemoveSharedLabel(ctx context.Context, name string) error
- func (c *Client) RenameSharedLabel(ctx context.Context, name, newName string) error
- func (c *Client) ReopenTask(ctx context.Context, id string) error
- func (c *Client) RevokeToken(ctx context.Context, clientID, clientSecret, accessToken string) error
- func (c *Client) SearchLabels(ctx context.Context, args *SearchLabelsArgs) (Page[Label], error)
- func (c *Client) SearchLabelsSeq(ctx context.Context, args *SearchLabelsArgs) iter.Seq2[Label, error]
- func (c *Client) SearchProjects(ctx context.Context, args *SearchProjectsArgs) (Page[Project], error)
- func (c *Client) SearchProjectsSeq(ctx context.Context, args *SearchProjectsArgs) iter.Seq2[Project, error]
- func (c *Client) SearchSections(ctx context.Context, args *SearchSectionsArgs) (Page[Section], error)
- func (c *Client) SearchSectionsSeq(ctx context.Context, args *SearchSectionsArgs) iter.Seq2[Section, error]
- func (c *Client) Sections(ctx context.Context, args *GetSectionsArgs) iter.Seq2[Section, error]
- func (c *Client) SharedLabels(ctx context.Context, args *GetSharedLabelsArgs) iter.Seq2[string, error]
- func (c *Client) Sync(ctx context.Context, req SyncRequest) (*SyncResponse, error)
- func (c *Client) Tasks(ctx context.Context, args *GetTasksArgs) iter.Seq2[Task, error]
- func (c *Client) TasksByFilter(ctx context.Context, args *GetTasksByFilterArgs) iter.Seq2[Task, error]
- func (c *Client) UnarchiveProject(ctx context.Context, id string) error
- func (c *Client) UnarchiveSection(ctx context.Context, id string) error
- func (c *Client) UpdateComment(ctx context.Context, id string, args UpdateCommentArgs) (Comment, error)
- func (c *Client) UpdateFolder(ctx context.Context, id string, args UpdateFolderArgs) (Folder, error)
- func (c *Client) UpdateLabel(ctx context.Context, id string, args UpdateLabelArgs) (Label, error)
- func (c *Client) UpdateLocationReminder(ctx context.Context, id string, args UpdateLocationReminderArgs) (LocationReminder, error)
- func (c *Client) UpdateProject(ctx context.Context, id string, args UpdateProjectArgs) (Project, error)
- func (c *Client) UpdateReminder(ctx context.Context, id string, args UpdateReminderArgs) (Reminder, error)
- func (c *Client) UpdateSection(ctx context.Context, id string, args UpdateSectionArgs) (Section, error)
- func (c *Client) UpdateTask(ctx context.Context, id string, args UpdateTaskArgs) (Task, error)
- func (c *Client) UpdateWorkspace(ctx context.Context, id string, args UpdateWorkspaceArgs) (Workspace, error)
- func (c *Client) UploadFile(ctx context.Context, file io.Reader, fileName string, projectID *string) (UploadResult, error)
- func (c *Client) WorkspaceActiveProjects(ctx context.Context, workspaceID string, args *GetProjectsArgs) iter.Seq2[Project, error]
- func (c *Client) WorkspaceArchivedProjects(ctx context.Context, workspaceID string, args *GetProjectsArgs) iter.Seq2[Project, error]
- type Collaborator
- type Command
- type Comment
- type CreateCommentArgs
- type CreateFolderArgs
- type CreateLabelArgs
- type CreateLocationReminderArgs
- type CreateProjectArgs
- type CreateReminderArgs
- type CreateSectionArgs
- type CreateTaskArgs
- type CreateWorkspaceArgs
- type DayStats
- type Deadline
- type Due
- type Duration
- type Error
- type FileURLResponse
- type Filter
- type Folder
- type GetCommentsArgs
- type GetCompletedTasksArgs
- type GetFoldersArgs
- type GetLabelsArgs
- type GetLocationRemindersArgs
- type GetProjectsArgs
- type GetRemindersArgs
- type GetSectionsArgs
- type GetSharedLabelsArgs
- type GetTasksArgs
- type GetTasksByFilterArgs
- type GetWorkspaceUsersArgs
- type JoinWorkspaceArgs
- type Label
- type LocationReminder
- type MoveTaskArgs
- type Option
- type Page
- type ProductivityStats
- type Project
- type ProjectImportCreateResponse
- type ProjectImportResponse
- type Reminder
- type SearchLabelsArgs
- type SearchProjectsArgs
- type SearchSectionsArgs
- type Section
- type SyncRequest
- type SyncResponse
- type TZInfo
- type Task
- type UpdateCommentArgs
- type UpdateFolderArgs
- type UpdateLabelArgs
- type UpdateLocationReminderArgs
- type UpdateProjectArgs
- type UpdateReminderArgs
- type UpdateSectionArgs
- type UpdateTaskArgs
- type UpdateWorkspaceArgs
- type UploadResult
- type User
- type WeekStats
- type Workspace
- type WorkspaceInvitation
- type WorkspaceUser
Examples ¶
Constants ¶
const ( PriorityNormal = 1 PriorityMedium = 2 PriorityHigh = 3 PriorityUrgent = 4 )
Priority levels for tasks. The API uses 1 (natural, lowest) through 4 (urgent, highest); note this is the reverse of what the Todoist UI shows.
const DefaultBaseURL = "https://api.todoist.com/api/v1"
DefaultBaseURL is the root of the Todoist API v1.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶ added in v0.2.0
type AccessToken struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
}
AccessToken is an OAuth2 access token returned by MigratePersonalToken.
type Attachment ¶
type Attachment struct {
ResourceType string `json:"resource_type,omitempty"`
FileName string `json:"file_name,omitempty"`
FileType string `json:"file_type,omitempty"`
FileURL string `json:"file_url,omitempty"`
FileSize int `json:"file_size,omitempty"`
UploadState string `json:"upload_state,omitempty"`
}
Attachment describes a file attached to a comment.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Todoist API v1 client. It is safe for concurrent use as long as its configuration is not mutated after construction.
func New ¶
New returns a Client authenticated with the given personal or OAuth2 token.
Example ¶
package main
import (
"os"
todoist "github.com/smirnoffmg/go-todoist"
)
func main() {
api := todoist.New(os.Getenv("TODOIST_TOKEN"))
_ = api
}
Output:
func (*Client) AcceptWorkspaceInvitation ¶ added in v0.2.0
func (c *Client) AcceptWorkspaceInvitation(ctx context.Context, inviteCode string) (WorkspaceInvitation, error)
AcceptWorkspaceInvitation accepts an invitation by its invite code.
func (*Client) ArchiveProject ¶
ArchiveProject archives a project.
func (*Client) ArchiveSection ¶ added in v0.2.0
ArchiveSection archives a section.
func (*Client) ArchivedProjects ¶ added in v0.2.0
func (c *Client) ArchivedProjects(ctx context.Context, args *GetProjectsArgs) iter.Seq2[Project, error]
ArchivedProjects returns an iterator over all archived projects, following pagination.
func (*Client) Comments ¶
Comments returns an iterator over all comments matching args, following pagination.
func (*Client) CompletedByCompletionDate ¶ added in v0.2.0
func (c *Client) CompletedByCompletionDate(ctx context.Context, args *GetCompletedTasksArgs) iter.Seq2[Task, error]
CompletedByCompletionDate iterates over all tasks completed within the time range, following pagination.
func (*Client) CompletedByDueDate ¶ added in v0.2.0
func (c *Client) CompletedByDueDate(ctx context.Context, args *GetCompletedTasksArgs) iter.Seq2[Task, error]
CompletedByDueDate iterates over all tasks completed within the time range, keyed by due date, following pagination.
func (*Client) CreateComment ¶
CreateComment creates a new comment.
func (*Client) CreateFolder ¶ added in v0.3.0
CreateFolder creates a new folder.
func (*Client) CreateLabel ¶
CreateLabel creates a new personal label.
func (*Client) CreateLocationReminder ¶ added in v0.2.0
func (c *Client) CreateLocationReminder(ctx context.Context, args CreateLocationReminderArgs) (LocationReminder, error)
CreateLocationReminder creates a new location reminder.
func (*Client) CreateProject ¶
CreateProject creates a new project.
func (*Client) CreateProjectFromFile ¶ added in v0.2.0
func (c *Client) CreateProjectFromFile(ctx context.Context, name string, workspaceID *string, file io.Reader, fileName string) (ProjectImportCreateResponse, error)
CreateProjectFromFile creates a new project from a CSV template file. When workspaceID is non-nil the project is created in that workspace.
func (*Client) CreateReminder ¶
CreateReminder creates a new reminder.
func (*Client) CreateSection ¶
CreateSection creates a new section.
func (*Client) CreateTask ¶
CreateTask creates a new task.
Example ¶
package main
import (
"context"
"fmt"
"log"
"os"
todoist "github.com/smirnoffmg/go-todoist"
)
func main() {
api := todoist.New(os.Getenv("TODOIST_TOKEN"))
task, err := api.CreateTask(context.Background(), todoist.CreateTaskArgs{
Content: "Buy milk",
DueString: todoist.Ptr("tomorrow at 9am"),
Priority: todoist.Ptr(todoist.PriorityHigh),
})
if err != nil {
log.Fatal(err)
}
fmt.Println(task.ID)
}
Output:
func (*Client) CreateWorkspace ¶
CreateWorkspace creates a new workspace.
func (*Client) DeleteComment ¶
DeleteComment deletes a comment.
func (*Client) DeleteFolder ¶ added in v0.3.0
DeleteFolder deletes a folder.
func (*Client) DeleteLabel ¶
DeleteLabel deletes a label.
func (*Client) DeleteLocationReminder ¶ added in v0.2.0
DeleteLocationReminder deletes a location reminder.
func (*Client) DeleteProject ¶
DeleteProject deletes a project.
func (*Client) DeleteReminder ¶
DeleteReminder deletes a reminder.
func (*Client) DeleteSection ¶
DeleteSection deletes a section and all of its tasks.
func (*Client) DeleteTask ¶
DeleteTask deletes a task.
func (*Client) DeleteUpload ¶ added in v0.3.0
DeleteUpload deletes a previously uploaded file by its URL.
func (*Client) DeleteWorkspaceInvitation ¶ added in v0.2.0
func (c *Client) DeleteWorkspaceInvitation(ctx context.Context, workspaceID int64, userEmail string) (WorkspaceInvitation, error)
DeleteWorkspaceInvitation revokes a pending invitation.
func (*Client) Folders ¶ added in v0.3.0
func (c *Client) Folders(ctx context.Context, workspaceID string, args *GetFoldersArgs) iter.Seq2[Folder, error]
Folders returns an iterator over all folders in a workspace, following pagination.
func (*Client) GetAllWorkspaceInvitations ¶ added in v0.2.0
func (c *Client) GetAllWorkspaceInvitations(ctx context.Context, workspaceID string) ([]WorkspaceInvitation, error)
GetAllWorkspaceInvitations returns all invitations for a workspace (admin view).
func (*Client) GetArchivedProjects ¶ added in v0.2.0
func (c *Client) GetArchivedProjects(ctx context.Context, args *GetProjectsArgs) (Page[Project], error)
GetArchivedProjects returns a single page of archived projects.
func (*Client) GetCollaborators ¶
func (c *Client) GetCollaborators(ctx context.Context, projectID string, args *GetProjectsArgs) (Page[Collaborator], error)
GetCollaborators returns a page of collaborators for a shared project.
func (*Client) GetComment ¶
GetComment returns a single comment by ID.
func (*Client) GetComments ¶
GetComments returns a single page of comments.
func (*Client) GetCompletedByCompletionDate ¶ added in v0.2.0
func (c *Client) GetCompletedByCompletionDate(ctx context.Context, args *GetCompletedTasksArgs) (Page[Task], error)
GetCompletedByCompletionDate returns a page of tasks completed within the args' time range, keyed by completion date.
func (*Client) GetCompletedByDueDate ¶ added in v0.2.0
func (c *Client) GetCompletedByDueDate(ctx context.Context, args *GetCompletedTasksArgs) (Page[Task], error)
GetCompletedByDueDate returns a page of tasks completed within the args' time range, keyed by due date.
func (*Client) GetFolders ¶ added in v0.3.0
func (c *Client) GetFolders(ctx context.Context, workspaceID string, args *GetFoldersArgs) (Page[Folder], error)
GetFolders returns a single page of folders in a workspace.
func (*Client) GetLocationReminder ¶ added in v0.2.0
GetLocationReminder returns a single location reminder by ID.
func (*Client) GetLocationReminders ¶ added in v0.2.0
func (c *Client) GetLocationReminders(ctx context.Context, args *GetLocationRemindersArgs) (Page[LocationReminder], error)
GetLocationReminders returns a single page of location reminders.
func (*Client) GetProductivityStats ¶
func (c *Client) GetProductivityStats(ctx context.Context) (ProductivityStats, error)
GetProductivityStats returns the authenticated user's completed-task and karma statistics.
func (*Client) GetProject ¶
GetProject returns a single project by ID.
func (*Client) GetProjects ¶
GetProjects returns a single page of projects.
func (*Client) GetReminders ¶
GetReminders returns a single page of reminders.
func (*Client) GetSection ¶
GetSection returns a single section by ID.
func (*Client) GetSections ¶
GetSections returns a single page of sections.
func (*Client) GetSharedLabels ¶ added in v0.2.0
func (c *Client) GetSharedLabels(ctx context.Context, args *GetSharedLabelsArgs) (Page[string], error)
GetSharedLabels returns a page of shared label names (labels used on tasks but not saved as personal labels).
func (*Client) GetTasksByFilter ¶ added in v0.2.0
func (c *Client) GetTasksByFilter(ctx context.Context, args *GetTasksByFilterArgs) (Page[Task], error)
GetTasksByFilter returns a page of tasks matching a Todoist filter query. This is the v1 replacement for the removed filters REST endpoints.
func (*Client) GetTemplateFile ¶ added in v0.2.0
func (c *Client) GetTemplateFile(ctx context.Context, projectID string, useRelativeDates bool) (string, error)
GetTemplateFile returns a project exported as a CSV template, as raw text.
func (*Client) GetTemplateURL ¶ added in v0.2.0
func (c *Client) GetTemplateURL(ctx context.Context, projectID string, useRelativeDates bool) (FileURLResponse, error)
GetTemplateURL returns a URL to a project exported as a template file.
func (*Client) GetWorkspace ¶
GetWorkspace returns a single workspace by ID.
func (*Client) GetWorkspaceActiveProjects ¶ added in v0.2.0
func (c *Client) GetWorkspaceActiveProjects(ctx context.Context, workspaceID string, args *GetProjectsArgs) (Page[Project], error)
GetWorkspaceActiveProjects returns a page of active projects in a workspace.
func (*Client) GetWorkspaceArchivedProjects ¶ added in v0.2.0
func (c *Client) GetWorkspaceArchivedProjects(ctx context.Context, workspaceID string, args *GetProjectsArgs) (Page[Project], error)
GetWorkspaceArchivedProjects returns a page of archived projects in a workspace.
func (*Client) GetWorkspaceInvitations ¶ added in v0.2.0
func (c *Client) GetWorkspaceInvitations(ctx context.Context, workspaceID string) ([]WorkspaceInvitation, error)
GetWorkspaceInvitations returns the current user's pending invitations for a workspace.
func (*Client) GetWorkspaceUsers ¶
func (c *Client) GetWorkspaceUsers(ctx context.Context, args *GetWorkspaceUsersArgs) (Page[WorkspaceUser], error)
GetWorkspaceUsers returns a page of members of a workspace.
func (*Client) GetWorkspaces ¶
GetWorkspaces returns the workspaces the user belongs to. Unlike the other list endpoints this one is not paginated and returns a plain array.
func (*Client) ImportIntoProjectFromFile ¶ added in v0.2.0
func (c *Client) ImportIntoProjectFromFile(ctx context.Context, projectID string, file io.Reader, fileName string) (ProjectImportResponse, error)
ImportIntoProjectFromFile imports a CSV template file into an existing project.
func (*Client) ImportIntoProjectFromTemplateID ¶ added in v0.2.0
func (c *Client) ImportIntoProjectFromTemplateID(ctx context.Context, projectID, templateID string, locale *string) (ProjectImportResponse, error)
ImportIntoProjectFromTemplateID imports a shared template into an existing project. Locale is optional (e.g. "en").
func (*Client) JoinProject ¶ added in v0.2.0
JoinProject adds the current user to a shared project.
func (*Client) JoinWorkspace ¶ added in v0.2.0
func (c *Client) JoinWorkspace(ctx context.Context, args JoinWorkspaceArgs) (WorkspaceUser, error)
JoinWorkspace adds the current user to a workspace and returns their membership.
func (*Client) LocationReminders ¶ added in v0.2.0
func (c *Client) LocationReminders(ctx context.Context, args *GetLocationRemindersArgs) iter.Seq2[LocationReminder, error]
LocationReminders returns an iterator over all location reminders, following pagination.
func (*Client) MigratePersonalToken ¶ added in v0.2.0
func (c *Client) MigratePersonalToken(ctx context.Context, clientID, clientSecret, personalToken, scope string) (AccessToken, error)
MigratePersonalToken exchanges a personal API token for an OAuth2 access token scoped to the given application. Scope is a comma-separated list of OAuth scopes.
func (*Client) MoveTask ¶ added in v0.2.0
MoveTask moves a task to a different project, section, or parent task.
func (*Client) QuickAddTask ¶
QuickAddTask creates a task using Todoist's natural-language quick-add syntax.
func (*Client) RejectWorkspaceInvitation ¶ added in v0.2.0
func (c *Client) RejectWorkspaceInvitation(ctx context.Context, inviteCode string) (WorkspaceInvitation, error)
RejectWorkspaceInvitation rejects an invitation by its invite code.
func (*Client) RemoveSharedLabel ¶ added in v0.2.0
RemoveSharedLabel removes a shared label from all tasks that use it.
func (*Client) RenameSharedLabel ¶ added in v0.2.0
RenameSharedLabel renames a shared label across all tasks that use it.
func (*Client) ReopenTask ¶
ReopenTask reopens a previously completed task.
func (*Client) RevokeToken ¶ added in v0.2.0
RevokeToken revokes an OAuth2 access token. It authenticates with the application's client credentials rather than the client's own token.
func (*Client) SearchLabels ¶ added in v0.3.0
SearchLabels returns a page of labels matching the query.
func (*Client) SearchLabelsSeq ¶ added in v0.3.0
func (c *Client) SearchLabelsSeq(ctx context.Context, args *SearchLabelsArgs) iter.Seq2[Label, error]
SearchLabelsSeq iterates over all labels matching the query, following pagination.
func (*Client) SearchProjects ¶ added in v0.3.0
func (c *Client) SearchProjects(ctx context.Context, args *SearchProjectsArgs) (Page[Project], error)
SearchProjects returns a page of projects matching the query.
func (*Client) SearchProjectsSeq ¶ added in v0.3.0
func (c *Client) SearchProjectsSeq(ctx context.Context, args *SearchProjectsArgs) iter.Seq2[Project, error]
SearchProjectsSeq iterates over all projects matching the query, following pagination.
func (*Client) SearchSections ¶ added in v0.3.0
func (c *Client) SearchSections(ctx context.Context, args *SearchSectionsArgs) (Page[Section], error)
SearchSections returns a page of sections matching the query.
func (*Client) SearchSectionsSeq ¶ added in v0.3.0
func (c *Client) SearchSectionsSeq(ctx context.Context, args *SearchSectionsArgs) iter.Seq2[Section, error]
SearchSectionsSeq iterates over all sections matching the query, following pagination.
func (*Client) SharedLabels ¶ added in v0.2.0
func (c *Client) SharedLabels(ctx context.Context, args *GetSharedLabelsArgs) iter.Seq2[string, error]
SharedLabels returns an iterator over all shared label names, following pagination.
func (*Client) Sync ¶
func (c *Client) Sync(ctx context.Context, req SyncRequest) (*SyncResponse, error)
Sync performs a synchronization request against the /sync endpoint, batching any commands in req. Callers should persist the returned SyncToken to make subsequent incremental syncs.
Example ¶
package main
import (
"context"
"fmt"
"log"
"os"
todoist "github.com/smirnoffmg/go-todoist"
)
func main() {
api := todoist.New(os.Getenv("TODOIST_TOKEN"))
addProject := todoist.NewCommand("project_add", "proj-tmp", map[string]any{"name": "Launch"})
addTask := todoist.NewCommand("item_add", "", map[string]any{
"content": "Draft announcement",
"project_id": "proj-tmp", // resolved via temp_id mapping
})
resp, err := api.Sync(context.Background(), todoist.SyncRequest{
ResourceTypes: []string{"projects", "items"},
Commands: []todoist.Command{addProject, addTask},
})
if err != nil {
log.Fatal(err)
}
if err := resp.Err(); err != nil {
log.Fatal(err)
}
fmt.Println("created project", resp.TempIDMapping["proj-tmp"])
// Persist resp.SyncToken for the next incremental sync.
}
Output:
func (*Client) Tasks ¶
Tasks returns an iterator over all tasks matching args, transparently following pagination cursors.
Example ¶
package main
import (
"context"
"fmt"
"log"
"os"
todoist "github.com/smirnoffmg/go-todoist"
)
func main() {
api := todoist.New(os.Getenv("TODOIST_TOKEN"))
// The iterator follows pagination cursors automatically.
for task, err := range api.Tasks(context.Background(), &todoist.GetTasksArgs{ProjectID: "220474322"}) {
if err != nil {
log.Fatal(err)
}
fmt.Println(task.ID, task.Content)
}
}
Output:
func (*Client) TasksByFilter ¶ added in v0.2.0
func (c *Client) TasksByFilter(ctx context.Context, args *GetTasksByFilterArgs) iter.Seq2[Task, error]
TasksByFilter iterates over all tasks matching a filter query, following pagination.
func (*Client) UnarchiveProject ¶
UnarchiveProject restores an archived project.
func (*Client) UnarchiveSection ¶ added in v0.2.0
UnarchiveSection restores an archived section.
func (*Client) UpdateComment ¶
func (c *Client) UpdateComment(ctx context.Context, id string, args UpdateCommentArgs) (Comment, error)
UpdateComment updates an existing comment.
func (*Client) UpdateFolder ¶ added in v0.3.0
func (c *Client) UpdateFolder(ctx context.Context, id string, args UpdateFolderArgs) (Folder, error)
UpdateFolder updates an existing folder.
func (*Client) UpdateLabel ¶
UpdateLabel updates an existing label.
func (*Client) UpdateLocationReminder ¶ added in v0.2.0
func (c *Client) UpdateLocationReminder(ctx context.Context, id string, args UpdateLocationReminderArgs) (LocationReminder, error)
UpdateLocationReminder updates an existing location reminder.
func (*Client) UpdateProject ¶
func (c *Client) UpdateProject(ctx context.Context, id string, args UpdateProjectArgs) (Project, error)
UpdateProject updates an existing project.
func (*Client) UpdateReminder ¶
func (c *Client) UpdateReminder(ctx context.Context, id string, args UpdateReminderArgs) (Reminder, error)
UpdateReminder updates an existing reminder.
func (*Client) UpdateSection ¶
func (c *Client) UpdateSection(ctx context.Context, id string, args UpdateSectionArgs) (Section, error)
UpdateSection updates an existing section.
func (*Client) UpdateTask ¶
UpdateTask updates an existing task and returns the updated resource.
func (*Client) UpdateWorkspace ¶
func (c *Client) UpdateWorkspace(ctx context.Context, id string, args UpdateWorkspaceArgs) (Workspace, error)
UpdateWorkspace updates an existing workspace.
func (*Client) UploadFile ¶ added in v0.3.0
func (c *Client) UploadFile(ctx context.Context, file io.Reader, fileName string, projectID *string) (UploadResult, error)
UploadFile uploads a file and returns its metadata. When projectID is non-nil the upload is associated with that project.
type Collaborator ¶
type Collaborator struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
}
Collaborator is a user who shares a project.
type Command ¶
type Command struct {
Type string `json:"type"`
UUID string `json:"uuid"`
TempID string `json:"temp_id,omitempty"`
Args any `json:"args"`
}
Command is a single write operation submitted to the Sync API. Multiple commands can be batched in one Sync call and may reference each other's temp_id values.
func NewCommand ¶
NewCommand builds a Command with a freshly generated UUID. Pass a non-empty tempID when the created object needs to be referenced by later commands in the same batch.
type Comment ¶
type Comment struct {
ID string `json:"id"`
TaskID string `json:"task_id"`
ProjectID string `json:"project_id"`
Content string `json:"content"`
PostedAt string `json:"posted_at"`
PostedUID string `json:"posted_uid"`
Attachment *Attachment `json:"attachment"`
}
Comment is a comment on a task or project.
type CreateCommentArgs ¶
type CreateCommentArgs struct {
Content string `json:"content"`
TaskID *string `json:"task_id,omitempty"`
ProjectID *string `json:"project_id,omitempty"`
Attachment *Attachment `json:"attachment,omitempty"`
}
CreateCommentArgs are the parameters for creating a comment. Content and exactly one of TaskID or ProjectID are required.
type CreateFolderArgs ¶ added in v0.3.0
type CreateFolderArgs struct {
Name string `json:"name"`
WorkspaceID int64 `json:"workspace_id"`
DefaultOrder *int `json:"default_order,omitempty"`
ChildOrder *int `json:"child_order,omitempty"`
}
CreateFolderArgs are the parameters for creating a folder. Name and WorkspaceID are required.
type CreateLabelArgs ¶
type CreateLabelArgs struct {
Name string `json:"name"`
Color *string `json:"color,omitempty"`
Order *int `json:"order,omitempty"`
IsFavorite *bool `json:"is_favorite,omitempty"`
}
CreateLabelArgs are the parameters for creating a label. Name is required.
type CreateLocationReminderArgs ¶ added in v0.2.0
type CreateLocationReminderArgs struct {
TaskID string `json:"task_id"`
Name string `json:"name"`
LocLat string `json:"loc_lat"`
LocLong string `json:"loc_long"`
LocTrigger string `json:"loc_trigger"`
Radius *int `json:"radius,omitempty"`
}
CreateLocationReminderArgs are the parameters for creating a location reminder. TaskID, Name, LocLat, LocLong and LocTrigger are required; LocTrigger is "on_enter" or "on_leave".
type CreateProjectArgs ¶
type CreateProjectArgs struct {
Name string `json:"name"`
ParentID *string `json:"parent_id,omitempty"`
Color *string `json:"color,omitempty"`
IsFavorite *bool `json:"is_favorite,omitempty"`
ViewStyle *string `json:"view_style,omitempty"`
}
CreateProjectArgs are the parameters for creating a project. Name is required.
type CreateReminderArgs ¶
type CreateReminderArgs struct {
ItemID string `json:"item_id"`
Type string `json:"type"`
DueString *string `json:"due_string,omitempty"`
DueDate *string `json:"due_date,omitempty"`
DueDatetime *string `json:"due_datetime,omitempty"`
MinuteBias *int `json:"minute_offset,omitempty"`
Name *string `json:"name,omitempty"`
LocLat *string `json:"loc_lat,omitempty"`
LocLong *string `json:"loc_long,omitempty"`
LocTrigger *string `json:"loc_trigger,omitempty"`
Radius *int `json:"radius,omitempty"`
}
CreateReminderArgs are the parameters for creating a reminder. ItemID and Type are required.
type CreateSectionArgs ¶
type CreateSectionArgs struct {
Name string `json:"name"`
ProjectID string `json:"project_id"`
Order *int `json:"order,omitempty"`
}
CreateSectionArgs are the parameters for creating a section. Name and ProjectID are required.
type CreateTaskArgs ¶
type CreateTaskArgs struct {
Content string `json:"content"`
Description *string `json:"description,omitempty"`
ProjectID *string `json:"project_id,omitempty"`
SectionID *string `json:"section_id,omitempty"`
ParentID *string `json:"parent_id,omitempty"`
Order *int `json:"order,omitempty"`
Labels []string `json:"labels,omitempty"`
Priority *int `json:"priority,omitempty"`
AssigneeID *string `json:"assignee_id,omitempty"`
DueString *string `json:"due_string,omitempty"`
DueDate *string `json:"due_date,omitempty"`
DueDatetime *string `json:"due_datetime,omitempty"`
DueLang *string `json:"due_lang,omitempty"`
Deadline *string `json:"deadline_date,omitempty"`
Duration *int `json:"duration,omitempty"`
DurationUnit *string `json:"duration_unit,omitempty"`
}
CreateTaskArgs are the parameters for creating a task. Content is required; pointer fields are omitted from the request when nil.
type CreateWorkspaceArgs ¶
type CreateWorkspaceArgs struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
}
CreateWorkspaceArgs are the parameters for creating a workspace. Name is required.
type Due ¶
type Due struct {
Date string `json:"date"`
String string `json:"string"`
Lang string `json:"lang"`
IsRecurring bool `json:"is_recurring"`
Timezone string `json:"timezone,omitempty"`
}
Due represents the due date of a task.
type Error ¶
type Error struct {
// StatusCode is the HTTP status code of the response.
StatusCode int
// Status is the HTTP status text of the response.
Status string
// Body is the raw response body, typically a JSON error payload.
Body string
// RetryAfter is populated from the Retry-After header on 429 responses.
RetryAfter time.Duration
}
Error is returned for any non-2xx response from the Todoist API. It carries the HTTP status and the raw response body so callers can inspect the failure.
Example ¶
package main
import (
"context"
"errors"
"fmt"
"os"
todoist "github.com/smirnoffmg/go-todoist"
)
func main() {
api := todoist.New(os.Getenv("TODOIST_TOKEN"))
_, err := api.GetTask(context.Background(), "does-not-exist")
var apiErr *todoist.Error
if errors.As(err, &apiErr) {
fmt.Println(apiErr.StatusCode)
if apiErr.Temporary() {
// Retry after apiErr.RetryAfter.
}
}
}
Output:
type FileURLResponse ¶ added in v0.2.0
FileURLResponse points to a generated template file.
type Filter ¶
type Filter struct {
ID string `json:"id"`
Name string `json:"name"`
Query string `json:"query"`
Color string `json:"color"`
Order int `json:"item_order"`
IsFavorite bool `json:"is_favorite"`
}
Filter is a saved filter query.
The Todoist API v1 does not expose filters as REST endpoints; they are managed through the Sync API using the "filter_add", "filter_update" and "filter_delete" commands, and returned in SyncResponse.Filters when "filters" is among the requested resource types. See Sync and NewCommand.
type Folder ¶ added in v0.3.0
type Folder struct {
ID string `json:"id"`
Name string `json:"name"`
WorkspaceID string `json:"workspace_id"`
DefaultOrder int `json:"default_order"`
ChildOrder int `json:"child_order"`
IsDeleted bool `json:"is_deleted"`
}
Folder groups projects within a workspace.
type GetCommentsArgs ¶
GetCommentsArgs controls listing of comments. Exactly one of TaskID or ProjectID must be set.
type GetCompletedTasksArgs ¶ added in v0.2.0
type GetCompletedTasksArgs struct {
Since time.Time
Until time.Time
WorkspaceID string
ProjectID string
SectionID string
ParentID string
FilterQuery string
FilterLang string
Cursor string
Limit int
}
GetCompletedTasksArgs are the parameters for the completed-task endpoints. Since and Until define the (inclusive, exclusive) time range and are required; the remaining fields are optional filters and pagination controls.
type GetFoldersArgs ¶ added in v0.3.0
GetFoldersArgs controls listing and pagination of folders.
type GetLabelsArgs ¶
GetLabelsArgs controls listing and pagination of labels.
type GetLocationRemindersArgs ¶ added in v0.2.0
GetLocationRemindersArgs controls listing and pagination of location reminders.
type GetProjectsArgs ¶
GetProjectsArgs controls listing and pagination of projects.
type GetRemindersArgs ¶
GetRemindersArgs controls listing and pagination of reminders.
type GetSectionsArgs ¶
GetSectionsArgs controls listing and pagination of sections.
type GetSharedLabelsArgs ¶ added in v0.2.0
type GetSharedLabelsArgs struct {
}
GetSharedLabelsArgs controls listing of shared labels. When OmitPersonal is true, labels that also exist as personal labels are excluded.
type GetTasksArgs ¶
type GetTasksArgs struct {
ProjectID string
SectionID string
ParentID string
Label string
Cursor string
Limit int
}
GetTasksArgs are the filters and pagination controls for listing tasks. All fields are optional.
type GetTasksByFilterArgs ¶ added in v0.2.0
GetTasksByFilterArgs are the parameters for querying tasks with a filter string. Query is required.
type GetWorkspaceUsersArgs ¶
GetWorkspaceUsersArgs controls listing and pagination of workspace members.
type JoinWorkspaceArgs ¶ added in v0.2.0
type JoinWorkspaceArgs struct {
InviteCode *string `json:"invite_code,omitempty"`
WorkspaceID *string `json:"workspace_id,omitempty"`
}
JoinWorkspaceArgs identifies the workspace to join, by invite code or by workspace ID (for open workspaces). At least one should be set.
type Label ¶
type Label struct {
ID string `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
Order int `json:"item_order"`
IsFavorite bool `json:"is_favorite"`
}
Label is a personal label.
type LocationReminder ¶ added in v0.2.0
type LocationReminder struct {
ID string `json:"id"`
ItemID string `json:"item_id"`
ProjectID string `json:"project_id"`
NotifyUID string `json:"notify_uid"`
Name string `json:"name"`
LocLat string `json:"loc_lat"`
LocLong string `json:"loc_long"`
LocTrigger string `json:"loc_trigger"`
Radius int `json:"radius"`
Type string `json:"type"`
IsDeleted bool `json:"is_deleted"`
}
LocationReminder is a reminder that triggers on arriving at or leaving a geographic location.
type MoveTaskArgs ¶ added in v0.2.0
type MoveTaskArgs struct {
ProjectID *string `json:"project_id,omitempty"`
SectionID *string `json:"section_id,omitempty"`
ParentID *string `json:"parent_id,omitempty"`
}
MoveTaskArgs specifies where to move a task. Exactly one destination should be set.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithBaseURL ¶
WithBaseURL overrides the API base URL. Useful for testing against a stub server. The trailing slash, if any, is trimmed.
func WithHTTPClient ¶
WithHTTPClient sets the underlying HTTP client used for requests.
func WithRetry ¶ added in v0.2.0
WithRetry enables retrying requests that fail with HTTP 429 or 5xx, up to maxRetries additional attempts. Between attempts the client waits for the Retry-After duration when the server provides one, otherwise an exponential backoff. Retries respect context cancellation. Retrying is disabled by default (maxRetries <= 0).
func WithUserAgent ¶
WithUserAgent sets the User-Agent header sent with each request.
type Page ¶
Page is a single page of a cursor-paginated list response. NextCursor is empty when there are no further pages.
type ProductivityStats ¶
type ProductivityStats struct {
KarmaLastUpdate float64 `json:"karma_last_update"`
KarmaTrend string `json:"karma_trend"`
Karma float64 `json:"karma"`
CompletedCount int `json:"completed_count"`
DaysItems []DayStats `json:"days_items"`
WeekItems []WeekStats `json:"week_items"`
Goals map[string]any `json:"goals"`
}
ProductivityStats holds the user's karma and completion statistics.
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
ParentID string `json:"parent_id"`
Order int `json:"child_order"`
CommentCount int `json:"comment_count"`
IsFavorite bool `json:"is_favorite"`
IsInboxProject bool `json:"is_inbox_project"`
IsArchived bool `json:"is_archived"`
ViewStyle string `json:"view_style"`
WorkspaceID string `json:"workspace_id"`
URL string `json:"url"`
}
Project is a Todoist project.
type ProjectImportCreateResponse ¶ added in v0.2.0
type ProjectImportCreateResponse struct {
ProjectImportResponse
ProjectID string `json:"project_id"`
}
ProjectImportCreateResponse is returned when a template creates a new project.
type ProjectImportResponse ¶ added in v0.2.0
type ProjectImportResponse struct {
Status string `json:"status"`
TemplateType string `json:"template_type"`
Projects []Project `json:"projects"`
Sections []Section `json:"sections"`
Tasks []Task `json:"tasks"`
Comments []Comment `json:"comments"`
ProjectNotes []Comment `json:"project_notes"`
}
ProjectImportResponse is returned when a template is imported into an existing project.
type Reminder ¶
type Reminder struct {
ID string `json:"id"`
ItemID string `json:"item_id"`
Type string `json:"type"`
Due *Due `json:"due"`
MinuteBias int `json:"minute_offset"`
Name string `json:"name"`
LocLat string `json:"loc_lat"`
LocLong string `json:"loc_long"`
LocTrigger string `json:"loc_trigger"`
Radius int `json:"radius"`
IsDeleted bool `json:"is_deleted"`
}
Reminder is a reminder attached to a task.
type SearchLabelsArgs ¶ added in v0.3.0
SearchLabelsArgs are the parameters for searching labels. Query is required.
type SearchProjectsArgs ¶ added in v0.3.0
SearchProjectsArgs are the parameters for searching projects. Query is required.
type SearchSectionsArgs ¶ added in v0.3.0
SearchSectionsArgs are the parameters for searching sections. Query is required.
type Section ¶
type Section struct {
ID string `json:"id"`
ProjectID string `json:"project_id"`
Name string `json:"name"`
Order int `json:"section_order"`
IsArchived bool `json:"is_archived"`
WorkspaceID string `json:"workspace_id"`
}
Section is a section within a project.
type SyncRequest ¶
SyncRequest is the payload for a call to the Sync API. An empty SyncToken is sent as "*", requesting a full sync.
type SyncResponse ¶
type SyncResponse struct {
SyncToken string `json:"sync_token"`
FullSync bool `json:"full_sync"`
SyncStatus map[string]json.RawMessage `json:"sync_status"`
TempIDMapping map[string]string `json:"temp_id_mapping"`
Projects []Project `json:"projects"`
Items []Task `json:"items"`
Sections []Section `json:"sections"`
Labels []Label `json:"labels"`
Notes []Comment `json:"notes"`
Reminders []Reminder `json:"reminders"`
Filters []Filter `json:"filters"`
User *User `json:"user"`
}
SyncResponse is the result of a Sync API call. Only the resource slices relevant to the requested ResourceTypes are populated.
func (*SyncResponse) Err ¶
func (r *SyncResponse) Err() error
Err aggregates any per-command failures reported in SyncStatus. It returns nil when every command succeeded (status "ok") or when no commands were sent.
type TZInfo ¶
type TZInfo struct {
Timezone string `json:"timezone"`
GMTString string `json:"gmt_string"`
Hours int `json:"hours"`
Minutes int `json:"minutes"`
IsDST int `json:"is_dst"`
}
TZInfo is the user's timezone configuration.
type Task ¶
type Task struct {
ID string `json:"id"`
ProjectID string `json:"project_id"`
SectionID string `json:"section_id"`
ParentID string `json:"parent_id"`
Content string `json:"content"`
Description string `json:"description"`
Priority int `json:"priority"`
Labels []string `json:"labels"`
Due *Due `json:"due"`
Deadline *Deadline `json:"deadline"`
Duration *Duration `json:"duration"`
AssigneeID string `json:"assignee_id"`
AssignerID string `json:"assigner_id"`
Order int `json:"child_order"`
CommentCount int `json:"comment_count"`
IsCompleted bool `json:"checked"`
AddedAt string `json:"added_at"`
CompletedAt string `json:"completed_at"`
URL string `json:"url"`
}
Task is a Todoist task (an "item" in Sync API terms).
type UpdateCommentArgs ¶
type UpdateCommentArgs struct {
Content string `json:"content"`
}
UpdateCommentArgs are the parameters for updating a comment.
type UpdateFolderArgs ¶ added in v0.3.0
type UpdateFolderArgs struct {
Name *string `json:"name,omitempty"`
DefaultOrder *int `json:"default_order,omitempty"`
}
UpdateFolderArgs are the parameters for updating a folder. Only non-nil fields are sent.
type UpdateLabelArgs ¶
type UpdateLabelArgs struct {
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
Order *int `json:"order,omitempty"`
IsFavorite *bool `json:"is_favorite,omitempty"`
}
UpdateLabelArgs are the parameters for updating a label. Only non-nil fields are sent.
type UpdateLocationReminderArgs ¶ added in v0.2.0
type UpdateLocationReminderArgs struct {
Name *string `json:"name,omitempty"`
LocLat *string `json:"loc_lat,omitempty"`
LocLong *string `json:"loc_long,omitempty"`
LocTrigger *string `json:"loc_trigger,omitempty"`
Radius *int `json:"radius,omitempty"`
}
UpdateLocationReminderArgs are the parameters for updating a location reminder. Only non-nil fields are sent.
type UpdateProjectArgs ¶
type UpdateProjectArgs struct {
Name *string `json:"name,omitempty"`
Color *string `json:"color,omitempty"`
IsFavorite *bool `json:"is_favorite,omitempty"`
ViewStyle *string `json:"view_style,omitempty"`
}
UpdateProjectArgs are the parameters for updating a project. Only non-nil fields are sent.
type UpdateReminderArgs ¶
type UpdateReminderArgs struct {
Type *string `json:"type,omitempty"`
DueString *string `json:"due_string,omitempty"`
DueDate *string `json:"due_date,omitempty"`
DueDatetime *string `json:"due_datetime,omitempty"`
MinuteBias *int `json:"minute_offset,omitempty"`
Name *string `json:"name,omitempty"`
}
UpdateReminderArgs are the parameters for updating a reminder.
type UpdateSectionArgs ¶
type UpdateSectionArgs struct {
Name string `json:"name"`
}
UpdateSectionArgs are the parameters for updating a section.
type UpdateTaskArgs ¶
type UpdateTaskArgs struct {
Content *string `json:"content,omitempty"`
Description *string `json:"description,omitempty"`
Labels []string `json:"labels,omitempty"`
Priority *int `json:"priority,omitempty"`
AssigneeID *string `json:"assignee_id,omitempty"`
DueString *string `json:"due_string,omitempty"`
DueDate *string `json:"due_date,omitempty"`
DueDatetime *string `json:"due_datetime,omitempty"`
DueLang *string `json:"due_lang,omitempty"`
Deadline *string `json:"deadline_date,omitempty"`
Duration *int `json:"duration,omitempty"`
DurationUnit *string `json:"duration_unit,omitempty"`
}
UpdateTaskArgs are the parameters for updating a task. Only non-nil fields are sent, so the zero value leaves the task unchanged.
type UpdateWorkspaceArgs ¶
type UpdateWorkspaceArgs struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
}
UpdateWorkspaceArgs are the parameters for updating a workspace.
type UploadResult ¶ added in v0.3.0
type UploadResult struct {
FileURL string `json:"file_url"`
FileName string `json:"file_name"`
FileType string `json:"file_type"`
FileSize int `json:"file_size"`
ResourceType string `json:"resource_type"`
UploadState string `json:"upload_state"`
Image string `json:"image"`
ImageWidth int `json:"image_width"`
ImageHeight int `json:"image_height"`
}
UploadResult describes a file uploaded to Todoist, suitable for attaching to a comment.
func (UploadResult) Attachment ¶ added in v0.3.0
func (u UploadResult) Attachment() Attachment
Attachment converts an upload into the Attachment form accepted by CreateComment.
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
FullName string `json:"full_name"`
InboxID string `json:"inbox_project_id"`
TZInfo TZInfo `json:"tz_info"`
Lang string `json:"lang"`
DateFormat int `json:"date_format"`
TimeFormat int `json:"time_format"`
StartDay int `json:"start_day"`
Karma float64 `json:"karma"`
IsPremium bool `json:"is_premium"`
PremiumUntil string `json:"premium_until"`
AvatarBig string `json:"avatar_big"`
}
User is the authenticated user's profile.
type WeekStats ¶
type WeekStats struct {
From string `json:"from"`
To string `json:"to"`
TotalCompleted int `json:"total_completed"`
}
WeekStats holds completion counts for a single week.
type Workspace ¶
type Workspace struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Role string `json:"role"`
Plan string `json:"current_active_plan"`
IsGuest bool `json:"is_guest_allowed"`
MemberCount int `json:"member_count"`
LogoBig string `json:"logo_big"`
}
Workspace is a Todoist workspace (team space).
type WorkspaceInvitation ¶ added in v0.2.0
type WorkspaceInvitation struct {
ID string `json:"id"`
InviterID string `json:"inviter_id"`
UserEmail string `json:"user_email"`
WorkspaceID string `json:"workspace_id"`
Role string `json:"role"`
IsExistingUser bool `json:"is_existing_user"`
}
WorkspaceInvitation is a pending invitation for a user to join a workspace.