# NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule Thinkific.Api.Orders do @moduledoc """ API calls for all endpoints tagged `Orders`. """ alias Thinkific.Connection import Thinkific.RequestBuilder @doc """ getOrderByID Returns the orders identified by the provided id. ## Parameters - connection (Thinkific.Connection): Connection to server - id (float()): ID of the Orders in the form of an integer. - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %Thinkific.Model.OrderResponse{}} on success {:error, info} on failure """ @spec get_order_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.OrderResponse.t} | {:error, Tesla.Env.t} def get_order_by_id(connection, id, _opts \\ []) do %{} |> method(:get) |> url("/orders/#{id}") |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.OrderResponse{}) end @doc """ getOrders Retrieve a list of Orders ## Parameters - connection (Thinkific.Connection): Connection to server - opts (KeywordList): [optional] Optional parameters - :page (float()): The page within the collection to fetch. - :limit (float()): The number of items to be returned. ## Returns {:ok, %Thinkific.Model.GetOrdersResponse{}} on success {:error, info} on failure """ @spec get_orders(Tesla.Env.client, keyword()) :: {:ok, Thinkific.Model.GetOrdersResponse.t} | {:error, Tesla.Env.t} def get_orders(connection, opts \\ []) do optional_params = %{ :"page" => :query, :"limit" => :query } %{} |> method(:get) |> url("/orders") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.GetOrdersResponse{}) end end