todoist

package module
v0.0.0-...-4ec9e45 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

README

This project is not created by, affiliated with, or supported by Doist.

Documentation

Index

Constants

View Source
const (
	ColorBerryRed   = "berry_red"
	ColorBlue       = "blue"
	ColorCharcoal   = "charcoal"
	ColorGrape      = "grape"
	ColorGreen      = "green"
	ColorGrey       = "grey"
	ColorLavender   = "lavender"
	ColorLightBlue  = "light_blue"
	ColorLimeGreen  = "lime_green"
	ColorMagenta    = "magenta"
	ColorMintGreen  = "mint_green"
	ColorOliveGreen = "olive_green"
	ColorOrange     = "orange"
	ColorRed        = "red"
	ColorSalmon     = "salmon"
	ColorSkyBlue    = "sky_blue"
	ColorTaupe      = "taupe"
	ColorTeal       = "teal"
	ColorViolet     = "violet"
	ColorYellow     = "yellow"
)
View Source
const (
	ViewStyleBoard = "board"
	ViewStyleList  = "list"
)

Variables

This section is empty.

Functions

func ByDatetime

func ByDatetime(a, b Task) int

func ByPriority

func ByPriority(a, b Task) int

func ByScheduled

func ByScheduled(t Task) bool

func Filter

func Filter[S ~[]E, E Filterable](coll S, f func(v E) bool) (S, S)

func Sort

func Sort[S ~[]E, E Sortable](coll S, f func(a, b E) int)

Types

type Client

type Client struct {
	APIToken   string
	HTTPClient *http.Client
	Verbose    bool
}

func NewClient

func NewClient(apiToken string) (*Client, error)

func (*Client) CloseTask

func (c *Client) CloseTask(ctx context.Context, id string) error

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, params ProjectParams) (*Project, error)

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, params TaskParams) (*Task, error)

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, id string) error

func (*Client) DeleteTask

func (c *Client) DeleteTask(ctx context.Context, id string) error

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, projectID string) (*Project, error)

func (*Client) GetProjects

func (c *Client) GetProjects(ctx context.Context) ([]Project, error)

func (*Client) GetTasks

func (c *Client) GetTasks(ctx context.Context, filter *TaskFilter) ([]Task, error)

func (*Client) ReopenTask

func (c *Client) ReopenTask(ctx context.Context, id string) error

type Due

type Due struct {
	Date        string `json:"date"`
	IsRecurring bool   `json:"is_recurring"`
	Datetime    string `json:"datetime"`
	String      string `json:"string"`
	Timezone    string `json:"timezone"`
}

type Duration

type Duration struct {
	Amount int64  `json:"amount"`
	Unit   string `json:"unit"`
}

type Error

type Error struct {
	Code     int
	Body     string
	Response string
}

func (Error) Error

func (err Error) Error() string

type Filterable

type Filterable interface {
	Task | Project
}

type Project

type Project struct {
	ID             string `json:"id"`
	Name           string `json:"name"`
	Color          string `json:"color"`
	ParentID       string `json:"parent_id"`
	Order          int64  `json:"order"`
	CommentCount   int64  `json:"comment_count"`
	IsShared       bool   `json:"is_shared"`
	IsFavorite     bool   `json:"is_favorite"`
	IsInboxProject bool   `json:"is_inbox_project"`
	IsTeamInbox    bool   `json:"is_team_inbox"`
	ViewStyle      string `json:"view_style"`
	URL            string `json:"url"`
}

type ProjectParams

type ProjectParams struct {
	Name       string `json:"name,omitempty"`
	ParentID   string `json:"parent_id,omitempty"`
	Color      string `json:"color,omitempty"`
	IsFavorite bool   `json:"is_favorite,omitempty"`
	ViewStyle  string `json:"view_style,omitempty"`
}

type Sortable

type Sortable interface {
	Task | Project
}

type Task

type Task struct {
	CreatorID    string    `json:"creator_id"`
	CreatedAt    string    `json:"created_at"`
	AssigneeID   string    `json:"assignee_id"`
	AssignerID   string    `json:"assigner_id"`
	CommentCount int64     `json:"comment_count"`
	IsCompleted  bool      `json:"is_completed"`
	Content      string    `json:"content"`
	Description  string    `json:"description"`
	Due          *Due      `json:"due"`
	Duration     *Duration `json:"duration"`
	ID           string    `json:"id"`
	Labels       []string  `json:"labels"`
	Order        int64     `json:"order"`
	Priority     int64     `json:"priority"`
	ProjectID    string    `json:"project_id"`
	SectionID    string    `json:"section_id"`
	ParentID     string    `json:"parent_id"`
	URL          string    `json:"url"`
}

type TaskFilter

type TaskFilter struct {
	Filter string
}

type TaskParams

type TaskParams struct {
	Content      string   `json:"content,omitempty"`
	Description  string   `json:"description,omitempty"`
	ProjectID    string   `json:"project_id,omitempty"` // Not in update
	SectionID    string   `json:"section_id,omitempty"` // Not in update
	ParentID     string   `json:"parent_id,omitempty"`  // Not in update
	Order        string   `json:"order,omitempty"`      // Not in update
	Labels       []string `json:"labels,omitempty"`
	Priority     int64    `json:"priority,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"`
	AssigneeID   string   `json:"assignee_id,omitempty"`
	Duration     int64    `json:"duration,omitempty"`
	DurationUnit string   `json:"duration_unit,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL