edgurgel / tentacat

Simple Elixir wrapper for the GitHub API
https://hexdocs.pm/tentacat
MIT License
444 stars 155 forks source link

Add Projects API endpoints #172

Closed achiurizo closed 5 years ago

achiurizo commented 5 years ago

This PR adds the Projects API endpoints, which is currently in developer preview.

You'll need to be authenticated and have the headers set to access this preview:

Application.put_env(:tentacat, :extra_headers, [{"Accept", "application/vnd.github.inertia-preview+json"}])
client = Tentacat.Client.new(%{access_token: "yourtoken"})

Examples

# Get projects for a specific repo
Tentacat.Repositories.Projects.list client, "elixir-lang", "elixir"

# Get projects for an organization
Tentacat.Organizations.Projects.list client, "myorg"

# Get projects for a user
Tentacat.Users.Projects.list client, "achiurizo"

# Get projects by their ID
Tentacat.Projects.find 12345

# Create a project for a repository
Tentacat.Repositories.Projects.create client, "achiurizo", "dotfiles", name: "tentacat", body: "my new project"

# Create a project for an organization
Tentacat.Organizations.Projects.create client, "achiurizo", "dotfiles", name: "tentacat", body: "my new project"

# Create a project for an authenticated user
Tentacat.Users.Projects.create client, name: "tentacat", body: "my new project"

# Update a project
Tentacat.Projects.update 12345, name: "New Project"

# Delete a project
Tentacat.Projects.delete 12345
coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.3%) to 91.694% when pulling 1269a13febe9f967b073265f70698f07ba76321a on achiurizo:achiurizo/add-projects-endpoint into 8083c54159da967ea5dafe1abc3b82caa870c067 on edgurgel:master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.3%) to 91.694% when pulling 1269a13febe9f967b073265f70698f07ba76321a on achiurizo:achiurizo/add-projects-endpoint into 8083c54159da967ea5dafe1abc3b82caa870c067 on edgurgel:master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.3%) to 91.694% when pulling 1269a13febe9f967b073265f70698f07ba76321a on achiurizo:achiurizo/add-projects-endpoint into 8083c54159da967ea5dafe1abc3b82caa870c067 on edgurgel:master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.3%) to 91.694% when pulling 1269a13febe9f967b073265f70698f07ba76321a on achiurizo:achiurizo/add-projects-endpoint into 8083c54159da967ea5dafe1abc3b82caa870c067 on edgurgel:master.

edgurgel commented 5 years ago

Awesome! Thanks for the PR! I will release a new version :soon: