Tentacat v1.6.0 Tentacat.Hooks View Source
The Repository Webhooks API allows repository admins to manage the post-receive hooks for a repository.
Link to this section 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"
}
}
Link to this section Functions
create(client, owner, repo, body)
View Source
create(Tentacat.Client.t(), binary(), binary(), list()) :: Tentacat.response()
create(Tentacat.Client.t(), binary(), binary(), list()) :: Tentacat.response()
Create webhook for a repository.
Example
Tentacat.Hooks.create(client, "elixir-lang", "elixir", hook_body)
More info at: http://developer.github.com/v3/repos/hooks/#create-a-hook
find(client, owner, repo, hook_id)
View Source
find(Tentacat.Client.t(), binary(), binary(), binary() | integer()) ::
Tentacat.response()
find(Tentacat.Client.t(), binary(), binary(), binary() | integer()) :: Tentacat.response()
Get a webhook for a repository by id.
Example
Tentacat.Hooks.find(client, "elixir-lang", "elixir", "1234567")
More info at: http://developer.github.com/v3/repos/hooks/#get-single-hook
list(client, owner, repo)
View Source
list(Tentacat.Client.t(), binary(), binary()) :: Tentacat.response()
list(Tentacat.Client.t(), binary(), binary()) :: Tentacat.response()
Get a list of webhooks for a repository.
Example
Tentacat.Hooks.list(client, "elixir-lang", "elixir")
More info at: http://developer.github.com/v3/repos/hooks/#list-hooks
ping(client, owner, repo, hook_id)
View Source
ping(Tentacat.Client.t(), binary(), binary(), binary() | integer()) ::
Tentacat.response()
ping(Tentacat.Client.t(), binary(), binary(), binary() | integer()) :: Tentacat.response()
This will trigger a ping event to be sent to the hook.
Example
Tentacat.Hooks.ping(client, "elixir-lang", "elixir", "1234567")
More info at: http://developer.github.com/v3/repos/hooks/#ping-a-hook
remove(client, owner, repo, hook_id)
View Source
remove(Tentacat.Client.t(), binary(), binary(), binary() | integer()) ::
Tentacat.response()
remove(Tentacat.Client.t(), binary(), binary(), binary() | integer()) :: Tentacat.response()
Delete a repo's webhook by it's Id.
Example
Tentacat.Hooks.remove(client, "elixir-lang", "elixir", "1234567")
More info at: http://developer.github.com/v3/repos/hooks/#delete-a-hook
test(client, owner, repo, hook_id)
View Source
test(Tentacat.Client.t(), binary(), binary(), binary() | integer()) ::
Tentacat.response()
test(Tentacat.Client.t(), binary(), binary(), binary() | integer()) :: 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(client, "elixir-lang", "elixir", "1234567")
More info at: http://developer.github.com/v3/repos/hooks/#test-a-push-hook
update(client, owner, repo, hook_id, body)
View Source
update(Tentacat.Client.t(), binary(), binary(), binary() | integer(), list()) ::
Tentacat.response()
update(Tentacat.Client.t(), binary(), binary(), binary() | integer(), list()) :: 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(client, "elixir-lang", "elixir", "1234567", hook_body)
More info at: http://developer.github.com/v3/repos/hooks/#edit-a-hook