NAV
nim

Introduction

This a library is a Nim client for the Todoist REST API.

Authentication

To initialize a Todoist client you must instantiate it with your personal tokek

import todoist

let client = Todoist("abcd123...")

To use todoist you need an authorization key. This can be requested from the Todoist app management.

Once the client has been initialized, all the subsequent oprations can be requested from your client instance.

Projects

Structure

This will return a seq[TodoistProject] where TodoistProject is

type TodoistProject* = object
    id*: int
    order*: Option[int] 
    color*: int
    name*: string
    comment_count*: int
    `shared`*: bool
    favorite*: bool
    sync_id*: int
    url*: string

A project is represented by a TodoistProject object. The available fields are:

Get all projects

import todoist

let client = Todoist("abcd123...")

let projects = client.getAllProject()

To get all the projects use client.getAllProjects(). The result is a seq[TodoistProject] containing all the projects or an empty seq if none.

Get a specific project

let id = 1234 # ... project id
client.getProject(id)

Getting a specific project with id

To retrieve a specific project, call client.getProject(id), where id is the project id.

Tasks

Structure

The structure of a TodoistTask is

type TodoistTask* = object
    id*: int
    project_id*: int
    section_id*: int
    parent_id*: Option[int]
    order*: int
    content*: string
    description*: string
    completed*: bool
    label_ids*: seq[int]
    priority*: int
    comment_count*: int
    created*: string
    due*: Option[DueDate]

Tasks are represented by TodoistTask. The fields are:

Due date

The structure of a DueDate is

type DueDate* = object
    recurring*: bool
    `string`*: string
    date*: string

Get all active tasks

import todoist

let client = Todoist("abcd123...")

let tasks = client.getActiveTasks()

To get all active tasks use client.getActiveTasks(). The result is a seq[TodoistTask] containing all the active tasks or an empty seq if none.

Get a specific tasks

let task_id = 1234 # ... task id
client.getTask(task_id)

Getting a specific task with task_id

To retrieve a specific task, call client.getTask(task_id), where task_id is the task id.

Sections

Structure

The structure of a TodoistSection is

type TodoistSection* = object
    id*: int
    project_id*: int
    order*: int
    name*: string

Sections are represented by TodoistSection. The fields are:

Get project's sections

import todoist

let client = Todoist("abcd123...")
let project_id = 1234
let sections = client.getProjectSections(project_id)

To get a project's sections use client.getProjectSections(). The result is a seq[TodoistSection] containing all the sections or an empty seq if none.

Labels

Structure

The structure of a TodoistLabel is

type TodoistLabel* = object
    id*:int # Label ID
    name*:string # Label name
    color*:int # A numeric ID representing the color of the label icon
    order*: int # Number used by clients to sort list of labels
    favorite*: bool # Whether the label is a favorite

Labels are represented by TodoistLabel. The fields are:

Get all labels

import todoist

let client = Todoist("abcd123...")
let labels = client.getAllLabels()

To get all labels use client.getAllLabels(). The result is a seq[TodoistLabel] containing all the labels or an empty seq if none.

nim