Chronicle.WebHooks.DefinitionBuilder (cratis_chronicle v1.0.2)

Copy Markdown View Source

Immutable builder for webhook definitions.

When no event types are configured explicitly, the builder uses all registered event types passed to new/1.

Summary

Functions

Builds a webhook definition.

Creates a new definition builder.

Marks the webhook as inactive.

Marks the webhook as not replayable.

Sets the event sequence id for the webhook.

Uses HTTP basic authentication.

Uses HTTP bearer-token authentication.

Adds an event type to the webhook definition.

Adds or replaces a target header.

Uses OAuth client credentials authentication.

Types

t()

@type t() :: %Chronicle.WebHooks.DefinitionBuilder{
  active?: boolean(),
  authorization: Chronicle.WebHooks.Target.authorization(),
  event_sequence_id: String.t(),
  event_types: [module()],
  headers: %{optional(String.t()) => String.t()},
  registered_event_types: [module()],
  replayable?: boolean()
}

Functions

build(builder, id, target_url)

Builds a webhook definition.

new(registered_event_types \\ [])

@spec new([module()]) :: t()

Creates a new definition builder.

not_active(builder)

@spec not_active(t()) :: t()

Marks the webhook as inactive.

not_replayable(builder)

@spec not_replayable(t()) :: t()

Marks the webhook as not replayable.

on_event_sequence(builder, event_sequence_id)

@spec on_event_sequence(t(), String.t()) :: t()

Sets the event sequence id for the webhook.

with_basic_auth(builder, username, password)

@spec with_basic_auth(t(), String.t(), String.t()) :: t()

Uses HTTP basic authentication.

with_bearer_token(builder, token)

@spec with_bearer_token(t(), String.t()) :: t()

Uses HTTP bearer-token authentication.

with_event_type(builder, event_type)

@spec with_event_type(t(), module()) :: t()

Adds an event type to the webhook definition.

with_header(builder, key, value)

@spec with_header(t(), String.t(), String.t()) :: t()

Adds or replaces a target header.

with_oauth(builder, authority, client_id, client_secret)

@spec with_oauth(t(), String.t(), String.t(), String.t()) :: t()

Uses OAuth client credentials authentication.