lib/braze_ex/api/export_purchases.ex

# NOTE: This file is auto generated by OpenAPI Generator 6.1.1-SNAPSHOT (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule BrazeEx.Api.ExportPurchases do
  @moduledoc """
  API calls for all endpoints tagged `ExportPurchases`.
  """

  alias BrazeEx.Connection
  import BrazeEx.RequestBuilder

  @doc """

  ## Product IDs List

  This endpoint returns paginated lists of product IDs.

  ## Rate limit

  For customers who onboarded with Braze on or after September 16, 2021, we apply a shared rate limit of 1,000 requests per hour to this endpoint. This rate limit is shared with the `/events/list` endpoint, as documented in [API rate limits](https://www.braze.com/docs/api/api_limits/).

  ## Response

  ``` json
  Content-Type: application/json
  Authorization: Bearer YOUR-REST-API-KEY
  {
  "products": [
    "5499334426779",
    "5499334819995",
    "5499335442587",
    "5499335835803",
    "Calendula Face Mask Peel",
    "Dior Lip Gloss",
    "Rice Bowl",
    "product_name"
  ],
  "message": "success"
  }

  ```

  ### Parameters

  - `connection` (BrazeEx.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:authorization` (String.t): 
    - `:page` (integer()): (Optional) Integer  The page of your product list that you would like to view.

  ### Returns

  - `{:ok, nil}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec purchases_product_list_get(Tesla.Env.client(), keyword()) ::
          {:ok, nil} | {:error, Tesla.Env.t()}
  def purchases_product_list_get(connection, opts \\ []) do
    optional_params = %{
      :Authorization => :headers,
      :page => :query
    }

    request =
      %{}
      |> method(:get)
      |> url("/purchases/product_list")
      |> add_optional_params(optional_params, opts)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, false}
    ])
  end
end