Library.Teamwork (Portico/Z v0.1.0)

Context for accessing Teamwork API functions.

Note that for now, these functions just return the raw JSON/Map from the Teamwork API. We're not mapping this stuff into more durable Z structs (yet). So be warned: this API is potentially unstable!

Setup

Requires config.exs to have a setup incantation like so:

config :library, 
  Library.Teamwork: [
    api_token: "yer token"
  ]

Link to this section Summary

Functions

Teamwork base URL

Create a Teamwork link.

Create a Teamwork message.

Create a Teamwork task list.

Retrieve link objects from a given TW project

Get a Teamwork notebook by ID.

Get Teamwork notebooks by Category ID.

Get a list of Teamwork people

Get details about a person from Teamwork

Get a Teamwork project by ID.

Get messages by Teamwork project_id and category_id

Get notebooks for a project (by project id)

Move a notebook from one project to another

Link to this section Types

Specs

id() :: String.t() | integer()

Link to this section Functions

Teamwork base URL

Link to this function

create_link(project_id, params \\ %{})

Create a Teamwork link.

All params will be sent as link parameters to the API.

See https://developer.teamwork.com/projects/api-v1/ref/links/post-projects-id-links-json for options.

Examples

Library.Teamwork.create_link(project_id, %{name: "EXPLO", code: "https://www.explo.org", description: "Explo's web site"})
Link to this function

create_message(project_id, params \\ %{})

Create a Teamwork message.

All params will be sent as post parameters to the API.

See https://developer.teamwork.com/projects/api-v1/ref/messages/post-projects-id-posts-json for options.

Examples

Library.Teamwork.create_message(project_id, %{title: "My Message", body: "This is the message"})
Link to this function

create_task_list(project_id, params \\ %{})

Create a Teamwork task list.

All params will be sent as todo-list parameters to the API.

See https://developer.teamwork.com/projects/api-v1/ref/task-lists/post-projects-id-tasklists-json for options.

One particular option worth calling out is the todo-list-template-id option - which allows you to create task lists from templates automatically! It's not entirely clear how to use this from the API docs, so here's an example:

Library.Teamwork.create_task_list(project_id, %{:"todo-list-template-id" => 123456})
Link to this function

get_links(project_id)

Specs

get_links(id()) :: map()

Retrieve link objects from a given TW project

Link to this function

get_notebook(id)

Specs

get_notebook(id()) :: map()

Get a Teamwork notebook by ID.

See https://developer.teamwork.com/projects/api-v3/ref/notebooks/get-projects-api-v3-notebooks-notebookidjson for more information.

Link to this function

get_notebooks_by_category(category_id)

Specs

get_notebooks_by_category(id()) :: map()

Get Teamwork notebooks by Category ID.

See https://developer.teamwork.com/projects/api-v1/ref/notebooks/get-notebookcategories-id-notebooks-json for more information.

Link to this function

get_people(query \\ [])

Specs

get_people(list()) :: map()

Get a list of Teamwork people

See https://developer.teamwork.com/projects/api-v1/ref/people/get-people-json for query parameters you can pass.

Examples

# Get all full-time employees
Library.Teamwork.get_people(projectId: 815104)

Specs

get_person(id()) :: map()

Get details about a person from Teamwork

See https://developer.teamwork.com/projects/api-v1/ref/people/get-people-id-json for more information.

Link to this function

get_project(id, opts \\ [])

Specs

get_project(id(), list()) :: map()

Get a Teamwork project by ID.

See https://developer.teamwork.com/projects/api-v3/ref/projects/get-projects-api-v3-projects-projectidjson for more information.

Link to this function

get_project_category_messages(project_id, category_id)

Get messages by Teamwork project_id and category_id

See https://developer.teamwork.com/projects/api-v1/ref/messages/get-projects-id-posts-json for more information.

Link to this function

get_project_notebooks(project_id)

Specs

get_project_notebooks(id()) :: map()

Get notebooks for a project (by project id)

See https://developer.teamwork.com/projects/api-v1/ref/notebooks/get-projects-id-notebooks-json for more information.

Link to this function

move_notebook(notebook_id, project_id)

Specs

move_notebook(id(), id()) :: map()

Move a notebook from one project to another

See https://developer.teamwork.com/projects/api-v1/ref/notebooks/put-notebooks-id-move-json for more information.

Link to this function

update_message(message_id, params \\ %{})

Specs

update_message(id(), map()) :: map()

Update a message.

params can be any attribute or series of attributes of a message ("post") in Teamwork.

See https://developer.teamwork.com/projects/api-v1/ref/messages/put-posts-id-json for more information.

Link to this function

update_notebook(notebook_id, params \\ %{})

Specs

update_notebook(id(), map()) :: map()

Update a notebook.

params can be any attribute or series of attributes of a notebook in Teamwork.

See https://developer.teamwork.com/projects/api-v1/ref/notebooks/put-notebooks-id-json for more information.