starkbank v2.3.0 StarkBank.Webhook View Source

Groups Webhook related functions

Link to this section Summary

Functions

A Webhook is used to subscribe to notification events on a user-selected endpoint. Currently available services for subscription are transfer, invoice, deposit, brcode-payment, boleto, boleto-holmes, boleto-payment and utility-payment.

Send a single Webhook subscription for creation in the Stark Bank API

Same as create(), but it will unwrap the error tuple and raise in case of errors.

Delete a Webhook subscription entity previously created in the Stark Bank API

Same as delete(), but it will unwrap the error tuple and raise in case of errors.

Receive a single Webhook subscription struct previously created in the Stark Bank API by passing its id

Same as get(), but it will unwrap the error tuple and raise in case of errors.

Receive a stream of Webhook subcription structs previously created in the Stark Bank API

Same as query(), but it will unwrap the error tuple and raise in case of errors.

Link to this section Types

Link to this type

t()

View Source
t() :: %StarkBank.Webhook{id: term(), subscriptions: term(), url: term()}

Link to this section Functions

Link to this function

%StarkBank.Webhook{}

View Source (struct)

A Webhook is used to subscribe to notification events on a user-selected endpoint. Currently available services for subscription are transfer, invoice, deposit, brcode-payment, boleto, boleto-holmes, boleto-payment and utility-payment.

Parameters (required):

  • :url [string]: Url that will be notified when an event occurs.
  • :subscriptions [list of strings]: list of any non-empty combination of the available services. ex: ["transfer", "invoice", "deposit"]

Attributes:

  • :id [string, default nil]: unique id returned when the webhook is created. ex: "5656565656565656"
Link to this function

create(parameters \\ [])

View Source
create(
  user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil,
  url: binary(),
  subscriptions: [binary()]
) :: {:ok, StarkBank.Webhook.t()} | {:error, [StarkBank.Error.t()]}

Send a single Webhook subscription for creation in the Stark Bank API

Parameters (required):

Parameters (optional):

  • :user [Organization/Project]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.

Return:

  • Webhook struct with updated attributes
Link to this function

create!(parameters \\ [])

View Source
create!(
  user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil,
  url: binary(),
  subscriptions: [binary()]
) :: any()

Same as create(), but it will unwrap the error tuple and raise in case of errors.

Link to this function

delete(id, options \\ [])

View Source
delete(binary(), [
  {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil}
]) ::
  {:ok, StarkBank.Webhook.t()}
  | {:error, [%StarkBank.Error{code: term(), message: term()}]}

Delete a Webhook subscription entity previously created in the Stark Bank API

Parameters (required):

  • id [string]: Webhook unique id. ex: "5656565656565656"

Options:

  • :user [Organization/Project]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.

Return:

  • deleted Webhook struct
Link to this function

delete!(id, options \\ [])

View Source
delete!(binary(), [
  {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil}
]) :: StarkBank.Webhook.t()

Same as delete(), but it will unwrap the error tuple and raise in case of errors.

Link to this function

get(id, options \\ [])

View Source
get(binary(), [
  {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil}
]) ::
  {:ok, StarkBank.Webhook.t()}
  | {:error, [%StarkBank.Error{code: term(), message: term()}]}

Receive a single Webhook subscription struct previously created in the Stark Bank API by passing its id

Parameters (required):

  • id [string]: struct unique id. ex: "5656565656565656"

Options:

  • :user [Organization/Project]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.

Return:

  • Webhook struct with updated attributes
Link to this function

get!(id, options \\ [])

View Source
get!(binary(), [
  {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil}
]) :: StarkBank.Webhook.t()

Same as get(), but it will unwrap the error tuple and raise in case of errors.

Link to this function

query(options \\ [])

View Source
query(
  limit: integer(),
  user: StarkBank.User.Project.t() | StarkBank.User.Organization.t()
) ::
  ({:cont, {:ok, [StarkBank.Webhook.t()]}}
   | {:error, [StarkBank.Error.t()]}
   | {:halt, any()}
   | {:suspend, any()},
   any() ->
     any())

Receive a stream of Webhook subcription structs previously created in the Stark Bank API

Options:

  • :limit [integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35
  • :user [Organization/Project]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.

Return:

  • stream of Webhook structs with updated attributes
Link to this function

query!(options \\ [])

View Source
query!(
  limit: integer(),
  user: StarkBank.User.Project.t() | StarkBank.User.Organization.t()
) ::
  ({:cont, [StarkBank.Webhook.t()]}
   | {:halt, any()}
   | {:suspend, any()},
   any() ->
     any())

Same as query(), but it will unwrap the error tuple and raise in case of errors.