Class: WhopSDK::Resources::Apps

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

Overview

An App is software you build on Whop. It can be a hosted web app served at <route>.whop.app or an API integration installed as an experience, and it belongs to the account that owns its credentials, settings, builds, and runtime logs.

Use the Apps API to manage app configuration and, for hosted apps, read server runtime logs for console output, uncaught exceptions, and failed requests. Logs are retained for 7 days and can be filtered by build, level, time window, and message text.

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:



237
238
239
# File 'lib/whop_sdk/resources/apps.rb', line 237

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Register a new app on the Whop developer platform. Apps provide custom experiences that can be added to products.

Required permissions:

  • developer:create_app
  • developer:manage_api_key
  • developer:update_app

'biz_'

Parameters:

  • company_id (String)

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

  • name (String)

    The display name for the app, shown to users on the app store and product pages.

  • base_url (String, nil)

    The base production URL where the app is hosted, such as 'https://myapp.example.

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

    The icon image for the app in PNG, JPEG, or GIF format.

  • redirect_uris (Array<String>, nil)

    The whitelisted OAuth callback URLs that users are redirected to after authorizi

  • route (String, nil)

    The unique subdomain route where the app's hosted web builds are served, such as

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

Returns:

See Also:



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

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, app_type: 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.

Returns a paginated list of apps on the Whop platform, with optional filtering by company, type, view support, and search query.

Parameters:

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • app_type (Symbol, WhopSDK::Models::AppType, nil)

    The type of end-user an app is built for

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • company_id (String, nil)

    Filter apps to only those created by this company, starting with 'biz_'.

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

    A search string to filter apps by name, such as 'chat' or 'analytics'.

  • verified_apps_only (Boolean, nil)

    Whether to only return apps that have been verified by Whop. Useful for populati

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



177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/whop_sdk/resources/apps.rb', line 177

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

#logs(id, after: nil, app_build_id: nil, before: nil, created_after: nil, created_before: nil, first: nil, level: nil, query: nil, request_options: {}) ⇒ WhopSDK::Models::AppLogsResponse

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

Lists a hosted app's server runtime logs, most recent first: console output, uncaught exceptions, and failed-request summaries captured on whop.app hosting. Logs are retained for 7 days.

Parameters:

  • id (String)

    The ID of the app, which will look like app_*.

  • after (String)

    A cursor for fetching logs after a previous page.

  • app_build_id (String)

    Only return logs from this build.

  • before (String)

    A cursor for fetching logs before a later page.

  • created_after (Time)

    Start of the time window as an ISO 8601 timestamp. Defaults to 7 days before cre

  • created_before (Time)

    End of the time window as an ISO 8601 timestamp. Defaults to now.

  • first (Integer)

    The number of log lines to return (max 500).

  • level (Symbol, WhopSDK::Models::AppLogsParams::Level)

    Only return console lines of this level.

  • query (String)

    Only return logs whose message contains this text (case-insensitive).

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

Returns:

See Also:



222
223
224
225
226
227
228
229
230
231
232
# File 'lib/whop_sdk/resources/apps.rb', line 222

def logs(id, params = {})
  parsed, options = WhopSDK::AppLogsParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["apps/%1$s/logs", id],
    query: query,
    model: WhopSDK::Models::AppLogsResponse,
    options: options
  )
end

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

Retrieves the details of an existing app.

Required permissions:

  • developer:manage_api_key
  • developer:update_app

Parameters:

  • id (String)

    The unique identifier of the app to retrieve.

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

Returns:

See Also:



68
69
70
71
72
73
74
75
# File 'lib/whop_sdk/resources/apps.rb', line 68

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, app_type: nil, base_url: nil, dashboard_path: nil, description: nil, discover_path: nil, experience_path: nil, icon: nil, name: nil, oauth_client_type: nil, openapi_path: nil, redirect_uris: nil, required_scopes: nil, route: nil, secrets: nil, skills_path: nil, status: nil, request_options: {}) ⇒ WhopSDK::Models::App

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

Update the settings, metadata, or status of an existing app on the Whop developer platform.

Required permissions:

  • developer:update_app
  • developer:manage_api_key

Parameters:

  • id (String)

    The unique identifier of the app to update, starting with 'app_'.

  • app_store_description (String, nil)

    The detailed description shown on the app store's in-depth app view page.

  • app_type (Symbol, WhopSDK::Models::AppType, nil)

    The type of end-user an app is built for

  • base_url (String, nil)

    The base production URL where the app is hosted, such as 'https://myapp.example.

  • dashboard_path (String, nil)

    The URL path for the company dashboard view of the app, such as '/dashboard'.

  • description (String, nil)

    A short description of the app shown in listings and search results.

  • discover_path (String, nil)

    The URL path for the discover view of the app, such as '/discover'.

  • experience_path (String, nil)

    The URL path for the member-facing hub view of the app, such as '/experiences/[e

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

    The icon image for the app, used in listings and navigation.

  • name (String, nil)

    The display name for the app, shown to users on the app store and product pages.

  • oauth_client_type (Symbol, WhopSDK::Models::AppUpdateParams::OAuthClientType, nil)

    How this app authenticates at the OAuth token endpoint.

  • openapi_path (String, nil)

    The URL path to the OpenAPI spec file of the app, such as '/assets/openapi.json'

  • redirect_uris (Array<String>, nil)

    The whitelisted OAuth callback URLs that users are redirected to after authorizi

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

    The permission scopes the app will request from users when they install it.

  • route (String, nil)

    The unique subdomain route where the app's hosted web builds are served, such as

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

    Secrets to add or overwrite on the app, as an object of string values (e.g. {"MA

  • skills_path (String, nil)

    The URL path to the skills directory of the app, such as '/assets/skills/'.

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

    The status of an experience interface

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

Returns:

See Also:



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

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