starkbank v0.0.2 StarkBank.Webhook View Source
Groups Webhook related functions
Webhook subscription struct:
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 log is created. ex: "5656565656565656"
Link to this section Summary
Functions
Create Webhook subscription
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
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.
Retrieve a specific Webhook subscription
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.
Retrieve Webhook subcriptions
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
create(user, url, subscriptions)
View Sourcecreate(StarkBank.User.Project.t(), binary(), [binary()]) :: {:ok, StarkBank.Webhook.t()} | {:error, [StarkBank.Error.t()]}
Create Webhook subscription
Send a single Webhook subscription for creation in the Stark Bank API
Parameters (required):
- user [Project]: Project struct returned from StarkBank.project().
- 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"]
Return:
- Webhook struct with updated attributes
Same as create(), but it will unwrap the error tuple and raise in case of errors.
delete(user, id)
View Sourcedelete(StarkBank.User.Project.t(), binary()) :: {:ok, StarkBank.Webhook.t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Delete a Webhook subscription entity
Delete a Webhook subscription entity previously created in the Stark Bank API
Parameters (required):
- user [Project]: Project struct returned from StarkBank.project().
- id [string]: Webhook unique id. ex: "5656565656565656"
Return:
- deleted Webhook with updated attributes
delete!(user, id)
View Sourcedelete!(StarkBank.User.Project.t(), binary()) :: StarkBank.Webhook.t()
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
get(user, id)
View Sourceget(StarkBank.User.Project.t(), binary()) :: {:ok, StarkBank.Webhook.t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Retrieve a specific Webhook subscription
Receive a single Webhook subscription struct previously created in the Stark Bank API by passing its id
Parameters (required):
- user [Project]: Project struct returned from StarkBank.project().
- id [string]: struct unique id. ex: "5656565656565656"
Return:
- Webhook struct with updated attributes
get!(user, id)
View Sourceget!(StarkBank.User.Project.t(), binary()) :: StarkBank.Webhook.t()
Same as get(), but it will unwrap the error tuple and raise in case of errors.
query(user, options \\ [])
View Sourcequery(StarkBank.User.Project.t(), any()) :: ({:cont, {:ok, [StarkBank.Webhook.t()]}} | {:error, [StarkBank.Error.t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Retrieve Webhook subcriptions
Receive a stream of Webhook subcription structs previously created in the Stark Bank API
Parameters (required):
- user [Project]: Project struct returned from StarkBank.project().
Parameters (optional):
- limit [integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35
Return:
- stream of Webhook structs with updated attributes
Same as query(), but it will unwrap the error tuple and raise in case of errors.