Class: WhopSDK::Resources::Leads

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

Overview

Leads

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Leads

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

Parameters:



155
156
157
# File 'lib/whop_sdk/resources/leads.rb', line 155

def initialize(client:)
  @client = client
end

Instance Method Details

#create(company_id:, metadata: nil, product_id: nil, referrer: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Models::Lead

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

Record a new lead for a company, capturing a potential customer’s interest in a specific product.

Required permissions:

  • ‘lead:manage`

  • ‘member:email:read`

  • ‘access_pass:basic:read`

  • ‘member:basic:read`

‘biz_

Parameters:

  • company_id (String)

    The unique identifier of the company to create the lead for, starting with

  • metadata (Hash{Symbol=>Object}, nil)

    A JSON object of custom metadata to attach to the lead for tracking purposes.

  • product_id (String, nil)

    The unique identifier of the product the lead is interested in, starting with ‘p

  • referrer (String, nil)

    The referral URL that brought the lead to the company, such as ‘example.

  • user_id (String, nil)

    The unique identifier of the user to record as the lead. If authenticated as a u

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

Returns:

See Also:



38
39
40
41
# File 'lib/whop_sdk/resources/leads.rb', line 38

def create(params)
  parsed, options = WhopSDK::LeadCreateParams.dump_request(params)
  @client.request(method: :post, path: "leads", body: parsed, model: WhopSDK::Lead, options: options)
end

#list(company_id:, after: nil, before: nil, created_after: nil, created_before: nil, first: nil, last: nil, product_ids: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::LeadListResponse>

Returns a paginated list of leads for a company, with optional filtering by product and creation date.

Required permissions:

  • ‘lead:basic:read`

  • ‘member:email:read`

  • ‘access_pass:basic:read`

  • ‘member:basic:read`

Parameters:

  • company_id (String)

    The unique identifier of the company to list leads 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.

  • created_after (Time, nil)

    Only return leads created after this timestamp.

  • created_before (Time, nil)

    Only return leads created before this timestamp.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • product_ids (Array<String>, nil)

    Filter leads to only those associated with these specific product identifiers.

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

Returns:

See Also:



139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/whop_sdk/resources/leads.rb', line 139

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

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

Retrieves the details of an existing lead.

Required permissions:

  • ‘lead:basic:read`

  • ‘member:email:read`

  • ‘access_pass:basic:read`

  • ‘member:basic:read`

Parameters:

  • id (String)

    The unique identifier of the lead to retrieve.

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

Returns:

See Also:



61
62
63
64
65
66
67
68
# File 'lib/whop_sdk/resources/leads.rb', line 61

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

#update(id, metadata: nil, referrer: nil, request_options: {}) ⇒ WhopSDK::Models::Lead

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

Update the metadata or referrer information on an existing lead record.

Required permissions:

  • ‘lead:manage`

  • ‘member:email:read`

  • ‘access_pass:basic:read`

  • ‘member:basic:read`

Parameters:

  • id (String)

    The unique identifier of the lead to update, starting with ‘lead_’.

  • metadata (Hash{Symbol=>Object}, nil)

    A JSON object of custom metadata to set on the lead, replacing any existing meta

  • referrer (String, nil)

    The updated referral URL for the lead, such as ‘example.com/landing’.

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

Returns:

See Also:



95
96
97
98
99
100
101
102
103
104
# File 'lib/whop_sdk/resources/leads.rb', line 95

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