starkbank v2.6.1 StarkBank.Event View Source
Groups Webhook-Event related functions
Link to this section Summary
Functions
An Event is the notification received from the subscription to the Webhook. Events cannot be created, but may be retrieved from the Stark Bank API to list all generated updates on entities.
Delete a list of notification Event entities 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 notification Event 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 list of up to 100 Event objects previously created in the Stark Bank API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
Same as page(), but it will unwrap the error tuple and raise in case of errors.
Create a single Event struct received from event listening at subscribed user endpoint. If the provided digital signature does not check out with the StarkBank public key, an "invalidSignature" error will be returned.
Same as parse(), but it will unwrap the error tuple and raise in case of errors.
Receive a stream of notification Event structs previously created in the Stark Bank API
Same as query(), but it will unwrap the error tuple and raise in case of errors.
Update notification Event by passing id. If is_delivered is true, the event will no longer be returned on queries with is_delivered=false.
Same as update(), but it will unwrap the error tuple and raise in case of errors.
Link to this section Types
Link to this section Functions
An Event is the notification received from the subscription to the Webhook. Events cannot be created, but may be retrieved from the Stark Bank API to list all generated updates on entities.
Attributes:
:id
[string]: unique id returned when the event is created. ex: "5656565656565656":log
[Log]: a Log struct from one the subscription services (Transfer.Log, Boleto.Log, BoletoPayment.log, UtilityPayment.Log or TaxPayment.Log):created
[DateTime]: creation datetime for the notification event. ex: ~U[2020-03-26 19:32:35.418698Z]:is_delivered
[bool]: true if the event has been successfully delivered to the user url. ex: false:subscription
[string]: service that triggered this event. ex: "transfer", "utility-payment"workspace_id
[string]: ID of the Workspace that generated this event. Mostly used when multiple Workspaces have Webhooks registered to the same endpoint. ex: "4545454545454545"
Delete a list of notification Event entities previously created in the Stark Bank API
Parameters (required):
id
[string]: Event unique id. ex: "5656565656565656"
Options:
:user
[Organization/Project, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- deleted Event struct
Same as delete(), but it will unwrap the error tuple and raise in case of errors.
Receive a single notification Event 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, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- Event struct with updated attributes
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Receive a list of up to 100 Event objects previously created in the Stark Bank API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
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:after
[Date or string, default nil]: date filter for structs created only after specified date. ex: ~D[2020-03-25]:before
[Date or string, default nil]: date filter for structs created only before specified date. ex: ~D[2020-03-25]:is_delivered
[bool, default nil]: filter successfully delivered events. ex: true or false:user
[Organization/Project, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- list of Event structs with updated attributes and cursor to retrieve the next page of Event objects
Same as page(), but it will unwrap the error tuple and raise in case of errors.
parse(parameters)
View Sourceparse( content: binary(), signature: binary(), cache_pid: PID, user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: {:ok, {t(), binary()}} | {:error, [StarkBank.Error.t()]}
Create a single Event struct received from event listening at subscribed user endpoint. If the provided digital signature does not check out with the StarkBank public key, an "invalidSignature" error will be returned.
Parameters (required):
content
[string]: response content from request received at user endpoint (not parsed)signature
[string]: base-64 digital signature received at response header "Digital-Signature"
Parameters (optional):
cache_pid
[PID, default nil]: PID of the process that holds the public key cache, returned on previous parses. If not provided, a new cache process will be generated.user
[Organization/Project, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- Event struct with updated attributes
- Cache PID that holds the Stark Bank public key in order to avoid unnecessary requests to the API on future parses
Same as parse(), but it will unwrap the error tuple and raise in case of errors.
Receive a stream of notification Event 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:after
[Date or string, default nil]: date filter for structs created only after specified date. ex: ~D[2020-03-25]:before
[Date or string, default nil]: date filter for structs created only before specified date. ex: ~D[2020-03-25]:is_delivered
[bool, default nil]: filter successfully delivered events. ex: true or false:user
[Organization/Project, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- stream of Event structs with updated attributes
Same as query(), but it will unwrap the error tuple and raise in case of errors.
Update notification Event by passing id. If is_delivered is true, the event will no longer be returned on queries with is_delivered=false.
Parameters (required):
id
[list of strings]: Event unique ids. ex: "5656565656565656":is_delivered
[bool]: If true and event hasn't been delivered already, event will be set as delivered. ex: true
Parameters (optional):
:user
[Organization/Project, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- target Event with updated attributes
Same as update(), but it will unwrap the error tuple and raise in case of errors.