Webhooks API for event notifications on HuggingFace Hub.
Webhooks enable automated notifications when events occur on repositories.
Examples
# List all webhooks
{:ok, webhooks} = HfHub.Webhooks.list(token: "hf_xxx")
# Get a specific webhook
{:ok, webhook} = HfHub.Webhooks.get("webhook-id", token: "hf_xxx")
# Create a new webhook
{:ok, webhook} = HfHub.Webhooks.create("https://example.com/hook",
watched: [{:model, "bert-base-uncased"}],
domains: [:repo],
token: "hf_xxx")
# Enable/disable a webhook
{:ok, webhook} = HfHub.Webhooks.enable("webhook-id", token: "hf_xxx")
{:ok, webhook} = HfHub.Webhooks.disable("webhook-id", token: "hf_xxx")
# Delete a webhook
:ok = HfHub.Webhooks.delete("webhook-id", token: "hf_xxx")
Summary
Functions
Creates a new webhook.
Deletes a webhook.
Disables a webhook.
Enables a webhook.
Gets a webhook by ID.
Lists all webhooks for the authenticated user.
Updates a webhook.
Types
Functions
@spec create( String.t(), keyword() ) :: {:ok, HfHub.Webhooks.WebhookInfo.t()} | {:error, term()}
Creates a new webhook.
Arguments
url- Webhook endpoint URL
Options
:watched- List of repos to watch:[{:model, "user/repo"}, {:dataset, "name"}]:domains- Event domains:[:repo, :discussion]:secret- Webhook secret for signature verification:token- Authentication token (required)
Examples
{:ok, webhook} = HfHub.Webhooks.create("https://example.com/hook",
watched: [{:model, "bert-base-uncased"}],
domains: [:repo],
secret: "my-secret",
token: "hf_xxx")
{:ok, webhook} = HfHub.Webhooks.create("https://example.com/hook",
watched: [{:model, "bert-base-uncased"}, {:dataset, "squad"}],
domains: [:repo, :discussion],
token: "hf_xxx")
Deletes a webhook.
Options
:missing_ok- Don't error if webhook doesn't exist (default: false):token- Authentication token (required)
Examples
:ok = HfHub.Webhooks.delete("webhook-id", token: "hf_xxx")
:ok = HfHub.Webhooks.delete("maybe-exists", missing_ok: true, token: "hf_xxx")
@spec disable( String.t(), keyword() ) :: {:ok, HfHub.Webhooks.WebhookInfo.t()} | {:error, term()}
Disables a webhook.
Options
:token- Authentication token (required)
Examples
{:ok, webhook} = HfHub.Webhooks.disable("webhook-id", token: "hf_xxx")
@spec enable( String.t(), keyword() ) :: {:ok, HfHub.Webhooks.WebhookInfo.t()} | {:error, term()}
Enables a webhook.
Options
:token- Authentication token (required)
Examples
{:ok, webhook} = HfHub.Webhooks.enable("webhook-id", token: "hf_xxx")
@spec get( String.t(), keyword() ) :: {:ok, HfHub.Webhooks.WebhookInfo.t()} | {:error, term()}
Gets a webhook by ID.
Options
:token- Authentication token (required)
Examples
{:ok, webhook} = HfHub.Webhooks.get("webhook-id", token: "hf_xxx")
@spec list(keyword()) :: {:ok, [HfHub.Webhooks.WebhookInfo.t()]} | {:error, term()}
Lists all webhooks for the authenticated user.
Options
:token- Authentication token (required)
Examples
{:ok, webhooks} = HfHub.Webhooks.list(token: "hf_xxx")
@spec update( String.t(), keyword() ) :: {:ok, HfHub.Webhooks.WebhookInfo.t()} | {:error, term()}
Updates a webhook.
Options
:url- New webhook endpoint URL:watched- New list of repos to watch:domains- New event domains:secret- New webhook secret:token- Authentication token (required)
Examples
{:ok, webhook} = HfHub.Webhooks.update("webhook-id",
url: "https://new-url.com/hook",
token: "hf_xxx")
{:ok, webhook} = HfHub.Webhooks.update("webhook-id",
watched: [{:model, "gpt2"}],
token: "hf_xxx")