starkbank v0.4.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, boleto, 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 section Functions
A Webhook is used to subscribe to notification events on a user-selected endpoint. Currently available services for subscription are transfer, boleto, 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", "boleto-payment"]
Attributes:
:id
[string, default nil]: unique id returned when the webhook is created. ex: "5656565656565656"
create(parameters \\ [])
View Sourcecreate( user: StarkBank.User.Project.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):
:url
[string]: url to which notification events will be sent to. ex: "https://webhook.site/60e9c18e-4b5c-4369-bda1-ab5fcd8e1b29":subscriptions
[list of strings]: list of any non-empty combination of the available services. ex: ["transfer", "boleto-payment"]
Parameters (optional):
:user
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.
Return:
- Webhook struct with updated attributes
Same as create(), but it will unwrap the error tuple and raise in case of errors.
delete(id, options \\ [])
View Sourcedelete(binary(), [{:user, StarkBank.User.Project.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
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.
Return:
- deleted Webhook with updated attributes
delete!(id, options \\ [])
View Sourcedelete!(binary(), [{:user, StarkBank.User.Project.t() | nil}]) :: StarkBank.Webhook.t()
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
get(id, options \\ [])
View Sourceget(binary(), [{:user, StarkBank.User.Project.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
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.
Return:
- Webhook struct with updated attributes
get!(id, options \\ [])
View Sourceget!(binary(), [{:user, StarkBank.User.Project.t() | nil}]) :: StarkBank.Webhook.t()
Same as get(), but it will unwrap the error tuple and raise in case of errors.
query(options \\ [])
View Sourcequery(limit: integer(), user: StarkBank.User.Project.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
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project has not been set in configs.
Return:
- stream of Webhook structs with updated attributes
Same as query(), but it will unwrap the error tuple and raise in case of errors.