Documentation
¶
Index ¶
- Constants
- Variables
- type Comment
- type Config
- type Deadline
- type Due
- type Duration
- type Manager
- type PRIORITY_LEVEL
- type Project
- type ProjectManager
- type SyncResponse
- type Task
- func (t *Task) AddLabel(label string)
- func (t *Task) Close() error
- func (t *Task) DeleteContext() error
- func (t *Task) DeleteContextField(key string) error
- func (t *Task) GetChildren() []*Task
- func (t *Task) GetComments() ([]Comment, error)
- func (t *Task) GetContext() (map[string]interface{}, error)
- func (t *Task) RemoveLabel(label string) error
- func (t *Task) Reopen() error
- func (t *Task) SetContext(contextData map[string]interface{}) error
- func (t *Task) String() string
- func (t *Task) UnmarshalJSON(data []byte) error
- func (t *Task) Update(key string, value interface{}) error
- func (t *Task) UpdateContext(updates map[string]interface{}) error
- type TaskManager
- func (t *TaskManager) AddTask(task Task) error
- func (t *TaskManager) All() []*Task
- func (t *TaskManager) Create(content string) (*Task, error)
- func (t *TaskManager) Get(id string) *Task
- func (t *TaskManager) GetByName(name string) []*Task
- func (t *TaskManager) Len() int
- func (t *TaskManager) String() string
- func (t *TaskManager) Update(tasks []Task)
- func (t *TaskManager) UpdateTask(task Task)
- type Todoist
- type TodoistAPI
- func (t *TodoistAPI) CloseTask(id string) error
- func (api *TodoistAPI) CreateComment(taskID, content string) (*Comment, error)
- func (t *TodoistAPI) CreateProject(fields map[string]interface{}) (*Project, error)
- func (t *TodoistAPI) CreateTask(fields map[string]interface{}) (*Task, error)
- func (api *TodoistAPI) DeleteComment(commentID string) error
- func (t *TodoistAPI) DeleteTask(id string) error
- func (api *TodoistAPI) GetComments(taskID string) ([]Comment, error)
- func (t *TodoistAPI) GetProjects() ([]Project, error)
- func (t *TodoistAPI) GetTasks() ([]Task, error)
- func (t *TodoistAPI) MoveTask(taskID, projectID, parentID string) error
- func (t *TodoistAPI) ReopenTask(id string) error
- func (t *TodoistAPI) SyncResources(resourceTypes []string) (*SyncResponse, error)
- func (api *TodoistAPI) UpdateComment(commentID, content string) error
- func (t *TodoistAPI) UpdateProject(id string, fields map[string]interface{}) error
- func (t *TodoistAPI) UpdateTask(id string, fields map[string]interface{}) error
Constants ¶
const ContextPrefix = "[CONTEXT]"
Variables ¶
var (
APIURL = "https://api.todoist.com/api/v1"
)
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.0.1
type Config struct {
Token string `koanf:"token"`
ApiURL string `koanf:"api_url"`
Timeout int `koanf:"timeout"`
Debug bool `koanf:"debug"`
UseSyncAPI bool `koanf:"use_sync_api"`
}
func BuildConfig ¶ added in v0.0.1
type Deadline ¶
type Deadline struct {
Date string `json:"date"`
Lang string `json:"lang"`
ParsedDate time.Time `json:"-"`
}
func (*Deadline) UnmarshalJSON ¶
type Due ¶
type Due struct {
Date string `json:"date"`
Lang string `json:"lang"`
String string `json:"string"`
Timezone string `json:"timezone"`
IsRecurring bool `json:"is_recurring"`
ParsedDate time.Time `json:"-"`
}
func (*Due) UnmarshalJSON ¶
type Manager ¶
type Manager struct {
Tasks *TaskManager
Projects *ProjectManager
}
type PRIORITY_LEVEL ¶
type PRIORITY_LEVEL int
const ( HIGH PRIORITY_LEVEL = 4 MEDIUM PRIORITY_LEVEL = 3 LOW PRIORITY_LEVEL = 2 VERY_LOW PRIORITY_LEVEL = 1 )
func (PRIORITY_LEVEL) String ¶
func (p PRIORITY_LEVEL) String() string
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Color string `json:"color"`
ParentID string `json:"parent_id"`
ChildOrder int `json:"child_order"`
InboxProject bool `json:"inbox_project"`
IsFavorite bool `json:"is_favorite"`
IsArchived bool `json:"is_archived"`
IsCollapsed bool `json:"is_collapsed"`
ViewStyle string `json:"view_style"`
DefaultOrder int `json:"default_order"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
URL string `json:"url"`
Manager *ProjectManager `json:"-"`
}
func (*Project) GetChildren ¶
type ProjectManager ¶
type ProjectManager struct {
Manager *Manager
// contains filtered or unexported fields
}
func NewProjectManager ¶
func NewProjectManager(api *TodoistAPI) *ProjectManager
func (*ProjectManager) AddProject ¶
func (p *ProjectManager) AddProject(project Project)
func (*ProjectManager) All ¶
func (p *ProjectManager) All() []*Project
func (*ProjectManager) Get ¶
func (p *ProjectManager) Get(id string) *Project
func (*ProjectManager) GetByName ¶
func (p *ProjectManager) GetByName(name string) []*Project
func (*ProjectManager) Update ¶
func (p *ProjectManager) Update(projects []Project)
type SyncResponse ¶ added in v0.3.3
type Task ¶
type Task struct {
ID string `json:"id"`
Content string `json:"content"`
Description string `json:"description"`
ProjectID string `json:"project_id"`
SectionID string `json:"section_id"`
ChildOrder int `json:"child_order"`
Priority PRIORITY_LEVEL `json:"priority"`
Deadline *Deadline `json:"deadline"`
Due *Due `json:"due"`
Duration *Duration `json:"duration"`
ParentID string `json:"parent_id"`
Labels []string `json:"labels"`
Checked bool `json:"checked"`
AddedAt string `json:"added_at"`
UpdatedAt string `json:"updated_at"`
CompletedAt string `json:"completed_at"`
NoteCount int `json:"note_count"`
DayOrder int `json:"day_order"`
IsCollapsed bool `json:"is_collapsed"`
URL string `json:"url"`
// contains filtered or unexported fields
}
func (*Task) DeleteContext ¶ added in v0.3.3
DeleteContext removes the context comment entirely
func (*Task) DeleteContextField ¶ added in v0.3.3
DeleteContextField removes a specific field from the context
func (*Task) GetChildren ¶
func (*Task) GetComments ¶ added in v0.3.3
GetComments retrieves all comments for a task
func (*Task) GetContext ¶ added in v0.3.3
GetContext retrieves the context data for a task
func (*Task) RemoveLabel ¶
func (*Task) SetContext ¶ added in v0.3.3
SetContext sets or updates the context data for a task
func (*Task) UnmarshalJSON ¶
func (*Task) UpdateContext ¶ added in v0.3.3
UpdateContext updates specific fields in the context without replacing everything
type TaskManager ¶
type TaskManager struct {
Manager *Manager
// contains filtered or unexported fields
}
func NewTaskManager ¶
func NewTaskManager(api *TodoistAPI) *TaskManager
func (*TaskManager) AddTask ¶
func (t *TaskManager) AddTask(task Task) error
func (*TaskManager) All ¶
func (t *TaskManager) All() []*Task
func (*TaskManager) Get ¶
func (t *TaskManager) Get(id string) *Task
func (*TaskManager) GetByName ¶
func (t *TaskManager) GetByName(name string) []*Task
func (*TaskManager) Len ¶
func (t *TaskManager) Len() int
func (*TaskManager) String ¶
func (t *TaskManager) String() string
func (*TaskManager) Update ¶
func (t *TaskManager) Update(tasks []Task)
func (*TaskManager) UpdateTask ¶
func (t *TaskManager) UpdateTask(task Task)
type Todoist ¶
type Todoist struct {
Token string
API *TodoistAPI
Tasks TaskManager
Projects ProjectManager
UseSyncAPI bool
// contains filtered or unexported fields
}
func NewTodoistWithConfig ¶ added in v0.3.3
NewTodoistWithConfig creates a new Todoist client with configuration
type TodoistAPI ¶
type TodoistAPI struct {
Token string
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(token string) *TodoistAPI
NewDispatcher creates a new Todoist API client
func (*TodoistAPI) CloseTask ¶ added in v0.2.0
func (t *TodoistAPI) CloseTask(id string) error
func (*TodoistAPI) CreateComment ¶ added in v0.3.3
func (api *TodoistAPI) CreateComment(taskID, content string) (*Comment, error)
CreateComment creates a comment for a task
func (*TodoistAPI) CreateProject ¶ added in v0.2.0
func (t *TodoistAPI) CreateProject(fields map[string]interface{}) (*Project, error)
func (*TodoistAPI) CreateTask ¶ added in v0.2.0
func (t *TodoistAPI) CreateTask(fields map[string]interface{}) (*Task, error)
func (*TodoistAPI) DeleteComment ¶ added in v0.3.3
func (api *TodoistAPI) DeleteComment(commentID string) error
DeleteComment deletes a comment by its ID
func (*TodoistAPI) DeleteTask ¶ added in v0.5.0
func (t *TodoistAPI) DeleteTask(id string) error
DeleteTask deletes a task by ID.
func (*TodoistAPI) GetComments ¶ added in v0.3.3
func (api *TodoistAPI) GetComments(taskID string) ([]Comment, error)
GetComments retrieves all comments for a task
func (*TodoistAPI) GetProjects ¶ added in v0.2.0
func (t *TodoistAPI) GetProjects() ([]Project, error)
func (*TodoistAPI) GetTasks ¶ added in v0.2.0
func (t *TodoistAPI) GetTasks() ([]Task, error)
func (*TodoistAPI) MoveTask ¶ added in v0.5.0
func (t *TodoistAPI) MoveTask(taskID, projectID, parentID string) error
MoveTask moves a task to a different project and/or parent.
func (*TodoistAPI) ReopenTask ¶ added in v0.3.0
func (t *TodoistAPI) ReopenTask(id string) error
func (*TodoistAPI) SyncResources ¶ added in v0.3.3
func (t *TodoistAPI) SyncResources(resourceTypes []string) (*SyncResponse, error)
SyncResources fetches specified resources using the sync endpoint
func (*TodoistAPI) UpdateComment ¶ added in v0.3.3
func (api *TodoistAPI) UpdateComment(commentID, content string) error
UpdateComment updates a comment by its ID
func (*TodoistAPI) UpdateProject ¶ added in v0.2.0
func (t *TodoistAPI) UpdateProject(id string, fields map[string]interface{}) error
func (*TodoistAPI) UpdateTask ¶ added in v0.2.0
func (t *TodoistAPI) UpdateTask(id string, fields map[string]interface{}) error