Packages

Webhook delivery, monitoring, and management API. All endpoints under `/v1` require authentication via `Authorization: Bearer <api_key>` header unless marked as **Public**.

Current section

Files

Jump to
hooksniff lib hooksniff resources schemas.ex
Raw

lib/hooksniff/resources/schemas.ex

defmodule HookSniff.Schemas do
@moduledoc "Schema registry — register, validate."
alias HookSniff.Client
@doc "List schemas"
@spec list(HookSniff.t()) :: {:ok, map()} | {:error, term()}
def list(client), do: Client.request(:get, "/api/v1/schemas", nil, client)
@doc "Register a schema"
@spec register(HookSniff.t(), map()) :: {:ok, map()} | {:error, term()}
def register(client, params), do: Client.request(:post, "/api/v1/schemas", params, client)
@doc "Get a schema"
@spec get(HookSniff.t(), String.t()) :: {:ok, map()} | {:error, term()}
def get(client, id), do: Client.request(:get, "/api/v1/schemas/#{id}", nil, client)
@doc "Validate an event"
@spec validate(HookSniff.t(), String.t(), map()) :: {:ok, map()} | {:error, term()}
def validate(client, id, params), do: Client.request(:post, "/api/v1/schemas/#{id}/validate", params, client)
end