Class: WhopSDK::Resources::Accounts

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Accounts

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

Parameters:



163
164
165
# File 'lib/whop_sdk/resources/accounts.rb', line 163

def initialize(client:)
  @client = client
end

Instance Method Details

#create(email: nil, metadata: nil, request_options: {}) ⇒ WhopSDK::Models::Account

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

Creates an account. User tokens create business accounts; business account API keys create connected accounts.

Parameters:

  • email (String)

    The email address of the account owner. Required for business account API key re

  • metadata (Hash{Symbol=>Object})

    Arbitrary key/value metadata to store on the account.

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

Returns:

See Also:



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

def create(params = {})
  parsed, options = WhopSDK::AccountCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "accounts",
    body: parsed,
    model: WhopSDK::Account,
    options: options
  )
end

#list(page: nil, per: nil, request_options: {}) ⇒ WhopSDK::Models::AccountListResponse

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

Lists accounts visible to the credential. User tokens return the user’s business accounts; business account API keys return the requesting business account and its connected accounts.

Parameters:

  • page (Integer)

    The page number to retrieve

  • per (Integer)

    The number of resources to return per page. There is a limit of 50 results per p

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

Returns:

See Also:



129
130
131
132
133
134
135
136
137
138
139
# File 'lib/whop_sdk/resources/accounts.rb', line 129

def list(params = {})
  parsed, options = WhopSDK::AccountListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "accounts",
    query: query,
    model: WhopSDK::Models::AccountListResponse,
    options: options
  )
end

#me(request_options: {}) ⇒ WhopSDK::Models::Account

Retrieves the business account associated with the current business account API key.

Parameters:

Returns:

See Also:



151
152
153
154
155
156
157
158
# File 'lib/whop_sdk/resources/accounts.rb', line 151

def me(params = {})
  @client.request(
    method: :get,
    path: "accounts/me",
    model: WhopSDK::Account,
    options: params[:request_options]
  )
end

#retrieve(account_id, request_options: {}) ⇒ WhopSDK::Models::Account

Retrieves a single account visible to the credential, including its crypto wallet.

Parameters:

  • account_id (String)

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

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

Returns:

See Also:



46
47
48
49
50
51
52
53
# File 'lib/whop_sdk/resources/accounts.rb', line 46

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

#update(account_id, affiliate_application_required: nil, affiliate_instructions: nil, banner_image: nil, business_type: nil, description: nil, featured_affiliate_product_id: nil, industry_group: nil, industry_type: nil, logo: nil, metadata: nil, route: nil, send_customer_emails: nil, social_links: nil, target_audience: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Account

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

Updates an account. User tokens can update business accounts; business account API keys can update connected accounts.

Parameters:

  • account_id (String)

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

  • affiliate_application_required (Boolean)

    Whether prospective affiliates must submit an application before promoting this

  • affiliate_instructions (String, nil)

    Guidelines shown to affiliates promoting this account.

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

    Attachment input for the account banner image.

  • business_type (String, nil)

    The high-level business category for the account.

  • description (String, nil)

    A promotional description for the account.

  • featured_affiliate_product_id (String, nil)

    The ID of the product to feature for affiliates. Pass null to clear.

  • industry_group (String, nil)

    The industry group the account belongs to.

  • industry_type (String, nil)

    The specific industry vertical the account operates in.

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

    Attachment input for the account logo.

  • metadata (Hash{Symbol=>Object})

    Arbitrary key/value metadata to store on the account.

  • route (String, nil)

    The unique URL slug for the account.

  • send_customer_emails (Boolean)

    Whether Whop sends transactional emails to customers on behalf of this account.

  • social_links (Array<Hash{Symbol=>Object}>)

    The full list of social links to display for the account.

  • target_audience (String, nil)

    The target audience for this account.

  • title (String, nil)

    The display name of the account.

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

Returns:

See Also:



100
101
102
103
104
105
106
107
108
109
# File 'lib/whop_sdk/resources/accounts.rb', line 100

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