Wraps an array of todo and/or project items and encodes them into a URL for use to send the request to Things.
Things Integration Notes
Things is a popular task and project management app from Cultured Code. Things supports advanced URL schemes (required Things v3.4 or greater on iOS) which can accept multiple todos, projects, headings in a single call to the app. The scripting interfaces below are convenience wrappers that allow easy creation and encoding of the URLs needed to pass this type of information to Things.
The TJS* JavaScript objects are wrappers around an open source Swift library provided by Cultured Code, with a few modifications to work in JavaScript. In all cases, nothing is committed to Things until the the items are wrapped in a TJSContainer, and the URL it generates called to send the data to Things. This is best done with Drafts’ CallbackURL object (see example below).
// create a Things Project letproject = TJSProject.create(); project.title = "My Project From Drafts"; project.notes = "Let's do this stuff";
// create and add a heading to the project letheading = TJSHeading.create(); heading.title = "First Heading"; project.addHeading(heading);
// add todos to the project lettodo1 = TJSTodo.create(); todo1.title = "My first todo"; todo1.when = "today"; project.addTodo(todo1);
lettodo2 = TJSTodo.create(); todo2.title = "My second todo"; todo2.when = "tomorrow"; project.addTodo(todo2);
// create a container to handle creation of Things URL letcontainer = TJSContainer.create([project]);
// Use CallbackURL object to open URL in Things. letcb = CallbackURL.create(); cb.baseURL = container.url; letsuccess = cb.open(); if (success) { console.log("Project created in Things"); } else { context.fail(); }
Wraps an array of todo and/or project items and encodes them into a URL for use to send the request to Things.
Things Integration Notes
The TJS* JavaScript objects are wrappers around an open source Swift library provided by Cultured Code, with a few modifications to work in JavaScript. In all cases, nothing is committed to Things until the the items are wrapped in a TJSContainer, and the URL it generates called to send the data to Things. This is best done with Drafts’
CallbackURL
object (see example below).For more information about what values Things understands in these objects, refer to their URL scheme documenation.
Example