Class: WhopSDK::Resources::Affiliates
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Affiliates
- Defined in:
- lib/whop_sdk/resources/affiliates.rb,
lib/whop_sdk/resources/affiliates/overrides.rb
Overview
Affiliates
Defined Under Namespace
Classes: Overrides
Instance Attribute Summary collapse
-
#overrides ⇒ WhopSDK::Resources::Affiliates::Overrides
readonly
Affiliates.
Instance Method Summary collapse
-
#archive(id, request_options: {}) ⇒ Boolean
Archives an existing Affiliate.
-
#create(company_id:, user_identifier:, request_options: {}) ⇒ WhopSDK::Models::Affiliate
Creates or finds an affiliate for a company and user.
-
#initialize(client:) ⇒ Affiliates
constructor
private
A new instance of Affiliates.
-
#list(company_id:, after: nil, before: nil, direction: nil, first: nil, last: nil, order: nil, query: nil, status: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::AffiliateListResponse>
Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Affiliate
Retrieves the details of an existing affiliate.
-
#unarchive(id, request_options: {}) ⇒ Boolean
Unarchives an existing Affiliate.
Constructor Details
#initialize(client:) ⇒ Affiliates
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 Affiliates.
159 160 161 162 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 159 def initialize(client:) @client = client @overrides = WhopSDK::Resources::Affiliates::Overrides.new(client: client) end |
Instance Attribute Details
#overrides ⇒ WhopSDK::Resources::Affiliates::Overrides (readonly)
Affiliates
9 10 11 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 9 def overrides @overrides end |
Instance Method Details
#archive(id, request_options: {}) ⇒ Boolean
Archives an existing Affiliate
Required permissions:
-
‘affiliate:update`
123 124 125 126 127 128 129 130 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 123 def archive(id, params = {}) @client.request( method: :post, path: ["affiliates/%1$s/archive", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#create(company_id:, user_identifier:, request_options: {}) ⇒ WhopSDK::Models::Affiliate
Creates or finds an affiliate for a company and user.
Required permissions:
-
‘affiliate:create`
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 28 def create(params) parsed, = WhopSDK::AffiliateCreateParams.dump_request(params) @client.request( method: :post, path: "affiliates", body: parsed, model: WhopSDK::Affiliate, options: ) end |
#list(company_id:, after: nil, before: nil, direction: nil, first: nil, last: nil, order: nil, query: nil, status: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::AffiliateListResponse>
Returns a paginated list of affiliates for the actor in context, with optional filtering by status, search, and sorting.
Required permissions:
-
‘affiliate:basic:read`
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 95 def list(params) parsed, = WhopSDK::AffiliateListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "affiliates", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::AffiliateListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Affiliate
Retrieves the details of an existing affiliate.
Required permissions:
-
‘affiliate:basic:read`
54 55 56 57 58 59 60 61 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 54 def retrieve(id, params = {}) @client.request( method: :get, path: ["affiliates/%1$s", id], model: WhopSDK::Affiliate, options: params[:request_options] ) end |
#unarchive(id, request_options: {}) ⇒ Boolean
Unarchives an existing Affiliate
Required permissions:
-
‘affiliate:update`
147 148 149 150 151 152 153 154 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 147 def unarchive(id, params = {}) @client.request( method: :post, path: ["affiliates/%1$s/unarchive", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |