View Source StarkInfra.Webhook (starkinfra v0.0.1)
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 contract, credit-note, signer, issuing-card, issuing-invoice, issuing-purchase, pix-request.in, pix-request.out, pix-reversal.in, pix-reversal.out, pix-claim, pix-key, pix-chargeback, pix-infraction.
Same as create(), but it will unwrap the error tuple and raise in case of errors.
Send a single Webhook subscription for creation in the Stark Infra API
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
Delete a Webhook subscription entity previously created in the Stark Infra API
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Receive a single Webhook subscription struct previously created in the Stark Infra API by passing its id
Same as page(), but it will unwrap the error tuple and raise in case of errors.
Receive a list of up to 100 Webhook objects previously created in the Stark Infra API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
Same as query(), 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 Infra API
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 contract, credit-note, signer, issuing-card, issuing-invoice, issuing-purchase, pix-request.in, pix-request.out, pix-reversal.in, pix-reversal.out, pix-claim, pix-key, pix-chargeback, pix-infraction.
parameters-required
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: ["contract", "credit-note", "signer", "issuing-card", "issuing-invoice", "issuing-purchase", "pix-request.in", "pix-request.out", "pix-reversal.in", "pix-reversal.out", "pix-claim", "pix-key", "pix-chargeback", "pix-infraction"]
attributes
Attributes:
- `:id` [string, default nil]: unique id returned when the webhook is created. ex: "5656565656565656"
@spec create!( user: StarkInfra.User.Project.t() | StarkInfra.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.
@spec create( user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil, url: binary(), subscriptions: [binary()] ) :: {:ok, t()} | {:error, [StarkInfra.Error.t()]}
Send a single Webhook subscription for creation in the Stark Infra API
parameters-required
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: ["contract", "credit-note", "signer", "issuing-card", "issuing-invoice", "issuing-purchase", "pix-request.in", "pix-request.out", "pix-reversal.in", "pix-reversal.out", "pix-claim", "pix-key", "pix-chargeback", "pix-infraction"]
options
Options:
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- Webhook struct with updated attributes
@spec delete!(binary(), [ {:user, StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil} ]) :: t()
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
@spec delete(binary(), [ {:user, StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil} ]) :: {:ok, t()} | {:error, [%StarkInfra.Error{code: term(), message: term()}]}
Delete a Webhook subscription entity previously created in the Stark Infra API
parameters-required
Parameters (required):
- `id` [string]: Webhook unique id. ex: "5656565656565656"
options
Options:
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- deleted Webhook struct
@spec get!(binary(), [ {:user, StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil} ]) :: t()
Same as get(), but it will unwrap the error tuple and raise in case of errors.
@spec get(binary(), [ {:user, StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() | nil} ]) :: {:ok, t()} | {:error, [%StarkInfra.Error{code: term(), message: term()}]}
Receive a single Webhook subscription struct previously created in the Stark Infra API by passing its id
parameters-required
Parameters (required):
- `id` [string]: struct unique id. ex: "5656565656565656"
options
Options:
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- Webhook struct with updated attributes
@spec page!( cursor: binary(), limit: integer(), user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() ) :: [t()]
Same as page(), but it will unwrap the error tuple and raise in case of errors.
@spec page( cursor: binary(), limit: integer(), user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() ) :: {:ok, {binary(), [t()]}} | {:error, [%StarkInfra.Error{code: term(), message: term()}]}
Receive a list of up to 100 Webhook objects previously created in the Stark Infra API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
options
Options:
- `:cursor` [string, default nil]: cursor returned on the previous page function call
- `:limit` [integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- list of Webhook structs with updated attributes and cursor to retrieve the next page of Webhook objects
@spec query!( limit: integer(), user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() ) :: ({:cont, [t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Same as query(), but it will unwrap the error tuple and raise in case of errors.
@spec query( limit: integer(), user: StarkInfra.User.Project.t() | StarkInfra.User.Organization.t() ) :: ({:cont, {:ok, [t()]}} | {:error, [StarkInfra.Error.t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Receive a stream of Webhook subcription structs previously created in the Stark Infra API
options
Options:
- `:limit` [integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35
- `:user` [Organization/Project, default nil]: Organization or Project struct returned from StarkInfra.project(). Only necessary if default project or organization has not been set in configs.
return
Return:
- stream of Webhook structs with updated attributes