Current section

Files

Jump to
thinkific_admin_api lib thinkific_admin_api api course_reviews.ex
Raw

lib/thinkific_admin_api/api/course_reviews.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 ThinkificAdminAPI.Api.CourseReviews do
@moduledoc """
API calls for all endpoints tagged `CourseReviews`.
"""
alias ThinkificAdminAPI.Connection
import ThinkificAdminAPI.RequestBuilder
@doc """
createCourseReview
Create a course review
## Parameters
- connection (ThinkificAdminAPI.Connection): Connection to server
- course_id (float()): ID of the Course for which the review needs to be created for.
- body (CreateCourseReviewRequest): Course Review Attributes
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %ThinkificAdminAPI.Model.CourseReviewResponse{}} on success
{:error, info} on failure
"""
@spec create_course_review(Tesla.Env.client, float(), ThinkificAdminAPI.Model.CreateCourseReviewRequest.t, keyword()) :: {:ok, ThinkificAdminAPI.Model.CourseReviewResponse.t} | {:error, Tesla.Env.t}
def create_course_review(connection, course_id, body, _opts \\ []) do
%{}
|> method(:post)
|> url("/course_reviews")
|> add_param(:query, :"course_id", course_id)
|> add_param(:body, :"body", body)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%ThinkificAdminAPI.Model.CourseReviewResponse{})
end
@doc """
getCourseReviewByID
Retrieve a Course Review identified by the provided id.
## Parameters
- connection (ThinkificAdminAPI.Connection): Connection to server
- id (float()): ID of the Course Review in the form of an integer.
- opts (KeywordList): [optional] Optional parameters
## Returns
{:ok, %ThinkificAdminAPI.Model.CourseReviewResponse{}} on success
{:error, info} on failure
"""
@spec get_course_review_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, ThinkificAdminAPI.Model.CourseReviewResponse.t} | {:error, Tesla.Env.t}
def get_course_review_by_id(connection, id, _opts \\ []) do
%{}
|> method(:get)
|> url("/course_reviews/#{id}")
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%ThinkificAdminAPI.Model.CourseReviewResponse{})
end
@doc """
getCourseReviews
Retrieve a list of Course Reviews
## Parameters
- connection (ThinkificAdminAPI.Connection): Connection to server
- course_id (float()): ID of the Course 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.
- :approved (boolean()): If true, returns only approved Course Reviews.
## Returns
{:ok, %ThinkificAdminAPI.Model.GetCourseReviewsResponse{}} on success
{:error, info} on failure
"""
@spec get_course_reviews(Tesla.Env.client, float(), keyword()) :: {:ok, ThinkificAdminAPI.Model.GetCourseReviewsResponse.t} | {:error, Tesla.Env.t}
def get_course_reviews(connection, course_id, opts \\ []) do
optional_params = %{
:"page" => :query,
:"limit" => :query,
:"approved" => :query
}
%{}
|> method(:get)
|> url("/course_reviews")
|> add_param(:query, :"course_id", course_id)
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%ThinkificAdminAPI.Model.GetCourseReviewsResponse{})
end
end