Class: WhopSDK::Resources::Companies
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Companies
- Defined in:
- lib/whop_sdk/resources/companies.rb,
sig/whop_sdk/resources/companies.rbs
Instance Method Summary collapse
-
#create(title:, description: nil, email: nil, logo: nil, metadata: nil, parent_company_id: nil, send_customer_emails: nil, request_options: {}) ⇒ WhopSDK::Models::Company
Some parameter documentations has been truncated, see Models::CompanyCreateParams for more details.
-
#create_api_key(parent_company_id, child_company_id:, name: nil, permissions: nil, role: nil, request_options: {}) ⇒ WhopSDK::Models::CompanyCreateAPIKeyResponse
Some parameter documentations has been truncated, see Models::CompanyCreateAPIKeyParams for more details.
-
#initialize(client:) ⇒ Companies
constructor
private
A new instance of Companies.
-
#list(after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, parent_company_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CompanyListResponse>
Some parameter documentations has been truncated, see Models::CompanyListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Company
Retrieves the details of an existing company.
-
#update(id, affiliate_application_required: nil, affiliate_instructions: nil, banner_image: nil, description: nil, featured_affiliate_product_id: nil, logo: nil, route: nil, send_customer_emails: nil, social_links: nil, target_audience: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Company
Some parameter documentations has been truncated, see Models::CompanyUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Companies
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 Companies.
209 210 211 |
# File 'lib/whop_sdk/resources/companies.rb', line 209 def initialize(client:) @client = client end |
Instance Method Details
#create(title:, description: nil, email: nil, logo: nil, metadata: nil, parent_company_id: nil, send_customer_emails: nil, request_options: {}) ⇒ WhopSDK::Models::Company
Some parameter documentations has been truncated, see Models::CompanyCreateParams for more details.
Create a new company. Pass parent_company_id to create a connected account under a platform, or omit it to create a company for the current user.
Required permissions:
company:createcompany:basic:read
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/whop_sdk/resources/companies.rb', line 38 def create(params) parsed, = WhopSDK::CompanyCreateParams.dump_request(params) @client.request( method: :post, path: "companies", body: parsed, model: WhopSDK::Company, options: ) end |
#create_api_key(parent_company_id, child_company_id:, name: nil, permissions: nil, role: nil, request_options: {}) ⇒ WhopSDK::Models::CompanyCreateAPIKeyResponse
Some parameter documentations has been truncated, see Models::CompanyCreateAPIKeyParams for more details.
Create an API key for a connected account (child company) owned by a parent company.
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/whop_sdk/resources/companies.rb', line 195 def create_api_key(parent_company_id, params) parsed, = WhopSDK::CompanyCreateAPIKeyParams.dump_request(params) @client.request( method: :post, path: ["companies/%1$s/api_keys", parent_company_id], body: parsed, model: WhopSDK::Models::CompanyCreateAPIKeyResponse, options: ) end |
#list(after: nil, before: nil, created_after: nil, created_before: nil, direction: nil, first: nil, last: nil, parent_company_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::CompanyListResponse>
Some parameter documentations has been truncated, see Models::CompanyListParams for more details.
Returns a paginated list of companies. When parent_company_id is provided, lists connected accounts under that platform. When omitted, lists companies the current user has access to.
Required permissions:
company:basic:read
159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/whop_sdk/resources/companies.rb', line 159 def list(params = {}) parsed, = WhopSDK::CompanyListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "companies", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::CompanyListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Company
Retrieves the details of an existing company.
Required permissions:
company:basic:read
64 65 66 67 68 69 70 71 |
# File 'lib/whop_sdk/resources/companies.rb', line 64 def retrieve(id, params = {}) @client.request( method: :get, path: ["companies/%1$s", id], model: WhopSDK::Company, options: params[:request_options] ) end |
#update(id, affiliate_application_required: nil, affiliate_instructions: nil, banner_image: nil, description: nil, featured_affiliate_product_id: nil, logo: nil, route: nil, send_customer_emails: nil, social_links: nil, target_audience: nil, title: nil, request_options: {}) ⇒ WhopSDK::Models::Company
Some parameter documentations has been truncated, see Models::CompanyUpdateParams for more details.
Update a company's title, description, logo, and other settings.
Required permissions:
company:updatecompany:basic:read
114 115 116 117 118 119 120 121 122 123 |
# File 'lib/whop_sdk/resources/companies.rb', line 114 def update(id, params = {}) parsed, = WhopSDK::CompanyUpdateParams.dump_request(params) @client.request( method: :patch, path: ["companies/%1$s", id], body: parsed, model: WhopSDK::Company, options: ) end |