This builds a valid Things App URL to interact with Cultured Code's Things app v3.4+. Read more.
Installation
$ npm install things-json
Inclusion
import ThingsJSC from 'things-json';
// Or if not using babel
const ThingsJSC = require('things-json').default;
For documentation and references, see the official docs.
See examples in src/spec.js
.
.todo(options)
: object; Creates a new to-do item.project(options)
: object; Creates a new project item.heading(options)
: string or object; Creates a new heading item..url(item)
: instance (or instances) oftodo
orproject
; converts item to an encoded URL for use. Accepts an array of items.
title
: string; title of to-donotes
: string; text for notes (max 10K)when
: string or date;today
,tomorrow
,evening
,anytime
,someday
deadline
: datetags
: array of stringschecklist
: array; strings or checklistItemlistId
: stringheading
: string or object of headingItemcompleted
: booleancanceled
: boolean
const todo1 = {
title: 'Pick up dry cleaning',
when: 'today',
};
const todo2 = {
title: 'Pack for vacation',
checklist: ["Camera", "Passport"],
};
const todo1Obj = ThingsJSC.todo(todo1);
const todo2Obj = ThingsJSC.todo(todo2);
const url1 = ThingsJSC.url(todo1Obj);
const url2 = ThingsJSC.url(todo2Obj);
// Or combine URLs
const urls = ThingsJSC.url([todo1Obj, todo2Obj]);
title
: string; title of to-donotes
: string; text for notes (max 10K)when
: string or date;today
,tomorrow
,evening
,anytime
,someday
deadline
: datetags
: array of stringschecklist
: array; strings or checklistItemareaId
: stringarea
: stringitems
: array of to-do or headingItemcompleted
: booleancanceled
: boolean
const newProject = {
title: 'Go Shopping',
};
const project = ThingsJSC.project(newProject);
const url = ThingsJSC.url(project);
item
: Heading or To-Do
const newTodo = {
title: 'Buy milk',
};
const newProject = {
title: 'Go Shopping',
};
const project = ThingsJSC.project(newProject);
const todo = ThingsJSC.todo(newTodo);
project.addItem(todo);
const url = ThingsJSC.url(project);
title
: string; title of to-docompleted
: booleancanceled
: boolean
title
: string; title of to-doarchived
: boolean
const heading = {
title: 'New Heading',
}
const heading = ThingsJSC.heading(heading);