Class: WhopSDK::Resources::CourseChapters
- Inherits:
-
Object
- Object
- WhopSDK::Resources::CourseChapters
- Defined in:
- lib/whop_sdk/resources/course_chapters.rb
Overview
Course chapters
Instance Method Summary collapse
-
#create(course_id:, title: nil, request_options: {}) ⇒ WhopSDK::Models::CourseChapter
Some parameter documentations has been truncated, see Models::CourseChapterCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a chapter and all of its lessons from a course.
-
#initialize(client:) ⇒ CourseChapters
constructor
private
A new instance of CourseChapters.
-
#list(course_id:, after: nil, before: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CourseChapterListResponse>
Returns a paginated list of chapters within a course, ordered by position.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::CourseChapter
Retrieves the details of an existing course chapter.
-
#update(id, title:, request_options: {}) ⇒ WhopSDK::Models::CourseChapter
Update a chapter’s title within a course.
Constructor Details
#initialize(client:) ⇒ CourseChapters
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 CourseChapters.
153 154 155 |
# File 'lib/whop_sdk/resources/course_chapters.rb', line 153 def initialize(client:) @client = client end |
Instance Method Details
#create(course_id:, title: nil, request_options: {}) ⇒ WhopSDK::Models::CourseChapter
Some parameter documentations has been truncated, see Models::CourseChapterCreateParams for more details.
Create a new chapter within a course to organize lessons into sections.
Required permissions:
-
‘courses:update`
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/whop_sdk/resources/course_chapters.rb', line 27 def create(params) parsed, = WhopSDK::CourseChapterCreateParams.dump_request(params) @client.request( method: :post, path: "course_chapters", body: parsed, model: WhopSDK::CourseChapter, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a chapter and all of its lessons from a course.
Required permissions:
-
‘courses:update`
141 142 143 144 145 146 147 148 |
# File 'lib/whop_sdk/resources/course_chapters.rb', line 141 def delete(id, params = {}) @client.request( method: :delete, path: ["course_chapters/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#list(course_id:, after: nil, before: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CourseChapterListResponse>
Returns a paginated list of chapters within a course, ordered by position.
Required permissions:
-
‘courses:read`
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/whop_sdk/resources/course_chapters.rb', line 113 def list(params) parsed, = WhopSDK::CourseChapterListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "course_chapters", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::CourseChapterListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::CourseChapter
Retrieves the details of an existing course chapter.
Required permissions:
-
‘courses:read`
53 54 55 56 57 58 59 60 |
# File 'lib/whop_sdk/resources/course_chapters.rb', line 53 def retrieve(id, params = {}) @client.request( method: :get, path: ["course_chapters/%1$s", id], model: WhopSDK::CourseChapter, options: params[:request_options] ) end |
#update(id, title:, request_options: {}) ⇒ WhopSDK::Models::CourseChapter
Update a chapter’s title within a course.
Required permissions:
-
‘courses:update`
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/whop_sdk/resources/course_chapters.rb', line 79 def update(id, params) parsed, = WhopSDK::CourseChapterUpdateParams.dump_request(params) @client.request( method: :patch, path: ["course_chapters/%1$s", id], body: parsed, model: WhopSDK::CourseChapter, options: ) end |