Pivo
Pivo is an Elixir interface for the Pivotal TrackerREST API V5.
Installation
Add :pivo
to your list of dependencies in mix.exs
:
def deps do
[{:pivo, "~> 0.1"}]
end
Configuration
Pivo needs your Pivotal Tracker API token, by default it reads the TOKEN
variable from the current environment.
Otherwise you could override the following configuration variables in your config/config.exs
file.
config :pivo,
api_token: "TOKEN",
url_base: "https://www.pivotaltracker.com/services/v5"
Usage
The Pivo
module provides all the methods to access the currently supported endpoints and resources.
Depending on what the underlying API supports, a resource may have the following methods:
Method Prefix | Description |
---|---|
get_all_ | Returns all of user's resource. |
get_selected_ | Returns a list of resources given its parent id. |
get_paginated_ | Returns a metadata map with a paginated list of resources given its parent id. |
fetch_ | Fetch the content of the specified resource by id. |
create_ | Create a resource. |
update_ | Update a resource. |
destroy_ | Destroy a resource. |
Supported Endpoints
- [x] Account
- [ ] Account Memberships
- [x] Accounts
- [ ] Activity
- [ ] Attachments
- [ ] Blockers
- [x] Comments
- [ ] Epic
- [ ] Epics
- [ ] Exports
- [ ] Iterations
- [ ] Labels
- [x] Me
- [ ] Notifications
- [x] Project
- [ ] Project History
- [ ] Project Integrations
- [ ] Project Memberships
- [ ] Project Webhooks
- [x] Projects
- [ ] Releases
- [ ] Request Aggregator
- [ ] Reviews
- [ ] Search
- [ ] Source Commits
- [x] Stories
- [x] Story
- [ ] Story Tasks
- [ ] Story Transitions
- [ ] Workspaces
Example
iex> Pivo.get_all_projects()
{:ok,
[
%Pivo.Resources.Project{id: 1234, ...},
%Pivo.Resources.Project{...}
]}
iex> Pivo.create_story(1234, %{name: "This is a story"})
{:ok,
%Pivo.Resources.Story{id: 4567, ...}}
iex> Pivo.get_paginated_stories(1234)
{:ok,
%{
data: [
%Pivo.Resources.Story{id: 4567, ...}
],
http_status: "200",
pagination: %{limit: 100, offset: 0, returned: 1, total: 1},
project_version: 3
}}
iex> Pivo.create_comment(1234, 4567, %{text: "This is a comment"})
{:ok,
%Pivo.Resources.Comment{id: 8900, ...}}
iex> Pivo.get_selected_comments(1234, 4567)
{:ok,
[
%Pivo.Resources.Comment{id: 8900, ...}
]}
iex> Pivo.update_comment(1234, 4567, 8900, %{text: "This is an updated comment"})
{:ok,
%Pivo.Resources.Comment{id: 8900, ...}}
iex(3)> Pivo.destroy_comment(1234, 4567, 8900)
{:ok, :no_content}
Copyright and License
Copyright (c) 2020 FLEET-LINK GmbH
The source code is licensed under The MIT License (MIT)