GhEx.Hooks (gh_ex v0.3.4)

Copy Markdown View Source

Repository webhook configuration management.

This module manages hooks through GitHub's REST API. GhEx.Webhooks remains the receiving side for verifying signatures and parsing delivery payloads.

The wrappers return the same {:ok, body, meta} / {:error, reason} shape as GhEx.REST; opts pass through to Req.

Summary

Functions

Creates a repository webhook. attrs contains its config, events, and active state.

Deletes a repository webhook. GitHub returns 204 No Content on success.

Gets a repository webhook by id.

Lists repository webhooks.

Sends a ping event to a repository webhook.

Auto-paginates repository webhooks into a lazy Stream.

Sends the repository's latest push to a hook subscribed to push events.

Types

id()

@type id() :: integer() | String.t()

Functions

create(client, owner, repo, attrs, opts \\ [])

@spec create(GhEx.Client.t(), String.t(), String.t(), map(), keyword()) ::
  GhEx.REST.result()

Creates a repository webhook. attrs contains its config, events, and active state.

delete(client, owner, repo, hook_id, opts \\ [])

@spec delete(GhEx.Client.t(), String.t(), String.t(), id(), keyword()) ::
  GhEx.REST.result()

Deletes a repository webhook. GitHub returns 204 No Content on success.

get(client, owner, repo, hook_id, opts \\ [])

@spec get(GhEx.Client.t(), String.t(), String.t(), id(), keyword()) ::
  GhEx.REST.result()

Gets a repository webhook by id.

list(client, owner, repo, opts \\ [])

Lists repository webhooks.

ping(client, owner, repo, hook_id, opts \\ [])

@spec ping(GhEx.Client.t(), String.t(), String.t(), id(), keyword()) ::
  GhEx.REST.result()

Sends a ping event to a repository webhook.

stream(client, owner, repo, opts \\ [])

@spec stream(GhEx.Client.t(), String.t(), String.t(), keyword()) :: Enumerable.t()

Auto-paginates repository webhooks into a lazy Stream.

test(client, owner, repo, hook_id, opts \\ [])

@spec test(GhEx.Client.t(), String.t(), String.t(), id(), keyword()) ::
  GhEx.REST.result()

Sends the repository's latest push to a hook subscribed to push events.

GitHub returns 204 without a delivery when the hook does not subscribe to push events.

update(client, owner, repo, hook_id, attrs, opts \\ [])

@spec update(GhEx.Client.t(), String.t(), String.t(), id(), map(), keyword()) ::
  GhEx.REST.result()

Updates a repository webhook.

When a hook already has a secret, include that secret again or replace it. GitHub removes an existing secret when the update omits it.