Tentacat.Hooks
The Repository Webhooks API allows repository admins to manage the post-receive hooks for a repository.
Summary
| create(owner, repo, body, client) | Create webhook for a repository |
| find(owner, repo, hook_id, client) | Get a webhook for a repository by id |
| list(owner, repo, client) | Get a list of webhooks for a repository |
| remove(owner, repo, hook_id, client) | Delete a repo’s webhook by it’s Id |
| test(owner, repo, hook_id, client) | This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated |
| update(owner, repo, hook_id, body, client) | hook_body = %{
} |
Functions
Specs:
- create(binary, binary, list, Tentacat.Client.t) :: Tentacat.response
Create webhook for a repository.
Example
Tentacat.Hooks.create("elixir-lang", "elixir", hook_body, client)
More info at: http:\developer.github.com/v3/repos/hooks/#create-a-hook
Specs:
- find(binary, binary, binary | integer, Tentacat.Client.t) :: Tentacat.response
Get a webhook for a repository by id.
Example
Tentacat.Hooks.find("elixir-lang", "elixir", "1234567", client)
More info at: http:\developer.github.com/v3/repos/hooks/#get-single-hook
Specs:
- list(binary, binary, Tentacat.Client.t) :: Tentacat.response
Get a list of webhooks for a repository.
Example
Tentacat.Hooks.list("elixir-lang", "elixir", client)
More info at: http:\developer.github.com/v3/repos/hooks/#list-hooks
Specs:
- remove(binary, binary, binary | integer, Tentacat.Client.t) :: Tentacat.response
Delete a repo’s webhook by it’s Id.
Example
Tentacat.Hooks.remove("elixir-lang", "elixir", "1234567", client)
More info at: http:\developer.github.com/v3/repos/hooks/#delete-a-hook
Specs:
- test(binary, binary, binary | integer, Tentacat.Client.t) :: Tentacat.response
This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated.
Example
Tentacat.Hooks.test("elixir-lang", "elixir", "1234567", client)
More info at: http:\developer.github.com/v3/repos/hooks/#test-a-push-hook
Specs:
- update(binary, binary, binary | integer, list, Tentacat.Client.t) :: Tentacat.response
hook_body = %{
"name" => "web",
"active" => true,
"events" => [ "push", "pull_request" ],
"config" => {
"url" => "http://example.com/webhook",
"content_type" => "json"
}
}
Example
Tentacat.Hooks.update("elixir-lang", "elixir", "1234567", hook_body, client)
More info at: http:\developer.github.com/v3/repos/hooks/#edit-a-hook