Class: WhopSDK::Resources::Apps

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Apps

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

Parameters:



148
149
150
# File 'lib/whop_sdk/resources/apps.rb', line 148

def initialize(client:)
  @client = client
end

Instance Method Details

#create(company_id: , name: , base_url: nil, request_options: {}) ⇒ WhopSDK::Models::App

Create a new App

Required permissions:

  • ‘developer:create_app`

  • ‘developer:manage_api_key`

Parameters:

  • company_id (String)

    The ID of the company to create the app for

  • name (String)

    The name of the app to be created

  • base_url (String, nil)

    The base URL of the app to be created

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

Returns:

See Also:



26
27
28
29
# File 'lib/whop_sdk/resources/apps.rb', line 26

def create(params)
  parsed, options = WhopSDK::AppCreateParams.dump_request(params)
  @client.request(method: :post, path: "apps", body: parsed, model: WhopSDK::App, options: options)
end

#list(after: nil, before: nil, company_id: nil, direction: nil, first: nil, last: nil, order: nil, query: nil, verified_apps_only: nil, view_type: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::AppListResponse>

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

Fetches a list of apps

Parameters:

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

  • company_id (String, nil)

    The ID of the company to filter apps by

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

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • order (Symbol, WhopSDK::Models::AppListParams::Order, nil)

    The order to fetch the apps in for discovery.

  • query (String, nil)

    The query to search for apps by name.

  • verified_apps_only (Boolean, nil)

    If true, you will only get apps that are verified by Whop. Use this to populate

  • view_type (Symbol, WhopSDK::Models::AppViewType, nil)

    The different types of an app view

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

Returns:

See Also:



133
134
135
136
137
138
139
140
141
142
143
# File 'lib/whop_sdk/resources/apps.rb', line 133

def list(params = {})
  parsed, options = WhopSDK::AppListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "apps",
    query: parsed,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::AppListResponse,
    options: options
  )
end

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

Retrieves an app by ID

Required permissions:

  • ‘developer:manage_api_key`

Parameters:

Returns:

See Also:



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

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

#update(id, app_store_description: nil, base_url: nil, dashboard_path: nil, description: nil, discover_path: nil, experience_path: nil, icon: nil, name: nil, required_scopes: nil, status: nil, request_options: {}) ⇒ WhopSDK::Models::App

Update an existing App

Required permissions:

  • ‘developer:update_app`

  • ‘developer:manage_api_key`

Parameters:

  • id (String)
  • app_store_description (String, nil)

    The description of the app for the app store in-depth app view.

  • base_url (String, nil)

    The base production url of the app

  • dashboard_path (String, nil)

    The path for the dashboard view of the app

  • description (String, nil)

    The description of the app

  • discover_path (String, nil)

    The path for the discover view of the app

  • experience_path (String, nil)

    The path for the hub view of the app

  • icon (WhopSDK::Models::AppUpdateParams::Icon, nil)

    The icon for the app

  • name (String, nil)

    The name of the app

  • required_scopes (Array<Symbol, WhopSDK::Models::AppUpdateParams::RequiredScope>, nil)

    The scopes that the app will request off of users when a user installs the app.

  • status (Symbol, WhopSDK::Models::AppStatuses, nil)

    The status of an experience interface

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

Returns:

See Also:



90
91
92
93
94
95
96
97
98
99
# File 'lib/whop_sdk/resources/apps.rb', line 90

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