Documentation
¶
Overview ¶
Package sync defines the models of the sync API.
Index ¶
- Constants
- Variables
- type Color
- type Command
- type CommandArgs
- type Commands
- type Deadline
- type Due
- type Duration
- type Filter
- type FilterAddArgs
- type FilterDeleteArgs
- type FilterReorderArgs
- type FilterUpdateArgs
- type Label
- type LabelAddArgs
- type LabelDeleteArgs
- type LabelDeleteSharedArgs
- type LabelRenameSharedArgs
- type LabelReorderArgs
- type LabelUpdateArgs
- type Location
- type LocationClearArgs
- type Project
- type ProjectAddArgs
- type ProjectArchiveArgs
- type ProjectDeleteArgs
- type ProjectLeaveArgs
- type ProjectMoveArgs
- type ProjectMoveToPersonalArgs
- type ProjectMoveToWorkspaceArgs
- type ProjectReorderArgs
- type ProjectReorderItem
- type ProjectUnarchiveArgs
- type ProjectUpdateArgs
- type Reminder
- type ReminderAddArgs
- type ReminderDeleteArgs
- type ReminderType
- type ReminderUpdateArgs
- type ResourceType
- type ResourceTypes
- type Section
- type SectionAddArgs
- type SectionArchiveArgs
- type SectionDeleteArgs
- type SectionMoveArgs
- type SectionReorderArgs
- type SectionReorderItem
- type SectionUnarchiveArgs
- type SectionUpdateArgs
- type SyncErr
- type SyncRequest
- type SyncResponse
- type Task
- type TaskAddArgs
- type TaskCloseArgs
- type TaskCompleteArgs
- type TaskCompleteRecurringArgs
- type TaskDeleteArgs
- type TaskMoveArgs
- type TaskReorderArgs
- type TaskReorderItem
- type TaskUncompleteArgs
- type TaskUpdateArgs
- type TaskUpdateDayOrdersArgs
- type User
Constants ¶
const (
DefaultSyncToken = "*"
)
Variables ¶
var DefaultResourceTypes = ResourceTypes{ All, NoTaskComments, NoProjectComments, NoCollaborators, NoCollaboratorStates, NoNotificationSettings, NoUserPlanLimits, NoWorkspaces, NoWorkspaceUsers, NoCompletedInfo, NoStats, }
DefaultResourceTypes is the default set of resource to fetch from the server.
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color string
Color represents a color of a label or project.
var ( BerryRed Color = "berry_red" Red Color = "red" Orange Color = "orange" Yellow Color = "yellow" OliveGreen Color = "olive_green" LimeGreen Color = "lime_green" Green Color = "green" MintGreen Color = "mint_green" Teal Color = "teal" SkyBlue Color = "sky_blue" LightBlue Color = "light_blue" Blue Color = "blue" Grape Color = "grape" Violet Color = "violet" Lavender Color = "lavender" Magenta Color = "magenta" Salmon Color = "salmon" Charcoal Color = "charcoal" Grey Color = "grey" Taupe Color = "taupe" )
func ParseColor ¶
ParseColor returns a Color from a string.
type Command ¶
type Command struct {
// The type of the command.
Type string `json:"type"`
// The parameters of the command.
Args any `json:"args"`
// Command UUID. More details about this below.
UUID uuid.UUID `json:"uuid"`
// Temporary resource ID, Optional. Only specified for commands that create a
// new resource (e.g. item_add command).
TempID uuid.UUID `json:"temp_id"`
}
Command represents a command to be sent through the Sync API.
func NewCommand ¶
func NewCommand(args CommandArgs) *Command
type CommandArgs ¶
type CommandArgs interface {
// contains filtered or unexported methods
}
type Commands ¶
type Commands []*Command
Commands is a slice of Command.
func NewCommands ¶
func NewCommands[T CommandArgs](args []T) Commands
type Deadline ¶
type Deadline struct {
// Deadline in the format of YYYY-MM-DD (RFC 3339).
Date *time.Time `json:"date"`
// Lang which has to be used to parse the content of the string attribute.
// Used by clients and on the server side to properly process deadlines.
//
// Valid languages are:
// en, da, pl, zh, ko, de, pt, ja, it, fr, sv, ru, es, nl, fi, nb, tw.
Lang *string `json:"lang"`
}
Deadline represents a deadline on a task.
Similar to due dates, deadlines can be set on tasks, and can be used to differentiate between when a task should be started, and when it must be done by.
Unlike due dates, deadlines only support non-recurring dates with no time component.
See Deadlines for more details.
func (*Deadline) MarshalJSON ¶
func (*Deadline) UnmarshalJSON ¶
type Due ¶
type Due struct {
// Due date.
Date *time.Time `json:"date,omitempty"`
// Timezone of the due instance.
//
// Used to recalculate properly the next iteration for a recurring due date.
Timezone *time.Location `json:"timezone,omitempty"`
// Human-readable representation of due date. String always represents the due
// object in user's timezone. See
// https://todoist.com/help/articles/introduction-to-dates-and-time-q7VobO for
// more details.
String *string `json:"string,omitempty"`
// Lang which has to be used to parse the content of the string attribute.
// Used by clients and on the server side to properly process due dates when
// date object is not set, and when dealing with recurring tasks.
//
// Valid languages are:
// en, da, pl, zh, ko, de, pt, ja, it, fr, sv, ru, es, nl, fi, nb, tw.
Lang *string `json:"lang,omitempty"`
// Boolean flag which is set to true if the due object represents a recurring
// due date.
IsRecurring *bool `json:"is_recurring,omitempty"`
}
Due dates for tasks and reminders is one of the core concepts of Todoist. It's very powerful and quite complex, because it has to embrace different use-cases of Todoist users.
Todoist supports three types of due dates:
Full-day dates (like "1 January 2018" or "tomorrow")
- Date is time.DateOnly.
- Timezone is null.
Floating due dates with time (like "1 January 2018 at 12:00" or "tomorrow at 10am")
- Date is "2006-01-02T15:04:05.000000".
- Timezone is null.
Due dates with time and fixed timezone (like "1 January 2018 at 12:00 America/Chicago" or "tomorrow at 10am Asia/Jakarta")
- Date is time.RFC3339.
- Timezone is not null.
Unless specified explicitly, dates with time are created as floating.
In addition, any of these due dates can be set to recurring or not, depending on the date string, provided by the client.
Our Help Center contains an in-depth article about the difference between floating due dates and dates with fixed zones.
You can also find more information about recurring due dates in our Help Center.
See Due dates for more details.
func (*Due) MarshalJSON ¶
func (*Due) UnmarshalJSON ¶
type Duration ¶
type Duration struct {
// Time the task will take.
Amount int `json:"amount"`
// The amount represents which must be either minute or day.
Unit string `json:"unit"`
}
Duration represents a duration of a task.
func ParseDuration ¶
ParseDuration returns a Duration from a string.
type Filter ¶
type Filter struct {
// The ID of the filter.
ID string `json:"id"`
// The name of the filter.
Name string `json:"name"`
// The query to search for.
// https://www.todoist.com/help/articles/introduction-to-filters-V98wIH can be
// found in the Todoist help page.
Query string `json:"query"`
// The color of the filter icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color Color `json:"color"`
// Filter’s order in the filter list (where the smallest value should place
// the filter at the top).
ItemOrder int `json:"item_order"`
// Whether the filter is marked as deleted (a true or false value).
IsDeleted bool `json:"is_deleted"`
// Whether the filter is a favorite (a true or false value).
IsFavorite bool `json:"is_favorite"`
// Filters from a cancelled subscription cannot be changed. This is a
// read-only attribute (a true or false value).
IsFrozen bool `json:"is_frozen"`
}
Filter represents a filter in Todoist.
See Filters for more details.
type FilterAddArgs ¶
type FilterAddArgs struct {
// Required.
// The name of the filter.
Name string `json:"name"`
// Required.
// The query to search for.
// https://www.todoist.com/help/articles/introduction-to-filters-V98wIH can be
// found in the Todoist help page.
Query string `json:"query"`
// Optional.
// The color of the filter icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color *Color `json:"color,omitempty"`
// Optional.
// Filter’s order in the filter list (where the smallest value should place
// the filter at the top).
ItemOrder *int `json:"item_order,omitempty"`
// Optional.
// Whether the filter is a favorite (a true or false value).
IsFavorite *bool `json:"is_favorite,omitempty"`
}
type FilterDeleteArgs ¶
type FilterDeleteArgs struct {
// Required.
// The ID of the filter.
ID string `json:"id"`
}
type FilterReorderArgs ¶
type FilterUpdateArgs ¶
type FilterUpdateArgs struct {
// Required.
// The ID of the filter.
ID string `json:"id"`
// Optional.
// The name of the filter.
Name *string `json:"name,omitempty"`
// Optional.
// The query to search for.
// https://www.todoist.com/help/articles/introduction-to-filters-V98wIH can be
// found in the Todoist help page.
Query *string `json:"query,omitempty"`
// Optional.
// The color of the filter icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color *Color `json:"color,omitempty"`
// Optional.
// Filter’s order in the filter list (where the smallest value should place
// the filter at the top).
ItemOrder *int `json:"item_order,omitempty"`
// Optional.
// Whether the filter is a favorite (a true or false value).
IsFavorite *bool `json:"is_favorite,omitempty"`
}
type Label ¶
type Label struct {
// The ID of the label.
ID string `json:"id"`
// The name of the label.
Name string `json:"name"`
// The color of the project icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color Color `json:"color"`
// Label’s order in the label list (a number, where the smallest value should
// place the label at the top).
ItemOrder int `json:"item_order"`
// Whether the label is marked as deleted (a true or false value).
IsDeleted bool `json:"is_deleted"`
// Whether the label is a favorite (a true or false value).
IsFavorite bool `json:"is_favorite"`
}
Label represents a label in Todoist.
There are two types of labels that can be added to Todoist tasks. We refer to these as personal and shared labels.
Personal labels ¶
Labels created by the current user will show up in their personal label list. These labels can be customized and will stay in their account unless deleted.
A personal label can be converted to a shared label by the user if they no longer require them to be stored against their account, but they still appear on shared tasks.
Shared labels ¶
A label created by a collaborator that doesn't share a name with an existing personal label will appear in our clients as a shared label. These labels are gray by default and will only stay in the shared labels list if there are any active tasks with this label.
A user can convert a shared label to a personal label at any time. The label will then become customizable and will remain in the account even if not assigned to any active tasks.
Shared labels do not appear in the sync response for a user's account. They only appear within the labels list of the Task that they are assigned to.
You can find more information on the differences between personal and shared labels in our Help Center.
See Labels for more details.
type LabelAddArgs ¶
type LabelAddArgs struct {
// Required.
// The name of the label.
Name string `json:"name"`
// Optional.
// The color of the label icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color *Color `json:"color,omitempty"`
// Optional.
// Label’s order in the label list (a number, where the smallest value should
// place the label at the top).
ItemOrder *int `json:"item_order,omitempty"`
// Optional.
// Whether the label is a favorite (a true or false value).
IsFavorite *bool `json:"is_favorite,omitempty"`
}
type LabelDeleteArgs ¶
type LabelDeleteArgs struct {
// Required.
// The ID of the label.
ID string `json:"id"`
// Optional.
// A string value, either all (default) or none. If no value or all is passed,
// the personal label will be removed and any instances of the label will also
// be removed from tasks (including tasks in shared projects). If none is
// passed, the personal label will be removed from the user's account but it
// will continue to appear on tasks as a shared label.
Cascade *string `json:"cascade,omitempty"`
}
type LabelDeleteSharedArgs ¶ added in v0.2.0
type LabelDeleteSharedArgs struct {
// The name of the label to remove.
Name string `json:"name"`
}
type LabelRenameSharedArgs ¶ added in v0.2.0
type LabelReorderArgs ¶
type LabelUpdateArgs ¶
type LabelUpdateArgs struct {
// Required.
// The ID of the label.
ID string `json:"id"`
// Optional.
// The name of the label.
Name *string `json:"name,omitempty"`
// Optional.
// The color of the label icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color *Color `json:"color,omitempty"`
// Optional.
// Label’s order in the label list.
ItemOrder *int `json:"item_order,omitempty"`
// Optional.
// Whether the label is a favorite (a true or false value).
IsFavorite *bool `json:"is_favorite,omitempty"`
}
type Location ¶
type Location []string
Location is specific, as it's not an object, but an ordered array.
- 0: Name of the location.
- 1: Location latitude.
- 2: Location longitude.
Locations are a top-level entity in the sync model. They contain a list of all locations that are used within user's current location reminders.
See Locations for more details.
type LocationClearArgs ¶
type LocationClearArgs struct{}
type Project ¶
type Project struct {
// The ID of the project.
ID string `json:"id"`
// The name of the project.
Name string `json:"name"`
// Description for the project. Only used for teams.
Description string `json:"description"`
// Real or temp ID of the workspace the project. Only used for teams.
WorkspaceID string `json:"workspace_id"`
// Indicates if the project is invite-only or if it should be visible for
// everyone in the workspace. If missing or null, the default value from the
// workspace is_invite_only_default will be used. Only used for teams.
IsInviteOnly bool `json:"is_invite_only"`
// The status of the project. Possible values: PLANNED, IN_PROGRESS, PAUSED,
// COMPLETED, CANCELED. Only used for teams.
Status string `json:"status"`
// If False, the project is invite-only and people can't join by link. If
// true, the project is visible to anyone with a link, and anyone can join it.
// Only used for teams.
IsLinkSharingEnabled bool `json:"is_link_sharing_enabled"`
// The role a user can have. Possible values: CREATOR, ADMIN, READ_WRITE,
// READ_AND_COMMENT, READ_ONLY. (CREATOR is equivalent to admin and is
// automatically set at project creation; it can’t be set to anyone later).
// Defaults to READ_WRITE. Only used for teams.
CollaboratorRoleDefault string `json:"collaborator_role_default"`
// The color of the project icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color Color `json:"color"`
// The ID of the parent project. Set to null for root projects.
ParentID *string `json:"parent_id,omitempty"`
// The order of the project. Defines the position of the project among all the
// projects with the same parent_id.
ChildOrder int `json:"child_order"`
// Whether the project's sub-projects are collapsed (a true or false value).
Collapsed bool `json:"collapsed"`
Shared bool `json:"shared"`
// Whether tasks in the project can be assigned to users (a true or false
// value).
CanAssignTasks bool `json:"can_assign_tasks"`
// Whether the project is marked as deleted (a true or false value).
IsDeleted bool `json:"is_deleted"`
// Whether the project is marked as archived (a true or false value).
IsArchived bool `json:"is_archived"`
// Whether the project is a favorite (a true or false value).
IsFavorite bool `json:"is_favorite"`
// Workspace or personal projects from a cancelled subscription (a true or
// false value).
IsFrozen bool `json:"is_frozen"`
// The mode in which to render tasks in this project. One of list, board, or
// calendar.
ViewStyle string `json:"view_style"`
// The role of the requesting user. Possible values: CREATOR, ADMIN,
// READ_WRITE, READ_AND_COMMENT, READ_ONLY. Only used for teams
Role string `json:"role"`
// Whether the project is Inbox (true or otherwise this property is not sent).
InboxProject bool `json:"inbox_project,omitempty"`
// The ID of the folder which this project is in.
FolderID *string `json:"folder_id,omitempty"`
// Project creation date in the format YYYY-MM-DDTHH:MM:SSZ date.
CreatedAt time.Time `json:"created_at"`
// Project update date in the format YYYY-MM-DDTHH:MM:SSZ date.
UpdatedAt time.Time `json:"updated_at"`
}
Project represents a project in Todoist.
See Projects for more details.
type ProjectAddArgs ¶
type ProjectAddArgs struct {
// Required.
// The name of the project (a string value).
Name string `json:"name"`
// Optional.
// The color of the project icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color *Color `json:"color,omitempty"`
// Optional.
// The ID of the parent project. Set to null for root projects.
ParentID *string `json:"parent_id,omitempty"`
// Optional.
// The ID of the folder, when creating projects in workspaces. Set to null for
// root projects.
FolderID *string `json:"folder_id,omitempty"`
// Optional.
// The order of the project. Defines the position of the project among all the
// projects with the same parent_id.
ChildOrder *int `json:"child_order,omitempty"`
// Optional.
// Whether the project is a favorite (a true or false value).
IsFavorite *bool `json:"is_favorite,omitempty"`
// Optional.
// The mode in which to render tasks in this project. One of list, board, or
// calendar.
ViewStyle *string `json:"view_style,omitempty"`
// Optional.
// Description for the project (up to 1024 characters). Only used for teams.
Description *string `json:"description,omitempty"`
// Optional.
// Real or temp ID of the workspace the project. Only used for teams.
WorkspaceID *string `json:"workspace_id,omitempty"`
// Optional.
// Indicates if the project is invite-only or if it should be visible for
// everyone in the workspace. If missing or null, the default value from the
// workspace is_invite_only_default will be used. Only used for teams.
IsInviteOnly *bool `json:"is_invite_only,omitempty"`
// Optional.
// The status of the project. Possible values: PLANNED, IN_PROGRESS, PAUSED,
// COMPLETED, CANCELED. Only used for teams.
Status *string `json:"status,omitempty"`
// Optional.
// If False, the project is invite-only and people can't join by link. If
// true, the project is visible to anyone with a link, and anyone can join it.
// Only used for teams.
IsLinkSharingEnabled *bool `json:"is_link_sharing_enabled,omitempty"`
// Optional.
// The role a user can have. Possible values: CREATOR, ADMIN, READ_WRITE,
// READ_AND_COMMENT, READ_ONLY. (CREATOR is equivalent to admin and is
// automatically set at project creation; it can’t be set to anyone later).
// Only used for teams.
CollaboratorRoleDefault *string `json:"collaborator_role_default,omitempty"`
}
type ProjectArchiveArgs ¶
type ProjectArchiveArgs struct {
// Required.
// ID of the project to archive (could be a temp id).
ID string `json:"id"`
}
type ProjectDeleteArgs ¶
type ProjectDeleteArgs struct {
// Required.
// ID of the project to delete (could be a temp id).
ID string `json:"id"`
}
type ProjectLeaveArgs ¶
type ProjectLeaveArgs struct {
// Required.
// The ID (v2_id) of the project to leave. It only accepts v2_id as the id.
ProjectID string `json:"project_id"`
}
type ProjectMoveArgs ¶
type ProjectMoveToPersonalArgs ¶
type ProjectMoveToPersonalArgs struct {
// Required.
// The ID of the project being moved back (can be a temp id).
ProjectID string `json:"project_id"`
}
type ProjectMoveToWorkspaceArgs ¶
type ProjectMoveToWorkspaceArgs struct {
// Required.
// The ID of the project (can be a temp id).
ProjectID string `json:"project_id"`
// Required.
// The ID of the workspace the project will be moved into.
WorkspaceID string `json:"workspace_id"`
// Optional.
// If true the project will be restricted access, otherwise any workspace
// member could join it.
IsInviteOnly *bool `json:"is_invite_only,omitempty"`
// Optional.
// If supplied, the project and any child projects will be moved into this
// workspace folder
FolderID *string `json:"folder_id,omitempty"`
}
type ProjectReorderArgs ¶
type ProjectReorderArgs struct {
// Required.
// An array of objects to update.
Items []ProjectReorderItem `json:"projects"`
}
type ProjectReorderItem ¶ added in v0.2.1
type ProjectUnarchiveArgs ¶
type ProjectUnarchiveArgs struct {
// Required.
// ID of the project to unarchive (could be a temp id).
ID string `json:"id"`
}
type ProjectUpdateArgs ¶
type ProjectUpdateArgs struct {
// Required.
// The ID of the project (could be temp id).
ID string `json:"id"`
// Optional.
// The name of the project (a string value).
Name *string `json:"name,omitempty"`
// Optional.
// The color of the project icon. Refer to the name column in the
// https://todoist.com/api/v1/docs#tag/Colors guide for more info.
Color *Color `json:"color,omitempty"`
// Optional.
// Whether the project's sub-projects are collapsed (a true or false value).
Collapsed *bool `json:"collapsed,omitempty"`
// Optional.
// Whether the project is a favorite (a true or false value).
IsFavorite *bool `json:"is_favorite,omitempty"`
// Optional.
// The mode in which to render tasks in this project. One of list, board, or
// calendar.
ViewStyle *string `json:"view_style,omitempty"`
// Optional.
// Description for the project (up to 1024 characters). Only used for teams.
Description *string `json:"description,omitempty"`
// Optional.
// The status of the project. Possible values: PLANNED, IN_PROGRESS, PAUSED,
// COMPLETED, CANCELED. Only used for teams.
Status *string `json:"status,omitempty"`
// Optional.
// If False, the project is invite-only and people can't join by link. If
// true, the project is visible to anyone with a link, and anyone can join it.
// Only used for teams.
IsLinkSharingEnabled *bool `json:"is_link_sharing_enabled,omitempty"`
// Optional.
// The role a user can have. Possible values: CREATOR, ADMIN, READ_WRITE,
// READ_AND_COMMENT, READ_ONLY. (CREATOR is equivalent to admin and is
// automatically set at project creation; it can’t be set to anyone later).
// Defaults to READ_WRITE. Only used for teams.
CollaboratorRoleDefault *string `json:"collaborator_role_default,omitempty"`
}
type Reminder ¶
type Reminder struct {
// The ID of the reminder.
ID string `json:"id"`
// The user ID which should be notified of the reminder, typically the current
// user ID creating the reminder.
NotifyUID string `json:"notify_uid"`
// The item ID for which the reminder is about.
ItemID string `json:"item_id"`
// The type of the reminder:
//
// - relative: a time-based reminder specified in minutes from now.
// - absolute: a time-based reminder with a specific time and date in the future.
// - location: a location-based reminder.
ReminderType ReminderType `json:"type"`
// The due date of the reminder. See the
// https://todoist.com/api/v1/docs#tag/Due-dates section for more details.
// Note that reminders only support due dates with time, since full-day
// reminders don't make sense.
Due Due `json:"due"`
// The relative time in minutes before the due date of the item, in which the
// reminder should be triggered. Note that the item should have a due date
// with time set in order to add a relative reminder.
MinuteOffset int `json:"minute_offset"`
// An alias name for the location.
Name *string `json:"name"`
// The location latitude.
LocLat *string `json:"loc_lat"`
// The location longitude.
LocLong *string `json:"loc_long"`
// What should trigger the reminder:
//
// - on_enter: entering the location.
// - on_leave: leaving the location.
LocTrigger *string `json:"loc_trigger"`
// The radius around the location that is still considered as part of the
// location (in meters).
Radius *int `json:"radius"`
// Whether the reminder is marked as deleted.
IsDeleted bool `json:"is_deleted"`
}
Reminder represents a reminder in Todoist.
See Reminders for more details.
type ReminderAddArgs ¶
type ReminderAddArgs struct {
// Required.
// The item ID for which the reminder is about.
ItemID string `json:"item_id"`
// Required.
// The type of the reminder:
//
// - relative: a time-based reminder specified in minutes from now.
// - absolute: a time-based reminder with a specific time and date in the future.
// - location: a location-based reminder.
ReminderType ReminderType `json:"type"`
// Optional.
// The user ID which should be notified of the reminder, typically the current
// user ID creating the reminder.
NotifyUID *string `json:"notify_uid,omitempty"`
// Optional.
// The due date of the reminder. See the
// https://todoist.com/api/v1/docs#tag/Due-dates section for more details.
// Note that reminders only support due dates with time, since full-day
// reminders don't make sense.
Due *Due `json:"due,omitempty"`
// Optional.
// The relative time in minutes before the due date of the item, in which the
// reminder should be triggered. Note that the item should have a due date
// with time set in order to add a relative reminder.
MinuteOffset *int `json:"minute_offset,omitempty"`
// Optional.
// An alias name for the location.
Name *string `json:"name,omitempty"`
// Optional.
// The location latitude.
LocLat *string `json:"loc_lat,omitempty"`
// Optional.
// The location longitude.
LocLong *string `json:"loc_long,omitempty"`
// Optional.
// What should trigger the reminder:
//
// - on_enter: entering the location.
// - on_leave: leaving the location.
LocTrigger *string `json:"loc_trigger,omitempty"`
// Optional.
// The radius around the location that is still considered as part of the
// location (in meters).
Radius *int `json:"radius,omitempty"`
}
type ReminderDeleteArgs ¶
type ReminderDeleteArgs struct {
// Required.
// The ID of the reminder.
ID string `json:"id"`
}
type ReminderType ¶
type ReminderType string
ReminderType represents the type of the reminder.
const ( // A location-based reminder. RelativeReminder ReminderType = "relative" // A time-based reminder with a specific time and date in the future. AbsoluteReminder ReminderType = "absolute" // A time-based reminder specified in minutes from now. LocationReminder ReminderType = "location" )
type ReminderUpdateArgs ¶
type ReminderUpdateArgs struct {
// Required.
// The ID of the reminder.
ID string `json:"id"`
// Optional.
// The user ID which should be notified of the reminder, typically the current
// user ID creating the reminder.
NotifyUID *string `json:"notify_uid,omitempty"`
// Required.
// The type of the reminder:
//
// - relative: a time-based reminder specified in minutes from now.
// - absolute: a time-based reminder with a specific time and date in the future.
// - location: a location-based reminder.
ReminderType *ReminderType `json:"type,omitempty"`
// Optional.
// The due date of the reminder. See the
// https://todoist.com/api/v1/docs#tag/Due-dates section for more details.
// Note that reminders only support due dates with time, since full-day
// reminders don't make sense.
Due *Due `json:"due,omitempty"`
// Optional.
// The relative time in minutes before the due date of the item, in which the
// reminder should be triggered. Note that the item should have a due date
// with time set in order to add a relative reminder.
MinuteOffset *int `json:"minute_offset,omitempty"`
// Optional.
// An alias name for the location.
Name *string `json:"name,omitempty"`
// Optional.
// The location latitude.
LocLat *string `json:"loc_lat,omitempty"`
// Optional.
// The location longitude.
LocLong *string `json:"loc_long,omitempty"`
// Optional.
// What should trigger the reminder:
//
// - on_enter: entering the location.
// - on_leave: leaving the location.
LocTrigger *string `json:"loc_trigger,omitempty"`
// Optional.
// The radius around the location that is still considered as part of the
// location (in meters).
Radius *int `json:"radius,omitempty"`
}
type ResourceType ¶
type ResourceType string
ResourceType represents a type of resource that can be fetched from the server.
const ( UserData ResourceType = "user" Projects ResourceType = "projects" Tasks ResourceType = "items" TaskComments ResourceType = "notes" ProjectComments ResourceType = "project_notes" Sections ResourceType = "sections" Labels ResourceType = "labels" Filters ResourceType = "filters" Reminders ResourceType = "reminders" RemindersLocation ResourceType = "reminders_location" Locations ResourceType = "locations" Collaborators ResourceType = "collaborators" CollaboratorStates ResourceType = "collaborator_states" LiveNotifications ResourceType = "live_notifications" UserSettings ResourceType = "user_settings" NotificationSettings ResourceType = "notification_settings" UserPlanLimits ResourceType = "user_plan_limits" Workspaces ResourceType = "workspaces" WorkspaceUsers ResourceType = "workspace_users" CompletedInfo ResourceType = "completed_info" Stats ResourceType = "stats" All ResourceType = "all" NoUserData ResourceType = "-user" NoProjects ResourceType = "-projects" NoTasks ResourceType = "-items" NoTaskComments ResourceType = "-notes" NoProjectComments ResourceType = "-project_notes" NoSections ResourceType = "-sections" NoLabels ResourceType = "-labels" NoFilters ResourceType = "-filters" NoReminders ResourceType = "-reminders" NoRemindersLocation ResourceType = "-reminders_location" NoLocations ResourceType = "-locations" NoCollaborators ResourceType = "-collaborators" NoCollaboratorStates ResourceType = "-collaborator_states" NoLiveNotifications ResourceType = "-live_notifications" NoUserSettings ResourceType = "-user_settings" NoNotificationSettings ResourceType = "-notification_settings" NoUserPlanLimits ResourceType = "-user_plan_limits" NoWorkspaces ResourceType = "-workspaces" NoWorkspaceUsers ResourceType = "-workspace_users" NoCompletedInfo ResourceType = "-completed_info" NoStats ResourceType = "-stats" )
type ResourceTypes ¶
type ResourceTypes []ResourceType
ResourceTypes represents resources that can be fetched from the server.
type Section ¶
type Section struct {
// The ID of the section.
ID string `json:"id"`
// The name of the section.
Name string `json:"name"`
// Project that the section resides in.
ProjectID string `json:"project_id"`
// The order of the section. Defines the position of the section among all the
// sections in the project.
SectionOrder int `json:"section_order"`
// Whether the section's tasks are collapsed.
IsCollapsed bool `json:"is_collapsed"`
// A special ID for shared sections (a number or null if not set). Used
// internally and can be ignored.
SyncID *string `json:"sync_id"`
// Whether the section is marked as deleted (a true or false value).
IsDeleted bool `json:"is_deleted"`
// Whether the section is marked as archived (a true or false value).
IsArchived bool `json:"is_archived"`
// The date when the section was archived (or null if not archived).
ArchivedAt *time.Time `json:"archived_at"`
// The date when the section was created.
AddedAt time.Time `json:"added_at"`
// The date when the section was updated.
UpdatedAt time.Time `json:"updated_at"`
}
Section represents a section in Todoist.
See Sections for more details.
type SectionAddArgs ¶
type SectionAddArgs struct {
// Required.
// The name of the section.
Name string `json:"name"`
// Required.
// The ID of the parent project.
ProjectID string `json:"project_id"`
// Optional.
// The order of the section. Defines the position of the section among all the
// sections in the project.
SectionOrder *int `json:"section_order,omitempty"`
}
type SectionArchiveArgs ¶
type SectionArchiveArgs struct {
// Required.
// Section ID to archive.
ID string `json:"id"`
}
type SectionDeleteArgs ¶
type SectionDeleteArgs struct {
// Required.
// The ID of the section.
ID string `json:"id"`
}
type SectionMoveArgs ¶
type SectionReorderArgs ¶
type SectionReorderArgs struct {
// Required.
// An array of objects to update.
Items []SectionReorderItem `json:"sections"`
}
type SectionReorderItem ¶ added in v0.2.1
type SectionUnarchiveArgs ¶
type SectionUnarchiveArgs struct {
// Required.
// Section ID to unarchive
ID string `json:"id"`
}
type SectionUpdateArgs ¶
type SectionUpdateArgs struct {
// Required.
// The ID of the section.
ID string `json:"id"`
// Optional.
// The name of the section.
Name *string `json:"name,omitempty"`
// Optional.
// Whether the section's tasks are collapsed (a true or false value).
IsCollapsed *bool `json:"is_collapsed,omitempty"`
}
type SyncErr ¶
type SyncRequest ¶
type SyncRequest struct {
// A special string, used to allow the client to perform incremental sync.
// Pass * to retrieve all active resource data. More details about this below.
SyncToken *string `json:"sync_token,omitempty"`
// Used to specify what resources to fetch from the server. It should be a
// JSON-encoded array of strings. Here is a list of available resource types:
// labels, projects, items, notes, sections, filters, reminders,
// reminders_location, locations, user, live_notifications, collaborators,
// user_settings, notification_settings, user_plan_limits, completed_info,
// stats, workspaces, workspace_users. You may use all to include all the
// resource types. Resources can also be excluded by prefixing a - prior to
// the name, for example, -projects
ResourceTypes *ResourceTypes `json:"resource_types,omitempty"`
// A JSON array of Command objects. Each command will be processed in the
// specified order.
Commands Commands `json:"commands,omitempty"`
}
type SyncResponse ¶
type SyncResponse struct {
// A new synchronization token. Used by the client in the next sync request to
// perform an incremental sync.
SyncToken string `json:"sync_token"`
// Whether the response contains all data (a full synchronization) or just the
// incremental updates since the last sync.
FullSync bool `json:"full_sync"`
// A dictionary object containing result of each command execution. The key
// will be the command's uuid field and the value will be the result status of
// the command execution.
SyncStatus map[uuid.UUID]error `json:"sync_status"`
// A dictionary object that maps temporary resource IDs to real resource IDs.
TempIDMapping map[uuid.UUID]string `json:"temp_id_mapping"`
// A user object.
User *User `json:"user,omitempty"`
// An array of project objects.
Projects []*Project `json:"projects,omitempty"`
// An array of task objects.
Tasks []*Task `json:"items,omitempty"`
// An array of task comments objects.
TaskComments []any `json:"notes,omitempty"`
// An array of project comments objects.
ProjectComments []any `json:"project_notes,omitempty"`
// An array of section objects.
Sections []*Section `json:"sections,omitempty"`
// An array of personal label objects.
Labels []*Label `json:"labels,omitempty"`
// An array of filter objects.
Filters []*Filter `json:"filters,omitempty"`
// A JSON object specifying the order of items in daily agenda.
DayOrders map[string]int `json:"day_orders,omitempty"`
// An array of reminder objects.
Reminders []*Reminder `json:"reminders,omitempty"`
// An array of location objects.
Locations []*Location `json:"locations,omitempty"`
// A JSON object containing all collaborators for all shared projects. The
// projects field contains the list of all shared projects, where the user
// acts as one of collaborators.
Collaborators []any `json:"collaborators,omitempty"`
// An array specifying the state of each collaborator in each project. The
// state can be invited, active, inactive, deleted.
CollaboratorStates []any `json:"collaborator_states,omitempty"`
// An array of live_notification objects.
LiveNotifications []any `json:"live_notifications,omitempty"`
// What is the last live notification the user has seen? This is used to
// implement unread notifications.
LiveNotificationsLastReadID string `json:"live_notifications_last_read_id"`
// A JSON object containing user settings.
UserSettings map[string]any `json:"user_settings,omitempty"`
// A JSON object containing user plan limits.
UserPlanLimits map[string]any `json:"user_plan_limits,omitempty"`
// A JSON object containing workspace objects.
Workspaces []any `json:"workspaces,omitempty"`
// A JSON object containing workspace_user objects. Only in incremental sync.
WorkspaceUsers []any `json:"workspace_users,omitempty"`
}
func (*SyncResponse) UnmarshalJSON ¶
func (r *SyncResponse) UnmarshalJSON(data []byte) error
type Task ¶
type Task struct {
// The ID of the task.
ID string `json:"id"`
// The owner of the task.
UserID string `json:"user_id"`
// The ID of the parent project.
ProjectID string `json:"project_id"`
// The text of the task. This value may contain markdown-formatted text and
// hyperlinks. Details on markdown support can be found in the
// https://www.todoist.com/help/articles/format-text-in-a-todoist-task-e5dHw9
// 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
// https://www.todoist.com/help/articles/format-text-in-a-todoist-task-e5dHw9
// in the Help Center.
Description string `json:"description"`
// The due date of the task. See the
// https://todoist.com/api/v1/docs#tag/Due-dates section for more details.
Due *Due `json:"due"`
// The deadline of the task. See the
// https://todoist.com/api/v1/docs#tag/Deadlines section for more details.
Deadline *Deadline `json:"deadline"`
// The priority of the task (a number between 1 and 4, 4 for very urgent and
// 1 for natural).
Priority int `json:"priority"`
// The ID of the parent task. Set to null for root tasks.
ParentID *string `json:"parent_id"`
// The order of the task. Defines the position of the task among all the tasks
// with the same parent.
ChildOrder int `json:"child_order"`
// The ID of the parent section. Set to null for tasks not belonging to a
// section.
SectionID *string `json:"section_id"`
// The order of the task inside the Today or Next 7 days view. (a number,
// where the smallest value would place the task at the top).
DayOrder int `json:"day_order"`
// Whether the task's sub-tasks are collapsed (a true or false value).
Collapsed bool `json:"collapsed"`
// The task's labels (a list of names that may represent either personal or
// shared labels).
Labels []string `json:"labels"`
// The ID of the user who created the task. This makes sense for shared
// projects only. For tasks created before 31 Oct 2019 the value is set to
// null. Cannot be set explicitly or changed via API.
AddedByUID *string `json:"added_by_uid"`
// The ID of the user who assigned the task. This makes sense for shared
// projects only. Accepts any user ID from the list of project collaborators.
// If this value is unset or invalid, it will automatically be set up to your
// uid.
AssignedByUID *string `json:"assigned_by_uid"`
// The ID of user who is responsible for accomplishing the current task. This
// makes sense for shared projects only. Accepts any user ID from the list of
// project collaborators or null or an empty string to unset.
ResponsibleUID *string `json:"responsible_uid"`
// Whether the task is marked as completed (a true or false value).
Checked bool `json:"checked"`
// Whether the task is marked as deleted (a true or false value).
IsDeleted bool `json:"is_deleted"`
// The datetime when the task was created.
AddedAt time.Time `json:"added_at"`
// The datetime when the task was updated.
UpdatedAt time.Time `json:"updated_at"`
// The date when the task was completed.
CompletedAt *string `json:"completed_at"`
// The task's duration. Includes a positive integer (greater than zero) for
// the amount of time the task will take, and the unit of time that the amount
// represents which must be either minute or day. Both the amount and unit
// must be defined.
Duration *Duration `json:"duration"`
}
Task represents a task in Todoist.
See Tasks for more details.
type TaskAddArgs ¶
type TaskAddArgs struct {
// Required.
// The text of the task. This value may contain markdown-formatted text and
// hyperlinks. Details on markdown support can be found in the
// https://www.todoist.com/help/articles/format-text-in-a-todoist-task-e5dHw9
// in the Help Center.
Content string `json:"content"`
// Optional.
// A description for the task. This value may contain markdown-formatted text
// and hyperlinks. Details on markdown support can be found in the
// https://www.todoist.com/help/articles/format-text-in-a-todoist-task-e5dHw9
// in the Help Center.
Description *string `json:"description,omitempty"`
// Optional.
// The ID of the project to add the task to (a number or a temp id). By
// default the task is added to the user’s Inbox project.
ProjectID *string `json:"project_id,omitempty"`
// Optional.
// The due date of the task. See the
// https://todoist.com/api/v1/docs#tag/Due-dates section for more details.
Due *Due `json:"due,omitempty"`
// Optional.
// The deadline of the task. See the
// https://todoist.com/api/v1/docs#tag/Deadlines section for more details.
Deadline *Deadline `json:"deadline,omitempty"`
// Optional.
// The priority of the task (a number between 1 and 4, 4 for very urgent and
// 1 for natural).
Priority *int `json:"priority,omitempty"`
// Optional.
// The ID of the parent task. Set to null for root tasks.
ParentID *string `json:"parent_id,omitempty"`
// Optional.
// The order of the task. Defines the position of the task among all the tasks
// with the same parent.
ChildOrder *int `json:"child_order,omitempty"`
// Optional.
// The ID of the parent section. Set to null for tasks not belonging to a
// section.
SectionID *string `json:"section_id,omitempty"`
// Optional.
// The order of the task inside the Today or Next 7 days view. (a number,
// where the smallest value would place the task at the top).
DayOrder *int `json:"day_order,omitempty"`
// Optional.
// Whether the task's sub-tasks are collapsed (a true or false value).
Collapsed *bool `json:"collapsed,omitempty"`
// Optional.
// The task's labels (a list of names that may represent either personal or
// shared labels).
Labels []string `json:"labels,omitempty"`
// Optional.
// The ID of the user who assigned the task. This makes sense for shared
// projects only. Accepts any user ID from the list of project collaborators.
// If this value is unset or invalid, it will automatically be set up to your
// uid.
AssignedByUID *string `json:"assigned_by_uid,omitempty"`
// Optional.
// The ID of user who is responsible for accomplishing the current task. This
// makes sense for shared projects only. Accepts any user ID from the list of
// project collaborators or null or an empty string to unset.
ResponsibleUID *string `json:"responsible_uid,omitempty"`
// Optional.
// When this option is enabled, the default reminder will be added to the new
// item if it has a due date with time set. See also the
// https://todoist.com/api/v1/docs#tag/Sync/User for more info about the
// default reminder.
AutoReminder *bool `json:"auto_reminder,omitempty"`
// Optional.
// When this option is enabled, the labels will be parsed from the task
// content and added to the task. In case the label doesn't exist, a new one
// will be created.
AutoParseLabels *bool `json:"auto_parse_labels,omitempty"`
// Optional.
// The task's duration. Includes a positive integer (greater than zero) for
// the amount of time the task will take, and the unit of time that the amount
// represents which must be either minute or day. Both the amount and unit
// must be defined.
Duration *Duration `json:"duration,omitempty"`
}
type TaskCloseArgs ¶
type TaskCloseArgs struct {
// Required.
// The ID of the item to close (a number or a temp id).
ID string `json:"id"`
}
type TaskCompleteArgs ¶
type TaskCompleteRecurringArgs ¶
type TaskCompleteRecurringArgs struct {
// Required.
// The ID of the item to update (a number or a temp id).
ID string `json:"id"` // required
// Optional.
// The due date of the task. See the
// https://todoist.com/api/v1/docs#tag/Due-dates section for more details.
Due *Due `json:"due,omitempty"`
// Optional.
// Whether the task is completed or not. Defaults to true.
IsForward *bool `json:"is_forward,omitempty"`
// Optional.
// Whether the subtasks are reset or not. Defaults to false.
ResetSubtasks *bool `json:"reset_subtasks,omitempty"`
}
type TaskDeleteArgs ¶
type TaskDeleteArgs struct {
// Required.
// ID of the task to delete.
ID string `json:"id"`
}
type TaskMoveArgs ¶
type TaskMoveArgs struct {
// Required.
// The ID of the task.
ID string `json:"id"`
// Optional.
// ID of the destination parent task. The task becomes the last child task of
// the parent task.
ParentID *string `json:"parent_id,omitempty"`
// Optional.
// ID of the destination section. The task becomes the last root task of the
// section.
SectionID *string `json:"section_id,omitempty"`
// Optional.
// ID of the destination project. The task becomes the last root task of the
// project.
ProjectID *string `json:"project_id,omitempty"`
}
type TaskReorderArgs ¶
type TaskReorderArgs struct {
// Required.
// An array of objects to update.
Items []TaskReorderItem `json:"items"`
}
type TaskReorderItem ¶ added in v0.2.1
type TaskUncompleteArgs ¶
type TaskUncompleteArgs struct {
// Required.
// Task ID to uncomplete
ID string `json:"id"`
}
type TaskUpdateArgs ¶
type TaskUpdateArgs struct {
// Required.
// The ID of the task.
ID string `json:"id"`
// Optional.
// A description for the task. This value may contain markdown-formatted text
// and hyperlinks. Details on markdown support can be found in the
// https://www.todoist.com/help/articles/format-text-in-a-todoist-task-e5dHw9
// in the Help Center.
Content *string `json:"content,omitempty"`
// Optional.
// A description for the task. This value may contain markdown-formatted text
// and hyperlinks. Details on markdown support can be found in the
// https://www.todoist.com/help/articles/format-text-in-a-todoist-task-e5dHw9
// in the Help Center.
Description *string `json:"description,omitempty"`
// Optional.
// The due date of the task. See the
// https://todoist.com/api/v1/docs#tag/Due-dates section for more details.
Due *Due `json:"due,omitempty"`
// Optional.
// The deadline of the task. See the
// https://todoist.com/api/v1/docs#tag/Deadlines section for more details.
Deadline *Deadline `json:"deadline,omitempty"`
// Optional.
// The priority of the task (a number between 1 and 4, 4 for very urgent and
// 1 for natural).
Priority *int `json:"priority,omitempty"`
// Optional.
// Whether the task's sub-tasks are collapsed (a true or false value).
Collapsed *bool `json:"collapsed,omitempty"`
// Optional.
// The task's labels (a list of names that may represent either personal or
// shared labels).
Labels []string `json:"labels,omitempty"`
// Optional.
// The ID of the user who assigned the task. This makes sense for shared
// projects only. Accepts any user ID from the list of project collaborators.
// If this value is unset or invalid, it will automatically be set up to your
// uid.
AssignedByUID *string `json:"assigned_by_uid,omitempty"`
// Optional.
// The ID of user who is responsible for accomplishing the current task. This
// makes sense for shared projects only. Accepts any user ID from the list of
// project collaborators or null or an empty string to unset.
ResponsibleUID *string `json:"responsible_uid,omitempty"`
// Optional.
// The order of the task inside the Today or Next 7 days view. (a number,
// where the smallest value would place the task at the top).
DayOrder *int `json:"day_order,omitempty"`
// Optional.
// The task's duration. Includes a positive integer (greater than zero) for
// the amount of time the task will take, and the unit of time that the amount
// represents which must be either minute or day. Both the amount and unit
// must be defined.
Duration *Duration `json:"duration,omitempty"`
}
type TaskUpdateDayOrdersArgs ¶
type User ¶
type User struct {
// The user's ID.
ID string `json:"id"`
// The user's email.
Email string `json:"email"`
// The user's real name formatted as Firstname Lastname.
FullName string `json:"full_name"`
// The user's language, which can take one of the following values:
// da, de, en, es, fi, fr, it, ja, ko, nl, pl, pt_BR, ru, sv, tr, zh_CN,
// zh_TW.
Lang string `json:"lang"`
// The websocket URL for the user.
WebsocketURL string `json:"websocket_url"`
// Whether the user is marked as deleted (a true or false value).
IsDeleted bool `json:"is_deleted"`
}
User represents a Todoist user.
Source Files
¶
- color.go
- command.go
- deadline.go
- due.go
- duration.go
- filter.go
- filter_add.go
- filter_delete.go
- filter_reorder.go
- filter_update.go
- label.go
- label_add.go
- label_delete.go
- label_reorder.go
- label_update.go
- location.go
- location_clear.go
- project.go
- project_add.go
- project_archive.go
- project_delete.go
- project_leave.go
- project_move.go
- project_reorder.go
- project_unarchive.go
- project_update.go
- reminder.go
- reminder_add.go
- reminder_delete.go
- reminder_update.go
- resource_type.go
- section.go
- section_add.go
- section_archive.go
- section_delete.go
- section_move.go
- section_reorder.go
- section_unarchive.go
- section_update.go
- sync.go
- task.go
- task_add.go
- task_close.go
- task_complete.go
- task_delete.go
- task_move.go
- task_reorder.go
- task_uncomplete.go
- task_update.go
- task_update_day_orders.go
- user.go