Class: WhopSDK::Resources::CourseStudents

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

Overview

Course students

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CourseStudents

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 CourseStudents.

Parameters:



75
76
77
# File 'lib/whop_sdk/resources/course_students.rb', line 75

def initialize(client:)
  @client = client
end

Instance Method Details

#list(course_id:, after: nil, before: nil, first: nil, keyword: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CourseStudentListResponse>

Returns a paginated list of students enrolled in a course, with optional name filtering.

Required permissions:

  • ‘courses:read`

  • ‘course_analytics:read`

Parameters:

  • course_id (String)

    The unique identifier of the course to list enrolled students for.

  • 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.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • keyword (String, nil)

    A search term to filter students by name or username.

  • last (Integer, nil)

    Returns the last n elements from the list.

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

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/whop_sdk/resources/course_students.rb', line 59

def list(params)
  parsed, options = WhopSDK::CourseStudentListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "course_students",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::CourseStudentListResponse,
    options: options
  )
end

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

Retrieves the details of an existing course student.

Required permissions:

  • ‘courses:read`

  • ‘course_analytics:read`

Parameters:

  • id (String)

    The unique identifier of the course student record to retrieve.

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

Returns:

See Also:



23
24
25
26
27
28
29
30
# File 'lib/whop_sdk/resources/course_students.rb', line 23

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