Current section

Files

Jump to
ex_thinkific_api lib thinkific api external_orders.ex
Raw

lib/thinkific/api/external_orders.ex

# 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.ExternalOrders do
@moduledoc """
API calls for all endpoints tagged `ExternalOrders`.
"""
alias Thinkific.Connection
import Thinkific.RequestBuilder
@doc """
createExternalOrder
Please note that any External Orders created through the API do not appear on the orders report or dashboard in your Thinkific site. Using the External Orders endpoints will simply store the information in our database.
## Parameters
- connection (Thinkific.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
- :body (ExternalOrderRequest): External Order request
## Returns
{:ok, %Thinkific.Model.ExternalOrdersResponse{}} on success
{:error, info} on failure
"""
@spec create_external_order(Tesla.Env.client, keyword()) :: {:ok, Thinkific.Model.ExternalOrdersResponse.t} | {:error, Tesla.Env.t}
def create_external_order(connection, opts \\ []) do
optional_params = %{
:"body" => :body
}
%{}
|> method(:post)
|> url("/external_orders")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Thinkific.Model.ExternalOrdersResponse{})
end
@doc """
purchase transaction
This endpoint will create a new transaction purchase for the External Order.
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (String.t): External Order ID
- opts (KeywordList): [optional] Optional parameters
- :body (ExternalOrderTransaction): Transaction
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec purchasetransaction(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def purchasetransaction(connection, id, opts \\ []) do
optional_params = %{
:"body" => :body
}
%{}
|> method(:post)
|> url("/external_orders/#{id}/transactions/purchase")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
@doc """
refund transaction
This endpoint will create a new transaction refund for the External Order.
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): External Order ID as integer
- opts (KeywordList): [optional] Optional parameters
- :body (ExternalOrderTransaction): Transaction
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec refundtransaction(Tesla.Env.client, float(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def refundtransaction(connection, id, opts \\ []) do
optional_params = %{
:"body" => :body
}
%{}
|> method(:post)
|> url("/external_orders/#{id}/transactions/refund")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
end