todoist

package module
v0.0.0-...-ec6b38b Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: MIT Imports: 8 Imported by: 0

README

todoist

godoc Build Status Go Report Card

Unofficial todoist api implementation

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Token string

Token save the personal token from todoist

Functions

This section is empty.

Types

type CustomTime

type CustomTime struct {
	time.Time
}

CustomTime had a custom json date format

func (CustomTime) MarshalJSON

func (ct CustomTime) MarshalJSON() ([]byte, error)

MarshalJSON convert CustomTime to []byte

func (*CustomTime) UnmarshalJSON

func (ct *CustomTime) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON convert from []byte to CustomTime

type Due

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

Due is a model of todoist project entity

type Project

type Project struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	CommentCount int    `json:"comment_count"`
	Order        int    `json:"order"`
	Indent       int    `json:"indent"`
}

Project is a model of todoist project entity

func CreateProject

func CreateProject(name string) (Project, error)

CreateProject create a new project with a name

Example:

todoist.Token = "your token"
project, err := todoist.CreateProject("New Project")
if err != nil {
	panic(err)
}
fmt.Println(project)

func GetProject

func GetProject(id int) (Project, error)

GetProject return a project by id

Example:

todoist.Token = "your token"
project, err := todoist.GetProject(1)
if err != nil {
	panic(err)
}
fmt.Println(project)

func ListProject

func ListProject() ([]Project, error)

ListProject return all projects

Example:

todoist.Token = "your token"
projects, err := todoist.ListProject()
if err != nil {
	panic(err)
}
fmt.Println(projects)

func (Project) Delete

func (p Project) Delete() error

Delete project

Example:

todoist.Token = "your token"
project, err := todoist.GetProject(1)
if err != nil {
	panic(err)
}
err = project.Delete()
if err != nil {
	panic(err)
}

func (Project) Update

func (p Project) Update() error

Update project

Example:

todoist.Token = "your token"
project, err := todoist.GetProject(1)
if err != nil {
	panic(err)
}
project.Name = "updated"
err = project.Update()
if err != nil {
	panic(err)
}
fmt.Println(project)

type QueryParam

type QueryParam map[string]string

QueryParam is a map[string]string to build http query

func (QueryParam) String

func (qp QueryParam) String() string

type Task

type Task struct {
	ID           int    `json:"id"`
	CommentCount int    `json:"comment_count"`
	Completed    bool   `json:"completed"`
	Content      string `json:"content"`
	Indent       int    `json:"indent"`
	LabelIDs     []int  `json:"label_ids"`
	Order        int    `json:"order"`
	Priority     int    `json:"priority"`
	ProjectID    int    `json:"project_id"`
	Due          Due    `json:"due"`
}

Task is a model of todoist project entity

func CreateTask

func CreateTask(task Task) (Task, error)

CreateTask create a new task

func GetTask

func GetTask(id int) (Task, error)

GetTask return a task by id

func ListTask

func ListTask(qp QueryParam) ([]Task, error)

ListTask return all task, you can filter using QueryParam See documentation: https://developer.todoist.com/rest/v8/#get-tasks

func (Task) Close

func (t Task) Close() error

Close mask task as done

func (Task) Delete

func (t Task) Delete() error

Delete remove a task

func (Task) Reopen

func (t Task) Reopen() error

Reopen a task

func (Task) Update

func (t Task) Update() error

Update a task

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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