# 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.Enrollments do @moduledoc """ API calls for all endpoints tagged `Enrollments`. """ alias Thinkific.Connection import Thinkific.RequestBuilder @doc """ createEnrollment Creates a new Enrollment for specified student in specified course ## Parameters - connection (Thinkific.Connection): Connection to server - body (CreateEnrollmentRequest): New enrollment attributes - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %Thinkific.Model.EnrollmentResponse{}} on success {:error, info} on failure """ @spec create_enrollment(Tesla.Env.client, Thinkific.Model.CreateEnrollmentRequest.t, keyword()) :: {:ok, Thinkific.Model.EnrollmentResponse.t} | {:error, Tesla.Env.t} def create_enrollment(connection, body, _opts \\ []) do %{} |> method(:post) |> url("/enrollments") |> add_param(:body, :"body", body) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.EnrollmentResponse{}) end @doc """ getEnrollments Returns a list of enrollments ## 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. - :query[user_id] (float()): Search Enrollments by User ID. - :query[course_id] (float()): Search Enrollments by Course ID. - :query[email] (String.t): Search Enrollments by User email. - :query[free_trial] (boolean()): Filter for only Free Trial Enrollments when set to true. - :query[full] (boolean()): Filter for only full Enrollments when set to true. - :query[completed] (boolean()): Filter for only completed Enrollments when set to true. - :query[expired] (boolean()): Filter for only expired Enrollments when set to true. - :query[created_on] (DateTime.t): Filter for only Enrollments created on the date specified. - :query[created_before] (DateTime.t): Filter for only Enrollments created before the date specified. - :query[created_on_or_before] (DateTime.t): Filter for only Enrollments created on or before the date specified. - :query[created_after] (DateTime.t): Filter for only Enrollments created after the date specified. - :query[created_on_or_after] (DateTime.t): Filter for only Enrollments created on or after the date specified. - :query[updated_on] (DateTime.t): Filter for only Enrollments updated on the date specified. - :query[updated_before] (DateTime.t): Filter for only Enrollments updated before the date specified. - :query[updated_on_or_before] (DateTime.t): Filter for only Enrollments updated on or before the date specified. - :query[updated_after] (DateTime.t): Filter for only Enrollments updated after the date specified. ## Returns {:ok, %Thinkific.Model.GetEnrollmentsResponse{}} on success {:error, info} on failure """ @spec get_enrollments(Tesla.Env.client, keyword()) :: {:ok, Thinkific.Model.GetEnrollmentsResponse.t} | {:error, Tesla.Env.t} def get_enrollments(connection, opts \\ []) do optional_params = %{ :"page" => :query, :"limit" => :query, :"query[user_id]" => :query, :"query[course_id]" => :query, :"query[email]" => :query, :"query[free_trial]" => :query, :"query[full]" => :query, :"query[completed]" => :query, :"query[expired]" => :query, :"query[created_on]" => :query, :"query[created_before]" => :query, :"query[created_on_or_before]" => :query, :"query[created_after]" => :query, :"query[created_on_or_after]" => :query, :"query[updated_on]" => :query, :"query[updated_before]" => :query, :"query[updated_on_or_before]" => :query, :"query[updated_after]" => :query } %{} |> method(:get) |> url("/enrollments") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.GetEnrollmentsResponse{}) end @doc """ getEnrollmentsByID Returns the Enrollment identified by the provided id. ## Parameters - connection (Thinkific.Connection): Connection to server - id (float()): ID of the Enrollment in the form of an integer. - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %Thinkific.Model.EnrollmentResponse{}} on success {:error, info} on failure """ @spec get_enrollments_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.EnrollmentResponse.t} | {:error, Tesla.Env.t} def get_enrollments_by_id(connection, id, _opts \\ []) do %{} |> method(:get) |> url("/enrollments/#{id}") |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.EnrollmentResponse{}) end @doc """ updateEnrollment Updates a Enrollment for specified student in specified course ## Parameters - connection (Thinkific.Connection): Connection to server - id (float()): ID of the Enrollment in the form of an integer. - body (UpdateEnrollmentRequest): New enrollment attributes - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %Thinkific.Model.EnrollmentResponse{}} on success {:error, info} on failure """ @spec update_enrollment(Tesla.Env.client, float(), Thinkific.Model.UpdateEnrollmentRequest.t, keyword()) :: {:ok, Thinkific.Model.EnrollmentResponse.t} | {:error, Tesla.Env.t} def update_enrollment(connection, id, body, _opts \\ []) do %{} |> method(:put) |> url("/enrollments/#{id}") |> add_param(:body, :"body", body) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.EnrollmentResponse{}) end end