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,
sig/whop_sdk/resources/affiliates.rbs,
sig/whop_sdk/resources/affiliates/overrides.rbs
Defined Under Namespace
Classes: Overrides
Instance Attribute Summary collapse
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.
157 158 159 160 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 157 def initialize(client:) @client = client @overrides = WhopSDK::Resources::Affiliates::Overrides.new(client: client) end |
Instance Attribute Details
#overrides ⇒ WhopSDK::Resources::Affiliates::Overrides (readonly)
7 8 9 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 7 def overrides @overrides end |
Instance Method Details
#archive(id, request_options: {}) ⇒ Boolean
Archives an existing Affiliate
Required permissions:
affiliate:update
121 122 123 124 125 126 127 128 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 121 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
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 26 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
93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 93 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
52 53 54 55 56 57 58 59 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 52 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
145 146 147 148 149 150 151 152 |
# File 'lib/whop_sdk/resources/affiliates.rb', line 145 def unarchive(id, params = {}) @client.request( method: :post, path: ["affiliates/%1$s/unarchive", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |