Class: WhopSDK::Resources::Audiences
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Audiences
- Defined in:
- lib/whop_sdk/resources/audiences.rb,
sig/whop_sdk/resources/audiences.rbs
Overview
An Audience represents a customer list uploaded to Whop for ad targeting. Audiences belong to an account and sync to supported ad platforms as custom audiences.
Use the Audiences API to create audiences from CSV uploads, monitor processing
status, and list or delete audiences for an account. Created audiences are
usable for targeting after processing reaches ready or partial.
Instance Method Summary collapse
-
#create(account_id:, column_mapping:, file_id:, name:, request_options: {}) ⇒ WhopSDK::Models::Audience
Some parameter documentations has been truncated, see Models::AudienceCreateParams for more details.
-
#delete(audience_id, request_options: {}) ⇒ WhopSDK::Models::AudienceDeleteResponse
Deletes an audience so it is no longer available for targeting.
-
#initialize(client:) ⇒ Audiences
constructor
private
A new instance of Audiences.
-
#list(account_id:, after: nil, audience_id: nil, first: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::Audience>
Lists uploaded customer-list audiences for an account.
Constructor Details
#initialize(client:) ⇒ Audiences
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 Audiences.
99 100 101 |
# File 'lib/whop_sdk/resources/audiences.rb', line 99 def initialize(client:) @client = client end |
Instance Method Details
#create(account_id:, column_mapping:, file_id:, name:, request_options: {}) ⇒ WhopSDK::Models::Audience
Some parameter documentations has been truncated, see Models::AudienceCreateParams for more details.
Creates an audience from an uploaded customer identity CSV file and starts processing it.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/whop_sdk/resources/audiences.rb', line 34 def create(params) parsed, = WhopSDK::AudienceCreateParams.dump_request(params) @client.request( method: :post, path: "audiences", body: parsed, model: WhopSDK::Audience, options: ) end |
#delete(audience_id, request_options: {}) ⇒ WhopSDK::Models::AudienceDeleteResponse
Deletes an audience so it is no longer available for targeting.
87 88 89 90 91 92 93 94 |
# File 'lib/whop_sdk/resources/audiences.rb', line 87 def delete(audience_id, params = {}) @client.request( method: :delete, path: ["audiences/%1$s", audience_id], model: WhopSDK::Models::AudienceDeleteResponse, options: params[:request_options] ) end |
#list(account_id:, after: nil, audience_id: nil, first: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::Audience>
Lists uploaded customer-list audiences for an account. Pass audience_id to
return a specific audience.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/whop_sdk/resources/audiences.rb', line 63 def list(params) parsed, = WhopSDK::AudienceListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "audiences", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Audience, options: ) end |