late-sdk 0.0.549 → 0.0.551

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -74
  3. data/docs/AdAccountsApi.md +915 -0
  4. data/docs/AdCampaignsApi.md +615 -15
  5. data/docs/AdCreativesApi.md +815 -0
  6. data/docs/AdInsightsApi.md +415 -0
  7. data/docs/AdTargetingApi.md +371 -0
  8. data/docs/AnalyticsApi.md +7 -7
  9. data/docs/ConversionsApi.md +890 -0
  10. data/docs/LeadGenApi.md +527 -0
  11. data/docs/MessagingAdsApi.md +215 -0
  12. data/docs/ReachAndFrequencyApi.md +294 -0
  13. data/docs/TrackingTagsApi.md +141 -0
  14. data/docs/YouTubeDailyViewsResponse.md +2 -0
  15. data/docs/YouTubeDemographicsResponse.md +2 -0
  16. data/docs/YouTubeVideoRetentionResponse.md +2 -0
  17. data/lib/zernio-sdk/api/ad_accounts_api.rb +958 -0
  18. data/lib/zernio-sdk/api/ad_campaigns_api.rb +618 -12
  19. data/lib/zernio-sdk/api/ad_creatives_api.rb +826 -0
  20. data/lib/zernio-sdk/api/ad_insights_api.rb +446 -0
  21. data/lib/zernio-sdk/api/ad_targeting_api.rb +404 -0
  22. data/lib/zernio-sdk/api/analytics_api.rb +8 -8
  23. data/lib/zernio-sdk/api/conversions_api.rb +936 -0
  24. data/lib/zernio-sdk/api/lead_gen_api.rb +547 -0
  25. data/lib/zernio-sdk/api/messaging_ads_api.rb +226 -0
  26. data/lib/zernio-sdk/api/reach_and_frequency_api.rb +316 -0
  27. data/lib/zernio-sdk/api/tracking_tags_api.rb +137 -0
  28. data/lib/zernio-sdk/models/you_tube_daily_views_response.rb +11 -1
  29. data/lib/zernio-sdk/models/you_tube_demographics_response.rb +11 -1
  30. data/lib/zernio-sdk/models/you_tube_video_retention_response.rb +11 -1
  31. data/lib/zernio-sdk/version.rb +1 -1
  32. data/lib/zernio-sdk.rb +8 -1
  33. data/openapi.yaml +321 -162
  34. data/spec/api/ad_accounts_api_spec.rb +206 -0
  35. data/spec/api/ad_campaigns_api_spec.rb +119 -6
  36. data/spec/api/ad_creatives_api_spec.rb +182 -0
  37. data/spec/api/ad_insights_api_spec.rb +120 -0
  38. data/spec/api/ad_targeting_api_spec.rb +101 -0
  39. data/spec/api/analytics_api_spec.rb +4 -4
  40. data/spec/api/conversions_api_spec.rb +199 -0
  41. data/spec/api/lead_gen_api_spec.rb +131 -0
  42. data/spec/api/messaging_ads_api_spec.rb +71 -0
  43. data/spec/api/reach_and_frequency_api_spec.rb +87 -0
  44. data/spec/api/tracking_tags_api_spec.rb +25 -0
  45. data/spec/models/you_tube_daily_views_response_spec.rb +6 -0
  46. data/spec/models/you_tube_demographics_response_spec.rb +6 -0
  47. data/spec/models/you_tube_video_retention_response_spec.rb +6 -0
  48. data/zernio-sdk-0.0.551.gem +0 -0
  49. metadata +35 -7
  50. data/docs/AdsApi.md +0 -5278
  51. data/lib/zernio-sdk/api/ads_api.rb +0 -5391
  52. data/spec/api/ads_api_spec.rb +0 -1015
  53. data/zernio-sdk-0.0.549.gem +0 -0
@@ -0,0 +1,958 @@
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.4
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 Zernio
16
+ class AdAccountsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Ad account finances
23
+ # Finances of one Meta ad account: prepaid `balance`, lifetime `amountSpent`, account `spendCap` (null = no cap) and the `fundingSource`. Money values are converted from Meta's minor units to whole units of `currency`.
24
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
25
+ # @param ad_account_id [String] Meta ad account id (act_<n>).
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [GetAdAccountFinance200Response]
28
+ def get_ad_account_finance(account_id, ad_account_id, opts = {})
29
+ data, _status_code, _headers = get_ad_account_finance_with_http_info(account_id, ad_account_id, opts)
30
+ data
31
+ end
32
+
33
+ # Ad account finances
34
+ # Finances of one Meta ad account: prepaid `balance`, lifetime `amountSpent`, account `spendCap` (null = no cap) and the `fundingSource`. Money values are converted from Meta's minor units to whole units of `currency`.
35
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
36
+ # @param ad_account_id [String] Meta ad account id (act_<n>).
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(GetAdAccountFinance200Response, Integer, Hash)>] GetAdAccountFinance200Response data, response status code and response headers
39
+ def get_ad_account_finance_with_http_info(account_id, ad_account_id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_ad_account_finance ...'
42
+ end
43
+ # verify the required parameter 'account_id' is set
44
+ if @api_client.config.client_side_validation && account_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.get_ad_account_finance"
46
+ end
47
+ # verify the required parameter 'ad_account_id' is set
48
+ if @api_client.config.client_side_validation && ad_account_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.get_ad_account_finance"
50
+ end
51
+ # resource path
52
+ local_var_path = '/v1/ads/accounts/finance'
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+ query_params[:'accountId'] = account_id
57
+ query_params[:'adAccountId'] = ad_account_id
58
+
59
+ # header parameters
60
+ header_params = opts[:header_params] || {}
61
+ # HTTP header 'Accept' (if needed)
62
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:debug_body]
69
+
70
+ # return_type
71
+ return_type = opts[:debug_return_type] || 'GetAdAccountFinance200Response'
72
+
73
+ # auth_names
74
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
75
+
76
+ new_options = opts.merge(
77
+ :operation => :"AdAccountsApi.get_ad_account_finance",
78
+ :header_params => header_params,
79
+ :query_params => query_params,
80
+ :form_params => form_params,
81
+ :body => post_body,
82
+ :auth_names => auth_names,
83
+ :return_type => return_type
84
+ )
85
+
86
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug "API called: AdAccountsApi#get_ad_account_finance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
93
+ # List comments on an ad
94
+ # Returns comments on an ad's underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/{postId} endpoint cannot serve because dark posts are not in Zernio's post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative's effective_object_story_id and effective_instagram_media_id). Use the `placement` query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account's token. If no connected Instagram account on the profile can read the ad's media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement=facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/{postId}. The `{adId}` path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal `_id` (24-char hex), Meta's numeric `platformAdId` (the value shipped in `comment.received` webhooks as `comment.ad.id`), or the creative's `effective_object_story_id` / `effective_instagram_media_id`. Caller doesn't need a translation step.
95
+ # @param ad_id [String] Internal Zernio ad ID (ObjectId).
96
+ # @param [Hash] opts the optional parameters
97
+ # @option opts [String] :placement Which side of the ad to return comments for. Omit to default to the Instagram side when present, else Facebook. Returns ad_not_commentable if the ad has no such placement.
98
+ # @option opts [Integer] :limit (default to 25)
99
+ # @option opts [String] :cursor Pagination cursor from a previous response.
100
+ # @return [GetAdComments200Response]
101
+ def get_ad_comments(ad_id, opts = {})
102
+ data, _status_code, _headers = get_ad_comments_with_http_info(ad_id, opts)
103
+ data
104
+ end
105
+
106
+ # List comments on an ad
107
+ # Returns comments on an ad&#39;s underlying creative post. Useful for moderating or analyzing engagement on dark posts (ad creatives that never went live organically), which the regular GET /v1/inbox/comments/{postId} endpoint cannot serve because dark posts are not in Zernio&#39;s post database. An ad that runs on both Facebook feed and Instagram feed has two separate underlying posts with separate comment threads (the creative&#39;s effective_object_story_id and effective_instagram_media_id). Use the &#x60;placement&#x60; query param to pick one; with no param the Instagram side is returned when it exists, otherwise Facebook. The identifiers are read from the ad record (persisted during sync) with a Marketing-API fallback for ads that predate the field. For Instagram-placed comments, the Instagram account that runs the ad must be connected to Zernio — those comments are read through that account&#39;s token. If no connected Instagram account on the profile can read the ad&#39;s media, the call returns ads_connection_required (the Facebook side, if any, is still readable via ?placement&#x3D;facebook). Meta-only. Other ad platforms (TikTok, LinkedIn, Pinterest, Google, X) do not expose a public per-ad comments API and return feature_not_available. Requires the Ads add-on. Response shape matches GET /v1/inbox/comments/{postId}. The &#x60;{adId}&#x60; path segment accepts any identifier dialect Zernio indexes for the ad: Zernio internal &#x60;_id&#x60; (24-char hex), Meta&#39;s numeric &#x60;platformAdId&#x60; (the value shipped in &#x60;comment.received&#x60; webhooks as &#x60;comment.ad.id&#x60;), or the creative&#39;s &#x60;effective_object_story_id&#x60; / &#x60;effective_instagram_media_id&#x60;. Caller doesn&#39;t need a translation step.
108
+ # @param ad_id [String] Internal Zernio ad ID (ObjectId).
109
+ # @param [Hash] opts the optional parameters
110
+ # @option opts [String] :placement Which side of the ad to return comments for. Omit to default to the Instagram side when present, else Facebook. Returns ad_not_commentable if the ad has no such placement.
111
+ # @option opts [Integer] :limit (default to 25)
112
+ # @option opts [String] :cursor Pagination cursor from a previous response.
113
+ # @return [Array<(GetAdComments200Response, Integer, Hash)>] GetAdComments200Response data, response status code and response headers
114
+ def get_ad_comments_with_http_info(ad_id, opts = {})
115
+ if @api_client.config.debugging
116
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_ad_comments ...'
117
+ end
118
+ # verify the required parameter 'ad_id' is set
119
+ if @api_client.config.client_side_validation && ad_id.nil?
120
+ fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdAccountsApi.get_ad_comments"
121
+ end
122
+ allowable_values = ["facebook", "instagram"]
123
+ if @api_client.config.client_side_validation && opts[:'placement'] && !allowable_values.include?(opts[:'placement'])
124
+ fail ArgumentError, "invalid value for \"placement\", must be one of #{allowable_values}"
125
+ end
126
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
127
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.get_ad_comments, must be smaller than or equal to 100.'
128
+ end
129
+
130
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
131
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.get_ad_comments, must be greater than or equal to 1.'
132
+ end
133
+
134
+ # resource path
135
+ local_var_path = '/v1/ads/{adId}/comments'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))
136
+
137
+ # query parameters
138
+ query_params = opts[:query_params] || {}
139
+ query_params[:'placement'] = opts[:'placement'] if !opts[:'placement'].nil?
140
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
141
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
142
+
143
+ # header parameters
144
+ header_params = opts[:header_params] || {}
145
+ # HTTP header 'Accept' (if needed)
146
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
147
+
148
+ # form parameters
149
+ form_params = opts[:form_params] || {}
150
+
151
+ # http body (model)
152
+ post_body = opts[:debug_body]
153
+
154
+ # return_type
155
+ return_type = opts[:debug_return_type] || 'GetAdComments200Response'
156
+
157
+ # auth_names
158
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
159
+
160
+ new_options = opts.merge(
161
+ :operation => :"AdAccountsApi.get_ad_comments",
162
+ :header_params => header_params,
163
+ :query_params => query_params,
164
+ :form_params => form_params,
165
+ :body => post_body,
166
+ :auth_names => auth_names,
167
+ :return_type => return_type
168
+ )
169
+
170
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug "API called: AdAccountsApi#get_ad_comments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
173
+ end
174
+ return data, status_code, headers
175
+ end
176
+
177
+ # Ad account change / audit log
178
+ # Account-level audit log from Meta's `/act_X/activities`: who changed what and when (creates, edits, status flips, budget changes...) with Meta's translated event names and the structured before/after in `extra_data`. Rows are returned verbatim. Meta has no server-side per-object filter on this edge, so `objectId` filters the returned page client-side (combine with paging to walk history for one campaign/ad set/ad).
179
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
180
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
181
+ # @param [Hash] opts the optional parameters
182
+ # @option opts [Date] :since Start of range (YYYY-MM-DD).
183
+ # @option opts [Date] :_until End of range (YYYY-MM-DD).
184
+ # @option opts [String] :object_id Client-side filter to one Meta object id (campaign, ad set or ad).
185
+ # @option opts [Integer] :limit Rows per page (default to 50)
186
+ # @option opts [String] :after Cursor from paging.after of the previous page.
187
+ # @return [GetAdsActivityLog200Response]
188
+ def get_ads_activity_log(account_id, ad_account_id, opts = {})
189
+ data, _status_code, _headers = get_ads_activity_log_with_http_info(account_id, ad_account_id, opts)
190
+ data
191
+ end
192
+
193
+ # Ad account change / audit log
194
+ # Account-level audit log from Meta&#39;s &#x60;/act_X/activities&#x60;: who changed what and when (creates, edits, status flips, budget changes...) with Meta&#39;s translated event names and the structured before/after in &#x60;extra_data&#x60;. Rows are returned verbatim. Meta has no server-side per-object filter on this edge, so &#x60;objectId&#x60; filters the returned page client-side (combine with paging to walk history for one campaign/ad set/ad).
195
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
196
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
197
+ # @param [Hash] opts the optional parameters
198
+ # @option opts [Date] :since Start of range (YYYY-MM-DD).
199
+ # @option opts [Date] :_until End of range (YYYY-MM-DD).
200
+ # @option opts [String] :object_id Client-side filter to one Meta object id (campaign, ad set or ad).
201
+ # @option opts [Integer] :limit Rows per page (default to 50)
202
+ # @option opts [String] :after Cursor from paging.after of the previous page.
203
+ # @return [Array<(GetAdsActivityLog200Response, Integer, Hash)>] GetAdsActivityLog200Response data, response status code and response headers
204
+ def get_ads_activity_log_with_http_info(account_id, ad_account_id, opts = {})
205
+ if @api_client.config.debugging
206
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_ads_activity_log ...'
207
+ end
208
+ # verify the required parameter 'account_id' is set
209
+ if @api_client.config.client_side_validation && account_id.nil?
210
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.get_ads_activity_log"
211
+ end
212
+ # verify the required parameter 'ad_account_id' is set
213
+ if @api_client.config.client_side_validation && ad_account_id.nil?
214
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.get_ads_activity_log"
215
+ end
216
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 200
217
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.get_ads_activity_log, must be smaller than or equal to 200.'
218
+ end
219
+
220
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
221
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.get_ads_activity_log, must be greater than or equal to 1.'
222
+ end
223
+
224
+ # resource path
225
+ local_var_path = '/v1/ads/activity'
226
+
227
+ # query parameters
228
+ query_params = opts[:query_params] || {}
229
+ query_params[:'accountId'] = account_id
230
+ query_params[:'adAccountId'] = ad_account_id
231
+ query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
232
+ query_params[:'until'] = opts[:'_until'] if !opts[:'_until'].nil?
233
+ query_params[:'objectId'] = opts[:'object_id'] if !opts[:'object_id'].nil?
234
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
235
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
236
+
237
+ # header parameters
238
+ header_params = opts[:header_params] || {}
239
+ # HTTP header 'Accept' (if needed)
240
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
241
+
242
+ # form parameters
243
+ form_params = opts[:form_params] || {}
244
+
245
+ # http body (model)
246
+ post_body = opts[:debug_body]
247
+
248
+ # return_type
249
+ return_type = opts[:debug_return_type] || 'GetAdsActivityLog200Response'
250
+
251
+ # auth_names
252
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
253
+
254
+ new_options = opts.merge(
255
+ :operation => :"AdAccountsApi.get_ads_activity_log",
256
+ :header_params => header_params,
257
+ :query_params => query_params,
258
+ :form_params => form_params,
259
+ :body => post_body,
260
+ :auth_names => auth_names,
261
+ :return_type => return_type
262
+ )
263
+
264
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
265
+ if @api_client.config.debugging
266
+ @api_client.config.logger.debug "API called: AdAccountsApi#get_ads_activity_log\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
267
+ end
268
+ return data, status_code, headers
269
+ end
270
+
271
+ # Get ad account DSA defaults
272
+ # Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via `PATCH /v1/ads/accounts` or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.
273
+ # @param account_id [String] Social account ID (metaads, or a facebook/instagram posting account)
274
+ # @param ad_account_id [String] Meta ad account ID (act_...)
275
+ # @param [Hash] opts the optional parameters
276
+ # @return [UpdateAdAccount200Response]
277
+ def get_dsa_defaults(account_id, ad_account_id, opts = {})
278
+ data, _status_code, _headers = get_dsa_defaults_with_http_info(account_id, ad_account_id, opts)
279
+ data
280
+ end
281
+
282
+ # Get ad account DSA defaults
283
+ # Returns the default DSA beneficiary and payor currently set on a Meta ad account, whether they were set via &#x60;PATCH /v1/ads/accounts&#x60; or in Meta Ads Manager. Fields are omitted when no default is configured. Meta accounts only.
284
+ # @param account_id [String] Social account ID (metaads, or a facebook/instagram posting account)
285
+ # @param ad_account_id [String] Meta ad account ID (act_...)
286
+ # @param [Hash] opts the optional parameters
287
+ # @return [Array<(UpdateAdAccount200Response, Integer, Hash)>] UpdateAdAccount200Response data, response status code and response headers
288
+ def get_dsa_defaults_with_http_info(account_id, ad_account_id, opts = {})
289
+ if @api_client.config.debugging
290
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_dsa_defaults ...'
291
+ end
292
+ # verify the required parameter 'account_id' is set
293
+ if @api_client.config.client_side_validation && account_id.nil?
294
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.get_dsa_defaults"
295
+ end
296
+ # verify the required parameter 'ad_account_id' is set
297
+ if @api_client.config.client_side_validation && ad_account_id.nil?
298
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.get_dsa_defaults"
299
+ end
300
+ # resource path
301
+ local_var_path = '/v1/ads/dsa-defaults'
302
+
303
+ # query parameters
304
+ query_params = opts[:query_params] || {}
305
+ query_params[:'accountId'] = account_id
306
+ query_params[:'adAccountId'] = ad_account_id
307
+
308
+ # header parameters
309
+ header_params = opts[:header_params] || {}
310
+ # HTTP header 'Accept' (if needed)
311
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
312
+
313
+ # form parameters
314
+ form_params = opts[:form_params] || {}
315
+
316
+ # http body (model)
317
+ post_body = opts[:debug_body]
318
+
319
+ # return_type
320
+ return_type = opts[:debug_return_type] || 'UpdateAdAccount200Response'
321
+
322
+ # auth_names
323
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
324
+
325
+ new_options = opts.merge(
326
+ :operation => :"AdAccountsApi.get_dsa_defaults",
327
+ :header_params => header_params,
328
+ :query_params => query_params,
329
+ :form_params => form_params,
330
+ :body => post_body,
331
+ :auth_names => auth_names,
332
+ :return_type => return_type
333
+ )
334
+
335
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug "API called: AdAccountsApi#get_dsa_defaults\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
338
+ end
339
+ return data, status_code, headers
340
+ end
341
+
342
+ # List DSA beneficiary/payor suggestions
343
+ # Returns Meta's suggested beneficiary/payor names for an ad account, derived by Meta from the account's recent activity. Useful for prefilling `dsaBeneficiary`/`dsaPayor` inputs, or the defaults sent to `PATCH /v1/ads/accounts`, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.
344
+ # @param account_id [String] Social account ID (metaads, or a facebook/instagram posting account)
345
+ # @param ad_account_id [String] Meta ad account ID (act_...)
346
+ # @param [Hash] opts the optional parameters
347
+ # @return [GetDsaRecommendations200Response]
348
+ def get_dsa_recommendations(account_id, ad_account_id, opts = {})
349
+ data, _status_code, _headers = get_dsa_recommendations_with_http_info(account_id, ad_account_id, opts)
350
+ data
351
+ end
352
+
353
+ # List DSA beneficiary/payor suggestions
354
+ # Returns Meta&#39;s suggested beneficiary/payor names for an ad account, derived by Meta from the account&#39;s recent activity. Useful for prefilling &#x60;dsaBeneficiary&#x60;/&#x60;dsaPayor&#x60; inputs, or the defaults sent to &#x60;PATCH /v1/ads/accounts&#x60;, in your own UI. Meta returns a single flat list. Entries are not labeled as beneficiary or payor, and since these are legal disclosures Zernio never applies them automatically: let your user pick the right entity. The list may be empty for accounts with little activity. Meta accounts only.
355
+ # @param account_id [String] Social account ID (metaads, or a facebook/instagram posting account)
356
+ # @param ad_account_id [String] Meta ad account ID (act_...)
357
+ # @param [Hash] opts the optional parameters
358
+ # @return [Array<(GetDsaRecommendations200Response, Integer, Hash)>] GetDsaRecommendations200Response data, response status code and response headers
359
+ def get_dsa_recommendations_with_http_info(account_id, ad_account_id, opts = {})
360
+ if @api_client.config.debugging
361
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.get_dsa_recommendations ...'
362
+ end
363
+ # verify the required parameter 'account_id' is set
364
+ if @api_client.config.client_side_validation && account_id.nil?
365
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.get_dsa_recommendations"
366
+ end
367
+ # verify the required parameter 'ad_account_id' is set
368
+ if @api_client.config.client_side_validation && ad_account_id.nil?
369
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.get_dsa_recommendations"
370
+ end
371
+ # resource path
372
+ local_var_path = '/v1/ads/dsa-recommendations'
373
+
374
+ # query parameters
375
+ query_params = opts[:query_params] || {}
376
+ query_params[:'accountId'] = account_id
377
+ query_params[:'adAccountId'] = ad_account_id
378
+
379
+ # header parameters
380
+ header_params = opts[:header_params] || {}
381
+ # HTTP header 'Accept' (if needed)
382
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
383
+
384
+ # form parameters
385
+ form_params = opts[:form_params] || {}
386
+
387
+ # http body (model)
388
+ post_body = opts[:debug_body]
389
+
390
+ # return_type
391
+ return_type = opts[:debug_return_type] || 'GetDsaRecommendations200Response'
392
+
393
+ # auth_names
394
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
395
+
396
+ new_options = opts.merge(
397
+ :operation => :"AdAccountsApi.get_dsa_recommendations",
398
+ :header_params => header_params,
399
+ :query_params => query_params,
400
+ :form_params => form_params,
401
+ :body => post_body,
402
+ :auth_names => auth_names,
403
+ :return_type => return_type
404
+ )
405
+
406
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
407
+ if @api_client.config.debugging
408
+ @api_client.config.logger.debug "API called: AdAccountsApi#get_dsa_recommendations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
409
+ end
410
+ return data, status_code, headers
411
+ end
412
+
413
+ # List ad accounts
414
+ # Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.
415
+ # @param account_id [String] Social account ID
416
+ # @param [Hash] opts the optional parameters
417
+ # @option opts [String] :ad_account_id Filter response to a single platform ad account ID (e.g. &#x60;act_123&#x60; for Meta, advertiser_id for TikTok). Returns at most one item.
418
+ # @option opts [Integer] :limit Clamp the returned &#x60;accounts[]&#x60; length. Useful for typeahead pickers on agency tokens with hundreds of advertisers.
419
+ # @return [ListAdAccounts200Response]
420
+ def list_ad_accounts(account_id, opts = {})
421
+ data, _status_code, _headers = list_ad_accounts_with_http_info(account_id, opts)
422
+ data
423
+ end
424
+
425
+ # List ad accounts
426
+ # Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok&#39;s &#x60;/advertiser/info/&#x60; endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time &#x60;advertiser_ids&#x60; list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry.
427
+ # @param account_id [String] Social account ID
428
+ # @param [Hash] opts the optional parameters
429
+ # @option opts [String] :ad_account_id Filter response to a single platform ad account ID (e.g. &#x60;act_123&#x60; for Meta, advertiser_id for TikTok). Returns at most one item.
430
+ # @option opts [Integer] :limit Clamp the returned &#x60;accounts[]&#x60; length. Useful for typeahead pickers on agency tokens with hundreds of advertisers.
431
+ # @return [Array<(ListAdAccounts200Response, Integer, Hash)>] ListAdAccounts200Response data, response status code and response headers
432
+ def list_ad_accounts_with_http_info(account_id, opts = {})
433
+ if @api_client.config.debugging
434
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ad_accounts ...'
435
+ end
436
+ # verify the required parameter 'account_id' is set
437
+ if @api_client.config.client_side_validation && account_id.nil?
438
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_ad_accounts"
439
+ end
440
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
441
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_accounts, must be smaller than or equal to 1000.'
442
+ end
443
+
444
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
445
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_accounts, must be greater than or equal to 1.'
446
+ end
447
+
448
+ # resource path
449
+ local_var_path = '/v1/ads/accounts'
450
+
451
+ # query parameters
452
+ query_params = opts[:query_params] || {}
453
+ query_params[:'accountId'] = account_id
454
+ query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
455
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
456
+
457
+ # header parameters
458
+ header_params = opts[:header_params] || {}
459
+ # HTTP header 'Accept' (if needed)
460
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
461
+
462
+ # form parameters
463
+ form_params = opts[:form_params] || {}
464
+
465
+ # http body (model)
466
+ post_body = opts[:debug_body]
467
+
468
+ # return_type
469
+ return_type = opts[:debug_return_type] || 'ListAdAccounts200Response'
470
+
471
+ # auth_names
472
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
473
+
474
+ new_options = opts.merge(
475
+ :operation => :"AdAccountsApi.list_ad_accounts",
476
+ :header_params => header_params,
477
+ :query_params => query_params,
478
+ :form_params => form_params,
479
+ :body => post_body,
480
+ :auth_names => auth_names,
481
+ :return_type => return_type
482
+ )
483
+
484
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
485
+ if @api_client.config.debugging
486
+ @api_client.config.logger.debug "API called: AdAccountsApi#list_ad_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
487
+ end
488
+ return data, status_code, headers
489
+ end
490
+
491
+ # Ad labels
492
+ # Lists the ad account's organizational labels (Meta's `/act_X/adlabels`), rows returned verbatim (id, name, created/updated time).
493
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
494
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
495
+ # @param [Hash] opts the optional parameters
496
+ # @option opts [Integer] :limit Rows per page (default to 25)
497
+ # @option opts [String] :after Cursor from paging.after of the previous page.
498
+ # @return [ListAdLabels200Response]
499
+ def list_ad_labels(account_id, ad_account_id, opts = {})
500
+ data, _status_code, _headers = list_ad_labels_with_http_info(account_id, ad_account_id, opts)
501
+ data
502
+ end
503
+
504
+ # Ad labels
505
+ # Lists the ad account&#39;s organizational labels (Meta&#39;s &#x60;/act_X/adlabels&#x60;), rows returned verbatim (id, name, created/updated time).
506
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
507
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
508
+ # @param [Hash] opts the optional parameters
509
+ # @option opts [Integer] :limit Rows per page (default to 25)
510
+ # @option opts [String] :after Cursor from paging.after of the previous page.
511
+ # @return [Array<(ListAdLabels200Response, Integer, Hash)>] ListAdLabels200Response data, response status code and response headers
512
+ def list_ad_labels_with_http_info(account_id, ad_account_id, opts = {})
513
+ if @api_client.config.debugging
514
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ad_labels ...'
515
+ end
516
+ # verify the required parameter 'account_id' is set
517
+ if @api_client.config.client_side_validation && account_id.nil?
518
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_ad_labels"
519
+ end
520
+ # verify the required parameter 'ad_account_id' is set
521
+ if @api_client.config.client_side_validation && ad_account_id.nil?
522
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.list_ad_labels"
523
+ end
524
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
525
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_labels, must be smaller than or equal to 100.'
526
+ end
527
+
528
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
529
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_labels, must be greater than or equal to 1.'
530
+ end
531
+
532
+ # resource path
533
+ local_var_path = '/v1/ads/labels'
534
+
535
+ # query parameters
536
+ query_params = opts[:query_params] || {}
537
+ query_params[:'accountId'] = account_id
538
+ query_params[:'adAccountId'] = ad_account_id
539
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
540
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
541
+
542
+ # header parameters
543
+ header_params = opts[:header_params] || {}
544
+ # HTTP header 'Accept' (if needed)
545
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
546
+
547
+ # form parameters
548
+ form_params = opts[:form_params] || {}
549
+
550
+ # http body (model)
551
+ post_body = opts[:debug_body]
552
+
553
+ # return_type
554
+ return_type = opts[:debug_return_type] || 'ListAdLabels200Response'
555
+
556
+ # auth_names
557
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
558
+
559
+ new_options = opts.merge(
560
+ :operation => :"AdAccountsApi.list_ad_labels",
561
+ :header_params => header_params,
562
+ :query_params => query_params,
563
+ :form_params => form_params,
564
+ :body => post_body,
565
+ :auth_names => auth_names,
566
+ :return_type => return_type
567
+ )
568
+
569
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
570
+ if @api_client.config.debugging
571
+ @api_client.config.logger.debug "API called: AdAccountsApi#list_ad_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
572
+ end
573
+ return data, status_code, headers
574
+ end
575
+
576
+ # A/B tests and lift studies
577
+ # Lists the ad account's A/B tests and lift studies (Meta's `/act_X/ad_studies`), rows returned verbatim. The default projection covers id, name, type, timing and cells with split percentages; `fields` is a raw-passthrough override.
578
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
579
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
580
+ # @param [Hash] opts the optional parameters
581
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
582
+ # @option opts [Integer] :limit Rows per page (default to 25)
583
+ # @option opts [String] :after Cursor from paging.after of the previous page.
584
+ # @return [ListAdStudies200Response]
585
+ def list_ad_studies(account_id, ad_account_id, opts = {})
586
+ data, _status_code, _headers = list_ad_studies_with_http_info(account_id, ad_account_id, opts)
587
+ data
588
+ end
589
+
590
+ # A/B tests and lift studies
591
+ # Lists the ad account&#39;s A/B tests and lift studies (Meta&#39;s &#x60;/act_X/ad_studies&#x60;), rows returned verbatim. The default projection covers id, name, type, timing and cells with split percentages; &#x60;fields&#x60; is a raw-passthrough override.
592
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
593
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
594
+ # @param [Hash] opts the optional parameters
595
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
596
+ # @option opts [Integer] :limit Rows per page (default to 25)
597
+ # @option opts [String] :after Cursor from paging.after of the previous page.
598
+ # @return [Array<(ListAdStudies200Response, Integer, Hash)>] ListAdStudies200Response data, response status code and response headers
599
+ def list_ad_studies_with_http_info(account_id, ad_account_id, opts = {})
600
+ if @api_client.config.debugging
601
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ad_studies ...'
602
+ end
603
+ # verify the required parameter 'account_id' is set
604
+ if @api_client.config.client_side_validation && account_id.nil?
605
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_ad_studies"
606
+ end
607
+ # verify the required parameter 'ad_account_id' is set
608
+ if @api_client.config.client_side_validation && ad_account_id.nil?
609
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.list_ad_studies"
610
+ end
611
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
612
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_studies, must be smaller than or equal to 100.'
613
+ end
614
+
615
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
616
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_ad_studies, must be greater than or equal to 1.'
617
+ end
618
+
619
+ # resource path
620
+ local_var_path = '/v1/ads/studies'
621
+
622
+ # query parameters
623
+ query_params = opts[:query_params] || {}
624
+ query_params[:'accountId'] = account_id
625
+ query_params[:'adAccountId'] = ad_account_id
626
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
627
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
628
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
629
+
630
+ # header parameters
631
+ header_params = opts[:header_params] || {}
632
+ # HTTP header 'Accept' (if needed)
633
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
634
+
635
+ # form parameters
636
+ form_params = opts[:form_params] || {}
637
+
638
+ # http body (model)
639
+ post_body = opts[:debug_body]
640
+
641
+ # return_type
642
+ return_type = opts[:debug_return_type] || 'ListAdStudies200Response'
643
+
644
+ # auth_names
645
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
646
+
647
+ new_options = opts.merge(
648
+ :operation => :"AdAccountsApi.list_ad_studies",
649
+ :header_params => header_params,
650
+ :query_params => query_params,
651
+ :form_params => form_params,
652
+ :body => post_body,
653
+ :auth_names => auth_names,
654
+ :return_type => return_type
655
+ )
656
+
657
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
658
+ if @api_client.config.debugging
659
+ @api_client.config.logger.debug "API called: AdAccountsApi#list_ad_studies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
660
+ end
661
+ return data, status_code, headers
662
+ end
663
+
664
+ # List TikTok Business Centers
665
+ # Returns the TikTok Business Centers (BCs) the connected `tiktokads` account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking `/v1/ads/accounts` per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.
666
+ # @param account_id [String] ID of the &#x60;tiktokads&#x60; (or parent &#x60;tiktok&#x60; posting) SocialAccount
667
+ # @param [Hash] opts the optional parameters
668
+ # @return [ListAdsBusinessCenters200Response]
669
+ def list_ads_business_centers(account_id, opts = {})
670
+ data, _status_code, _headers = list_ads_business_centers_with_http_info(account_id, opts)
671
+ data
672
+ end
673
+
674
+ # List TikTok Business Centers
675
+ # Returns the TikTok Business Centers (BCs) the connected &#x60;tiktokads&#x60; account can read. Each BC reports its advertiser count so callers can build agency-style pickers without re-walking &#x60;/v1/ads/accounts&#x60; per BC. TikTok-only. Solo advertisers (non-agency tokens) return an empty array.
676
+ # @param account_id [String] ID of the &#x60;tiktokads&#x60; (or parent &#x60;tiktok&#x60; posting) SocialAccount
677
+ # @param [Hash] opts the optional parameters
678
+ # @return [Array<(ListAdsBusinessCenters200Response, Integer, Hash)>] ListAdsBusinessCenters200Response data, response status code and response headers
679
+ def list_ads_business_centers_with_http_info(account_id, opts = {})
680
+ if @api_client.config.debugging
681
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_ads_business_centers ...'
682
+ end
683
+ # verify the required parameter 'account_id' is set
684
+ if @api_client.config.client_side_validation && account_id.nil?
685
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_ads_business_centers"
686
+ end
687
+ # resource path
688
+ local_var_path = '/v1/ads/business-centers'
689
+
690
+ # query parameters
691
+ query_params = opts[:query_params] || {}
692
+ query_params[:'accountId'] = account_id
693
+
694
+ # header parameters
695
+ header_params = opts[:header_params] || {}
696
+ # HTTP header 'Accept' (if needed)
697
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
698
+
699
+ # form parameters
700
+ form_params = opts[:form_params] || {}
701
+
702
+ # http body (model)
703
+ post_body = opts[:debug_body]
704
+
705
+ # return_type
706
+ return_type = opts[:debug_return_type] || 'ListAdsBusinessCenters200Response'
707
+
708
+ # auth_names
709
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
710
+
711
+ new_options = opts.merge(
712
+ :operation => :"AdAccountsApi.list_ads_business_centers",
713
+ :header_params => header_params,
714
+ :query_params => query_params,
715
+ :form_params => form_params,
716
+ :body => post_body,
717
+ :auth_names => auth_names,
718
+ :return_type => return_type
719
+ )
720
+
721
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
722
+ if @api_client.config.debugging
723
+ @api_client.config.logger.debug "API called: AdAccountsApi#list_ads_business_centers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
724
+ end
725
+ return data, status_code, headers
726
+ end
727
+
728
+ # High demand periods / budget schedules
729
+ # Scheduled budget increases (Meta's budget-scheduling API). The Graph edge lives on the campaign and ad-set nodes only, so exactly one of `campaignId` / `adSetId` (platform ids) is required. Rows returned verbatim (budget_value, budget_value_type, time window, recurrence).
730
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
731
+ # @param [Hash] opts the optional parameters
732
+ # @option opts [String] :campaign_id Platform campaign id. Exactly one of campaignId / adSetId.
733
+ # @option opts [String] :ad_set_id Platform ad set id. Exactly one of campaignId / adSetId.
734
+ # @option opts [Integer] :limit Rows per page (default to 25)
735
+ # @option opts [String] :after Cursor from paging.after of the previous page.
736
+ # @return [ListHighDemandPeriods200Response]
737
+ def list_high_demand_periods(account_id, opts = {})
738
+ data, _status_code, _headers = list_high_demand_periods_with_http_info(account_id, opts)
739
+ data
740
+ end
741
+
742
+ # High demand periods / budget schedules
743
+ # Scheduled budget increases (Meta&#39;s budget-scheduling API). The Graph edge lives on the campaign and ad-set nodes only, so exactly one of &#x60;campaignId&#x60; / &#x60;adSetId&#x60; (platform ids) is required. Rows returned verbatim (budget_value, budget_value_type, time window, recurrence).
744
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
745
+ # @param [Hash] opts the optional parameters
746
+ # @option opts [String] :campaign_id Platform campaign id. Exactly one of campaignId / adSetId.
747
+ # @option opts [String] :ad_set_id Platform ad set id. Exactly one of campaignId / adSetId.
748
+ # @option opts [Integer] :limit Rows per page (default to 25)
749
+ # @option opts [String] :after Cursor from paging.after of the previous page.
750
+ # @return [Array<(ListHighDemandPeriods200Response, Integer, Hash)>] ListHighDemandPeriods200Response data, response status code and response headers
751
+ def list_high_demand_periods_with_http_info(account_id, opts = {})
752
+ if @api_client.config.debugging
753
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_high_demand_periods ...'
754
+ end
755
+ # verify the required parameter 'account_id' is set
756
+ if @api_client.config.client_side_validation && account_id.nil?
757
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_high_demand_periods"
758
+ end
759
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
760
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_high_demand_periods, must be smaller than or equal to 100.'
761
+ end
762
+
763
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
764
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_high_demand_periods, must be greater than or equal to 1.'
765
+ end
766
+
767
+ # resource path
768
+ local_var_path = '/v1/ads/high-demand-periods'
769
+
770
+ # query parameters
771
+ query_params = opts[:query_params] || {}
772
+ query_params[:'accountId'] = account_id
773
+ query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
774
+ query_params[:'adSetId'] = opts[:'ad_set_id'] if !opts[:'ad_set_id'].nil?
775
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
776
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
777
+
778
+ # header parameters
779
+ header_params = opts[:header_params] || {}
780
+ # HTTP header 'Accept' (if needed)
781
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
782
+
783
+ # form parameters
784
+ form_params = opts[:form_params] || {}
785
+
786
+ # http body (model)
787
+ post_body = opts[:debug_body]
788
+
789
+ # return_type
790
+ return_type = opts[:debug_return_type] || 'ListHighDemandPeriods200Response'
791
+
792
+ # auth_names
793
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
794
+
795
+ new_options = opts.merge(
796
+ :operation => :"AdAccountsApi.list_high_demand_periods",
797
+ :header_params => header_params,
798
+ :query_params => query_params,
799
+ :form_params => form_params,
800
+ :body => post_body,
801
+ :auth_names => auth_names,
802
+ :return_type => return_type
803
+ )
804
+
805
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
806
+ if @api_client.config.debugging
807
+ @api_client.config.logger.debug "API called: AdAccountsApi#list_high_demand_periods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
808
+ end
809
+ return data, status_code, headers
810
+ end
811
+
812
+ # Businesses list
813
+ # Business Manager portfolios the connected Meta user belongs to (Meta's `/me/businesses`), rows returned verbatim (id, name, verification_status, created_time). Token-scoped, so no `adAccountId` is needed. For TikTok Business Centers use `GET /v1/ads/business-centers`.
814
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
815
+ # @param [Hash] opts the optional parameters
816
+ # @option opts [Integer] :limit Rows per page (default to 25)
817
+ # @option opts [String] :after Cursor from paging.after of the previous page.
818
+ # @return [ListMetaBusinesses200Response]
819
+ def list_meta_businesses(account_id, opts = {})
820
+ data, _status_code, _headers = list_meta_businesses_with_http_info(account_id, opts)
821
+ data
822
+ end
823
+
824
+ # Businesses list
825
+ # Business Manager portfolios the connected Meta user belongs to (Meta&#39;s &#x60;/me/businesses&#x60;), rows returned verbatim (id, name, verification_status, created_time). Token-scoped, so no &#x60;adAccountId&#x60; is needed. For TikTok Business Centers use &#x60;GET /v1/ads/business-centers&#x60;.
826
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
827
+ # @param [Hash] opts the optional parameters
828
+ # @option opts [Integer] :limit Rows per page (default to 25)
829
+ # @option opts [String] :after Cursor from paging.after of the previous page.
830
+ # @return [Array<(ListMetaBusinesses200Response, Integer, Hash)>] ListMetaBusinesses200Response data, response status code and response headers
831
+ def list_meta_businesses_with_http_info(account_id, opts = {})
832
+ if @api_client.config.debugging
833
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.list_meta_businesses ...'
834
+ end
835
+ # verify the required parameter 'account_id' is set
836
+ if @api_client.config.client_side_validation && account_id.nil?
837
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdAccountsApi.list_meta_businesses"
838
+ end
839
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
840
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_meta_businesses, must be smaller than or equal to 100.'
841
+ end
842
+
843
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
844
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdAccountsApi.list_meta_businesses, must be greater than or equal to 1.'
845
+ end
846
+
847
+ # resource path
848
+ local_var_path = '/v1/ads/businesses'
849
+
850
+ # query parameters
851
+ query_params = opts[:query_params] || {}
852
+ query_params[:'accountId'] = account_id
853
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
854
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
855
+
856
+ # header parameters
857
+ header_params = opts[:header_params] || {}
858
+ # HTTP header 'Accept' (if needed)
859
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
860
+
861
+ # form parameters
862
+ form_params = opts[:form_params] || {}
863
+
864
+ # http body (model)
865
+ post_body = opts[:debug_body]
866
+
867
+ # return_type
868
+ return_type = opts[:debug_return_type] || 'ListMetaBusinesses200Response'
869
+
870
+ # auth_names
871
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
872
+
873
+ new_options = opts.merge(
874
+ :operation => :"AdAccountsApi.list_meta_businesses",
875
+ :header_params => header_params,
876
+ :query_params => query_params,
877
+ :form_params => form_params,
878
+ :body => post_body,
879
+ :auth_names => auth_names,
880
+ :return_type => return_type
881
+ )
882
+
883
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
884
+ if @api_client.config.debugging
885
+ @api_client.config.logger.debug "API called: AdAccountsApi#list_meta_businesses\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
886
+ end
887
+ return data, status_code, headers
888
+ end
889
+
890
+ # Update ad account settings
891
+ # Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to `/v1/ads/create`, `/v1/ads/boost` and `/v1/ads/ctwa` on that ad account can omit `dsaBeneficiary`/`dsaPayor`: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use `GET /v1/ads/dsa-recommendations` to offer suggestions in your UI. If `defaultDsaPayor` is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with `GET /v1/ads/dsa-defaults`. Currently supported for Meta accounts only; other platforms return 400.
892
+ # @param update_ad_account_request [UpdateAdAccountRequest]
893
+ # @param [Hash] opts the optional parameters
894
+ # @return [UpdateAdAccount200Response]
895
+ def update_ad_account(update_ad_account_request, opts = {})
896
+ data, _status_code, _headers = update_ad_account_with_http_info(update_ad_account_request, opts)
897
+ data
898
+ end
899
+
900
+ # Update ad account settings
901
+ # Sets the default DSA beneficiary and payor on a Meta ad account (EU DSA, Article 26). Set them once and every EU-targeted call to &#x60;/v1/ads/create&#x60;, &#x60;/v1/ads/boost&#x60; and &#x60;/v1/ads/ctwa&#x60; on that ad account can omit &#x60;dsaBeneficiary&#x60;/&#x60;dsaPayor&#x60;: Meta applies the defaults automatically. The values are written to the ad account on Meta, the same setting Ads Manager edits. Nothing is stored in Zernio, and defaults already set in Ads Manager work identically. Zernio never guesses these values for you. Beneficiary and payor are legal disclosures shown to EU users, so you must provide the entity names explicitly. Use &#x60;GET /v1/ads/dsa-recommendations&#x60; to offer suggestions in your UI. If &#x60;defaultDsaPayor&#x60; is omitted, the beneficiary is also set as the payor, which covers the common case where the same entity benefits from and pays for the ads. Read the current values back with &#x60;GET /v1/ads/dsa-defaults&#x60;. Currently supported for Meta accounts only; other platforms return 400.
902
+ # @param update_ad_account_request [UpdateAdAccountRequest]
903
+ # @param [Hash] opts the optional parameters
904
+ # @return [Array<(UpdateAdAccount200Response, Integer, Hash)>] UpdateAdAccount200Response data, response status code and response headers
905
+ def update_ad_account_with_http_info(update_ad_account_request, opts = {})
906
+ if @api_client.config.debugging
907
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.update_ad_account ...'
908
+ end
909
+ # verify the required parameter 'update_ad_account_request' is set
910
+ if @api_client.config.client_side_validation && update_ad_account_request.nil?
911
+ fail ArgumentError, "Missing the required parameter 'update_ad_account_request' when calling AdAccountsApi.update_ad_account"
912
+ end
913
+ # resource path
914
+ local_var_path = '/v1/ads/accounts'
915
+
916
+ # query parameters
917
+ query_params = opts[:query_params] || {}
918
+
919
+ # header parameters
920
+ header_params = opts[:header_params] || {}
921
+ # HTTP header 'Accept' (if needed)
922
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
923
+ # HTTP header 'Content-Type'
924
+ content_type = @api_client.select_header_content_type(['application/json'])
925
+ if !content_type.nil?
926
+ header_params['Content-Type'] = content_type
927
+ end
928
+
929
+ # form parameters
930
+ form_params = opts[:form_params] || {}
931
+
932
+ # http body (model)
933
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_account_request)
934
+
935
+ # return_type
936
+ return_type = opts[:debug_return_type] || 'UpdateAdAccount200Response'
937
+
938
+ # auth_names
939
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
940
+
941
+ new_options = opts.merge(
942
+ :operation => :"AdAccountsApi.update_ad_account",
943
+ :header_params => header_params,
944
+ :query_params => query_params,
945
+ :form_params => form_params,
946
+ :body => post_body,
947
+ :auth_names => auth_names,
948
+ :return_type => return_type
949
+ )
950
+
951
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
952
+ if @api_client.config.debugging
953
+ @api_client.config.logger.debug "API called: AdAccountsApi#update_ad_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
954
+ end
955
+ return data, status_code, headers
956
+ end
957
+ end
958
+ end