starkbank v2.6.2 StarkBank.Event.Attempt View Source

Groups Event.Attempt related functions

Link to this section Summary

Functions

When an Event delivery fails, an event attempt will be registered. It carries information meant to help you debug event reception issues.

Receive a single Event.Attempt object previously created by the Stark Bank API by 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 Attempt 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.

Receive a stream of Event.Attempt 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.Event.Attempt{
  code: term(),
  created: term(),
  event_id: term(),
  id: term(),
  message: term(),
  webhook_id: term()
}

Link to this section Functions

Link to this function

%StarkBank.Event.Attempt{}

View Source (struct)

When an Event delivery fails, an event attempt will be registered. It carries information meant to help you debug event reception issues.

Attributes:

  • :id [string]: unique id that identifies the delivery attempt. ex: "5656565656565656"
  • :code [string]: delivery error code. ex: badHttpStatus, badConnection, timeout
  • :message [string]: delivery error full description. ex: "HTTP POST request returned status 404"
  • :event_id [string]: ID of the Event whose delivery failed. ex: "4848484848484848"
  • :webhook_id [string]: ID of the Webhook that triggered this event. ex: "5656565656565656"
  • :created [DateTime]: datetime representing the moment when the attempt was made. ex: ~U[2020-03-26 19:32:35.418698Z]
Link to this function

get(id, options \\ [])

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

Receive a single Event.Attempt object previously created by the Stark Bank API by 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.Attempt 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}
]) :: t()

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

Link to this function

page(options \\ [])

View Source
page(
  cursor: binary(),
  limit: integer(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  event_ids: [binary()],
  webhook_ids: [binary()],
  user: StarkBank.User.Project.t() | StarkBank.User.Organization.t()
) ::
  {:ok, {binary(), [t()]}}
  | {:error, [%StarkBank.Error{code: term(), message: term()}]}

Receive a list of up to 100 Attempt 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]
  • :event_ids [list of strings, default nil]: list of Event ids to filter attempts. ex: ["5656565656565656", "4545454545454545"]
  • :webhook_ids [list of strings, default nil]: list of Webhook ids to filter attempts. ex: ["5656565656565656", "4545454545454545"]
  • :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 Attempt structs with updated attributes and cursor to retrieve the next page of Attempt objects
Link to this function

page!(options \\ [])

View Source
page!(
  cursor: binary(),
  limit: integer(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  event_ids: [binary()],
  webhook_ids: [binary()],
  user: StarkBank.User.Project.t() | StarkBank.User.Organization.t()
) :: [t()]

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

Link to this function

query(options \\ [])

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

Receive a stream of Event.Attempt 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]
  • :event_ids [list of strings, default nil]: list of Event ids to filter attempts. ex: ["5656565656565656", "4545454545454545"]
  • :webhook_ids [list of strings, default nil]: list of Webhook ids to filter attempts. ex: ["5656565656565656", "4545454545454545"]
  • :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.Attempt structs with updated attributes
Link to this function

query!(options \\ [])

View Source
query!(
  limit: integer(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  event_ids: [binary()],
  webhook_ids: [binary()],
  user: StarkBank.User.Project.t() | StarkBank.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.