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 = %{

"name" => "web",
"active" => true,
"events" => [ "push", "pull_request" ],
"config" => {
  "url" => "http://example.com/webhook",
  "content_type" => "json"
}

}

Functions

create(owner, repo, body, client)

Specs:

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

find(owner, repo, hook_id, client)

Specs:

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

list(owner, repo, client)

Specs:

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

remove(owner, repo, hook_id, client)

Specs:

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

test(owner, repo, hook_id, client)

Specs:

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

update(owner, repo, hook_id, body, client)

Specs:

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