zernio-sdk 0.0.536 → 0.0.538

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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -1
  3. data/docs/AdAudiencesApi.md +5 -5
  4. data/docs/AdCampaignsApi.md +142 -0
  5. data/docs/AdsApi.md +715 -33
  6. data/docs/CreateAdCampaign201Response.md +24 -0
  7. data/docs/CreateAdCampaignRequest.md +32 -0
  8. data/docs/CreateAdCreative201Response.md +20 -0
  9. data/docs/CreateAdCreativeRequest.md +38 -0
  10. data/docs/CreateAdCreativeRequestCarouselCardsInner.md +26 -0
  11. data/docs/DeleteAdCreative200Response.md +20 -0
  12. data/docs/DuplicateAd200Response.md +22 -0
  13. data/docs/DuplicateAdRequest.md +28 -0
  14. data/docs/DuplicateAdSet200Response.md +22 -0
  15. data/docs/DuplicateAdSetRequest.md +36 -0
  16. data/docs/GetAdCreative200Response.md +18 -0
  17. data/docs/ListAdCreatives200Response.md +22 -0
  18. data/docs/ListAdImages200Response.md +22 -0
  19. data/docs/ListAdLabels200Response.md +22 -0
  20. data/docs/ListHighDemandPeriods200Response.md +22 -0
  21. data/docs/UpdateAdCreative200Response.md +22 -0
  22. data/docs/UpdateAdCreativeRequest.md +20 -0
  23. data/lib/zernio-sdk/api/ad_audiences_api.rb +4 -4
  24. data/lib/zernio-sdk/api/ad_campaigns_api.rb +142 -0
  25. data/lib/zernio-sdk/api/ads_api.rb +748 -48
  26. data/lib/zernio-sdk/models/create_ad_campaign201_response.rb +210 -0
  27. data/lib/zernio-sdk/models/create_ad_campaign_request.rb +343 -0
  28. data/lib/zernio-sdk/models/create_ad_creative201_response.rb +157 -0
  29. data/lib/zernio-sdk/models/create_ad_creative_request.rb +390 -0
  30. data/lib/zernio-sdk/models/create_ad_creative_request_carousel_cards_inner.rb +255 -0
  31. data/lib/zernio-sdk/models/delete_ad_creative200_response.rb +156 -0
  32. data/lib/zernio-sdk/models/duplicate_ad200_response.rb +200 -0
  33. data/lib/zernio-sdk/models/duplicate_ad_request.rb +243 -0
  34. data/lib/zernio-sdk/models/duplicate_ad_set200_response.rb +201 -0
  35. data/lib/zernio-sdk/models/duplicate_ad_set_request.rb +302 -0
  36. data/lib/zernio-sdk/models/get_ad_creative200_response.rb +148 -0
  37. data/lib/zernio-sdk/models/list_ad_creatives200_response.rb +167 -0
  38. data/lib/zernio-sdk/models/list_ad_images200_response.rb +167 -0
  39. data/lib/zernio-sdk/models/list_ad_labels200_response.rb +167 -0
  40. data/lib/zernio-sdk/models/list_high_demand_periods200_response.rb +168 -0
  41. data/lib/zernio-sdk/models/update_ad_creative200_response.rb +165 -0
  42. data/lib/zernio-sdk/models/update_ad_creative_request.rb +200 -0
  43. data/lib/zernio-sdk/version.rb +1 -1
  44. data/lib/zernio-sdk.rb +17 -0
  45. data/openapi.yaml +445 -7
  46. data/spec/api/ad_audiences_api_spec.rb +2 -2
  47. data/spec/api/ad_campaigns_api_spec.rb +25 -0
  48. data/spec/api/ads_api_spec.rb +128 -0
  49. data/spec/models/create_ad_campaign201_response_spec.rb +58 -0
  50. data/spec/models/create_ad_campaign_request_spec.rb +94 -0
  51. data/spec/models/create_ad_creative201_response_spec.rb +42 -0
  52. data/spec/models/create_ad_creative_request_carousel_cards_inner_spec.rb +60 -0
  53. data/spec/models/create_ad_creative_request_spec.rb +96 -0
  54. data/spec/models/delete_ad_creative200_response_spec.rb +42 -0
  55. data/spec/models/duplicate_ad200_response_spec.rb +52 -0
  56. data/spec/models/duplicate_ad_request_spec.rb +74 -0
  57. data/spec/models/duplicate_ad_set200_response_spec.rb +52 -0
  58. data/spec/models/duplicate_ad_set_request_spec.rb +102 -0
  59. data/spec/models/get_ad_creative200_response_spec.rb +36 -0
  60. data/spec/models/list_ad_creatives200_response_spec.rb +48 -0
  61. data/spec/models/list_ad_images200_response_spec.rb +48 -0
  62. data/spec/models/list_ad_labels200_response_spec.rb +48 -0
  63. data/spec/models/list_high_demand_periods200_response_spec.rb +48 -0
  64. data/spec/models/update_ad_creative200_response_spec.rb +48 -0
  65. data/spec/models/update_ad_creative_request_spec.rb +42 -0
  66. metadata +70 -2
@@ -382,6 +382,74 @@ module Zernio
382
382
  return data, status_code, headers
383
383
  end
384
384
 
385
+ # Create a standalone creative (Meta)
386
+ # Creates a creative in the library WITHOUT an ad, reusable on the create endpoints via `existingCreativeId`. Provide exactly one of `imageUrl` (uploaded server-side), `imageHash` (from POST /v1/ads/images or the library list), or `carouselCards` (2-10 hand-built cards). The Page (and linked Instagram account, when present) is resolved from `accountId` as the story actor. Meta only.
387
+ # @param create_ad_creative_request [CreateAdCreativeRequest]
388
+ # @param [Hash] opts the optional parameters
389
+ # @return [CreateAdCreative201Response]
390
+ def create_ad_creative(create_ad_creative_request, opts = {})
391
+ data, _status_code, _headers = create_ad_creative_with_http_info(create_ad_creative_request, opts)
392
+ data
393
+ end
394
+
395
+ # Create a standalone creative (Meta)
396
+ # Creates a creative in the library WITHOUT an ad, reusable on the create endpoints via `existingCreativeId`. Provide exactly one of `imageUrl` (uploaded server-side), `imageHash` (from POST /v1/ads/images or the library list), or `carouselCards` (2-10 hand-built cards). The Page (and linked Instagram account, when present) is resolved from `accountId` as the story actor. Meta only.
397
+ # @param create_ad_creative_request [CreateAdCreativeRequest]
398
+ # @param [Hash] opts the optional parameters
399
+ # @return [Array<(CreateAdCreative201Response, Integer, Hash)>] CreateAdCreative201Response data, response status code and response headers
400
+ def create_ad_creative_with_http_info(create_ad_creative_request, opts = {})
401
+ if @api_client.config.debugging
402
+ @api_client.config.logger.debug 'Calling API: AdsApi.create_ad_creative ...'
403
+ end
404
+ # verify the required parameter 'create_ad_creative_request' is set
405
+ if @api_client.config.client_side_validation && create_ad_creative_request.nil?
406
+ fail ArgumentError, "Missing the required parameter 'create_ad_creative_request' when calling AdsApi.create_ad_creative"
407
+ end
408
+ # resource path
409
+ local_var_path = '/v1/ads/creatives'
410
+
411
+ # query parameters
412
+ query_params = opts[:query_params] || {}
413
+
414
+ # header parameters
415
+ header_params = opts[:header_params] || {}
416
+ # HTTP header 'Accept' (if needed)
417
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
418
+ # HTTP header 'Content-Type'
419
+ content_type = @api_client.select_header_content_type(['application/json'])
420
+ if !content_type.nil?
421
+ header_params['Content-Type'] = content_type
422
+ end
423
+
424
+ # form parameters
425
+ form_params = opts[:form_params] || {}
426
+
427
+ # http body (model)
428
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_ad_creative_request)
429
+
430
+ # return_type
431
+ return_type = opts[:debug_return_type] || 'CreateAdCreative201Response'
432
+
433
+ # auth_names
434
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
435
+
436
+ new_options = opts.merge(
437
+ :operation => :"AdsApi.create_ad_creative",
438
+ :header_params => header_params,
439
+ :query_params => query_params,
440
+ :form_params => form_params,
441
+ :body => post_body,
442
+ :auth_names => auth_names,
443
+ :return_type => return_type
444
+ )
445
+
446
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
447
+ if @api_client.config.debugging
448
+ @api_client.config.logger.debug "API called: AdsApi#create_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
449
+ end
450
+ return data, status_code, headers
451
+ end
452
+
385
453
  # Submit an async insights report run (Meta)
386
454
  # Submits an asynchronous Meta insights report. Same query surface as GET /v1/ads/insights, but in the JSON body; Meta processes the report server-side, which is the right choice for long ranges or large accounts where the sync query is slow or rate-limited. Returns a `reportRunId` to poll via GET /v1/ads/insights/reports/{reportRunId}. Meta only.
387
455
  # @param create_ad_insights_report_request [CreateAdInsightsReportRequest]
@@ -1076,6 +1144,76 @@ module Zernio
1076
1144
  return data, status_code, headers
1077
1145
  end
1078
1146
 
1147
+ # Delete a creative (Meta)
1148
+ # Deletes a creative from the library. Meta only allows deleting creatives not referenced by any ad — otherwise its 400 surfaces verbatim.
1149
+ # @param creative_id [String] Platform creative id
1150
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
1151
+ # @param [Hash] opts the optional parameters
1152
+ # @return [DeleteAdCreative200Response]
1153
+ def delete_ad_creative(creative_id, account_id, opts = {})
1154
+ data, _status_code, _headers = delete_ad_creative_with_http_info(creative_id, account_id, opts)
1155
+ data
1156
+ end
1157
+
1158
+ # Delete a creative (Meta)
1159
+ # Deletes a creative from the library. Meta only allows deleting creatives not referenced by any ad — otherwise its 400 surfaces verbatim.
1160
+ # @param creative_id [String] Platform creative id
1161
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
1162
+ # @param [Hash] opts the optional parameters
1163
+ # @return [Array<(DeleteAdCreative200Response, Integer, Hash)>] DeleteAdCreative200Response data, response status code and response headers
1164
+ def delete_ad_creative_with_http_info(creative_id, account_id, opts = {})
1165
+ if @api_client.config.debugging
1166
+ @api_client.config.logger.debug 'Calling API: AdsApi.delete_ad_creative ...'
1167
+ end
1168
+ # verify the required parameter 'creative_id' is set
1169
+ if @api_client.config.client_side_validation && creative_id.nil?
1170
+ fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdsApi.delete_ad_creative"
1171
+ end
1172
+ # verify the required parameter 'account_id' is set
1173
+ if @api_client.config.client_side_validation && account_id.nil?
1174
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.delete_ad_creative"
1175
+ end
1176
+ # resource path
1177
+ local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))
1178
+
1179
+ # query parameters
1180
+ query_params = opts[:query_params] || {}
1181
+ query_params[:'accountId'] = account_id
1182
+
1183
+ # header parameters
1184
+ header_params = opts[:header_params] || {}
1185
+ # HTTP header 'Accept' (if needed)
1186
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1187
+
1188
+ # form parameters
1189
+ form_params = opts[:form_params] || {}
1190
+
1191
+ # http body (model)
1192
+ post_body = opts[:debug_body]
1193
+
1194
+ # return_type
1195
+ return_type = opts[:debug_return_type] || 'DeleteAdCreative200Response'
1196
+
1197
+ # auth_names
1198
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1199
+
1200
+ new_options = opts.merge(
1201
+ :operation => :"AdsApi.delete_ad_creative",
1202
+ :header_params => header_params,
1203
+ :query_params => query_params,
1204
+ :form_params => form_params,
1205
+ :body => post_body,
1206
+ :auth_names => auth_names,
1207
+ :return_type => return_type
1208
+ )
1209
+
1210
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
1211
+ if @api_client.config.debugging
1212
+ @api_client.config.logger.debug "API called: AdsApi#delete_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1213
+ end
1214
+ return data, status_code, headers
1215
+ end
1216
+
1079
1217
  # Delete a conversion destination
1080
1218
  # LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls \"delete\" is the same `enabled: false` flip we apply here. The rule remains fetchable via GET with `status: 'inactive'`; the unified discovery endpoint hides it by default. `adAccountId` may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.
1081
1219
  # @param account_id [String]
@@ -1148,6 +1286,76 @@ module Zernio
1148
1286
  return data, status_code, headers
1149
1287
  end
1150
1288
 
1289
+ # Duplicate an ad (Meta)
1290
+ # Duplicates a single ad via Meta's native `POST /{ad-id}/copies`. The copy is created paused. `adSetId` retargets the copy into another ad set; omitted = the source's own ad set. Accepts the Zernio ad id or the platform ad id. Sync discovery is triggered automatically (`syncAfter: false` to skip). Meta only.
1291
+ # @param ad_id [String] Zernio ad ID or platform ad ID
1292
+ # @param [Hash] opts the optional parameters
1293
+ # @option opts [DuplicateAdRequest] :duplicate_ad_request
1294
+ # @return [DuplicateAd200Response]
1295
+ def duplicate_ad(ad_id, opts = {})
1296
+ data, _status_code, _headers = duplicate_ad_with_http_info(ad_id, opts)
1297
+ data
1298
+ end
1299
+
1300
+ # Duplicate an ad (Meta)
1301
+ # Duplicates a single ad via Meta&#39;s native &#x60;POST /{ad-id}/copies&#x60;. The copy is created paused. &#x60;adSetId&#x60; retargets the copy into another ad set; omitted &#x3D; the source&#39;s own ad set. Accepts the Zernio ad id or the platform ad id. Sync discovery is triggered automatically (&#x60;syncAfter: false&#x60; to skip). Meta only.
1302
+ # @param ad_id [String] Zernio ad ID or platform ad ID
1303
+ # @param [Hash] opts the optional parameters
1304
+ # @option opts [DuplicateAdRequest] :duplicate_ad_request
1305
+ # @return [Array<(DuplicateAd200Response, Integer, Hash)>] DuplicateAd200Response data, response status code and response headers
1306
+ def duplicate_ad_with_http_info(ad_id, opts = {})
1307
+ if @api_client.config.debugging
1308
+ @api_client.config.logger.debug 'Calling API: AdsApi.duplicate_ad ...'
1309
+ end
1310
+ # verify the required parameter 'ad_id' is set
1311
+ if @api_client.config.client_side_validation && ad_id.nil?
1312
+ fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.duplicate_ad"
1313
+ end
1314
+ # resource path
1315
+ local_var_path = '/v1/ads/{adId}/duplicate'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))
1316
+
1317
+ # query parameters
1318
+ query_params = opts[:query_params] || {}
1319
+
1320
+ # header parameters
1321
+ header_params = opts[:header_params] || {}
1322
+ # HTTP header 'Accept' (if needed)
1323
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1324
+ # HTTP header 'Content-Type'
1325
+ content_type = @api_client.select_header_content_type(['application/json'])
1326
+ if !content_type.nil?
1327
+ header_params['Content-Type'] = content_type
1328
+ end
1329
+
1330
+ # form parameters
1331
+ form_params = opts[:form_params] || {}
1332
+
1333
+ # http body (model)
1334
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'duplicate_ad_request'])
1335
+
1336
+ # return_type
1337
+ return_type = opts[:debug_return_type] || 'DuplicateAd200Response'
1338
+
1339
+ # auth_names
1340
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1341
+
1342
+ new_options = opts.merge(
1343
+ :operation => :"AdsApi.duplicate_ad",
1344
+ :header_params => header_params,
1345
+ :query_params => query_params,
1346
+ :form_params => form_params,
1347
+ :body => post_body,
1348
+ :auth_names => auth_names,
1349
+ :return_type => return_type
1350
+ )
1351
+
1352
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1353
+ if @api_client.config.debugging
1354
+ @api_client.config.logger.debug "API called: AdsApi#duplicate_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1355
+ end
1356
+ return data, status_code, headers
1357
+ end
1358
+
1151
1359
  # Estimate audience reach
1152
1360
  # Returns a normalized pre-flight audience-size estimate for a targeting spec, before any campaign is created. Backed by each platform's native reach API (Meta `delivery_estimate`, LinkedIn `audienceCounts`, X `audience_summary`, Pinterest `audience_sizing`). Platforms without a usable pre-flight reach API (Google Search/Display, TikTok) return `available: false` with no bounds, so clients can hide or grey out the estimate rather than treat the absence as an error.
1153
1361
  # @param estimate_ad_reach_request [EstimateAdReachRequest]
@@ -1574,6 +1782,79 @@ module Zernio
1574
1782
  return data, status_code, headers
1575
1783
  end
1576
1784
 
1785
+ # Creative details (Meta)
1786
+ # One creative's details, verbatim from Meta. `fields` is a raw-passthrough override of the default projection. Meta only.
1787
+ # @param creative_id [String] Platform creative id
1788
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
1789
+ # @param [Hash] opts the optional parameters
1790
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
1791
+ # @return [GetAdCreative200Response]
1792
+ def get_ad_creative(creative_id, account_id, opts = {})
1793
+ data, _status_code, _headers = get_ad_creative_with_http_info(creative_id, account_id, opts)
1794
+ data
1795
+ end
1796
+
1797
+ # Creative details (Meta)
1798
+ # One creative&#39;s details, verbatim from Meta. &#x60;fields&#x60; is a raw-passthrough override of the default projection. Meta only.
1799
+ # @param creative_id [String] Platform creative id
1800
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
1801
+ # @param [Hash] opts the optional parameters
1802
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
1803
+ # @return [Array<(GetAdCreative200Response, Integer, Hash)>] GetAdCreative200Response data, response status code and response headers
1804
+ def get_ad_creative_with_http_info(creative_id, account_id, opts = {})
1805
+ if @api_client.config.debugging
1806
+ @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_creative ...'
1807
+ end
1808
+ # verify the required parameter 'creative_id' is set
1809
+ if @api_client.config.client_side_validation && creative_id.nil?
1810
+ fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdsApi.get_ad_creative"
1811
+ end
1812
+ # verify the required parameter 'account_id' is set
1813
+ if @api_client.config.client_side_validation && account_id.nil?
1814
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.get_ad_creative"
1815
+ end
1816
+ # resource path
1817
+ local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))
1818
+
1819
+ # query parameters
1820
+ query_params = opts[:query_params] || {}
1821
+ query_params[:'accountId'] = account_id
1822
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
1823
+
1824
+ # header parameters
1825
+ header_params = opts[:header_params] || {}
1826
+ # HTTP header 'Accept' (if needed)
1827
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1828
+
1829
+ # form parameters
1830
+ form_params = opts[:form_params] || {}
1831
+
1832
+ # http body (model)
1833
+ post_body = opts[:debug_body]
1834
+
1835
+ # return_type
1836
+ return_type = opts[:debug_return_type] || 'GetAdCreative200Response'
1837
+
1838
+ # auth_names
1839
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
1840
+
1841
+ new_options = opts.merge(
1842
+ :operation => :"AdsApi.get_ad_creative",
1843
+ :header_params => header_params,
1844
+ :query_params => query_params,
1845
+ :form_params => form_params,
1846
+ :body => post_body,
1847
+ :auth_names => auth_names,
1848
+ :return_type => return_type
1849
+ )
1850
+
1851
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1852
+ if @api_client.config.debugging
1853
+ @api_client.config.logger.debug "API called: AdsApi#get_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1854
+ end
1855
+ return data, status_code, headers
1856
+ end
1857
+
1577
1858
  # Poll an async insights report run (Meta)
1578
1859
  # Status and results for a report run created via POST /v1/ads/insights/reports. While the job runs, returns `status` and `percentCompletion`. Once `status` is \"Job Completed\" the response also carries a `data` page, cursor-paginated via `limit` / `after`.
1579
1860
  # @param report_run_id [String]
@@ -2846,51 +3127,51 @@ module Zernio
2846
3127
  return data, status_code, headers
2847
3128
  end
2848
3129
 
2849
- # A/B tests and lift studies (Meta)
2850
- # 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. Meta only.
3130
+ # Creative library (Meta)
3131
+ # Lists the ad account's creative library (Meta's `/act_X/adcreatives`), rows returned verbatim. The default projection covers id, name, status, object type, thumbnail, object_story_spec / asset_feed_spec and url_tags; `fields` is a raw-passthrough override. Any creative id here is reusable on the create endpoints via `existingCreativeId`. Meta only.
2851
3132
  # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
2852
3133
  # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
2853
3134
  # @param [Hash] opts the optional parameters
2854
3135
  # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
2855
3136
  # @option opts [Integer] :limit Rows per page (default to 25)
2856
3137
  # @option opts [String] :after Cursor from paging.after of the previous page.
2857
- # @return [ListAdStudies200Response]
2858
- def list_ad_studies(account_id, ad_account_id, opts = {})
2859
- data, _status_code, _headers = list_ad_studies_with_http_info(account_id, ad_account_id, opts)
3138
+ # @return [ListAdCreatives200Response]
3139
+ def list_ad_creatives(account_id, ad_account_id, opts = {})
3140
+ data, _status_code, _headers = list_ad_creatives_with_http_info(account_id, ad_account_id, opts)
2860
3141
  data
2861
3142
  end
2862
3143
 
2863
- # A/B tests and lift studies (Meta)
2864
- # 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. Meta only.
3144
+ # Creative library (Meta)
3145
+ # Lists the ad account&#39;s creative library (Meta&#39;s &#x60;/act_X/adcreatives&#x60;), rows returned verbatim. The default projection covers id, name, status, object type, thumbnail, object_story_spec / asset_feed_spec and url_tags; &#x60;fields&#x60; is a raw-passthrough override. Any creative id here is reusable on the create endpoints via &#x60;existingCreativeId&#x60;. Meta only.
2865
3146
  # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
2866
3147
  # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
2867
3148
  # @param [Hash] opts the optional parameters
2868
3149
  # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
2869
3150
  # @option opts [Integer] :limit Rows per page (default to 25)
2870
3151
  # @option opts [String] :after Cursor from paging.after of the previous page.
2871
- # @return [Array<(ListAdStudies200Response, Integer, Hash)>] ListAdStudies200Response data, response status code and response headers
2872
- def list_ad_studies_with_http_info(account_id, ad_account_id, opts = {})
3152
+ # @return [Array<(ListAdCreatives200Response, Integer, Hash)>] ListAdCreatives200Response data, response status code and response headers
3153
+ def list_ad_creatives_with_http_info(account_id, ad_account_id, opts = {})
2873
3154
  if @api_client.config.debugging
2874
- @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_studies ...'
3155
+ @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_creatives ...'
2875
3156
  end
2876
3157
  # verify the required parameter 'account_id' is set
2877
3158
  if @api_client.config.client_side_validation && account_id.nil?
2878
- fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_studies"
3159
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_creatives"
2879
3160
  end
2880
3161
  # verify the required parameter 'ad_account_id' is set
2881
3162
  if @api_client.config.client_side_validation && ad_account_id.nil?
2882
- fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_ad_studies"
3163
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_ad_creatives"
2883
3164
  end
2884
3165
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
2885
- fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_studies, must be smaller than or equal to 100.'
3166
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_creatives, must be smaller than or equal to 100.'
2886
3167
  end
2887
3168
 
2888
3169
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
2889
- fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_studies, must be greater than or equal to 1.'
3170
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_creatives, must be greater than or equal to 1.'
2890
3171
  end
2891
3172
 
2892
3173
  # resource path
2893
- local_var_path = '/v1/ads/studies'
3174
+ local_var_path = '/v1/ads/creatives'
2894
3175
 
2895
3176
  # query parameters
2896
3177
  query_params = opts[:query_params] || {}
@@ -2912,13 +3193,13 @@ module Zernio
2912
3193
  post_body = opts[:debug_body]
2913
3194
 
2914
3195
  # return_type
2915
- return_type = opts[:debug_return_type] || 'ListAdStudies200Response'
3196
+ return_type = opts[:debug_return_type] || 'ListAdCreatives200Response'
2916
3197
 
2917
3198
  # auth_names
2918
3199
  auth_names = opts[:debug_auth_names] || ['bearerAuth']
2919
3200
 
2920
3201
  new_options = opts.merge(
2921
- :operation => :"AdsApi.list_ad_studies",
3202
+ :operation => :"AdsApi.list_ad_creatives",
2922
3203
  :header_params => header_params,
2923
3204
  :query_params => query_params,
2924
3205
  :form_params => form_params,
@@ -2929,46 +3210,307 @@ module Zernio
2929
3210
 
2930
3211
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2931
3212
  if @api_client.config.debugging
2932
- @api_client.config.logger.debug "API called: AdsApi#list_ad_studies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3213
+ @api_client.config.logger.debug "API called: AdsApi#list_ad_creatives\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2933
3214
  end
2934
3215
  return data, status_code, headers
2935
3216
  end
2936
3217
 
2937
- # List ads
2938
- # Returns a paginated list of ads with metrics computed over an optional date range. Use source=all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) those are the post/media the ad's engagement lives on, and are also returned on each ad's `creative` object. Then call GET /v1/ads/{adId}/comments with the returned ad id.
3218
+ # Ad image library (Meta)
3219
+ # Lists the ad account's image library (Meta's `/act_X/adimages`), rows returned verbatim. The default projection covers hash, url, name, dimensions and status; `fields` is a raw-passthrough override. Any `hash` here is reusable wherever Meta accepts `image_hash` (e.g. `imageHash` on POST /v1/ads/creatives). Meta only.
3220
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3221
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
2939
3222
  # @param [Hash] opts the optional parameters
2940
- # @option opts [Integer] :page Page number (1-based) (default to 1)
2941
- # @option opts [Integer] :limit (default to 50)
2942
- # @option opts [String] :source all (default) &#x3D; Zernio-created + platform-discovered ads. zernio &#x3D; restrict to Zernio-created only. (default to 'all')
2943
- # @option opts [AdStatus] :status
2944
- # @option opts [String] :platform
2945
- # @option opts [String] :account_id Social account ID
2946
- # @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
2947
- # @option opts [String] :profile_id Profile ID
2948
- # @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
2949
- # @option opts [String] :platform_ad_id Meta ad ID. Returns the ad with this platform-side ad ID.
2950
- # @option opts [String] :effective_object_story_id Facebook &#x60;{pageId}_{postId}&#x60; of the post the ad&#39;s engagement lives on (Meta &#x60;effective_object_story_id&#x60;). Use to map a Business-Manager-visible post back to the Zernio ad.
2951
- # @option opts [String] :effective_instagram_media_id Instagram media ID of the boosted post (Meta &#x60;effective_instagram_media_id&#x60;). Use to map a Business-Manager-visible IG post back to the Zernio ad.
2952
- # @option opts [Date] :from_date Start of metrics date range (YYYY-MM-DD). Defaults to 90 days ago.
2953
- # @option opts [Date] :to_date End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
2954
- # @return [ListAds200Response]
2955
- def list_ads(opts = {})
2956
- data, _status_code, _headers = list_ads_with_http_info(opts)
3223
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
3224
+ # @option opts [Integer] :limit Rows per page (default to 25)
3225
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3226
+ # @return [ListAdImages200Response]
3227
+ def list_ad_images(account_id, ad_account_id, opts = {})
3228
+ data, _status_code, _headers = list_ad_images_with_http_info(account_id, ad_account_id, opts)
2957
3229
  data
2958
3230
  end
2959
3231
 
2960
- # List ads
2961
- # Returns a paginated list of ads with metrics computed over an optional date range. Use source&#x3D;all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) those are the post/media the ad&#39;s engagement lives on, and are also returned on each ad&#39;s &#x60;creative&#x60; object. Then call GET /v1/ads/{adId}/comments with the returned ad id.
3232
+ # Ad image library (Meta)
3233
+ # Lists the ad account&#39;s image library (Meta&#39;s &#x60;/act_X/adimages&#x60;), rows returned verbatim. The default projection covers hash, url, name, dimensions and status; &#x60;fields&#x60; is a raw-passthrough override. Any &#x60;hash&#x60; here is reusable wherever Meta accepts &#x60;image_hash&#x60; (e.g. &#x60;imageHash&#x60; on POST /v1/ads/creatives). Meta only.
3234
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3235
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
2962
3236
  # @param [Hash] opts the optional parameters
2963
- # @option opts [Integer] :page Page number (1-based) (default to 1)
2964
- # @option opts [Integer] :limit (default to 50)
2965
- # @option opts [String] :source all (default) &#x3D; Zernio-created + platform-discovered ads. zernio &#x3D; restrict to Zernio-created only. (default to 'all')
2966
- # @option opts [AdStatus] :status
2967
- # @option opts [String] :platform
2968
- # @option opts [String] :account_id Social account ID
2969
- # @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
2970
- # @option opts [String] :profile_id Profile ID
2971
- # @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
3237
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
3238
+ # @option opts [Integer] :limit Rows per page (default to 25)
3239
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3240
+ # @return [Array<(ListAdImages200Response, Integer, Hash)>] ListAdImages200Response data, response status code and response headers
3241
+ def list_ad_images_with_http_info(account_id, ad_account_id, opts = {})
3242
+ if @api_client.config.debugging
3243
+ @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_images ...'
3244
+ end
3245
+ # verify the required parameter 'account_id' is set
3246
+ if @api_client.config.client_side_validation && account_id.nil?
3247
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_images"
3248
+ end
3249
+ # verify the required parameter 'ad_account_id' is set
3250
+ if @api_client.config.client_side_validation && ad_account_id.nil?
3251
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_ad_images"
3252
+ end
3253
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
3254
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_images, must be smaller than or equal to 100.'
3255
+ end
3256
+
3257
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
3258
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_images, must be greater than or equal to 1.'
3259
+ end
3260
+
3261
+ # resource path
3262
+ local_var_path = '/v1/ads/images'
3263
+
3264
+ # query parameters
3265
+ query_params = opts[:query_params] || {}
3266
+ query_params[:'accountId'] = account_id
3267
+ query_params[:'adAccountId'] = ad_account_id
3268
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
3269
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
3270
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
3271
+
3272
+ # header parameters
3273
+ header_params = opts[:header_params] || {}
3274
+ # HTTP header 'Accept' (if needed)
3275
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3276
+
3277
+ # form parameters
3278
+ form_params = opts[:form_params] || {}
3279
+
3280
+ # http body (model)
3281
+ post_body = opts[:debug_body]
3282
+
3283
+ # return_type
3284
+ return_type = opts[:debug_return_type] || 'ListAdImages200Response'
3285
+
3286
+ # auth_names
3287
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
3288
+
3289
+ new_options = opts.merge(
3290
+ :operation => :"AdsApi.list_ad_images",
3291
+ :header_params => header_params,
3292
+ :query_params => query_params,
3293
+ :form_params => form_params,
3294
+ :body => post_body,
3295
+ :auth_names => auth_names,
3296
+ :return_type => return_type
3297
+ )
3298
+
3299
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3300
+ if @api_client.config.debugging
3301
+ @api_client.config.logger.debug "API called: AdsApi#list_ad_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3302
+ end
3303
+ return data, status_code, headers
3304
+ end
3305
+
3306
+ # Ad labels (Meta)
3307
+ # Lists the ad account's organizational labels (Meta's `/act_X/adlabels`), rows returned verbatim (id, name, created/updated time). Meta only.
3308
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3309
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
3310
+ # @param [Hash] opts the optional parameters
3311
+ # @option opts [Integer] :limit Rows per page (default to 25)
3312
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3313
+ # @return [ListAdLabels200Response]
3314
+ def list_ad_labels(account_id, ad_account_id, opts = {})
3315
+ data, _status_code, _headers = list_ad_labels_with_http_info(account_id, ad_account_id, opts)
3316
+ data
3317
+ end
3318
+
3319
+ # Ad labels (Meta)
3320
+ # Lists the ad account&#39;s organizational labels (Meta&#39;s &#x60;/act_X/adlabels&#x60;), rows returned verbatim (id, name, created/updated time). Meta only.
3321
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3322
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
3323
+ # @param [Hash] opts the optional parameters
3324
+ # @option opts [Integer] :limit Rows per page (default to 25)
3325
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3326
+ # @return [Array<(ListAdLabels200Response, Integer, Hash)>] ListAdLabels200Response data, response status code and response headers
3327
+ def list_ad_labels_with_http_info(account_id, ad_account_id, opts = {})
3328
+ if @api_client.config.debugging
3329
+ @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_labels ...'
3330
+ end
3331
+ # verify the required parameter 'account_id' is set
3332
+ if @api_client.config.client_side_validation && account_id.nil?
3333
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_labels"
3334
+ end
3335
+ # verify the required parameter 'ad_account_id' is set
3336
+ if @api_client.config.client_side_validation && ad_account_id.nil?
3337
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_ad_labels"
3338
+ end
3339
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
3340
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_labels, must be smaller than or equal to 100.'
3341
+ end
3342
+
3343
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
3344
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_labels, must be greater than or equal to 1.'
3345
+ end
3346
+
3347
+ # resource path
3348
+ local_var_path = '/v1/ads/labels'
3349
+
3350
+ # query parameters
3351
+ query_params = opts[:query_params] || {}
3352
+ query_params[:'accountId'] = account_id
3353
+ query_params[:'adAccountId'] = ad_account_id
3354
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
3355
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
3356
+
3357
+ # header parameters
3358
+ header_params = opts[:header_params] || {}
3359
+ # HTTP header 'Accept' (if needed)
3360
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3361
+
3362
+ # form parameters
3363
+ form_params = opts[:form_params] || {}
3364
+
3365
+ # http body (model)
3366
+ post_body = opts[:debug_body]
3367
+
3368
+ # return_type
3369
+ return_type = opts[:debug_return_type] || 'ListAdLabels200Response'
3370
+
3371
+ # auth_names
3372
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
3373
+
3374
+ new_options = opts.merge(
3375
+ :operation => :"AdsApi.list_ad_labels",
3376
+ :header_params => header_params,
3377
+ :query_params => query_params,
3378
+ :form_params => form_params,
3379
+ :body => post_body,
3380
+ :auth_names => auth_names,
3381
+ :return_type => return_type
3382
+ )
3383
+
3384
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3385
+ if @api_client.config.debugging
3386
+ @api_client.config.logger.debug "API called: AdsApi#list_ad_labels\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3387
+ end
3388
+ return data, status_code, headers
3389
+ end
3390
+
3391
+ # A/B tests and lift studies (Meta)
3392
+ # 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. Meta only.
3393
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3394
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
3395
+ # @param [Hash] opts the optional parameters
3396
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
3397
+ # @option opts [Integer] :limit Rows per page (default to 25)
3398
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3399
+ # @return [ListAdStudies200Response]
3400
+ def list_ad_studies(account_id, ad_account_id, opts = {})
3401
+ data, _status_code, _headers = list_ad_studies_with_http_info(account_id, ad_account_id, opts)
3402
+ data
3403
+ end
3404
+
3405
+ # A/B tests and lift studies (Meta)
3406
+ # 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. Meta only.
3407
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3408
+ # @param ad_account_id [String] Meta ad account id (act_&lt;n&gt;).
3409
+ # @param [Hash] opts the optional parameters
3410
+ # @option opts [String] :fields Comma-separated Graph field override (supports nested {} projections).
3411
+ # @option opts [Integer] :limit Rows per page (default to 25)
3412
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3413
+ # @return [Array<(ListAdStudies200Response, Integer, Hash)>] ListAdStudies200Response data, response status code and response headers
3414
+ def list_ad_studies_with_http_info(account_id, ad_account_id, opts = {})
3415
+ if @api_client.config.debugging
3416
+ @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_studies ...'
3417
+ end
3418
+ # verify the required parameter 'account_id' is set
3419
+ if @api_client.config.client_side_validation && account_id.nil?
3420
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_studies"
3421
+ end
3422
+ # verify the required parameter 'ad_account_id' is set
3423
+ if @api_client.config.client_side_validation && ad_account_id.nil?
3424
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdsApi.list_ad_studies"
3425
+ end
3426
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
3427
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_studies, must be smaller than or equal to 100.'
3428
+ end
3429
+
3430
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
3431
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ad_studies, must be greater than or equal to 1.'
3432
+ end
3433
+
3434
+ # resource path
3435
+ local_var_path = '/v1/ads/studies'
3436
+
3437
+ # query parameters
3438
+ query_params = opts[:query_params] || {}
3439
+ query_params[:'accountId'] = account_id
3440
+ query_params[:'adAccountId'] = ad_account_id
3441
+ query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
3442
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
3443
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
3444
+
3445
+ # header parameters
3446
+ header_params = opts[:header_params] || {}
3447
+ # HTTP header 'Accept' (if needed)
3448
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3449
+
3450
+ # form parameters
3451
+ form_params = opts[:form_params] || {}
3452
+
3453
+ # http body (model)
3454
+ post_body = opts[:debug_body]
3455
+
3456
+ # return_type
3457
+ return_type = opts[:debug_return_type] || 'ListAdStudies200Response'
3458
+
3459
+ # auth_names
3460
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
3461
+
3462
+ new_options = opts.merge(
3463
+ :operation => :"AdsApi.list_ad_studies",
3464
+ :header_params => header_params,
3465
+ :query_params => query_params,
3466
+ :form_params => form_params,
3467
+ :body => post_body,
3468
+ :auth_names => auth_names,
3469
+ :return_type => return_type
3470
+ )
3471
+
3472
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3473
+ if @api_client.config.debugging
3474
+ @api_client.config.logger.debug "API called: AdsApi#list_ad_studies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3475
+ end
3476
+ return data, status_code, headers
3477
+ end
3478
+
3479
+ # List ads
3480
+ # Returns a paginated list of ads with metrics computed over an optional date range. Use source=all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) — those are the post/media the ad's engagement lives on, and are also returned on each ad's `creative` object. Then call GET /v1/ads/{adId}/comments with the returned ad id.
3481
+ # @param [Hash] opts the optional parameters
3482
+ # @option opts [Integer] :page Page number (1-based) (default to 1)
3483
+ # @option opts [Integer] :limit (default to 50)
3484
+ # @option opts [String] :source all (default) &#x3D; Zernio-created + platform-discovered ads. zernio &#x3D; restrict to Zernio-created only. (default to 'all')
3485
+ # @option opts [AdStatus] :status
3486
+ # @option opts [String] :platform
3487
+ # @option opts [String] :account_id Social account ID
3488
+ # @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
3489
+ # @option opts [String] :profile_id Profile ID
3490
+ # @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
3491
+ # @option opts [String] :platform_ad_id Meta ad ID. Returns the ad with this platform-side ad ID.
3492
+ # @option opts [String] :effective_object_story_id Facebook &#x60;{pageId}_{postId}&#x60; of the post the ad&#39;s engagement lives on (Meta &#x60;effective_object_story_id&#x60;). Use to map a Business-Manager-visible post back to the Zernio ad.
3493
+ # @option opts [String] :effective_instagram_media_id Instagram media ID of the boosted post (Meta &#x60;effective_instagram_media_id&#x60;). Use to map a Business-Manager-visible IG post back to the Zernio ad.
3494
+ # @option opts [Date] :from_date Start of metrics date range (YYYY-MM-DD). Defaults to 90 days ago.
3495
+ # @option opts [Date] :to_date End of metrics date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
3496
+ # @return [ListAds200Response]
3497
+ def list_ads(opts = {})
3498
+ data, _status_code, _headers = list_ads_with_http_info(opts)
3499
+ data
3500
+ end
3501
+
3502
+ # List ads
3503
+ # Returns a paginated list of ads with metrics computed over an optional date range. Use source&#x3D;all to include externally-synced ads from platform ad managers. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max. To find the Zernio ad behind a comment you see in Meta Business Manager, filter by platformAdId (the Meta ad ID), effectiveObjectStoryId (Facebook), or effectiveInstagramMediaId (Instagram) — those are the post/media the ad&#39;s engagement lives on, and are also returned on each ad&#39;s &#x60;creative&#x60; object. Then call GET /v1/ads/{adId}/comments with the returned ad id.
3504
+ # @param [Hash] opts the optional parameters
3505
+ # @option opts [Integer] :page Page number (1-based) (default to 1)
3506
+ # @option opts [Integer] :limit (default to 50)
3507
+ # @option opts [String] :source all (default) &#x3D; Zernio-created + platform-discovered ads. zernio &#x3D; restrict to Zernio-created only. (default to 'all')
3508
+ # @option opts [AdStatus] :status
3509
+ # @option opts [String] :platform
3510
+ # @option opts [String] :account_id Social account ID
3511
+ # @option opts [String] :ad_account_id Platform ad account ID (e.g. act_123 for Meta). Mirrors the same filter on /v1/ads/campaigns and /v1/ads/tree.
3512
+ # @option opts [String] :profile_id Profile ID
3513
+ # @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
2972
3514
  # @option opts [String] :platform_ad_id Meta ad ID. Returns the ad with this platform-side ad ID.
2973
3515
  # @option opts [String] :effective_object_story_id Facebook &#x60;{pageId}_{postId}&#x60; of the post the ad&#39;s engagement lives on (Meta &#x60;effective_object_story_id&#x60;). Use to map a Business-Manager-visible post back to the Zernio ad.
2974
3516
  # @option opts [String] :effective_instagram_media_id Instagram media ID of the boosted post (Meta &#x60;effective_instagram_media_id&#x60;). Use to map a Business-Manager-visible IG post back to the Zernio ad.
@@ -3343,6 +3885,90 @@ module Zernio
3343
3885
  return data, status_code, headers
3344
3886
  end
3345
3887
 
3888
+ # High demand periods / budget schedules (Meta)
3889
+ # 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). Meta only.
3890
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3891
+ # @param [Hash] opts the optional parameters
3892
+ # @option opts [String] :campaign_id Platform campaign id. Exactly one of campaignId / adSetId.
3893
+ # @option opts [String] :ad_set_id Platform ad set id. Exactly one of campaignId / adSetId.
3894
+ # @option opts [Integer] :limit Rows per page (default to 25)
3895
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3896
+ # @return [ListHighDemandPeriods200Response]
3897
+ def list_high_demand_periods(account_id, opts = {})
3898
+ data, _status_code, _headers = list_high_demand_periods_with_http_info(account_id, opts)
3899
+ data
3900
+ end
3901
+
3902
+ # High demand periods / budget schedules (Meta)
3903
+ # 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). Meta only.
3904
+ # @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
3905
+ # @param [Hash] opts the optional parameters
3906
+ # @option opts [String] :campaign_id Platform campaign id. Exactly one of campaignId / adSetId.
3907
+ # @option opts [String] :ad_set_id Platform ad set id. Exactly one of campaignId / adSetId.
3908
+ # @option opts [Integer] :limit Rows per page (default to 25)
3909
+ # @option opts [String] :after Cursor from paging.after of the previous page.
3910
+ # @return [Array<(ListHighDemandPeriods200Response, Integer, Hash)>] ListHighDemandPeriods200Response data, response status code and response headers
3911
+ def list_high_demand_periods_with_http_info(account_id, opts = {})
3912
+ if @api_client.config.debugging
3913
+ @api_client.config.logger.debug 'Calling API: AdsApi.list_high_demand_periods ...'
3914
+ end
3915
+ # verify the required parameter 'account_id' is set
3916
+ if @api_client.config.client_side_validation && account_id.nil?
3917
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_high_demand_periods"
3918
+ end
3919
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
3920
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_high_demand_periods, must be smaller than or equal to 100.'
3921
+ end
3922
+
3923
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
3924
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_high_demand_periods, must be greater than or equal to 1.'
3925
+ end
3926
+
3927
+ # resource path
3928
+ local_var_path = '/v1/ads/high-demand-periods'
3929
+
3930
+ # query parameters
3931
+ query_params = opts[:query_params] || {}
3932
+ query_params[:'accountId'] = account_id
3933
+ query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
3934
+ query_params[:'adSetId'] = opts[:'ad_set_id'] if !opts[:'ad_set_id'].nil?
3935
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
3936
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
3937
+
3938
+ # header parameters
3939
+ header_params = opts[:header_params] || {}
3940
+ # HTTP header 'Accept' (if needed)
3941
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3942
+
3943
+ # form parameters
3944
+ form_params = opts[:form_params] || {}
3945
+
3946
+ # http body (model)
3947
+ post_body = opts[:debug_body]
3948
+
3949
+ # return_type
3950
+ return_type = opts[:debug_return_type] || 'ListHighDemandPeriods200Response'
3951
+
3952
+ # auth_names
3953
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
3954
+
3955
+ new_options = opts.merge(
3956
+ :operation => :"AdsApi.list_high_demand_periods",
3957
+ :header_params => header_params,
3958
+ :query_params => query_params,
3959
+ :form_params => form_params,
3960
+ :body => post_body,
3961
+ :auth_names => auth_names,
3962
+ :return_type => return_type
3963
+ )
3964
+
3965
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3966
+ if @api_client.config.debugging
3967
+ @api_client.config.logger.debug "API called: AdsApi#list_high_demand_periods\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3968
+ end
3969
+ return data, status_code, headers
3970
+ end
3971
+
3346
3972
  # List lead forms
3347
3973
  # Lists the Lead Gen forms owned by the connected Facebook Page. Requires the Ads add-on.
3348
3974
  # @param account_id [String] Connected facebook account id.
@@ -4314,6 +4940,80 @@ module Zernio
4314
4940
  return data, status_code, headers
4315
4941
  end
4316
4942
 
4943
+ # Rename a creative (Meta)
4944
+ # Renames a creative. Creatives are immutable on Meta beyond `name` — for content changes create a new creative (POST /v1/ads/creatives) and swap it onto the ad (PUT /v1/ads/{adId} with `creative`). Meta only.
4945
+ # @param creative_id [String] Platform creative id
4946
+ # @param update_ad_creative_request [UpdateAdCreativeRequest]
4947
+ # @param [Hash] opts the optional parameters
4948
+ # @return [UpdateAdCreative200Response]
4949
+ def update_ad_creative(creative_id, update_ad_creative_request, opts = {})
4950
+ data, _status_code, _headers = update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts)
4951
+ data
4952
+ end
4953
+
4954
+ # Rename a creative (Meta)
4955
+ # Renames a creative. Creatives are immutable on Meta beyond &#x60;name&#x60; — for content changes create a new creative (POST /v1/ads/creatives) and swap it onto the ad (PUT /v1/ads/{adId} with &#x60;creative&#x60;). Meta only.
4956
+ # @param creative_id [String] Platform creative id
4957
+ # @param update_ad_creative_request [UpdateAdCreativeRequest]
4958
+ # @param [Hash] opts the optional parameters
4959
+ # @return [Array<(UpdateAdCreative200Response, Integer, Hash)>] UpdateAdCreative200Response data, response status code and response headers
4960
+ def update_ad_creative_with_http_info(creative_id, update_ad_creative_request, opts = {})
4961
+ if @api_client.config.debugging
4962
+ @api_client.config.logger.debug 'Calling API: AdsApi.update_ad_creative ...'
4963
+ end
4964
+ # verify the required parameter 'creative_id' is set
4965
+ if @api_client.config.client_side_validation && creative_id.nil?
4966
+ fail ArgumentError, "Missing the required parameter 'creative_id' when calling AdsApi.update_ad_creative"
4967
+ end
4968
+ # verify the required parameter 'update_ad_creative_request' is set
4969
+ if @api_client.config.client_side_validation && update_ad_creative_request.nil?
4970
+ fail ArgumentError, "Missing the required parameter 'update_ad_creative_request' when calling AdsApi.update_ad_creative"
4971
+ end
4972
+ # resource path
4973
+ local_var_path = '/v1/ads/creatives/{creativeId}'.sub('{' + 'creativeId' + '}', CGI.escape(creative_id.to_s))
4974
+
4975
+ # query parameters
4976
+ query_params = opts[:query_params] || {}
4977
+
4978
+ # header parameters
4979
+ header_params = opts[:header_params] || {}
4980
+ # HTTP header 'Accept' (if needed)
4981
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
4982
+ # HTTP header 'Content-Type'
4983
+ content_type = @api_client.select_header_content_type(['application/json'])
4984
+ if !content_type.nil?
4985
+ header_params['Content-Type'] = content_type
4986
+ end
4987
+
4988
+ # form parameters
4989
+ form_params = opts[:form_params] || {}
4990
+
4991
+ # http body (model)
4992
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_creative_request)
4993
+
4994
+ # return_type
4995
+ return_type = opts[:debug_return_type] || 'UpdateAdCreative200Response'
4996
+
4997
+ # auth_names
4998
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
4999
+
5000
+ new_options = opts.merge(
5001
+ :operation => :"AdsApi.update_ad_creative",
5002
+ :header_params => header_params,
5003
+ :query_params => query_params,
5004
+ :form_params => form_params,
5005
+ :body => post_body,
5006
+ :auth_names => auth_names,
5007
+ :return_type => return_type
5008
+ )
5009
+
5010
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
5011
+ if @api_client.config.debugging
5012
+ @api_client.config.logger.debug "API called: AdsApi#update_ad_creative\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
5013
+ end
5014
+ return data, status_code, headers
5015
+ end
5016
+
4317
5017
  # Pause or resume a single ad
4318
5018
  # Ad-scoped pause/resume — touches ONLY this ad, never its parent ad set or campaign (so sibling ads keep running). Thin wrapper over the `status` field of PUT /v1/ads/{adId}, for callers that want a URL symmetric to /v1/ads/campaigns/{campaignId}/status and /v1/ads/ad-sets/{adSetId}/status. `{adId}` accepts the same identifier dialects as GET/PUT /v1/ads/{adId} (Zernio hex `_id`, Meta numeric `platformAdId`, or the creative's effective story/media IDs). `platform` is inferred from the ad, so it's not required in the body. Ads in terminal statuses (rejected, completed, cancelled) and no-op flips (already in the target state) are skipped.
4319
5019
  # @param ad_id [String] Zernio &#x60;_id&#x60; (hex), Meta &#x60;platformAdId&#x60; (numeric), or one of the creative&#39;s effective story/media IDs.