Skip to content

kobtea/go-todoist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-todoist

Go Report Card CircleCI

Unofficial CLI and library for todoist.

Install

Binary

Go to https://github.com/kobtea/go-todoist/releases

Building from source

$ go get -d github.com/kobtea/go-todoist
$ cd $GOPATH/src/github.com/kobtea/go-todoist
$ make build

Usage

$ todoist help
Command line tool for todoist.

Usage:
  todoist [command]

Available Commands:
  completion  generate completion script
  config      configure about this CLI
  filter      subcommand for filter
  help        Help about any command
  inbox       show inbox tasks
  item        subcommand for item
  label       subcommand for label
  next        show next 7 days tasks
  project     subcommand for project
  review      show completed items
  sync        Syncronize origin server
  today       show today's tasks
  version     show version of go-todoist

Flags:
      --config string   config file (default is $HOME/.todoist.yaml)
  -h, --help            help for todoist

Use "todoist [command] --help" for more information about a command.

Configure your API token of todoist.
The location of API token is Todoist > Settings > Integrations > API token.

$ todoist config
todoist token (default: ): YOUR_TOKEN_HERE
write config to /home/kobtea/.go-todoist/config.json

Sync contents.

$ todoist sync

Enjoy.

$ todoist item add hello go-todoist
$ todoist inbox

Bash and zsh completion are supported ;)
Completion requires fzf.

# bash
$ . <(todoist completion bash)
# zsh
$ . <(todoist completion zsh)

As a Library

This library supports sync api v8.
Implementation refers to python official library.

sample

package main

import (
	"context"
	"github.com/kobtea/go-todoist/todoist"
	"os"
)

func main() {
	token := os.Getenv("TODOIST_TOKEN")
	cli, _ := todoist.NewClient("", token, "*", "", nil)
	ctx := context.Background()

	// sync contents
	cli.FullSync(ctx, []todoist.Command{})

	// add item
	item, _ := todoist.NewItem("hello go-todoist", &todoist.NewItemOpts{})
	cli.Item.Add(*item)
	cli.Commit(ctx)
}

License

MIT