Current section
Files
Jump to
Current section
Files
lib/thinkific/api/bundles.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.Bundles do
@moduledoc """
API calls for all endpoints tagged `Bundles`.
"""
alias Thinkific.Connection
import Thinkific.RequestBuilder
@doc """
createEnrollmentInBundle
This endpoint enrolls a User in a Bundle and each of the Courses contained within the Bundle
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): ID of the bundle in a form of integer
- opts (KeywordList): [optional] Optional parameters
- :body (BundlesEnrollmentsRequest):
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec create_enrollment_in_bundle(Tesla.Env.client, float(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def create_enrollment_in_bundle(connection, id, opts \\ []) do
optional_params = %{
:"body" => :body
}
%{}
|> method(:post)
|> url("/bundles/#{id}/enrollments")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
@doc """
getBundleByID
Retrieves the Bundle identified by the provided id
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): ID of the Bundle in the form of an integer
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Thinkific.Model.BundleResponse{}} on success
{:error, info} on failure
"""
@spec get_bundle_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.BundleResponse.t} | {:error, Tesla.Env.t}
def get_bundle_by_id(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/bundles/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Thinkific.Model.BundleResponse{})
end
@doc """
getBundleEnrollments
Retrieves all the enrollments in the bundle identified by the provided id
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): ID of the Bundle in the form of an integer
- 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.GetEnrollmentsResponse{}} on success
{:error, info} on failure
"""
@spec get_bundle_enrollments(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.GetEnrollmentsResponse.t} | {:error, Tesla.Env.t}
def get_bundle_enrollments(connection, id, opts \\ []) do
optional_params = %{
:"page" => :query,
:"limit" => :query
}
%{}
|> method(:get)
|> url("/bundles/#{id}/enrollments")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Thinkific.Model.GetEnrollmentsResponse{})
end
@doc """
List Courses by bundle ID
Retrieves the Courses within the Bundle identified by the provided id
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): ID of the Bundle in the form of an integer
- 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.GetCoursesResponse{}} on success
{:error, info} on failure
"""
@spec list_coursesbybundle_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.GetCoursesResponse.t} | {:error, Tesla.Env.t}
def list_coursesbybundle_id(connection, id, opts \\ []) do
optional_params = %{
:"page" => :query,
:"limit" => :query
}
%{}
|> method(:get)
|> url("/bundles/#{id}/courses")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Thinkific.Model.GetCoursesResponse{})
end
@doc """
updateEnrollmentsInBundle
This endpoint updates a User’s Enrollment in a Bundle and each of the Courses contained within the Bundle.
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): ID of the bundle in a form of integer
- opts (KeywordList): [optional] Optional parameters
- :body (BundlesEnrollmentsRequest):
## Returns
{:ok, %{}} on success
{:error, info} on failure
"""
@spec update_enrollments_in_bundle(Tesla.Env.client, float(), keyword()) :: {:ok, nil} | {:error, Tesla.Env.t}
def update_enrollments_in_bundle(connection, id, opts \\ []) do
optional_params = %{
:"body" => :body
}
%{}
|> method(:put)
|> url("/bundles/#{id}/enrollments")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(false)
end
end