Tentacat v0.7.2 Tentacat.Hooks

The Repository Webhooks API allows repository admins to manage the post-receive hooks for a repository.

Summary

Functions

Create webhook for a repository

Get a webhook for a repository by id

Get a list of webhooks for a repository

This will trigger a ping event to be sent to the hook

Delete a repo’s webhook by it’s Id

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

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(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

find(owner, repo, hook_id, client)

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

list(owner, repo, client)

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

ping(owner, repo, hook_id, client)

Specs

ping(binary, binary, binary | integer, Tentacat.Client.t) :: Tentacat.response

This will trigger a ping event to be sent to the hook.

Example

Tentacat.Hooks.ping("elixir-lang", "elixir", "1234567", client)

More info at: http:\developer.github.com/v3/repos/hooks/#ping-a-hook

remove(owner, repo, hook_id, client)

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

test(owner, repo, hook_id, client)

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

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

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