Class: WhopSDK::Resources::AccessTokens

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AccessTokens

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

Parameters:



41
42
43
# File 'lib/whop_sdk/resources/access_tokens.rb', line 41

def initialize(client:)
  @client = client
end

Instance Method Details

#create(scoped_actions: , target_resource_id: , target_resource_type: , expires_at: nil, request_options: {}) ⇒ WhopSDK::Models::AccessTokenCreateResponse

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

Creates an access token for a user to access a specific resource. These access tokens are designed to be used with Whop’s embedded components.

Parameters:

  • scoped_actions (Array<String>)

    Array of desired scoped actions for the access token. This list must be a subset

  • target_resource_id (String)

    The ID of the target resource (Company, User, etc.) for which the access token i

  • target_resource_type (Symbol, WhopSDK::Models::AccessTokenCreateParams::TargetResourceType)

    The type of the target resource (company, user, product, experience, etc.).

  • expires_at (Time, nil)

    The expiration timestamp for the access token. If not provided, a default expira

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

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
# File 'lib/whop_sdk/resources/access_tokens.rb', line 27

def create(params)
  parsed, options = WhopSDK::AccessTokenCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "access_tokens",
    body: parsed,
    model: WhopSDK::Models::AccessTokenCreateResponse,
    options: options
  )
end