Class: WhopSDK::Resources::Courses

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/courses.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Courses

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Courses.

Parameters:



190
191
192
# File 'lib/whop_sdk/resources/courses.rb', line 190

def initialize(client:)
  @client = client
end

Instance Method Details

#create(experience_id: , title: , certificate_after_completion_enabled: nil, cover_image: nil, order: nil, require_completing_lessons_in_order: nil, tagline: nil, thumbnail: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Course

Some parameter documentations has been truncated, see Models::CourseCreateParams for more details.

Creates a new course module in an experience

Required permissions:

  • ‘courses:update`

Parameters:

  • experience_id (String)

    The ID of the experience to create the course in

  • title (String)

    The title of the course

  • certificate_after_completion_enabled (Boolean, nil)

    Whether the course will award its students a PDF certificate after completing al

  • cover_image (String, nil)

    The cover image URL of the course

  • order (String, nil)

    The decimal order position of the course within its experience. If not provided,

  • require_completing_lessons_in_order (Boolean, nil)

    Whether the course requires students to complete the previous lesson before movi

  • tagline (String, nil)

    The tagline of the course

  • thumbnail (WhopSDK::Models::CourseCreateParams::Thumbnail::AttachmentInputWithDirectUploadID, WhopSDK::Models::CourseCreateParams::Thumbnail::AttachmentInputWithID, nil)

    The thumbnail for the course in png, jpeg, or gif format

  • visibility (Symbol, WhopSDK::Models::CourseVisibilities, nil)

    The available visibilities for a course. Determines how / whether a course is vi

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



40
41
42
43
44
45
46
47
48
49
# File 'lib/whop_sdk/resources/courses.rb', line 40

def create(params)
  parsed, options = WhopSDK::CourseCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "courses",
    body: parsed,
    model: WhopSDK::Course,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Boolean

Deletes a course

Required permissions:

  • ‘courses:update`

Parameters:

  • id (String)

    The ID of the course to delete

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (Boolean)

See Also:



178
179
180
181
182
183
184
185
# File 'lib/whop_sdk/resources/courses.rb', line 178

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["courses/%1$s", id],
    model: WhopSDK::Internal::Type::Boolean,
    options: params[:request_options]
  )
end

#list(after: nil, before: nil, company_id: nil, experience_id: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CourseListResponse>

Lists courses for an experience or company

Required permissions:

  • ‘courses:read`

Parameters:

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • company_id (String, nil)

    The ID of the company

  • experience_id (String, nil)

    The ID of the experience

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



151
152
153
154
155
156
157
158
159
160
161
# File 'lib/whop_sdk/resources/courses.rb', line 151

def list(params = {})
  parsed, options = WhopSDK::CourseListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "courses",
    query: parsed,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::CourseListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Course

Retrieves a course by ID

Required permissions:

  • ‘courses:read`

Parameters:

Returns:

See Also:



66
67
68
69
70
71
72
73
# File 'lib/whop_sdk/resources/courses.rb', line 66

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["courses/%1$s", id],
    model: WhopSDK::Course,
    options: params[:request_options]
  )
end

#update(id, certificate_after_completion_enabled: nil, chapters: nil, cover_image: nil, description: nil, language: nil, order: nil, require_completing_lessons_in_order: nil, tagline: nil, thumbnail: nil, title: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::Course

Some parameter documentations has been truncated, see Models::CourseUpdateParams for more details.

Updates a course

Required permissions:

  • ‘courses:update`

Parameters:

Returns:

See Also:



115
116
117
118
119
120
121
122
123
124
# File 'lib/whop_sdk/resources/courses.rb', line 115

def update(id, params = {})
  parsed, options = WhopSDK::CourseUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["courses/%1$s", id],
    body: parsed,
    model: WhopSDK::Course,
    options: options
  )
end