late-sdk 0.0.98 → 0.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +53 -0
- data/docs/Ad.md +58 -0
- data/docs/AdAudiencesApi.md +365 -0
- data/docs/AdBudget.md +20 -0
- data/docs/AdCampaign.md +40 -0
- data/docs/AdCampaignsApi.md +165 -0
- data/docs/AdMetrics.md +34 -0
- data/docs/AdSchedule.md +20 -0
- data/docs/AddUsersToAdAudience200Response.md +22 -0
- data/docs/AddUsersToAdAudienceRequest.md +18 -0
- data/docs/AddUsersToAdAudienceRequestUsersInner.md +20 -0
- data/docs/AdsApi.md +726 -0
- data/docs/BoostPostRequest.md +36 -0
- data/docs/BoostPostRequestBudget.md +20 -0
- data/docs/BoostPostRequestSchedule.md +20 -0
- data/docs/BoostPostRequestTargeting.md +24 -0
- data/docs/CreateAdAudience201Response.md +20 -0
- data/docs/CreateAdAudienceRequest.md +36 -0
- data/docs/CreateStandaloneAdRequest.md +56 -0
- data/docs/GetAd200Response.md +18 -0
- data/docs/GetAdAnalytics200Response.md +20 -0
- data/docs/GetAdAnalytics200ResponseAd.md +24 -0
- data/docs/GetAdAnalytics200ResponseAnalytics.md +22 -0
- data/docs/GetAdAnalytics200ResponseAnalyticsDailyInner.md +36 -0
- data/docs/GetAdAudience200Response.md +20 -0
- data/docs/ListAdAccounts200Response.md +18 -0
- data/docs/ListAdAccounts200ResponseAccountsInner.md +24 -0
- data/docs/ListAdAudiences200Response.md +18 -0
- data/docs/ListAdAudiences200ResponseAudiencesInner.md +32 -0
- data/docs/ListAdCampaigns200Response.md +20 -0
- data/docs/ListAds200Response.md +20 -0
- data/docs/SearchAdInterests200Response.md +18 -0
- data/docs/SearchAdInterests200ResponseInterestsInner.md +22 -0
- data/docs/SyncExternalAds200Response.md +24 -0
- data/docs/UpdateAd200Response.md +20 -0
- data/docs/UpdateAdCampaignStatus200Response.md +22 -0
- data/docs/UpdateAdCampaignStatusRequest.md +20 -0
- data/docs/UpdateAdRequest.md +24 -0
- data/docs/UpdateAdRequestBudget.md +20 -0
- data/docs/UpdateAdRequestTargeting.md +24 -0
- data/lib/late-sdk/api/ad_audiences_api.rb +368 -0
- data/lib/late-sdk/api/ad_campaigns_api.rb +201 -0
- data/lib/late-sdk/api/ads_api.rb +719 -0
- data/lib/late-sdk/models/ad.rb +399 -0
- data/lib/late-sdk/models/ad_budget.rb +190 -0
- data/lib/late-sdk/models/ad_campaign.rb +293 -0
- data/lib/late-sdk/models/ad_metrics.rb +222 -0
- data/lib/late-sdk/models/ad_schedule.rb +156 -0
- data/lib/late-sdk/models/add_users_to_ad_audience200_response.rb +165 -0
- data/lib/late-sdk/models/add_users_to_ad_audience_request.rb +175 -0
- data/lib/late-sdk/models/add_users_to_ad_audience_request_users_inner.rb +157 -0
- data/lib/late-sdk/models/boost_post_request.rb +350 -0
- data/lib/late-sdk/models/boost_post_request_budget.rb +215 -0
- data/lib/late-sdk/models/boost_post_request_schedule.rb +157 -0
- data/lib/late-sdk/models/boost_post_request_targeting.rb +234 -0
- data/lib/late-sdk/models/create_ad_audience201_response.rb +156 -0
- data/lib/late-sdk/models/create_ad_audience_request.rb +391 -0
- data/lib/late-sdk/models/create_standalone_ad_request.rb +585 -0
- data/lib/late-sdk/models/get_ad200_response.rb +147 -0
- data/lib/late-sdk/models/get_ad_analytics200_response.rb +156 -0
- data/lib/late-sdk/models/get_ad_analytics200_response_ad.rb +174 -0
- data/lib/late-sdk/models/get_ad_analytics200_response_analytics.rb +169 -0
- data/lib/late-sdk/models/get_ad_analytics200_response_analytics_daily_inner.rb +238 -0
- data/lib/late-sdk/models/get_ad_audience200_response.rb +157 -0
- data/lib/late-sdk/models/list_ad_accounts200_response.rb +149 -0
- data/lib/late-sdk/models/list_ad_accounts200_response_accounts_inner.rb +175 -0
- data/lib/late-sdk/models/list_ad_audiences200_response.rb +149 -0
- data/lib/late-sdk/models/list_ad_audiences200_response_audiences_inner.rb +244 -0
- data/lib/late-sdk/models/list_ad_campaigns200_response.rb +158 -0
- data/lib/late-sdk/models/list_ads200_response.rb +158 -0
- data/lib/late-sdk/models/search_ad_interests200_response.rb +149 -0
- data/lib/late-sdk/models/search_ad_interests200_response_interests_inner.rb +165 -0
- data/lib/late-sdk/models/sync_external_ads200_response.rb +177 -0
- data/lib/late-sdk/models/update_ad200_response.rb +156 -0
- data/lib/late-sdk/models/update_ad_campaign_status200_response.rb +169 -0
- data/lib/late-sdk/models/update_ad_campaign_status_request.rb +216 -0
- data/lib/late-sdk/models/update_ad_request.rb +208 -0
- data/lib/late-sdk/models/update_ad_request_budget.rb +191 -0
- data/lib/late-sdk/models/update_ad_request_targeting.rb +235 -0
- data/lib/late-sdk/version.rb +1 -1
- data/lib/late-sdk.rb +39 -0
- data/openapi.yaml +684 -0
- data/spec/api/ad_audiences_api_spec.rb +98 -0
- data/spec/api/ad_campaigns_api_spec.rb +67 -0
- data/spec/api/ads_api_spec.rb +163 -0
- data/spec/models/ad_budget_spec.rb +46 -0
- data/spec/models/ad_campaign_spec.rb +110 -0
- data/spec/models/ad_metrics_spec.rb +84 -0
- data/spec/models/ad_schedule_spec.rb +42 -0
- data/spec/models/ad_spec.rb +172 -0
- data/spec/models/add_users_to_ad_audience200_response_spec.rb +48 -0
- data/spec/models/add_users_to_ad_audience_request_spec.rb +36 -0
- data/spec/models/add_users_to_ad_audience_request_users_inner_spec.rb +42 -0
- data/spec/models/boost_post_request_budget_spec.rb +46 -0
- data/spec/models/boost_post_request_schedule_spec.rb +42 -0
- data/spec/models/boost_post_request_spec.rb +94 -0
- data/spec/models/boost_post_request_targeting_spec.rb +54 -0
- data/spec/models/create_ad_audience201_response_spec.rb +42 -0
- data/spec/models/create_ad_audience_request_spec.rb +94 -0
- data/spec/models/create_standalone_ad_request_spec.rb +166 -0
- data/spec/models/get_ad200_response_spec.rb +36 -0
- data/spec/models/get_ad_analytics200_response_ad_spec.rb +54 -0
- data/spec/models/get_ad_analytics200_response_analytics_daily_inner_spec.rb +90 -0
- data/spec/models/get_ad_analytics200_response_analytics_spec.rb +48 -0
- data/spec/models/get_ad_analytics200_response_spec.rb +42 -0
- data/spec/models/get_ad_audience200_response_spec.rb +42 -0
- data/spec/models/list_ad_accounts200_response_accounts_inner_spec.rb +54 -0
- data/spec/models/list_ad_accounts200_response_spec.rb +36 -0
- data/spec/models/list_ad_audiences200_response_audiences_inner_spec.rb +82 -0
- data/spec/models/list_ad_audiences200_response_spec.rb +36 -0
- data/spec/models/list_ad_campaigns200_response_spec.rb +42 -0
- data/spec/models/list_ads200_response_spec.rb +42 -0
- data/spec/models/search_ad_interests200_response_interests_inner_spec.rb +48 -0
- data/spec/models/search_ad_interests200_response_spec.rb +36 -0
- data/spec/models/sync_external_ads200_response_spec.rb +54 -0
- data/spec/models/update_ad200_response_spec.rb +42 -0
- data/spec/models/update_ad_campaign_status200_response_spec.rb +48 -0
- data/spec/models/update_ad_campaign_status_request_spec.rb +50 -0
- data/spec/models/update_ad_request_budget_spec.rb +46 -0
- data/spec/models/update_ad_request_spec.rb +58 -0
- data/spec/models/update_ad_request_targeting_spec.rb +54 -0
- data/zernio-sdk-0.0.99.gem +0 -0
- metadata +158 -2
- data/zernio-sdk-0.0.98.gem +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Late::UpdateAdRequestTargeting
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
| **age_min** | **Integer** | | [optional] |
|
|
8
|
+
| **age_max** | **Integer** | | [optional] |
|
|
9
|
+
| **countries** | **Array<String>** | | [optional] |
|
|
10
|
+
| **interests** | **Array<String>** | | [optional] |
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
require 'late-sdk'
|
|
16
|
+
|
|
17
|
+
instance = Late::UpdateAdRequestTargeting.new(
|
|
18
|
+
age_min: null,
|
|
19
|
+
age_max: null,
|
|
20
|
+
countries: null,
|
|
21
|
+
interests: null
|
|
22
|
+
)
|
|
23
|
+
```
|
|
24
|
+
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zernio API
|
|
3
|
+
|
|
4
|
+
#API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.1
|
|
7
|
+
Contact: support@zernio.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Late
|
|
16
|
+
class AdAudiencesApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Add users to a customer list audience
|
|
23
|
+
# Upload user data (emails and/or phone numbers) to a customer_list audience. Data is SHA256-hashed server-side before sending to Meta. Max 10,000 users per request.
|
|
24
|
+
# @param audience_id [String]
|
|
25
|
+
# @param add_users_to_ad_audience_request [AddUsersToAdAudienceRequest]
|
|
26
|
+
# @param [Hash] opts the optional parameters
|
|
27
|
+
# @return [AddUsersToAdAudience200Response]
|
|
28
|
+
def add_users_to_ad_audience(audience_id, add_users_to_ad_audience_request, opts = {})
|
|
29
|
+
data, _status_code, _headers = add_users_to_ad_audience_with_http_info(audience_id, add_users_to_ad_audience_request, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Add users to a customer list audience
|
|
34
|
+
# Upload user data (emails and/or phone numbers) to a customer_list audience. Data is SHA256-hashed server-side before sending to Meta. Max 10,000 users per request.
|
|
35
|
+
# @param audience_id [String]
|
|
36
|
+
# @param add_users_to_ad_audience_request [AddUsersToAdAudienceRequest]
|
|
37
|
+
# @param [Hash] opts the optional parameters
|
|
38
|
+
# @return [Array<(AddUsersToAdAudience200Response, Integer, Hash)>] AddUsersToAdAudience200Response data, response status code and response headers
|
|
39
|
+
def add_users_to_ad_audience_with_http_info(audience_id, add_users_to_ad_audience_request, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: AdAudiencesApi.add_users_to_ad_audience ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'audience_id' is set
|
|
44
|
+
if @api_client.config.client_side_validation && audience_id.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'audience_id' when calling AdAudiencesApi.add_users_to_ad_audience"
|
|
46
|
+
end
|
|
47
|
+
# verify the required parameter 'add_users_to_ad_audience_request' is set
|
|
48
|
+
if @api_client.config.client_side_validation && add_users_to_ad_audience_request.nil?
|
|
49
|
+
fail ArgumentError, "Missing the required parameter 'add_users_to_ad_audience_request' when calling AdAudiencesApi.add_users_to_ad_audience"
|
|
50
|
+
end
|
|
51
|
+
# resource path
|
|
52
|
+
local_var_path = '/v1/ads/audiences/{audienceId}/users'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s))
|
|
53
|
+
|
|
54
|
+
# query parameters
|
|
55
|
+
query_params = opts[:query_params] || {}
|
|
56
|
+
|
|
57
|
+
# header parameters
|
|
58
|
+
header_params = opts[:header_params] || {}
|
|
59
|
+
# HTTP header 'Accept' (if needed)
|
|
60
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
61
|
+
# HTTP header 'Content-Type'
|
|
62
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
63
|
+
if !content_type.nil?
|
|
64
|
+
header_params['Content-Type'] = content_type
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# form parameters
|
|
68
|
+
form_params = opts[:form_params] || {}
|
|
69
|
+
|
|
70
|
+
# http body (model)
|
|
71
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(add_users_to_ad_audience_request)
|
|
72
|
+
|
|
73
|
+
# return_type
|
|
74
|
+
return_type = opts[:debug_return_type] || 'AddUsersToAdAudience200Response'
|
|
75
|
+
|
|
76
|
+
# auth_names
|
|
77
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
78
|
+
|
|
79
|
+
new_options = opts.merge(
|
|
80
|
+
:operation => :"AdAudiencesApi.add_users_to_ad_audience",
|
|
81
|
+
:header_params => header_params,
|
|
82
|
+
:query_params => query_params,
|
|
83
|
+
:form_params => form_params,
|
|
84
|
+
:body => post_body,
|
|
85
|
+
:auth_names => auth_names,
|
|
86
|
+
:return_type => return_type
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
90
|
+
if @api_client.config.debugging
|
|
91
|
+
@api_client.config.logger.debug "API called: AdAudiencesApi#add_users_to_ad_audience\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
92
|
+
end
|
|
93
|
+
return data, status_code, headers
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Create a custom audience (Meta only)
|
|
97
|
+
# Create a customer list, website retargeting, or lookalike audience on Meta (Facebook/Instagram).
|
|
98
|
+
# @param create_ad_audience_request [CreateAdAudienceRequest]
|
|
99
|
+
# @param [Hash] opts the optional parameters
|
|
100
|
+
# @return [CreateAdAudience201Response]
|
|
101
|
+
def create_ad_audience(create_ad_audience_request, opts = {})
|
|
102
|
+
data, _status_code, _headers = create_ad_audience_with_http_info(create_ad_audience_request, opts)
|
|
103
|
+
data
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Create a custom audience (Meta only)
|
|
107
|
+
# Create a customer list, website retargeting, or lookalike audience on Meta (Facebook/Instagram).
|
|
108
|
+
# @param create_ad_audience_request [CreateAdAudienceRequest]
|
|
109
|
+
# @param [Hash] opts the optional parameters
|
|
110
|
+
# @return [Array<(CreateAdAudience201Response, Integer, Hash)>] CreateAdAudience201Response data, response status code and response headers
|
|
111
|
+
def create_ad_audience_with_http_info(create_ad_audience_request, opts = {})
|
|
112
|
+
if @api_client.config.debugging
|
|
113
|
+
@api_client.config.logger.debug 'Calling API: AdAudiencesApi.create_ad_audience ...'
|
|
114
|
+
end
|
|
115
|
+
# verify the required parameter 'create_ad_audience_request' is set
|
|
116
|
+
if @api_client.config.client_side_validation && create_ad_audience_request.nil?
|
|
117
|
+
fail ArgumentError, "Missing the required parameter 'create_ad_audience_request' when calling AdAudiencesApi.create_ad_audience"
|
|
118
|
+
end
|
|
119
|
+
# resource path
|
|
120
|
+
local_var_path = '/v1/ads/audiences'
|
|
121
|
+
|
|
122
|
+
# query parameters
|
|
123
|
+
query_params = opts[:query_params] || {}
|
|
124
|
+
|
|
125
|
+
# header parameters
|
|
126
|
+
header_params = opts[:header_params] || {}
|
|
127
|
+
# HTTP header 'Accept' (if needed)
|
|
128
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
129
|
+
# HTTP header 'Content-Type'
|
|
130
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
131
|
+
if !content_type.nil?
|
|
132
|
+
header_params['Content-Type'] = content_type
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# form parameters
|
|
136
|
+
form_params = opts[:form_params] || {}
|
|
137
|
+
|
|
138
|
+
# http body (model)
|
|
139
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_ad_audience_request)
|
|
140
|
+
|
|
141
|
+
# return_type
|
|
142
|
+
return_type = opts[:debug_return_type] || 'CreateAdAudience201Response'
|
|
143
|
+
|
|
144
|
+
# auth_names
|
|
145
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
146
|
+
|
|
147
|
+
new_options = opts.merge(
|
|
148
|
+
:operation => :"AdAudiencesApi.create_ad_audience",
|
|
149
|
+
:header_params => header_params,
|
|
150
|
+
:query_params => query_params,
|
|
151
|
+
:form_params => form_params,
|
|
152
|
+
:body => post_body,
|
|
153
|
+
:auth_names => auth_names,
|
|
154
|
+
:return_type => return_type
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
158
|
+
if @api_client.config.debugging
|
|
159
|
+
@api_client.config.logger.debug "API called: AdAudiencesApi#create_ad_audience\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
160
|
+
end
|
|
161
|
+
return data, status_code, headers
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Delete a custom audience
|
|
165
|
+
# Deletes the audience from both Meta and the local database.
|
|
166
|
+
# @param audience_id [String]
|
|
167
|
+
# @param [Hash] opts the optional parameters
|
|
168
|
+
# @return [DeleteAccountGroup200Response]
|
|
169
|
+
def delete_ad_audience(audience_id, opts = {})
|
|
170
|
+
data, _status_code, _headers = delete_ad_audience_with_http_info(audience_id, opts)
|
|
171
|
+
data
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Delete a custom audience
|
|
175
|
+
# Deletes the audience from both Meta and the local database.
|
|
176
|
+
# @param audience_id [String]
|
|
177
|
+
# @param [Hash] opts the optional parameters
|
|
178
|
+
# @return [Array<(DeleteAccountGroup200Response, Integer, Hash)>] DeleteAccountGroup200Response data, response status code and response headers
|
|
179
|
+
def delete_ad_audience_with_http_info(audience_id, opts = {})
|
|
180
|
+
if @api_client.config.debugging
|
|
181
|
+
@api_client.config.logger.debug 'Calling API: AdAudiencesApi.delete_ad_audience ...'
|
|
182
|
+
end
|
|
183
|
+
# verify the required parameter 'audience_id' is set
|
|
184
|
+
if @api_client.config.client_side_validation && audience_id.nil?
|
|
185
|
+
fail ArgumentError, "Missing the required parameter 'audience_id' when calling AdAudiencesApi.delete_ad_audience"
|
|
186
|
+
end
|
|
187
|
+
# resource path
|
|
188
|
+
local_var_path = '/v1/ads/audiences/{audienceId}'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s))
|
|
189
|
+
|
|
190
|
+
# query parameters
|
|
191
|
+
query_params = opts[:query_params] || {}
|
|
192
|
+
|
|
193
|
+
# header parameters
|
|
194
|
+
header_params = opts[:header_params] || {}
|
|
195
|
+
# HTTP header 'Accept' (if needed)
|
|
196
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
197
|
+
|
|
198
|
+
# form parameters
|
|
199
|
+
form_params = opts[:form_params] || {}
|
|
200
|
+
|
|
201
|
+
# http body (model)
|
|
202
|
+
post_body = opts[:debug_body]
|
|
203
|
+
|
|
204
|
+
# return_type
|
|
205
|
+
return_type = opts[:debug_return_type] || 'DeleteAccountGroup200Response'
|
|
206
|
+
|
|
207
|
+
# auth_names
|
|
208
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
209
|
+
|
|
210
|
+
new_options = opts.merge(
|
|
211
|
+
:operation => :"AdAudiencesApi.delete_ad_audience",
|
|
212
|
+
:header_params => header_params,
|
|
213
|
+
:query_params => query_params,
|
|
214
|
+
:form_params => form_params,
|
|
215
|
+
:body => post_body,
|
|
216
|
+
:auth_names => auth_names,
|
|
217
|
+
:return_type => return_type
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
221
|
+
if @api_client.config.debugging
|
|
222
|
+
@api_client.config.logger.debug "API called: AdAudiencesApi#delete_ad_audience\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
223
|
+
end
|
|
224
|
+
return data, status_code, headers
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Get audience details
|
|
228
|
+
# Returns the local audience record and fresh data from Meta (if available).
|
|
229
|
+
# @param audience_id [String]
|
|
230
|
+
# @param [Hash] opts the optional parameters
|
|
231
|
+
# @return [GetAdAudience200Response]
|
|
232
|
+
def get_ad_audience(audience_id, opts = {})
|
|
233
|
+
data, _status_code, _headers = get_ad_audience_with_http_info(audience_id, opts)
|
|
234
|
+
data
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Get audience details
|
|
238
|
+
# Returns the local audience record and fresh data from Meta (if available).
|
|
239
|
+
# @param audience_id [String]
|
|
240
|
+
# @param [Hash] opts the optional parameters
|
|
241
|
+
# @return [Array<(GetAdAudience200Response, Integer, Hash)>] GetAdAudience200Response data, response status code and response headers
|
|
242
|
+
def get_ad_audience_with_http_info(audience_id, opts = {})
|
|
243
|
+
if @api_client.config.debugging
|
|
244
|
+
@api_client.config.logger.debug 'Calling API: AdAudiencesApi.get_ad_audience ...'
|
|
245
|
+
end
|
|
246
|
+
# verify the required parameter 'audience_id' is set
|
|
247
|
+
if @api_client.config.client_side_validation && audience_id.nil?
|
|
248
|
+
fail ArgumentError, "Missing the required parameter 'audience_id' when calling AdAudiencesApi.get_ad_audience"
|
|
249
|
+
end
|
|
250
|
+
# resource path
|
|
251
|
+
local_var_path = '/v1/ads/audiences/{audienceId}'.sub('{' + 'audienceId' + '}', CGI.escape(audience_id.to_s))
|
|
252
|
+
|
|
253
|
+
# query parameters
|
|
254
|
+
query_params = opts[:query_params] || {}
|
|
255
|
+
|
|
256
|
+
# header parameters
|
|
257
|
+
header_params = opts[:header_params] || {}
|
|
258
|
+
# HTTP header 'Accept' (if needed)
|
|
259
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
260
|
+
|
|
261
|
+
# form parameters
|
|
262
|
+
form_params = opts[:form_params] || {}
|
|
263
|
+
|
|
264
|
+
# http body (model)
|
|
265
|
+
post_body = opts[:debug_body]
|
|
266
|
+
|
|
267
|
+
# return_type
|
|
268
|
+
return_type = opts[:debug_return_type] || 'GetAdAudience200Response'
|
|
269
|
+
|
|
270
|
+
# auth_names
|
|
271
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
272
|
+
|
|
273
|
+
new_options = opts.merge(
|
|
274
|
+
:operation => :"AdAudiencesApi.get_ad_audience",
|
|
275
|
+
:header_params => header_params,
|
|
276
|
+
:query_params => query_params,
|
|
277
|
+
:form_params => form_params,
|
|
278
|
+
:body => post_body,
|
|
279
|
+
:auth_names => auth_names,
|
|
280
|
+
:return_type => return_type
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
284
|
+
if @api_client.config.debugging
|
|
285
|
+
@api_client.config.logger.debug "API called: AdAudiencesApi#get_ad_audience\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
286
|
+
end
|
|
287
|
+
return data, status_code, headers
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# List custom audiences
|
|
291
|
+
# Returns custom audiences for the given ad account. Supports Meta, Google, TikTok, and Pinterest.
|
|
292
|
+
# @param account_id [String] Social account ID
|
|
293
|
+
# @param ad_account_id [String] Platform ad account ID
|
|
294
|
+
# @param [Hash] opts the optional parameters
|
|
295
|
+
# @option opts [String] :platform
|
|
296
|
+
# @return [ListAdAudiences200Response]
|
|
297
|
+
def list_ad_audiences(account_id, ad_account_id, opts = {})
|
|
298
|
+
data, _status_code, _headers = list_ad_audiences_with_http_info(account_id, ad_account_id, opts)
|
|
299
|
+
data
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# List custom audiences
|
|
303
|
+
# Returns custom audiences for the given ad account. Supports Meta, Google, TikTok, and Pinterest.
|
|
304
|
+
# @param account_id [String] Social account ID
|
|
305
|
+
# @param ad_account_id [String] Platform ad account ID
|
|
306
|
+
# @param [Hash] opts the optional parameters
|
|
307
|
+
# @option opts [String] :platform
|
|
308
|
+
# @return [Array<(ListAdAudiences200Response, Integer, Hash)>] ListAdAudiences200Response data, response status code and response headers
|
|
309
|
+
def list_ad_audiences_with_http_info(account_id, ad_account_id, opts = {})
|
|
310
|
+
if @api_client.config.debugging
|
|
311
|
+
@api_client.config.logger.debug 'Calling API: AdAudiencesApi.list_ad_audiences ...'
|
|
312
|
+
end
|
|
313
|
+
# verify the required parameter 'account_id' is set
|
|
314
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
315
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAudiencesApi.list_ad_audiences"
|
|
316
|
+
end
|
|
317
|
+
# verify the required parameter 'ad_account_id' is set
|
|
318
|
+
if @api_client.config.client_side_validation && ad_account_id.nil?
|
|
319
|
+
fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAudiencesApi.list_ad_audiences"
|
|
320
|
+
end
|
|
321
|
+
allowable_values = ["facebook", "instagram", "googleads", "tiktok", "pinterest"]
|
|
322
|
+
if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
|
|
323
|
+
fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
|
|
324
|
+
end
|
|
325
|
+
# resource path
|
|
326
|
+
local_var_path = '/v1/ads/audiences'
|
|
327
|
+
|
|
328
|
+
# query parameters
|
|
329
|
+
query_params = opts[:query_params] || {}
|
|
330
|
+
query_params[:'accountId'] = account_id
|
|
331
|
+
query_params[:'adAccountId'] = ad_account_id
|
|
332
|
+
query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
|
|
333
|
+
|
|
334
|
+
# header parameters
|
|
335
|
+
header_params = opts[:header_params] || {}
|
|
336
|
+
# HTTP header 'Accept' (if needed)
|
|
337
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
338
|
+
|
|
339
|
+
# form parameters
|
|
340
|
+
form_params = opts[:form_params] || {}
|
|
341
|
+
|
|
342
|
+
# http body (model)
|
|
343
|
+
post_body = opts[:debug_body]
|
|
344
|
+
|
|
345
|
+
# return_type
|
|
346
|
+
return_type = opts[:debug_return_type] || 'ListAdAudiences200Response'
|
|
347
|
+
|
|
348
|
+
# auth_names
|
|
349
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
350
|
+
|
|
351
|
+
new_options = opts.merge(
|
|
352
|
+
:operation => :"AdAudiencesApi.list_ad_audiences",
|
|
353
|
+
:header_params => header_params,
|
|
354
|
+
:query_params => query_params,
|
|
355
|
+
:form_params => form_params,
|
|
356
|
+
:body => post_body,
|
|
357
|
+
:auth_names => auth_names,
|
|
358
|
+
:return_type => return_type
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
362
|
+
if @api_client.config.debugging
|
|
363
|
+
@api_client.config.logger.debug "API called: AdAudiencesApi#list_ad_audiences\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
364
|
+
end
|
|
365
|
+
return data, status_code, headers
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
end
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zernio API
|
|
3
|
+
|
|
4
|
+
#API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.1
|
|
7
|
+
Contact: support@zernio.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.19.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Late
|
|
16
|
+
class AdCampaignsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# List campaigns with aggregate metrics
|
|
23
|
+
# Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign. Campaign status is derived from child ad statuses (active > pending_review > paused > error > completed > cancelled > rejected).
|
|
24
|
+
# @param [Hash] opts the optional parameters
|
|
25
|
+
# @option opts [Integer] :page Page number (1-based) (default to 1)
|
|
26
|
+
# @option opts [Integer] :limit (default to 20)
|
|
27
|
+
# @option opts [String] :source (default to 'zernio')
|
|
28
|
+
# @option opts [String] :platform
|
|
29
|
+
# @option opts [String] :status Filter by derived campaign status (post-aggregation)
|
|
30
|
+
# @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta)
|
|
31
|
+
# @option opts [String] :account_id Social account ID
|
|
32
|
+
# @option opts [String] :profile_id Profile ID
|
|
33
|
+
# @return [ListAdCampaigns200Response]
|
|
34
|
+
def list_ad_campaigns(opts = {})
|
|
35
|
+
data, _status_code, _headers = list_ad_campaigns_with_http_info(opts)
|
|
36
|
+
data
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# List campaigns with aggregate metrics
|
|
40
|
+
# Returns campaigns as virtual aggregations over ad documents grouped by platform campaign ID. Metrics (spend, impressions, clicks, etc.) are summed across all ads in each campaign. Campaign status is derived from child ad statuses (active > pending_review > paused > error > completed > cancelled > rejected).
|
|
41
|
+
# @param [Hash] opts the optional parameters
|
|
42
|
+
# @option opts [Integer] :page Page number (1-based) (default to 1)
|
|
43
|
+
# @option opts [Integer] :limit (default to 20)
|
|
44
|
+
# @option opts [String] :source (default to 'zernio')
|
|
45
|
+
# @option opts [String] :platform
|
|
46
|
+
# @option opts [String] :status Filter by derived campaign status (post-aggregation)
|
|
47
|
+
# @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta)
|
|
48
|
+
# @option opts [String] :account_id Social account ID
|
|
49
|
+
# @option opts [String] :profile_id Profile ID
|
|
50
|
+
# @return [Array<(ListAdCampaigns200Response, Integer, Hash)>] ListAdCampaigns200Response data, response status code and response headers
|
|
51
|
+
def list_ad_campaigns_with_http_info(opts = {})
|
|
52
|
+
if @api_client.config.debugging
|
|
53
|
+
@api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_ad_campaigns ...'
|
|
54
|
+
end
|
|
55
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
|
|
56
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdCampaignsApi.list_ad_campaigns, must be greater than or equal to 1.'
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
|
|
60
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ad_campaigns, must be smaller than or equal to 100.'
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
64
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdCampaignsApi.list_ad_campaigns, must be greater than or equal to 1.'
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
allowable_values = ["zernio", "all"]
|
|
68
|
+
if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
|
|
69
|
+
fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
|
|
70
|
+
end
|
|
71
|
+
allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"]
|
|
72
|
+
if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
|
|
73
|
+
fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
|
|
74
|
+
end
|
|
75
|
+
allowable_values = ["active", "paused", "pending_review", "rejected", "completed", "cancelled", "error"]
|
|
76
|
+
if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
|
|
77
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
|
|
78
|
+
end
|
|
79
|
+
# resource path
|
|
80
|
+
local_var_path = '/v1/ads/campaigns'
|
|
81
|
+
|
|
82
|
+
# query parameters
|
|
83
|
+
query_params = opts[:query_params] || {}
|
|
84
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
|
85
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
86
|
+
query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
|
|
87
|
+
query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
|
|
88
|
+
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
|
89
|
+
query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
|
|
90
|
+
query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
|
|
91
|
+
query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
|
|
92
|
+
|
|
93
|
+
# header parameters
|
|
94
|
+
header_params = opts[:header_params] || {}
|
|
95
|
+
# HTTP header 'Accept' (if needed)
|
|
96
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
97
|
+
|
|
98
|
+
# form parameters
|
|
99
|
+
form_params = opts[:form_params] || {}
|
|
100
|
+
|
|
101
|
+
# http body (model)
|
|
102
|
+
post_body = opts[:debug_body]
|
|
103
|
+
|
|
104
|
+
# return_type
|
|
105
|
+
return_type = opts[:debug_return_type] || 'ListAdCampaigns200Response'
|
|
106
|
+
|
|
107
|
+
# auth_names
|
|
108
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
109
|
+
|
|
110
|
+
new_options = opts.merge(
|
|
111
|
+
:operation => :"AdCampaignsApi.list_ad_campaigns",
|
|
112
|
+
:header_params => header_params,
|
|
113
|
+
:query_params => query_params,
|
|
114
|
+
:form_params => form_params,
|
|
115
|
+
:body => post_body,
|
|
116
|
+
:auth_names => auth_names,
|
|
117
|
+
:return_type => return_type
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
121
|
+
if @api_client.config.debugging
|
|
122
|
+
@api_client.config.logger.debug "API called: AdCampaignsApi#list_ad_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
123
|
+
end
|
|
124
|
+
return data, status_code, headers
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Pause or resume a campaign
|
|
128
|
+
# Updates the status of all ads in a campaign. Makes one platform API call (not per-ad) since status cascades through the campaign hierarchy. Ads in terminal statuses (rejected, completed, cancelled) are automatically skipped.
|
|
129
|
+
# @param campaign_id [String] Platform campaign ID
|
|
130
|
+
# @param update_ad_campaign_status_request [UpdateAdCampaignStatusRequest]
|
|
131
|
+
# @param [Hash] opts the optional parameters
|
|
132
|
+
# @return [UpdateAdCampaignStatus200Response]
|
|
133
|
+
def update_ad_campaign_status(campaign_id, update_ad_campaign_status_request, opts = {})
|
|
134
|
+
data, _status_code, _headers = update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts)
|
|
135
|
+
data
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Pause or resume a campaign
|
|
139
|
+
# Updates the status of all ads in a campaign. Makes one platform API call (not per-ad) since status cascades through the campaign hierarchy. Ads in terminal statuses (rejected, completed, cancelled) are automatically skipped.
|
|
140
|
+
# @param campaign_id [String] Platform campaign ID
|
|
141
|
+
# @param update_ad_campaign_status_request [UpdateAdCampaignStatusRequest]
|
|
142
|
+
# @param [Hash] opts the optional parameters
|
|
143
|
+
# @return [Array<(UpdateAdCampaignStatus200Response, Integer, Hash)>] UpdateAdCampaignStatus200Response data, response status code and response headers
|
|
144
|
+
def update_ad_campaign_status_with_http_info(campaign_id, update_ad_campaign_status_request, opts = {})
|
|
145
|
+
if @api_client.config.debugging
|
|
146
|
+
@api_client.config.logger.debug 'Calling API: AdCampaignsApi.update_ad_campaign_status ...'
|
|
147
|
+
end
|
|
148
|
+
# verify the required parameter 'campaign_id' is set
|
|
149
|
+
if @api_client.config.client_side_validation && campaign_id.nil?
|
|
150
|
+
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.update_ad_campaign_status"
|
|
151
|
+
end
|
|
152
|
+
# verify the required parameter 'update_ad_campaign_status_request' is set
|
|
153
|
+
if @api_client.config.client_side_validation && update_ad_campaign_status_request.nil?
|
|
154
|
+
fail ArgumentError, "Missing the required parameter 'update_ad_campaign_status_request' when calling AdCampaignsApi.update_ad_campaign_status"
|
|
155
|
+
end
|
|
156
|
+
# resource path
|
|
157
|
+
local_var_path = '/v1/ads/campaigns/{campaignId}/status'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
|
|
158
|
+
|
|
159
|
+
# query parameters
|
|
160
|
+
query_params = opts[:query_params] || {}
|
|
161
|
+
|
|
162
|
+
# header parameters
|
|
163
|
+
header_params = opts[:header_params] || {}
|
|
164
|
+
# HTTP header 'Accept' (if needed)
|
|
165
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
166
|
+
# HTTP header 'Content-Type'
|
|
167
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
168
|
+
if !content_type.nil?
|
|
169
|
+
header_params['Content-Type'] = content_type
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# form parameters
|
|
173
|
+
form_params = opts[:form_params] || {}
|
|
174
|
+
|
|
175
|
+
# http body (model)
|
|
176
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_campaign_status_request)
|
|
177
|
+
|
|
178
|
+
# return_type
|
|
179
|
+
return_type = opts[:debug_return_type] || 'UpdateAdCampaignStatus200Response'
|
|
180
|
+
|
|
181
|
+
# auth_names
|
|
182
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
183
|
+
|
|
184
|
+
new_options = opts.merge(
|
|
185
|
+
:operation => :"AdCampaignsApi.update_ad_campaign_status",
|
|
186
|
+
:header_params => header_params,
|
|
187
|
+
:query_params => query_params,
|
|
188
|
+
:form_params => form_params,
|
|
189
|
+
:body => post_body,
|
|
190
|
+
:auth_names => auth_names,
|
|
191
|
+
:return_type => return_type
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
|
|
195
|
+
if @api_client.config.debugging
|
|
196
|
+
@api_client.config.logger.debug "API called: AdCampaignsApi#update_ad_campaign_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
197
|
+
end
|
|
198
|
+
return data, status_code, headers
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|