Class: WhopSDK::Resources::Members

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

Overview

Members

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Members

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

Parameters:



102
103
104
# File 'lib/whop_sdk/resources/members.rb', line 102

def initialize(client:)
  @client = client
end

Instance Method Details

#list(access_level: nil, after: nil, before: nil, company_id: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, most_recent_actions: nil, order: nil, plan_ids: nil, product_ids: nil, promo_code_ids: nil, query: nil, statuses: nil, user_ids: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::MemberListResponse>

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

Returns a paginated list of members for a company, with extensive filtering by product, plan, status, access level, and more.

Required permissions:

  • ‘member:basic:read`

  • ‘member:email:read`

  • ‘member:phone:read`

Parameters:

  • access_level (Symbol, WhopSDK::Models::AccessLevel, nil)

    The access level a given user (or company) has to a product or company.

  • 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 unique identifier of the company to list members for.

  • created_after (Time, nil)

    Only return members created after this timestamp.

  • created_before (Time, nil)

    Only return members created before this timestamp.

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • most_recent_actions (Array<Symbol, WhopSDK::Models::MemberMostRecentActions>, nil)

    Filter members by their most recent activity type.

  • order (Symbol, WhopSDK::Models::MemberListParams::Order, nil)

    Which columns can be used to sort.

  • plan_ids (Array<String>, nil)

    Filter members to only those subscribed to these specific plans.

  • product_ids (Array<String>, nil)

    Filter members to only those belonging to these specific products.

  • promo_code_ids (Array<String>, nil)

    Filter members to only those who used these specific promo codes.

  • query (String, nil)

    Search members by name, username, or email. Email filtering requires the member:

  • statuses (Array<Symbol, WhopSDK::Models::MemberStatuses>, nil)

    Filter members by their current subscription status.

  • user_ids (Array<String>, nil)

    Filter members to only those matching these specific user identifiers.

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

Returns:

See Also:



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/whop_sdk/resources/members.rb', line 86

def list(params = {})
  parsed, options = WhopSDK::MemberListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "members",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::MemberListResponse,
    options: options
  )
end

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

Retrieves the details of an existing member.

Required permissions:

  • ‘member:basic:read`

  • ‘member:email:read`

  • ‘member:phone:read`

Parameters:

  • id (String)

    The unique identifier of the member to retrieve.

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

Returns:

See Also:



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

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