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
Update a message.
Update a notebook.
Link to this section Types
id()
Specs
Link to this section Functions
base_url()
Teamwork base URL
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"})
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"})
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})
get_links(project_id)
Specs
Retrieve link objects from a given TW project
get_notebook(id)
Specs
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.
get_notebooks_by_category(category_id)
Specs
Get Teamwork notebooks by Category ID.
See https://developer.teamwork.com/projects/api-v1/ref/notebooks/get-notebookcategories-id-notebooks-json for more information.
get_people(query \\ [])
Specs
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)
get_person(id)
Specs
Get details about a person from Teamwork
See https://developer.teamwork.com/projects/api-v1/ref/people/get-people-id-json for more information.
get_project(id, opts \\ [])
Specs
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.
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.
get_project_notebooks(project_id)
Specs
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.
move_notebook(notebook_id, project_id)
Specs
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.
update_message(message_id, params \\ %{})
Specs
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.
update_notebook(notebook_id, params \\ %{})
Specs
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.