late-sdk 0.0.98 → 0.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +53 -0
  3. data/docs/Ad.md +58 -0
  4. data/docs/AdAudiencesApi.md +365 -0
  5. data/docs/AdBudget.md +20 -0
  6. data/docs/AdCampaign.md +40 -0
  7. data/docs/AdCampaignsApi.md +165 -0
  8. data/docs/AdMetrics.md +34 -0
  9. data/docs/AdSchedule.md +20 -0
  10. data/docs/AddUsersToAdAudience200Response.md +22 -0
  11. data/docs/AddUsersToAdAudienceRequest.md +18 -0
  12. data/docs/AddUsersToAdAudienceRequestUsersInner.md +20 -0
  13. data/docs/AdsApi.md +726 -0
  14. data/docs/BoostPostRequest.md +36 -0
  15. data/docs/BoostPostRequestBudget.md +20 -0
  16. data/docs/BoostPostRequestSchedule.md +20 -0
  17. data/docs/BoostPostRequestTargeting.md +24 -0
  18. data/docs/CreateAdAudience201Response.md +20 -0
  19. data/docs/CreateAdAudienceRequest.md +36 -0
  20. data/docs/CreateStandaloneAdRequest.md +56 -0
  21. data/docs/GetAd200Response.md +18 -0
  22. data/docs/GetAdAnalytics200Response.md +20 -0
  23. data/docs/GetAdAnalytics200ResponseAd.md +24 -0
  24. data/docs/GetAdAnalytics200ResponseAnalytics.md +22 -0
  25. data/docs/GetAdAnalytics200ResponseAnalyticsDailyInner.md +36 -0
  26. data/docs/GetAdAudience200Response.md +20 -0
  27. data/docs/ListAdAccounts200Response.md +18 -0
  28. data/docs/ListAdAccounts200ResponseAccountsInner.md +24 -0
  29. data/docs/ListAdAudiences200Response.md +18 -0
  30. data/docs/ListAdAudiences200ResponseAudiencesInner.md +32 -0
  31. data/docs/ListAdCampaigns200Response.md +20 -0
  32. data/docs/ListAds200Response.md +20 -0
  33. data/docs/SearchAdInterests200Response.md +18 -0
  34. data/docs/SearchAdInterests200ResponseInterestsInner.md +22 -0
  35. data/docs/SyncExternalAds200Response.md +24 -0
  36. data/docs/UpdateAd200Response.md +20 -0
  37. data/docs/UpdateAdCampaignStatus200Response.md +22 -0
  38. data/docs/UpdateAdCampaignStatusRequest.md +20 -0
  39. data/docs/UpdateAdRequest.md +24 -0
  40. data/docs/UpdateAdRequestBudget.md +20 -0
  41. data/docs/UpdateAdRequestTargeting.md +24 -0
  42. data/lib/late-sdk/api/ad_audiences_api.rb +368 -0
  43. data/lib/late-sdk/api/ad_campaigns_api.rb +201 -0
  44. data/lib/late-sdk/api/ads_api.rb +719 -0
  45. data/lib/late-sdk/models/ad.rb +399 -0
  46. data/lib/late-sdk/models/ad_budget.rb +190 -0
  47. data/lib/late-sdk/models/ad_campaign.rb +293 -0
  48. data/lib/late-sdk/models/ad_metrics.rb +222 -0
  49. data/lib/late-sdk/models/ad_schedule.rb +156 -0
  50. data/lib/late-sdk/models/add_users_to_ad_audience200_response.rb +165 -0
  51. data/lib/late-sdk/models/add_users_to_ad_audience_request.rb +175 -0
  52. data/lib/late-sdk/models/add_users_to_ad_audience_request_users_inner.rb +157 -0
  53. data/lib/late-sdk/models/boost_post_request.rb +350 -0
  54. data/lib/late-sdk/models/boost_post_request_budget.rb +215 -0
  55. data/lib/late-sdk/models/boost_post_request_schedule.rb +157 -0
  56. data/lib/late-sdk/models/boost_post_request_targeting.rb +234 -0
  57. data/lib/late-sdk/models/create_ad_audience201_response.rb +156 -0
  58. data/lib/late-sdk/models/create_ad_audience_request.rb +391 -0
  59. data/lib/late-sdk/models/create_standalone_ad_request.rb +585 -0
  60. data/lib/late-sdk/models/get_ad200_response.rb +147 -0
  61. data/lib/late-sdk/models/get_ad_analytics200_response.rb +156 -0
  62. data/lib/late-sdk/models/get_ad_analytics200_response_ad.rb +174 -0
  63. data/lib/late-sdk/models/get_ad_analytics200_response_analytics.rb +169 -0
  64. data/lib/late-sdk/models/get_ad_analytics200_response_analytics_daily_inner.rb +238 -0
  65. data/lib/late-sdk/models/get_ad_audience200_response.rb +157 -0
  66. data/lib/late-sdk/models/list_ad_accounts200_response.rb +149 -0
  67. data/lib/late-sdk/models/list_ad_accounts200_response_accounts_inner.rb +175 -0
  68. data/lib/late-sdk/models/list_ad_audiences200_response.rb +149 -0
  69. data/lib/late-sdk/models/list_ad_audiences200_response_audiences_inner.rb +244 -0
  70. data/lib/late-sdk/models/list_ad_campaigns200_response.rb +158 -0
  71. data/lib/late-sdk/models/list_ads200_response.rb +158 -0
  72. data/lib/late-sdk/models/search_ad_interests200_response.rb +149 -0
  73. data/lib/late-sdk/models/search_ad_interests200_response_interests_inner.rb +165 -0
  74. data/lib/late-sdk/models/sync_external_ads200_response.rb +177 -0
  75. data/lib/late-sdk/models/update_ad200_response.rb +156 -0
  76. data/lib/late-sdk/models/update_ad_campaign_status200_response.rb +169 -0
  77. data/lib/late-sdk/models/update_ad_campaign_status_request.rb +216 -0
  78. data/lib/late-sdk/models/update_ad_request.rb +208 -0
  79. data/lib/late-sdk/models/update_ad_request_budget.rb +191 -0
  80. data/lib/late-sdk/models/update_ad_request_targeting.rb +235 -0
  81. data/lib/late-sdk/version.rb +1 -1
  82. data/lib/late-sdk.rb +39 -0
  83. data/openapi.yaml +684 -0
  84. data/spec/api/ad_audiences_api_spec.rb +98 -0
  85. data/spec/api/ad_campaigns_api_spec.rb +67 -0
  86. data/spec/api/ads_api_spec.rb +163 -0
  87. data/spec/models/ad_budget_spec.rb +46 -0
  88. data/spec/models/ad_campaign_spec.rb +110 -0
  89. data/spec/models/ad_metrics_spec.rb +84 -0
  90. data/spec/models/ad_schedule_spec.rb +42 -0
  91. data/spec/models/ad_spec.rb +172 -0
  92. data/spec/models/add_users_to_ad_audience200_response_spec.rb +48 -0
  93. data/spec/models/add_users_to_ad_audience_request_spec.rb +36 -0
  94. data/spec/models/add_users_to_ad_audience_request_users_inner_spec.rb +42 -0
  95. data/spec/models/boost_post_request_budget_spec.rb +46 -0
  96. data/spec/models/boost_post_request_schedule_spec.rb +42 -0
  97. data/spec/models/boost_post_request_spec.rb +94 -0
  98. data/spec/models/boost_post_request_targeting_spec.rb +54 -0
  99. data/spec/models/create_ad_audience201_response_spec.rb +42 -0
  100. data/spec/models/create_ad_audience_request_spec.rb +94 -0
  101. data/spec/models/create_standalone_ad_request_spec.rb +166 -0
  102. data/spec/models/get_ad200_response_spec.rb +36 -0
  103. data/spec/models/get_ad_analytics200_response_ad_spec.rb +54 -0
  104. data/spec/models/get_ad_analytics200_response_analytics_daily_inner_spec.rb +90 -0
  105. data/spec/models/get_ad_analytics200_response_analytics_spec.rb +48 -0
  106. data/spec/models/get_ad_analytics200_response_spec.rb +42 -0
  107. data/spec/models/get_ad_audience200_response_spec.rb +42 -0
  108. data/spec/models/list_ad_accounts200_response_accounts_inner_spec.rb +54 -0
  109. data/spec/models/list_ad_accounts200_response_spec.rb +36 -0
  110. data/spec/models/list_ad_audiences200_response_audiences_inner_spec.rb +82 -0
  111. data/spec/models/list_ad_audiences200_response_spec.rb +36 -0
  112. data/spec/models/list_ad_campaigns200_response_spec.rb +42 -0
  113. data/spec/models/list_ads200_response_spec.rb +42 -0
  114. data/spec/models/search_ad_interests200_response_interests_inner_spec.rb +48 -0
  115. data/spec/models/search_ad_interests200_response_spec.rb +36 -0
  116. data/spec/models/sync_external_ads200_response_spec.rb +54 -0
  117. data/spec/models/update_ad200_response_spec.rb +42 -0
  118. data/spec/models/update_ad_campaign_status200_response_spec.rb +48 -0
  119. data/spec/models/update_ad_campaign_status_request_spec.rb +50 -0
  120. data/spec/models/update_ad_request_budget_spec.rb +46 -0
  121. data/spec/models/update_ad_request_spec.rb +58 -0
  122. data/spec/models/update_ad_request_targeting_spec.rb +54 -0
  123. data/zernio-sdk-0.0.99.gem +0 -0
  124. metadata +158 -2
  125. data/zernio-sdk-0.0.98.gem +0 -0
@@ -0,0 +1,719 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.1
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Late
16
+ class AdsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Boost an existing post as a paid ad
23
+ # Creates a paid ad campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).
24
+ # @param boost_post_request [BoostPostRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [UpdateAd200Response]
27
+ def boost_post(boost_post_request, opts = {})
28
+ data, _status_code, _headers = boost_post_with_http_info(boost_post_request, opts)
29
+ data
30
+ end
31
+
32
+ # Boost an existing post as a paid ad
33
+ # Creates a paid ad campaign from an existing published post. Creates the full platform campaign hierarchy (campaign, ad set, ad).
34
+ # @param boost_post_request [BoostPostRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(UpdateAd200Response, Integer, Hash)>] UpdateAd200Response data, response status code and response headers
37
+ def boost_post_with_http_info(boost_post_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: AdsApi.boost_post ...'
40
+ end
41
+ # verify the required parameter 'boost_post_request' is set
42
+ if @api_client.config.client_side_validation && boost_post_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'boost_post_request' when calling AdsApi.boost_post"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v1/ads/boost'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(boost_post_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'UpdateAd200Response'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"AdsApi.boost_post",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: AdsApi#boost_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Create a standalone ad with custom creative
91
+ # Creates a paid ad with custom creative (headline, body, image/video, link). Creates the full platform campaign hierarchy.
92
+ # @param create_standalone_ad_request [CreateStandaloneAdRequest]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [UpdateAd200Response]
95
+ def create_standalone_ad(create_standalone_ad_request, opts = {})
96
+ data, _status_code, _headers = create_standalone_ad_with_http_info(create_standalone_ad_request, opts)
97
+ data
98
+ end
99
+
100
+ # Create a standalone ad with custom creative
101
+ # Creates a paid ad with custom creative (headline, body, image/video, link). Creates the full platform campaign hierarchy.
102
+ # @param create_standalone_ad_request [CreateStandaloneAdRequest]
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(UpdateAd200Response, Integer, Hash)>] UpdateAd200Response data, response status code and response headers
105
+ def create_standalone_ad_with_http_info(create_standalone_ad_request, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: AdsApi.create_standalone_ad ...'
108
+ end
109
+ # verify the required parameter 'create_standalone_ad_request' is set
110
+ if @api_client.config.client_side_validation && create_standalone_ad_request.nil?
111
+ fail ArgumentError, "Missing the required parameter 'create_standalone_ad_request' when calling AdsApi.create_standalone_ad"
112
+ end
113
+ # resource path
114
+ local_var_path = '/v1/ads/create'
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+ # HTTP header 'Accept' (if needed)
122
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
123
+ # HTTP header 'Content-Type'
124
+ content_type = @api_client.select_header_content_type(['application/json'])
125
+ if !content_type.nil?
126
+ header_params['Content-Type'] = content_type
127
+ end
128
+
129
+ # form parameters
130
+ form_params = opts[:form_params] || {}
131
+
132
+ # http body (model)
133
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_standalone_ad_request)
134
+
135
+ # return_type
136
+ return_type = opts[:debug_return_type] || 'UpdateAd200Response'
137
+
138
+ # auth_names
139
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
140
+
141
+ new_options = opts.merge(
142
+ :operation => :"AdsApi.create_standalone_ad",
143
+ :header_params => header_params,
144
+ :query_params => query_params,
145
+ :form_params => form_params,
146
+ :body => post_body,
147
+ :auth_names => auth_names,
148
+ :return_type => return_type
149
+ )
150
+
151
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
152
+ if @api_client.config.debugging
153
+ @api_client.config.logger.debug "API called: AdsApi#create_standalone_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
154
+ end
155
+ return data, status_code, headers
156
+ end
157
+
158
+ # Cancel an ad
159
+ # Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history.
160
+ # @param ad_id [String]
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [DeleteAccountGroup200Response]
163
+ def delete_ad(ad_id, opts = {})
164
+ data, _status_code, _headers = delete_ad_with_http_info(ad_id, opts)
165
+ data
166
+ end
167
+
168
+ # Cancel an ad
169
+ # Cancels the ad on the platform and marks it as cancelled in the database. The ad is preserved for history.
170
+ # @param ad_id [String]
171
+ # @param [Hash] opts the optional parameters
172
+ # @return [Array<(DeleteAccountGroup200Response, Integer, Hash)>] DeleteAccountGroup200Response data, response status code and response headers
173
+ def delete_ad_with_http_info(ad_id, opts = {})
174
+ if @api_client.config.debugging
175
+ @api_client.config.logger.debug 'Calling API: AdsApi.delete_ad ...'
176
+ end
177
+ # verify the required parameter 'ad_id' is set
178
+ if @api_client.config.client_side_validation && ad_id.nil?
179
+ fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.delete_ad"
180
+ end
181
+ # resource path
182
+ local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))
183
+
184
+ # query parameters
185
+ query_params = opts[:query_params] || {}
186
+
187
+ # header parameters
188
+ header_params = opts[:header_params] || {}
189
+ # HTTP header 'Accept' (if needed)
190
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
191
+
192
+ # form parameters
193
+ form_params = opts[:form_params] || {}
194
+
195
+ # http body (model)
196
+ post_body = opts[:debug_body]
197
+
198
+ # return_type
199
+ return_type = opts[:debug_return_type] || 'DeleteAccountGroup200Response'
200
+
201
+ # auth_names
202
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
203
+
204
+ new_options = opts.merge(
205
+ :operation => :"AdsApi.delete_ad",
206
+ :header_params => header_params,
207
+ :query_params => query_params,
208
+ :form_params => form_params,
209
+ :body => post_body,
210
+ :auth_names => auth_names,
211
+ :return_type => return_type
212
+ )
213
+
214
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
215
+ if @api_client.config.debugging
216
+ @api_client.config.logger.debug "API called: AdsApi#delete_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
217
+ end
218
+ return data, status_code, headers
219
+ end
220
+
221
+ # Get ad details
222
+ # @param ad_id [String]
223
+ # @param [Hash] opts the optional parameters
224
+ # @return [GetAd200Response]
225
+ def get_ad(ad_id, opts = {})
226
+ data, _status_code, _headers = get_ad_with_http_info(ad_id, opts)
227
+ data
228
+ end
229
+
230
+ # Get ad details
231
+ # @param ad_id [String]
232
+ # @param [Hash] opts the optional parameters
233
+ # @return [Array<(GetAd200Response, Integer, Hash)>] GetAd200Response data, response status code and response headers
234
+ def get_ad_with_http_info(ad_id, opts = {})
235
+ if @api_client.config.debugging
236
+ @api_client.config.logger.debug 'Calling API: AdsApi.get_ad ...'
237
+ end
238
+ # verify the required parameter 'ad_id' is set
239
+ if @api_client.config.client_side_validation && ad_id.nil?
240
+ fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.get_ad"
241
+ end
242
+ # resource path
243
+ local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))
244
+
245
+ # query parameters
246
+ query_params = opts[:query_params] || {}
247
+
248
+ # header parameters
249
+ header_params = opts[:header_params] || {}
250
+ # HTTP header 'Accept' (if needed)
251
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
252
+
253
+ # form parameters
254
+ form_params = opts[:form_params] || {}
255
+
256
+ # http body (model)
257
+ post_body = opts[:debug_body]
258
+
259
+ # return_type
260
+ return_type = opts[:debug_return_type] || 'GetAd200Response'
261
+
262
+ # auth_names
263
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
264
+
265
+ new_options = opts.merge(
266
+ :operation => :"AdsApi.get_ad",
267
+ :header_params => header_params,
268
+ :query_params => query_params,
269
+ :form_params => form_params,
270
+ :body => post_body,
271
+ :auth_names => auth_names,
272
+ :return_type => return_type
273
+ )
274
+
275
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
276
+ if @api_client.config.debugging
277
+ @api_client.config.logger.debug "API called: AdsApi#get_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
278
+ end
279
+ return data, status_code, headers
280
+ end
281
+
282
+ # Get ad analytics with daily breakdown
283
+ # Returns real-time analytics from the platform API (not cached). Includes summary metrics, daily breakdown, and optional demographic breakdowns (Meta and TikTok only).
284
+ # @param ad_id [String]
285
+ # @param [Hash] opts the optional parameters
286
+ # @option opts [String] :breakdowns Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region. TikTok: gender, age, country_code, platform, ac, language.
287
+ # @return [GetAdAnalytics200Response]
288
+ def get_ad_analytics(ad_id, opts = {})
289
+ data, _status_code, _headers = get_ad_analytics_with_http_info(ad_id, opts)
290
+ data
291
+ end
292
+
293
+ # Get ad analytics with daily breakdown
294
+ # Returns real-time analytics from the platform API (not cached). Includes summary metrics, daily breakdown, and optional demographic breakdowns (Meta and TikTok only).
295
+ # @param ad_id [String]
296
+ # @param [Hash] opts the optional parameters
297
+ # @option opts [String] :breakdowns Comma-separated breakdown dimensions. Meta: age, gender, country, publisher_platform, device_platform, region. TikTok: gender, age, country_code, platform, ac, language.
298
+ # @return [Array<(GetAdAnalytics200Response, Integer, Hash)>] GetAdAnalytics200Response data, response status code and response headers
299
+ def get_ad_analytics_with_http_info(ad_id, opts = {})
300
+ if @api_client.config.debugging
301
+ @api_client.config.logger.debug 'Calling API: AdsApi.get_ad_analytics ...'
302
+ end
303
+ # verify the required parameter 'ad_id' is set
304
+ if @api_client.config.client_side_validation && ad_id.nil?
305
+ fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.get_ad_analytics"
306
+ end
307
+ # resource path
308
+ local_var_path = '/v1/ads/{adId}/analytics'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))
309
+
310
+ # query parameters
311
+ query_params = opts[:query_params] || {}
312
+ query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil?
313
+
314
+ # header parameters
315
+ header_params = opts[:header_params] || {}
316
+ # HTTP header 'Accept' (if needed)
317
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
318
+
319
+ # form parameters
320
+ form_params = opts[:form_params] || {}
321
+
322
+ # http body (model)
323
+ post_body = opts[:debug_body]
324
+
325
+ # return_type
326
+ return_type = opts[:debug_return_type] || 'GetAdAnalytics200Response'
327
+
328
+ # auth_names
329
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
330
+
331
+ new_options = opts.merge(
332
+ :operation => :"AdsApi.get_ad_analytics",
333
+ :header_params => header_params,
334
+ :query_params => query_params,
335
+ :form_params => form_params,
336
+ :body => post_body,
337
+ :auth_names => auth_names,
338
+ :return_type => return_type
339
+ )
340
+
341
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
342
+ if @api_client.config.debugging
343
+ @api_client.config.logger.debug "API called: AdsApi#get_ad_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
344
+ end
345
+ return data, status_code, headers
346
+ end
347
+
348
+ # List ad accounts for a social account
349
+ # Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs).
350
+ # @param account_id [String] Social account ID
351
+ # @param [Hash] opts the optional parameters
352
+ # @return [ListAdAccounts200Response]
353
+ def list_ad_accounts(account_id, opts = {})
354
+ data, _status_code, _headers = list_ad_accounts_with_http_info(account_id, opts)
355
+ data
356
+ end
357
+
358
+ # List ad accounts for a social account
359
+ # Returns the platform ad accounts available for the given social account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs).
360
+ # @param account_id [String] Social account ID
361
+ # @param [Hash] opts the optional parameters
362
+ # @return [Array<(ListAdAccounts200Response, Integer, Hash)>] ListAdAccounts200Response data, response status code and response headers
363
+ def list_ad_accounts_with_http_info(account_id, opts = {})
364
+ if @api_client.config.debugging
365
+ @api_client.config.logger.debug 'Calling API: AdsApi.list_ad_accounts ...'
366
+ end
367
+ # verify the required parameter 'account_id' is set
368
+ if @api_client.config.client_side_validation && account_id.nil?
369
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.list_ad_accounts"
370
+ end
371
+ # resource path
372
+ local_var_path = '/v1/ads/accounts'
373
+
374
+ # query parameters
375
+ query_params = opts[:query_params] || {}
376
+ query_params[:'accountId'] = account_id
377
+
378
+ # header parameters
379
+ header_params = opts[:header_params] || {}
380
+ # HTTP header 'Accept' (if needed)
381
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
382
+
383
+ # form parameters
384
+ form_params = opts[:form_params] || {}
385
+
386
+ # http body (model)
387
+ post_body = opts[:debug_body]
388
+
389
+ # return_type
390
+ return_type = opts[:debug_return_type] || 'ListAdAccounts200Response'
391
+
392
+ # auth_names
393
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
394
+
395
+ new_options = opts.merge(
396
+ :operation => :"AdsApi.list_ad_accounts",
397
+ :header_params => header_params,
398
+ :query_params => query_params,
399
+ :form_params => form_params,
400
+ :body => post_body,
401
+ :auth_names => auth_names,
402
+ :return_type => return_type
403
+ )
404
+
405
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
406
+ if @api_client.config.debugging
407
+ @api_client.config.logger.debug "API called: AdsApi#list_ad_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
408
+ end
409
+ return data, status_code, headers
410
+ end
411
+
412
+ # List ads
413
+ # Returns a paginated list of ads with cached metrics. Use `source=all` to include externally-synced ads from platform ad managers.
414
+ # @param [Hash] opts the optional parameters
415
+ # @option opts [Integer] :page Page number (1-based) (default to 1)
416
+ # @option opts [Integer] :limit (default to 50)
417
+ # @option opts [String] :source zernio &#x3D; Zernio-created only, all &#x3D; include external ads (default to 'zernio')
418
+ # @option opts [String] :status
419
+ # @option opts [String] :platform
420
+ # @option opts [String] :account_id Social account ID
421
+ # @option opts [String] :profile_id Profile ID
422
+ # @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
423
+ # @return [ListAds200Response]
424
+ def list_ads(opts = {})
425
+ data, _status_code, _headers = list_ads_with_http_info(opts)
426
+ data
427
+ end
428
+
429
+ # List ads
430
+ # Returns a paginated list of ads with cached metrics. Use &#x60;source&#x3D;all&#x60; to include externally-synced ads from platform ad managers.
431
+ # @param [Hash] opts the optional parameters
432
+ # @option opts [Integer] :page Page number (1-based) (default to 1)
433
+ # @option opts [Integer] :limit (default to 50)
434
+ # @option opts [String] :source zernio &#x3D; Zernio-created only, all &#x3D; include external ads (default to 'zernio')
435
+ # @option opts [String] :status
436
+ # @option opts [String] :platform
437
+ # @option opts [String] :account_id Social account ID
438
+ # @option opts [String] :profile_id Profile ID
439
+ # @option opts [String] :campaign_id Platform campaign ID (filter ads within a campaign)
440
+ # @return [Array<(ListAds200Response, Integer, Hash)>] ListAds200Response data, response status code and response headers
441
+ def list_ads_with_http_info(opts = {})
442
+ if @api_client.config.debugging
443
+ @api_client.config.logger.debug 'Calling API: AdsApi.list_ads ...'
444
+ end
445
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
446
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling AdsApi.list_ads, must be greater than or equal to 1.'
447
+ end
448
+
449
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
450
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ads, must be smaller than or equal to 500.'
451
+ end
452
+
453
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
454
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdsApi.list_ads, must be greater than or equal to 1.'
455
+ end
456
+
457
+ allowable_values = ["zernio", "all"]
458
+ if @api_client.config.client_side_validation && opts[:'source'] && !allowable_values.include?(opts[:'source'])
459
+ fail ArgumentError, "invalid value for \"source\", must be one of #{allowable_values}"
460
+ end
461
+ allowable_values = ["active", "paused", "pending_review", "rejected", "completed", "cancelled", "error"]
462
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
463
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
464
+ end
465
+ allowable_values = ["facebook", "instagram", "tiktok", "linkedin", "pinterest", "google", "twitter"]
466
+ if @api_client.config.client_side_validation && opts[:'platform'] && !allowable_values.include?(opts[:'platform'])
467
+ fail ArgumentError, "invalid value for \"platform\", must be one of #{allowable_values}"
468
+ end
469
+ # resource path
470
+ local_var_path = '/v1/ads'
471
+
472
+ # query parameters
473
+ query_params = opts[:query_params] || {}
474
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
475
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
476
+ query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
477
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
478
+ query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
479
+ query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
480
+ query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
481
+ query_params[:'campaignId'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil?
482
+
483
+ # header parameters
484
+ header_params = opts[:header_params] || {}
485
+ # HTTP header 'Accept' (if needed)
486
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
487
+
488
+ # form parameters
489
+ form_params = opts[:form_params] || {}
490
+
491
+ # http body (model)
492
+ post_body = opts[:debug_body]
493
+
494
+ # return_type
495
+ return_type = opts[:debug_return_type] || 'ListAds200Response'
496
+
497
+ # auth_names
498
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
499
+
500
+ new_options = opts.merge(
501
+ :operation => :"AdsApi.list_ads",
502
+ :header_params => header_params,
503
+ :query_params => query_params,
504
+ :form_params => form_params,
505
+ :body => post_body,
506
+ :auth_names => auth_names,
507
+ :return_type => return_type
508
+ )
509
+
510
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
511
+ if @api_client.config.debugging
512
+ @api_client.config.logger.debug "API called: AdsApi#list_ads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
513
+ end
514
+ return data, status_code, headers
515
+ end
516
+
517
+ # Search targeting interests
518
+ # Search for interest-based targeting options available on the platform.
519
+ # @param q [String] Search query
520
+ # @param account_id [String] Social account ID
521
+ # @param [Hash] opts the optional parameters
522
+ # @return [SearchAdInterests200Response]
523
+ def search_ad_interests(q, account_id, opts = {})
524
+ data, _status_code, _headers = search_ad_interests_with_http_info(q, account_id, opts)
525
+ data
526
+ end
527
+
528
+ # Search targeting interests
529
+ # Search for interest-based targeting options available on the platform.
530
+ # @param q [String] Search query
531
+ # @param account_id [String] Social account ID
532
+ # @param [Hash] opts the optional parameters
533
+ # @return [Array<(SearchAdInterests200Response, Integer, Hash)>] SearchAdInterests200Response data, response status code and response headers
534
+ def search_ad_interests_with_http_info(q, account_id, opts = {})
535
+ if @api_client.config.debugging
536
+ @api_client.config.logger.debug 'Calling API: AdsApi.search_ad_interests ...'
537
+ end
538
+ # verify the required parameter 'q' is set
539
+ if @api_client.config.client_side_validation && q.nil?
540
+ fail ArgumentError, "Missing the required parameter 'q' when calling AdsApi.search_ad_interests"
541
+ end
542
+ # verify the required parameter 'account_id' is set
543
+ if @api_client.config.client_side_validation && account_id.nil?
544
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling AdsApi.search_ad_interests"
545
+ end
546
+ # resource path
547
+ local_var_path = '/v1/ads/interests'
548
+
549
+ # query parameters
550
+ query_params = opts[:query_params] || {}
551
+ query_params[:'q'] = q
552
+ query_params[:'accountId'] = account_id
553
+
554
+ # header parameters
555
+ header_params = opts[:header_params] || {}
556
+ # HTTP header 'Accept' (if needed)
557
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
558
+
559
+ # form parameters
560
+ form_params = opts[:form_params] || {}
561
+
562
+ # http body (model)
563
+ post_body = opts[:debug_body]
564
+
565
+ # return_type
566
+ return_type = opts[:debug_return_type] || 'SearchAdInterests200Response'
567
+
568
+ # auth_names
569
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
570
+
571
+ new_options = opts.merge(
572
+ :operation => :"AdsApi.search_ad_interests",
573
+ :header_params => header_params,
574
+ :query_params => query_params,
575
+ :form_params => form_params,
576
+ :body => post_body,
577
+ :auth_names => auth_names,
578
+ :return_type => return_type
579
+ )
580
+
581
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
582
+ if @api_client.config.debugging
583
+ @api_client.config.logger.debug "API called: AdsApi#search_ad_interests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
584
+ end
585
+ return data, status_code, headers
586
+ end
587
+
588
+ # Sync external ads from platform ad managers
589
+ # Discovers and imports ads created outside Zernio (e.g. in Meta Ads Manager, Google Ads). Upserts new ads and updates metrics/status for existing ones. Also runs automatically every 30 minutes.
590
+ # @param [Hash] opts the optional parameters
591
+ # @return [SyncExternalAds200Response]
592
+ def sync_external_ads(opts = {})
593
+ data, _status_code, _headers = sync_external_ads_with_http_info(opts)
594
+ data
595
+ end
596
+
597
+ # Sync external ads from platform ad managers
598
+ # Discovers and imports ads created outside Zernio (e.g. in Meta Ads Manager, Google Ads). Upserts new ads and updates metrics/status for existing ones. Also runs automatically every 30 minutes.
599
+ # @param [Hash] opts the optional parameters
600
+ # @return [Array<(SyncExternalAds200Response, Integer, Hash)>] SyncExternalAds200Response data, response status code and response headers
601
+ def sync_external_ads_with_http_info(opts = {})
602
+ if @api_client.config.debugging
603
+ @api_client.config.logger.debug 'Calling API: AdsApi.sync_external_ads ...'
604
+ end
605
+ # resource path
606
+ local_var_path = '/v1/ads/sync'
607
+
608
+ # query parameters
609
+ query_params = opts[:query_params] || {}
610
+
611
+ # header parameters
612
+ header_params = opts[:header_params] || {}
613
+ # HTTP header 'Accept' (if needed)
614
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
615
+
616
+ # form parameters
617
+ form_params = opts[:form_params] || {}
618
+
619
+ # http body (model)
620
+ post_body = opts[:debug_body]
621
+
622
+ # return_type
623
+ return_type = opts[:debug_return_type] || 'SyncExternalAds200Response'
624
+
625
+ # auth_names
626
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
627
+
628
+ new_options = opts.merge(
629
+ :operation => :"AdsApi.sync_external_ads",
630
+ :header_params => header_params,
631
+ :query_params => query_params,
632
+ :form_params => form_params,
633
+ :body => post_body,
634
+ :auth_names => auth_names,
635
+ :return_type => return_type
636
+ )
637
+
638
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
639
+ if @api_client.config.debugging
640
+ @api_client.config.logger.debug "API called: AdsApi#sync_external_ads\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
641
+ end
642
+ return data, status_code, headers
643
+ end
644
+
645
+ # Update ad (pause/resume, budget, targeting, name)
646
+ # Update one or more fields on an ad. Status changes and budget updates are propagated to the platform. Targeting updates are Meta-only.
647
+ # @param ad_id [String]
648
+ # @param update_ad_request [UpdateAdRequest]
649
+ # @param [Hash] opts the optional parameters
650
+ # @return [UpdateAd200Response]
651
+ def update_ad(ad_id, update_ad_request, opts = {})
652
+ data, _status_code, _headers = update_ad_with_http_info(ad_id, update_ad_request, opts)
653
+ data
654
+ end
655
+
656
+ # Update ad (pause/resume, budget, targeting, name)
657
+ # Update one or more fields on an ad. Status changes and budget updates are propagated to the platform. Targeting updates are Meta-only.
658
+ # @param ad_id [String]
659
+ # @param update_ad_request [UpdateAdRequest]
660
+ # @param [Hash] opts the optional parameters
661
+ # @return [Array<(UpdateAd200Response, Integer, Hash)>] UpdateAd200Response data, response status code and response headers
662
+ def update_ad_with_http_info(ad_id, update_ad_request, opts = {})
663
+ if @api_client.config.debugging
664
+ @api_client.config.logger.debug 'Calling API: AdsApi.update_ad ...'
665
+ end
666
+ # verify the required parameter 'ad_id' is set
667
+ if @api_client.config.client_side_validation && ad_id.nil?
668
+ fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdsApi.update_ad"
669
+ end
670
+ # verify the required parameter 'update_ad_request' is set
671
+ if @api_client.config.client_side_validation && update_ad_request.nil?
672
+ fail ArgumentError, "Missing the required parameter 'update_ad_request' when calling AdsApi.update_ad"
673
+ end
674
+ # resource path
675
+ local_var_path = '/v1/ads/{adId}'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))
676
+
677
+ # query parameters
678
+ query_params = opts[:query_params] || {}
679
+
680
+ # header parameters
681
+ header_params = opts[:header_params] || {}
682
+ # HTTP header 'Accept' (if needed)
683
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
684
+ # HTTP header 'Content-Type'
685
+ content_type = @api_client.select_header_content_type(['application/json'])
686
+ if !content_type.nil?
687
+ header_params['Content-Type'] = content_type
688
+ end
689
+
690
+ # form parameters
691
+ form_params = opts[:form_params] || {}
692
+
693
+ # http body (model)
694
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_ad_request)
695
+
696
+ # return_type
697
+ return_type = opts[:debug_return_type] || 'UpdateAd200Response'
698
+
699
+ # auth_names
700
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
701
+
702
+ new_options = opts.merge(
703
+ :operation => :"AdsApi.update_ad",
704
+ :header_params => header_params,
705
+ :query_params => query_params,
706
+ :form_params => form_params,
707
+ :body => post_body,
708
+ :auth_names => auth_names,
709
+ :return_type => return_type
710
+ )
711
+
712
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
713
+ if @api_client.config.debugging
714
+ @api_client.config.logger.debug "API called: AdsApi#update_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
715
+ end
716
+ return data, status_code, headers
717
+ end
718
+ end
719
+ end