# 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.Chapters do @moduledoc """ API calls for all endpoints tagged `Chapters`. """ alias Thinkific.Connection import Thinkific.RequestBuilder @doc """ getChapterByID Returns a chapter ## Parameters - connection (Thinkific.Connection): Connection to server - id (float()): ID of the Chapter in the form of an integer. - opts (KeywordList): [optional] Optional parameters ## Returns {:ok, %Thinkific.Model.ChapterResponse{}} on success {:error, info} on failure """ @spec get_chapter_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.ChapterResponse.t} | {:error, Tesla.Env.t} def get_chapter_by_id(connection, id, _opts \\ []) do %{} |> method(:get) |> url("/chapters/#{id}") |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.ChapterResponse{}) end @doc """ getContentsByID Retrieves the Contents within the Chapter 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.GetContentsResponse{}} on success {:error, info} on failure """ @spec get_contents_by_id(Tesla.Env.client, float(), keyword()) :: {:ok, Thinkific.Model.GetContentsResponse.t} | {:error, Tesla.Env.t} def get_contents_by_id(connection, id, opts \\ []) do optional_params = %{ :"page" => :query, :"limit" => :query } %{} |> method(:get) |> url("/chapters/#{id}/contents") |> add_optional_params(optional_params, opts) |> Enum.into([]) |> (&Connection.request(connection, &1)).() |> decode(%Thinkific.Model.GetContentsResponse{}) end end