defmodule ExOAPI.Stripe.SDK.Events do
@doc """
**description**: <p>Retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook.</p>
"""
@type get_events_id_opts :: {:expand, String.t()}
@spec get_events_id(client :: ExOAPI.Client.t(), id :: String.t(), list(get_events_id_opts())) ::
{:ok, ExOAPI.Stripe.Schemas.Error.t() | ExOAPI.Stripe.Schemas.Event.t() | map()}
| {:error, any()}
def get_events_id(%ExOAPI.Client{} = client, id, opts \\ []) do
client
|> ExOAPI.Client.set_module(ExOAPI.Stripe.SDK)
|> ExOAPI.Client.add_method(:get)
|> ExOAPI.Client.add_base_url("https://api.stripe.com/", :exoapi_default)
|> ExOAPI.Client.add_path("/v1/events/{id}")
|> ExOAPI.Client.replace_in_path("id", id)
|> ExOAPI.Client.add_arg_opts(:keyword, :query, opts, [
{:expand, "expand", "deepObject", true}
])
|> ExOAPI.Client.request()
end
@doc """
**description**: <p>List events, going back up to 30 days. Each event data is rendered according to Stripe API version at its creation time, specified in <a href="/docs/api/events/object">event object</a> <code>api_version</code> attribute (not according to your current Stripe API version or <code>Stripe-Version</code> header).</p>
"""
@type get_events_opts ::
{:types, String.t()}
| {:type, String.t()}
| {:starting_after, String.t()}
| {:limit, String.t()}
| {:expand, String.t()}
| {:ending_before, String.t()}
| {:delivery_success, String.t()}
| {:created, String.t()}
@spec get_events(client :: ExOAPI.Client.t(), list(get_events_opts())) ::
{:ok,
ExOAPI.Stripe.Schemas.Error.t()
| %{
:url => String.t(),
:object => String.t() | :list,
:has_more => boolean(),
:data => [ExOAPI.Stripe.Schemas.Event.t()]
}
| map()}
| {:error, any()}
def get_events(%ExOAPI.Client{} = client, opts \\ []) do
client
|> ExOAPI.Client.set_module(ExOAPI.Stripe.SDK)
|> ExOAPI.Client.add_method(:get)
|> ExOAPI.Client.add_base_url("https://api.stripe.com/", :exoapi_default)
|> ExOAPI.Client.add_path("/v1/events")
|> ExOAPI.Client.add_arg_opts(:keyword, :query, opts, [
{:types, "types", "deepObject", true},
{:type, "type", "form", true},
{:starting_after, "starting_after", "form", true},
{:limit, "limit", "form", true},
{:expand, "expand", "deepObject", true},
{:ending_before, "ending_before", "form", true},
{:delivery_success, "delivery_success", "form", true},
{:created, "created", "deepObject", true}
])
|> ExOAPI.Client.request()
end
end