Class: WhopSDK::Resources::CompanyTokenTransactions

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

Overview

Company token transactions

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ CompanyTokenTransactions

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

Parameters:



109
110
111
# File 'lib/whop_sdk/resources/company_token_transactions.rb', line 109

def initialize(client:)
  @client = client
end

Instance Method Details

#create(body:, request_options: {}) ⇒ WhopSDK::Models::CompanyTokenTransaction

Create a token transaction to add, subtract, or transfer tokens for a member within a company.

Required permissions:

  • ‘company_token_transaction:create`

  • ‘member:basic:read`

  • ‘company:basic:read`



25
26
27
28
29
30
31
32
33
34
# File 'lib/whop_sdk/resources/company_token_transactions.rb', line 25

def create(params)
  parsed, options = WhopSDK::CompanyTokenTransactionCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "company_token_transactions",
    body: parsed[:body],
    model: WhopSDK::CompanyTokenTransaction,
    options: options
  )
end

#list(company_id:, after: nil, before: nil, first: nil, last: nil, transaction_type: nil, user_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CompanyTokenTransactionListResponse>

Returns a paginated list of token transactions for a user or company, depending on the authenticated actor, with optional filtering by user and transaction type.

Required permissions:

  • ‘company_token_transaction:read`

  • ‘member:basic:read`

  • ‘company:basic:read`

Parameters:

  • company_id (String)

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

  • last (Integer, nil)

    Returns the last n elements from the list.

  • transaction_type (Symbol, WhopSDK::Models::CompanyTokenTransactionType, nil)

    The type of token transaction

  • user_id (String, nil)

    Filter transactions to only those involving this specific user.

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

Returns:

See Also:



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

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

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

Retrieves the details of an existing company token transaction.

Required permissions:

  • ‘company_token_transaction:read`

  • ‘member:basic:read`

  • ‘company:basic:read`

Parameters:

  • id (String)

    The unique identifier of the token transaction to retrieve.

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

Returns:

See Also:



53
54
55
56
57
58
59
60
# File 'lib/whop_sdk/resources/company_token_transactions.rb', line 53

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