Class: WhopSDK::Resources::People

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/people.rb,
sig/whop_sdk/resources/people.rbs

Overview

A Person represents a visitor or customer of an account, assembled from pixel events and purchase activity — ad clicks, storefront visits, and checkouts.

Use the People API to list the people of an account and retrieve a single person.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ People

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

Parameters:



94
95
96
# File 'lib/whop_sdk/resources/people.rb', line 94

def initialize(client:)
  @client = client
end

Instance Method Details

#list(account_id: nil, after: nil, before: nil, direction: nil, filters: nil, first: nil, from: nil, sort: nil, to: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::PersonListResponse>

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

Lists the people (visitors and customers) of an account, aggregated from pixel events. The account is inferred from an account API key; other credentials must pass account_id.

acco

Parameters:

  • account_id (String)

    The ID of the account, which will look like biz_*. Optional for

  • after (String)

    A cursor for fetching people after a previous page.

  • before (String)

    A cursor for fetching people before a later page.

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

    Sort direction. Defaults to desc.

  • filters (String)

    A JSON-encoded array of filters, each with field, operator, and value keys.

  • first (Integer)

    The number of people to return (default 100, max 100).

  • from (Integer)

    Start of the time range as a Unix timestamp. Defaults to 366 days before to.

  • sort (String)

    Column to sort by (e.g. last_seen_at, ltv, purchase_count). Defaults to last_see

  • to (Integer)

    End of the time range as a Unix timestamp. Defaults to now.

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

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/whop_sdk/resources/people.rb', line 78

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

#retrieve(person_id, account_id: nil, from: nil, to: nil, request_options: {}) ⇒ WhopSDK::Models::PersonRetrieveResponse

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

Retrieves one person for an account, aggregated from pixel events.

acco

Parameters:

  • person_id (String)

    The ID of the person.

  • account_id (String)

    The ID of the account, which will look like biz_*. Optional for

  • from (Integer)

    Start of the time range as a Unix timestamp.

  • to (Integer)

    End of the time range as a Unix timestamp. Defaults to now.

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

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/whop_sdk/resources/people.rb', line 33

def retrieve(person_id, params = {})
  parsed, options = WhopSDK::PersonRetrieveParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["people/%1$s", person_id],
    query: query,
    model: WhopSDK::Models::PersonRetrieveResponse,
    options: options
  )
end