Current section
Files
Jump to
Current section
Files
lib/thinkific/api/courses.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.Courses do
@moduledoc """
API calls for all endpoints tagged `Courses`.
"""
alias Thinkific.Connection
import Thinkific.RequestBuilder
@doc """
getChapterOfCourseByID
Returns the Chapter of the course identified by the provided id.
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): ID of the Chapter 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.GetChaptersResponse{}} on success
{:error, info} on failure
"""
@spec get_chapter_of_course_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.GetChaptersResponse.t} | {:error, Tesla.Env.t}
def get_chapter_of_course_by_id(connection, id, opts \\ []) do
optional_params = %{
:"page" => :query,
:"limit" => :query
}
%{}
|> method(:get)
|> url("/courses/#{id}/chapters")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Thinkific.Model.GetChaptersResponse{})
end
@doc """
getCourseByID
Returns the Course identified by the provided id.
## Parameters
- connection (Thinkific.Connection): Connection to server
- id (float()): ID of the Course in the form of an integer.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %Thinkific.Model.CourseResponse{}} on success
{:error, info} on failure
"""
@spec get_course_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.CourseResponse.t} | {:error, Tesla.Env.t}
def get_course_by_id(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/courses/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Thinkific.Model.CourseResponse{})
end
@doc """
getCourses
Retrieve a list of Courses
## 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.GetCoursesResponse{}} on success
{:error, info} on failure
"""
@spec get_courses(Tesla.Env.client, keyword()) :: {:ok, Thinkific.Model.GetCoursesResponse.t} | {:error, Tesla.Env.t}
def get_courses(connection, opts \\ []) do
optional_params = %{
:"page" => :query,
:"limit" => :query
}
%{}
|> method(:get)
|> url("/courses")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%Thinkific.Model.GetCoursesResponse{})
end
end