View Source StarkInfra.Event.Attempt (starkinfra v0.0.1)

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.

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

Receive a single Event.Attempt struct previously created by the Stark Infra API by 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 Attempt structs 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 Event.Attempt structs previously created in the Stark Infra API

Link to this section Types

@type t() :: %StarkInfra.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

%StarkInfra.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

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]
@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 Event.Attempt struct previously created by the Stark Infra API by 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:

- Event.Attempt struct with updated attributes
@spec page!(
  cursor: binary(),
  limit: integer(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  event_ids: [binary()],
  webhook_ids: [binary()],
  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(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  event_ids: [binary()],
  webhook_ids: [binary()],
  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 Attempt structs 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
- `: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 StarkInfra.project(). Only necessary if default project or organization has not been set in configs.

return

Return:

- list of Attempt structs with updated attributes and cursor to retrieve the next page of Attempt structs
@spec query!(
  limit: integer(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  event_ids: [binary()],
  webhook_ids: [binary()],
  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(),
  after: Date.t() | binary(),
  before: Date.t() | binary(),
  event_ids: [binary()],
  webhook_ids: [binary()],
  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 Event.Attempt 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
- `: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 StarkInfra.project(). Only necessary if default project or organization has not been set in configs.

return

Return:

- stream of Event.Attempt structs with updated attributes