zernio-sdk 0.0.550 → 0.0.552

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +73 -75
  3. data/docs/AdAccountsApi.md +915 -0
  4. data/docs/AdCampaignsApi.md +615 -15
  5. data/docs/AdCreativesApi.md +815 -0
  6. data/docs/AdInsightsApi.md +415 -0
  7. data/docs/AdTargetingApi.md +371 -0
  8. data/docs/AnalyticsApi.md +7 -7
  9. data/docs/BoostPostRequestTracking.md +1 -1
  10. data/docs/{CreateLeadFormRequestQuestionsInnerOptionsInner.md → BoostPostRequestTrackingUrlTagsInner.md} +2 -2
  11. data/docs/ConversionsApi.md +890 -0
  12. data/docs/CreateLeadFormRequestQuestionsInner.md +1 -1
  13. data/docs/LeadGenApi.md +527 -0
  14. data/docs/MessagingAdsApi.md +215 -0
  15. data/docs/ReachAndFrequencyApi.md +294 -0
  16. data/docs/TrackingTagsApi.md +141 -0
  17. data/docs/YouTubeDailyViewsResponse.md +2 -0
  18. data/docs/YouTubeDemographicsResponse.md +2 -0
  19. data/docs/YouTubeVideoRetentionResponse.md +2 -0
  20. data/lib/zernio-sdk/api/ad_accounts_api.rb +958 -0
  21. data/lib/zernio-sdk/api/ad_campaigns_api.rb +618 -12
  22. data/lib/zernio-sdk/api/ad_creatives_api.rb +826 -0
  23. data/lib/zernio-sdk/api/ad_insights_api.rb +446 -0
  24. data/lib/zernio-sdk/api/ad_targeting_api.rb +404 -0
  25. data/lib/zernio-sdk/api/analytics_api.rb +8 -8
  26. data/lib/zernio-sdk/api/conversions_api.rb +936 -0
  27. data/lib/zernio-sdk/api/lead_gen_api.rb +547 -0
  28. data/lib/zernio-sdk/api/messaging_ads_api.rb +226 -0
  29. data/lib/zernio-sdk/api/reach_and_frequency_api.rb +316 -0
  30. data/lib/zernio-sdk/api/tracking_tags_api.rb +137 -0
  31. data/lib/zernio-sdk/models/boost_post_request_tracking.rb +5 -2
  32. data/lib/zernio-sdk/models/{create_lead_form_request_questions_inner_options_inner.rb → boost_post_request_tracking_url_tags_inner.rb} +3 -3
  33. data/lib/zernio-sdk/models/create_lead_form_request_questions_inner.rb +1 -1
  34. data/lib/zernio-sdk/models/you_tube_daily_views_response.rb +11 -1
  35. data/lib/zernio-sdk/models/you_tube_demographics_response.rb +11 -1
  36. data/lib/zernio-sdk/models/you_tube_video_retention_response.rb +11 -1
  37. data/lib/zernio-sdk/version.rb +1 -1
  38. data/lib/zernio-sdk.rb +9 -2
  39. data/openapi.yaml +329 -163
  40. data/spec/api/ad_accounts_api_spec.rb +206 -0
  41. data/spec/api/ad_campaigns_api_spec.rb +119 -6
  42. data/spec/api/ad_creatives_api_spec.rb +182 -0
  43. data/spec/api/ad_insights_api_spec.rb +120 -0
  44. data/spec/api/ad_targeting_api_spec.rb +101 -0
  45. data/spec/api/analytics_api_spec.rb +4 -4
  46. data/spec/api/conversions_api_spec.rb +199 -0
  47. data/spec/api/lead_gen_api_spec.rb +131 -0
  48. data/spec/api/messaging_ads_api_spec.rb +71 -0
  49. data/spec/api/reach_and_frequency_api_spec.rb +87 -0
  50. data/spec/api/tracking_tags_api_spec.rb +25 -0
  51. data/spec/models/{create_lead_form_request_questions_inner_options_inner_spec.rb → boost_post_request_tracking_url_tags_inner_spec.rb} +6 -6
  52. data/spec/models/you_tube_daily_views_response_spec.rb +6 -0
  53. data/spec/models/you_tube_demographics_response_spec.rb +6 -0
  54. data/spec/models/you_tube_video_retention_response_spec.rb +6 -0
  55. metadata +38 -10
  56. data/docs/AdsApi.md +0 -5278
  57. data/lib/zernio-sdk/api/ads_api.rb +0 -5391
  58. data/spec/api/ads_api_spec.rb +0 -1015
@@ -0,0 +1,936 @@
1
+ =begin
2
+ #Zernio API
3
+
4
+ #API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5
+
6
+ The version of the OpenAPI document: 1.0.4
7
+ Contact: support@zernio.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Zernio
16
+ class ConversionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Associate campaigns
23
+ # Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).
24
+ # @param account_id [String]
25
+ # @param destination_id [String]
26
+ # @param add_conversion_associations_request [AddConversionAssociationsRequest]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [AddConversionAssociations200Response]
29
+ def add_conversion_associations(account_id, destination_id, add_conversion_associations_request, opts = {})
30
+ data, _status_code, _headers = add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts)
31
+ data
32
+ end
33
+
34
+ # Associate campaigns
35
+ # Associate one or more campaigns with this conversion rule. Returns a per-campaign success/failure result so callers can retry only the rows that failed (e.g. wrong campaign type for the rule's objective).
36
+ # @param account_id [String]
37
+ # @param destination_id [String]
38
+ # @param add_conversion_associations_request [AddConversionAssociationsRequest]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(AddConversionAssociations200Response, Integer, Hash)>] AddConversionAssociations200Response data, response status code and response headers
41
+ def add_conversion_associations_with_http_info(account_id, destination_id, add_conversion_associations_request, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.add_conversion_associations ...'
44
+ end
45
+ # verify the required parameter 'account_id' is set
46
+ if @api_client.config.client_side_validation && account_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.add_conversion_associations"
48
+ end
49
+ # verify the required parameter 'destination_id' is set
50
+ if @api_client.config.client_side_validation && destination_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.add_conversion_associations"
52
+ end
53
+ # verify the required parameter 'add_conversion_associations_request' is set
54
+ if @api_client.config.client_side_validation && add_conversion_associations_request.nil?
55
+ fail ArgumentError, "Missing the required parameter 'add_conversion_associations_request' when calling ConversionsApi.add_conversion_associations"
56
+ end
57
+ # resource path
58
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+
63
+ # header parameters
64
+ header_params = opts[:header_params] || {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
67
+ # HTTP header 'Content-Type'
68
+ content_type = @api_client.select_header_content_type(['application/json'])
69
+ if !content_type.nil?
70
+ header_params['Content-Type'] = content_type
71
+ end
72
+
73
+ # form parameters
74
+ form_params = opts[:form_params] || {}
75
+
76
+ # http body (model)
77
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(add_conversion_associations_request)
78
+
79
+ # return_type
80
+ return_type = opts[:debug_return_type] || 'AddConversionAssociations200Response'
81
+
82
+ # auth_names
83
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
84
+
85
+ new_options = opts.merge(
86
+ :operation => :"ConversionsApi.add_conversion_associations",
87
+ :header_params => header_params,
88
+ :query_params => query_params,
89
+ :form_params => form_params,
90
+ :body => post_body,
91
+ :auth_names => auth_names,
92
+ :return_type => return_type
93
+ )
94
+
95
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug "API called: ConversionsApi#add_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ end
99
+ return data, status_code, headers
100
+ end
101
+
102
+ # Adjust uploaded conversions
103
+ # Adjust conversions that were previously uploaded via `POST /v1/ads/conversions` — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. **Google Ads only.** Google handles adjustments through the classic Google Ads API (`ConversionAdjustmentUploadService`); the Data Manager `ingestEvents` path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns `405` for those platforms. Adjustment types: - `RETRACTION` — remove the conversion entirely (refund, chargeback, cancelled order, churn). - `RESTATEMENT` — change the conversion's value (upgrade / downgrade / partial refund). Send the corrected **total** value in `restatementValue` (not a delta). - `ENHANCEMENT` — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - `orderId` — the transaction ID you sent as `eventId` on the original conversion. Recommended, and **required** for `ENHANCEMENT`. - or `gclid` + `conversionTime` — the click ID and the original conversion's time (unix seconds). Not available for `ENHANCEMENT`. `destinationId` is the conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` (same value you send to `POST /v1/ads/conversions`). PII in `user` is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google's required `yyyy-MM-dd HH:mm:ss+00:00` format. Up to 2000 adjustments per request; partial failure is supported (inspect `adjustmentsFailed` / `failures[]`).
104
+ # @param adjust_conversions_request [AdjustConversionsRequest]
105
+ # @param [Hash] opts the optional parameters
106
+ # @return [AdjustConversions200Response]
107
+ def adjust_conversions(adjust_conversions_request, opts = {})
108
+ data, _status_code, _headers = adjust_conversions_with_http_info(adjust_conversions_request, opts)
109
+ data
110
+ end
111
+
112
+ # Adjust uploaded conversions
113
+ # Adjust conversions that were previously uploaded via &#x60;POST /v1/ads/conversions&#x60; — retract them, restate their value, or enhance them with first-party data. Requires the Ads add-on. **Google Ads only.** Google handles adjustments through the classic Google Ads API (&#x60;ConversionAdjustmentUploadService&#x60;); the Data Manager &#x60;ingestEvents&#x60; path used for sending conversions is ingest-only. Meta and LinkedIn have no equivalent, so this endpoint returns &#x60;405&#x60; for those platforms. Adjustment types: - &#x60;RETRACTION&#x60; — remove the conversion entirely (refund, chargeback, cancelled order, churn). - &#x60;RESTATEMENT&#x60; — change the conversion&#39;s value (upgrade / downgrade / partial refund). Send the corrected **total** value in &#x60;restatementValue&#x60; (not a delta). - &#x60;ENHANCEMENT&#x60; — attach first-party identifiers (hashed email / phone) to an existing conversion (enhanced conversions applied after the fact). Identifying the original conversion (per adjustment): - &#x60;orderId&#x60; — the transaction ID you sent as &#x60;eventId&#x60; on the original conversion. Recommended, and **required** for &#x60;ENHANCEMENT&#x60;. - or &#x60;gclid&#x60; + &#x60;conversionTime&#x60; — the click ID and the original conversion&#39;s time (unix seconds). Not available for &#x60;ENHANCEMENT&#x60;. &#x60;destinationId&#x60; is the conversion action resource name, e.g. &#x60;customers/1234567890/conversionActions/987654321&#x60; (same value you send to &#x60;POST /v1/ads/conversions&#x60;). PII in &#x60;user&#x60; is hashed with SHA-256 server-side (Gmail-specific normalization included). Send plaintext. Times are unix seconds; we convert to Google&#39;s required &#x60;yyyy-MM-dd HH:mm:ss+00:00&#x60; format. Up to 2000 adjustments per request; partial failure is supported (inspect &#x60;adjustmentsFailed&#x60; / &#x60;failures[]&#x60;).
114
+ # @param adjust_conversions_request [AdjustConversionsRequest]
115
+ # @param [Hash] opts the optional parameters
116
+ # @return [Array<(AdjustConversions200Response, Integer, Hash)>] AdjustConversions200Response data, response status code and response headers
117
+ def adjust_conversions_with_http_info(adjust_conversions_request, opts = {})
118
+ if @api_client.config.debugging
119
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.adjust_conversions ...'
120
+ end
121
+ # verify the required parameter 'adjust_conversions_request' is set
122
+ if @api_client.config.client_side_validation && adjust_conversions_request.nil?
123
+ fail ArgumentError, "Missing the required parameter 'adjust_conversions_request' when calling ConversionsApi.adjust_conversions"
124
+ end
125
+ # resource path
126
+ local_var_path = '/v1/ads/conversions/adjustments'
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+ # HTTP header 'Accept' (if needed)
134
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
135
+ # HTTP header 'Content-Type'
136
+ content_type = @api_client.select_header_content_type(['application/json'])
137
+ if !content_type.nil?
138
+ header_params['Content-Type'] = content_type
139
+ end
140
+
141
+ # form parameters
142
+ form_params = opts[:form_params] || {}
143
+
144
+ # http body (model)
145
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(adjust_conversions_request)
146
+
147
+ # return_type
148
+ return_type = opts[:debug_return_type] || 'AdjustConversions200Response'
149
+
150
+ # auth_names
151
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
152
+
153
+ new_options = opts.merge(
154
+ :operation => :"ConversionsApi.adjust_conversions",
155
+ :header_params => header_params,
156
+ :query_params => query_params,
157
+ :form_params => form_params,
158
+ :body => post_body,
159
+ :auth_names => auth_names,
160
+ :return_type => return_type
161
+ )
162
+
163
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug "API called: ConversionsApi#adjust_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
166
+ end
167
+ return data, status_code, headers
168
+ end
169
+
170
+ # Create a conversion destination
171
+ # Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta manages destinations in its own UI and returns 405. **LinkedIn:** creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. **Google Ads:** calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed `IDEMPOTENCY_CONFLICT` (409) rather than silently returning the mismatched action. **LinkedIn:** the rule is created with `conversionMethod=CONVERSIONS_API` and (by default) auto-associated with all of the ad account's campaigns via `autoAssociationType=ALL_CAMPAIGNS`. Pass `autoAssociationType: NONE` to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for `SUBMIT_APPLICATION`, `PURCHASE`, `ADD_TO_CART`, `QUALIFIED_LEAD`, and `LEAD` rule types; the API rejects other combinations locally. **Google Ads:** the conversion action is created with `type=UPLOAD_CLICKS` (required for API-uploaded offline conversions, immutable after creation). The `type` field carries the Google `ConversionActionCategory` enum value, e.g. `PURCHASE`, `SUBSCRIBE_PAID`, `SIGNUP`, `IMPORTED_LEAD`, `BOOK_APPOINTMENT`. Unified standard event names (e.g. `Purchase`, `Subscribe`, `CompleteRegistration`, `Lead`, `Schedule`) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass `primaryForGoal: true` to opt in.
172
+ # @param account_id [String] SocialAccount ID (linkedinads or googleads).
173
+ # @param create_conversion_destination_request [CreateConversionDestinationRequest]
174
+ # @param [Hash] opts the optional parameters
175
+ # @return [CreateConversionDestination201Response]
176
+ def create_conversion_destination(account_id, create_conversion_destination_request, opts = {})
177
+ data, _status_code, _headers = create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts)
178
+ data
179
+ end
180
+
181
+ # Create a conversion destination
182
+ # Create a new conversion destination on the platform. Supported for LinkedIn (conversion rule) and Google Ads (conversion action). Meta manages destinations in its own UI and returns 405. **LinkedIn:** creation is NOT idempotent. A retry creates a second destination. Deduplicate before retrying. **Google Ads:** calling with a name that already exists reuses the existing conversion action transparently (the response is identical to a fresh create). Calling with the same name but a different category returns a typed &#x60;IDEMPOTENCY_CONFLICT&#x60; (409) rather than silently returning the mismatched action. **LinkedIn:** the rule is created with &#x60;conversionMethod&#x3D;CONVERSIONS_API&#x60; and (by default) auto-associated with all of the ad account&#39;s campaigns via &#x60;autoAssociationType&#x3D;ALL_CAMPAIGNS&#x60;. Pass &#x60;autoAssociationType: NONE&#x60; to opt out and manage associations explicitly via the associations endpoints below. 365-day attribution windows are only valid for &#x60;SUBMIT_APPLICATION&#x60;, &#x60;PURCHASE&#x60;, &#x60;ADD_TO_CART&#x60;, &#x60;QUALIFIED_LEAD&#x60;, and &#x60;LEAD&#x60; rule types; the API rejects other combinations locally. **Google Ads:** the conversion action is created with &#x60;type&#x3D;UPLOAD_CLICKS&#x60; (required for API-uploaded offline conversions, immutable after creation). The &#x60;type&#x60; field carries the Google &#x60;ConversionActionCategory&#x60; enum value, e.g. &#x60;PURCHASE&#x60;, &#x60;SUBSCRIBE_PAID&#x60;, &#x60;SIGNUP&#x60;, &#x60;IMPORTED_LEAD&#x60;, &#x60;BOOK_APPOINTMENT&#x60;. Unified standard event names (e.g. &#x60;Purchase&#x60;, &#x60;Subscribe&#x60;, &#x60;CompleteRegistration&#x60;, &#x60;Lead&#x60;, &#x60;Schedule&#x60;) are resolved to their Google category equivalents automatically. The action defaults to secondary (non-primary) to avoid immediately steering Smart Bidding; pass &#x60;primaryForGoal: true&#x60; to opt in.
183
+ # @param account_id [String] SocialAccount ID (linkedinads or googleads).
184
+ # @param create_conversion_destination_request [CreateConversionDestinationRequest]
185
+ # @param [Hash] opts the optional parameters
186
+ # @return [Array<(CreateConversionDestination201Response, Integer, Hash)>] CreateConversionDestination201Response data, response status code and response headers
187
+ def create_conversion_destination_with_http_info(account_id, create_conversion_destination_request, opts = {})
188
+ if @api_client.config.debugging
189
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.create_conversion_destination ...'
190
+ end
191
+ # verify the required parameter 'account_id' is set
192
+ if @api_client.config.client_side_validation && account_id.nil?
193
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.create_conversion_destination"
194
+ end
195
+ # verify the required parameter 'create_conversion_destination_request' is set
196
+ if @api_client.config.client_side_validation && create_conversion_destination_request.nil?
197
+ fail ArgumentError, "Missing the required parameter 'create_conversion_destination_request' when calling ConversionsApi.create_conversion_destination"
198
+ end
199
+ # resource path
200
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
201
+
202
+ # query parameters
203
+ query_params = opts[:query_params] || {}
204
+
205
+ # header parameters
206
+ header_params = opts[:header_params] || {}
207
+ # HTTP header 'Accept' (if needed)
208
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
209
+ # HTTP header 'Content-Type'
210
+ content_type = @api_client.select_header_content_type(['application/json'])
211
+ if !content_type.nil?
212
+ header_params['Content-Type'] = content_type
213
+ end
214
+
215
+ # form parameters
216
+ form_params = opts[:form_params] || {}
217
+
218
+ # http body (model)
219
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_conversion_destination_request)
220
+
221
+ # return_type
222
+ return_type = opts[:debug_return_type] || 'CreateConversionDestination201Response'
223
+
224
+ # auth_names
225
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
226
+
227
+ new_options = opts.merge(
228
+ :operation => :"ConversionsApi.create_conversion_destination",
229
+ :header_params => header_params,
230
+ :query_params => query_params,
231
+ :form_params => form_params,
232
+ :body => post_body,
233
+ :auth_names => auth_names,
234
+ :return_type => return_type
235
+ )
236
+
237
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
238
+ if @api_client.config.debugging
239
+ @api_client.config.logger.debug "API called: ConversionsApi#create_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
240
+ end
241
+ return data, status_code, headers
242
+ end
243
+
244
+ # Delete a conversion destination
245
+ # 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.
246
+ # @param account_id [String]
247
+ # @param destination_id [String]
248
+ # @param [Hash] opts the optional parameters
249
+ # @option opts [String] :ad_account_id Required as query OR in JSON body.
250
+ # @return [nil]
251
+ def delete_conversion_destination(account_id, destination_id, opts = {})
252
+ delete_conversion_destination_with_http_info(account_id, destination_id, opts)
253
+ nil
254
+ end
255
+
256
+ # Delete a conversion destination
257
+ # LinkedIn-only today. LinkedIn does not expose hard-delete on conversion rules — what their UI calls \&quot;delete\&quot; is the same &#x60;enabled: false&#x60; flip we apply here. The rule remains fetchable via GET with &#x60;status: &#39;inactive&#39;&#x60;; the unified discovery endpoint hides it by default. &#x60;adAccountId&#x60; may be passed as a query parameter (recommended) or as a JSON body field for clients that can send DELETE bodies.
258
+ # @param account_id [String]
259
+ # @param destination_id [String]
260
+ # @param [Hash] opts the optional parameters
261
+ # @option opts [String] :ad_account_id Required as query OR in JSON body.
262
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
263
+ def delete_conversion_destination_with_http_info(account_id, destination_id, opts = {})
264
+ if @api_client.config.debugging
265
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.delete_conversion_destination ...'
266
+ end
267
+ # verify the required parameter 'account_id' is set
268
+ if @api_client.config.client_side_validation && account_id.nil?
269
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.delete_conversion_destination"
270
+ end
271
+ # verify the required parameter 'destination_id' is set
272
+ if @api_client.config.client_side_validation && destination_id.nil?
273
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.delete_conversion_destination"
274
+ end
275
+ # resource path
276
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))
277
+
278
+ # query parameters
279
+ query_params = opts[:query_params] || {}
280
+ query_params[:'adAccountId'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
281
+
282
+ # header parameters
283
+ header_params = opts[:header_params] || {}
284
+ # HTTP header 'Accept' (if needed)
285
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
286
+
287
+ # form parameters
288
+ form_params = opts[:form_params] || {}
289
+
290
+ # http body (model)
291
+ post_body = opts[:debug_body]
292
+
293
+ # return_type
294
+ return_type = opts[:debug_return_type]
295
+
296
+ # auth_names
297
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
298
+
299
+ new_options = opts.merge(
300
+ :operation => :"ConversionsApi.delete_conversion_destination",
301
+ :header_params => header_params,
302
+ :query_params => query_params,
303
+ :form_params => form_params,
304
+ :body => post_body,
305
+ :auth_names => auth_names,
306
+ :return_type => return_type
307
+ )
308
+
309
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
310
+ if @api_client.config.debugging
311
+ @api_client.config.logger.debug "API called: ConversionsApi#delete_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
312
+ end
313
+ return data, status_code, headers
314
+ end
315
+
316
+ # Get a conversion destination
317
+ # LinkedIn-only today. Returns the full destination record for one conversion rule. The `adAccountId` query parameter is required because LinkedIn rules are scoped to a sponsored ad account.
318
+ # @param account_id [String]
319
+ # @param destination_id [String]
320
+ # @param ad_account_id [String] Numeric ID or full &#x60;urn:li:sponsoredAccount:{id}&#x60; URN.
321
+ # @param [Hash] opts the optional parameters
322
+ # @return [GetConversionDestination200Response]
323
+ def get_conversion_destination(account_id, destination_id, ad_account_id, opts = {})
324
+ data, _status_code, _headers = get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts)
325
+ data
326
+ end
327
+
328
+ # Get a conversion destination
329
+ # LinkedIn-only today. Returns the full destination record for one conversion rule. The &#x60;adAccountId&#x60; query parameter is required because LinkedIn rules are scoped to a sponsored ad account.
330
+ # @param account_id [String]
331
+ # @param destination_id [String]
332
+ # @param ad_account_id [String] Numeric ID or full &#x60;urn:li:sponsoredAccount:{id}&#x60; URN.
333
+ # @param [Hash] opts the optional parameters
334
+ # @return [Array<(GetConversionDestination200Response, Integer, Hash)>] GetConversionDestination200Response data, response status code and response headers
335
+ def get_conversion_destination_with_http_info(account_id, destination_id, ad_account_id, opts = {})
336
+ if @api_client.config.debugging
337
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.get_conversion_destination ...'
338
+ end
339
+ # verify the required parameter 'account_id' is set
340
+ if @api_client.config.client_side_validation && account_id.nil?
341
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.get_conversion_destination"
342
+ end
343
+ # verify the required parameter 'destination_id' is set
344
+ if @api_client.config.client_side_validation && destination_id.nil?
345
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.get_conversion_destination"
346
+ end
347
+ # verify the required parameter 'ad_account_id' is set
348
+ if @api_client.config.client_side_validation && ad_account_id.nil?
349
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.get_conversion_destination"
350
+ end
351
+ # resource path
352
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))
353
+
354
+ # query parameters
355
+ query_params = opts[:query_params] || {}
356
+ query_params[:'adAccountId'] = ad_account_id
357
+
358
+ # header parameters
359
+ header_params = opts[:header_params] || {}
360
+ # HTTP header 'Accept' (if needed)
361
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
362
+
363
+ # form parameters
364
+ form_params = opts[:form_params] || {}
365
+
366
+ # http body (model)
367
+ post_body = opts[:debug_body]
368
+
369
+ # return_type
370
+ return_type = opts[:debug_return_type] || 'GetConversionDestination200Response'
371
+
372
+ # auth_names
373
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
374
+
375
+ new_options = opts.merge(
376
+ :operation => :"ConversionsApi.get_conversion_destination",
377
+ :header_params => header_params,
378
+ :query_params => query_params,
379
+ :form_params => form_params,
380
+ :body => post_body,
381
+ :auth_names => auth_names,
382
+ :return_type => return_type
383
+ )
384
+
385
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
386
+ if @api_client.config.debugging
387
+ @api_client.config.logger.debug "API called: ConversionsApi#get_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
388
+ end
389
+ return data, status_code, headers
390
+ end
391
+
392
+ # Get attribution metrics
393
+ # LinkedIn-only today. Returns conversion-attribution metrics (`externalWebsiteConversions`, `externalWebsitePostClickConversions`, `externalWebsitePostViewConversions`, `conversionValueInLocalCurrency`, `qualifiedLeads`, `costInLocalCurrency`) bucketed by date. Date-range constraints (passed through from LinkedIn): - `granularity=DAILY` is retained for ~6 months only - `granularity=ALL` with a range > 6 months auto-rounds to month boundaries - `granularity=MONTHLY`/`YEARLY` retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.
394
+ # @param account_id [String]
395
+ # @param destination_id [String]
396
+ # @param ad_account_id [String]
397
+ # @param start_date [String]
398
+ # @param [Hash] opts the optional parameters
399
+ # @option opts [String] :end_date
400
+ # @option opts [String] :granularity (default to 'DAILY')
401
+ # @return [GetConversionMetrics200Response]
402
+ def get_conversion_metrics(account_id, destination_id, ad_account_id, start_date, opts = {})
403
+ data, _status_code, _headers = get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts)
404
+ data
405
+ end
406
+
407
+ # Get attribution metrics
408
+ # LinkedIn-only today. Returns conversion-attribution metrics (&#x60;externalWebsiteConversions&#x60;, &#x60;externalWebsitePostClickConversions&#x60;, &#x60;externalWebsitePostViewConversions&#x60;, &#x60;conversionValueInLocalCurrency&#x60;, &#x60;qualifiedLeads&#x60;, &#x60;costInLocalCurrency&#x60;) bucketed by date. Date-range constraints (passed through from LinkedIn): - &#x60;granularity&#x3D;DAILY&#x60; is retained for ~6 months only - &#x60;granularity&#x3D;ALL&#x60; with a range &gt; 6 months auto-rounds to month boundaries - &#x60;granularity&#x3D;MONTHLY&#x60;/&#x60;YEARLY&#x60; retains 24 months Throttle: LinkedIn caps adAnalytics at 45M metric values per 5-minute window across the calling token. Single-rule queries are well within that limit; surfaces as 429 if hit.
409
+ # @param account_id [String]
410
+ # @param destination_id [String]
411
+ # @param ad_account_id [String]
412
+ # @param start_date [String]
413
+ # @param [Hash] opts the optional parameters
414
+ # @option opts [String] :end_date
415
+ # @option opts [String] :granularity (default to 'DAILY')
416
+ # @return [Array<(GetConversionMetrics200Response, Integer, Hash)>] GetConversionMetrics200Response data, response status code and response headers
417
+ def get_conversion_metrics_with_http_info(account_id, destination_id, ad_account_id, start_date, opts = {})
418
+ if @api_client.config.debugging
419
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.get_conversion_metrics ...'
420
+ end
421
+ # verify the required parameter 'account_id' is set
422
+ if @api_client.config.client_side_validation && account_id.nil?
423
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.get_conversion_metrics"
424
+ end
425
+ # verify the required parameter 'destination_id' is set
426
+ if @api_client.config.client_side_validation && destination_id.nil?
427
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.get_conversion_metrics"
428
+ end
429
+ # verify the required parameter 'ad_account_id' is set
430
+ if @api_client.config.client_side_validation && ad_account_id.nil?
431
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.get_conversion_metrics"
432
+ end
433
+ # verify the required parameter 'start_date' is set
434
+ if @api_client.config.client_side_validation && start_date.nil?
435
+ fail ArgumentError, "Missing the required parameter 'start_date' when calling ConversionsApi.get_conversion_metrics"
436
+ end
437
+ pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/)
438
+ if @api_client.config.client_side_validation && start_date !~ pattern
439
+ fail ArgumentError, "invalid value for 'start_date' when calling ConversionsApi.get_conversion_metrics, must conform to the pattern #{pattern}."
440
+ end
441
+
442
+ pattern = Regexp.new(/^\\d{4}-\\d{2}-\\d{2}$/)
443
+ if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ pattern
444
+ fail ArgumentError, "invalid value for 'opts[:\"end_date\"]' when calling ConversionsApi.get_conversion_metrics, must conform to the pattern #{pattern}."
445
+ end
446
+
447
+ allowable_values = ["ALL", "DAILY", "MONTHLY", "YEARLY"]
448
+ if @api_client.config.client_side_validation && opts[:'granularity'] && !allowable_values.include?(opts[:'granularity'])
449
+ fail ArgumentError, "invalid value for \"granularity\", must be one of #{allowable_values}"
450
+ end
451
+ # resource path
452
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/metrics'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))
453
+
454
+ # query parameters
455
+ query_params = opts[:query_params] || {}
456
+ query_params[:'adAccountId'] = ad_account_id
457
+ query_params[:'startDate'] = start_date
458
+ query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
459
+ query_params[:'granularity'] = opts[:'granularity'] if !opts[:'granularity'].nil?
460
+
461
+ # header parameters
462
+ header_params = opts[:header_params] || {}
463
+ # HTTP header 'Accept' (if needed)
464
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
465
+
466
+ # form parameters
467
+ form_params = opts[:form_params] || {}
468
+
469
+ # http body (model)
470
+ post_body = opts[:debug_body]
471
+
472
+ # return_type
473
+ return_type = opts[:debug_return_type] || 'GetConversionMetrics200Response'
474
+
475
+ # auth_names
476
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
477
+
478
+ new_options = opts.merge(
479
+ :operation => :"ConversionsApi.get_conversion_metrics",
480
+ :header_params => header_params,
481
+ :query_params => query_params,
482
+ :form_params => form_params,
483
+ :body => post_body,
484
+ :auth_names => auth_names,
485
+ :return_type => return_type
486
+ )
487
+
488
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
489
+ if @api_client.config.debugging
490
+ @api_client.config.logger.debug "API called: ConversionsApi#get_conversion_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
491
+ end
492
+ return data, status_code, headers
493
+ end
494
+
495
+ # Get Event Match Quality
496
+ # Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta's Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.
497
+ # @param account_id [String] SocialAccount _id (must be a metaads account).
498
+ # @param destination_id [String] Meta pixel/dataset ID.
499
+ # @param [Hash] opts the optional parameters
500
+ # @return [GetConversionsQuality200Response]
501
+ def get_conversions_quality(account_id, destination_id, opts = {})
502
+ data, _status_code, _headers = get_conversions_quality_with_http_info(account_id, destination_id, opts)
503
+ data
504
+ end
505
+
506
+ # Get Event Match Quality
507
+ # Reads Meta Event Match Quality (EMQ) and pixel↔CAPI event coverage for a pixel/dataset, live from Meta&#39;s Dataset Quality API. Web events only (a Meta limitation). Meta-only; other platforms return 405. Requires the Ads add-on.
508
+ # @param account_id [String] SocialAccount _id (must be a metaads account).
509
+ # @param destination_id [String] Meta pixel/dataset ID.
510
+ # @param [Hash] opts the optional parameters
511
+ # @return [Array<(GetConversionsQuality200Response, Integer, Hash)>] GetConversionsQuality200Response data, response status code and response headers
512
+ def get_conversions_quality_with_http_info(account_id, destination_id, opts = {})
513
+ if @api_client.config.debugging
514
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.get_conversions_quality ...'
515
+ end
516
+ # verify the required parameter 'account_id' is set
517
+ if @api_client.config.client_side_validation && account_id.nil?
518
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.get_conversions_quality"
519
+ end
520
+ # verify the required parameter 'destination_id' is set
521
+ if @api_client.config.client_side_validation && destination_id.nil?
522
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.get_conversions_quality"
523
+ end
524
+ # resource path
525
+ local_var_path = '/v1/ads/conversions/quality'
526
+
527
+ # query parameters
528
+ query_params = opts[:query_params] || {}
529
+ query_params[:'accountId'] = account_id
530
+ query_params[:'destinationId'] = destination_id
531
+
532
+ # header parameters
533
+ header_params = opts[:header_params] || {}
534
+ # HTTP header 'Accept' (if needed)
535
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
536
+
537
+ # form parameters
538
+ form_params = opts[:form_params] || {}
539
+
540
+ # http body (model)
541
+ post_body = opts[:debug_body]
542
+
543
+ # return_type
544
+ return_type = opts[:debug_return_type] || 'GetConversionsQuality200Response'
545
+
546
+ # auth_names
547
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
548
+
549
+ new_options = opts.merge(
550
+ :operation => :"ConversionsApi.get_conversions_quality",
551
+ :header_params => header_params,
552
+ :query_params => query_params,
553
+ :form_params => form_params,
554
+ :body => post_body,
555
+ :auth_names => auth_names,
556
+ :return_type => return_type
557
+ )
558
+
559
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
560
+ if @api_client.config.debugging
561
+ @api_client.config.logger.debug "API called: ConversionsApi#get_conversions_quality\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
562
+ end
563
+ return data, status_code, headers
564
+ end
565
+
566
+ # List associated campaigns
567
+ # LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.
568
+ # @param account_id [String]
569
+ # @param destination_id [String]
570
+ # @param ad_account_id [String]
571
+ # @param [Hash] opts the optional parameters
572
+ # @return [ListConversionAssociations200Response]
573
+ def list_conversion_associations(account_id, destination_id, ad_account_id, opts = {})
574
+ data, _status_code, _headers = list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts)
575
+ data
576
+ end
577
+
578
+ # List associated campaigns
579
+ # LinkedIn-only today. Returns the campaigns currently associated with this conversion rule. Note that auto-association on rule creation runs once at create time; campaigns created after the rule still need explicit association.
580
+ # @param account_id [String]
581
+ # @param destination_id [String]
582
+ # @param ad_account_id [String]
583
+ # @param [Hash] opts the optional parameters
584
+ # @return [Array<(ListConversionAssociations200Response, Integer, Hash)>] ListConversionAssociations200Response data, response status code and response headers
585
+ def list_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, opts = {})
586
+ if @api_client.config.debugging
587
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.list_conversion_associations ...'
588
+ end
589
+ # verify the required parameter 'account_id' is set
590
+ if @api_client.config.client_side_validation && account_id.nil?
591
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.list_conversion_associations"
592
+ end
593
+ # verify the required parameter 'destination_id' is set
594
+ if @api_client.config.client_side_validation && destination_id.nil?
595
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.list_conversion_associations"
596
+ end
597
+ # verify the required parameter 'ad_account_id' is set
598
+ if @api_client.config.client_side_validation && ad_account_id.nil?
599
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.list_conversion_associations"
600
+ end
601
+ # resource path
602
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))
603
+
604
+ # query parameters
605
+ query_params = opts[:query_params] || {}
606
+ query_params[:'adAccountId'] = ad_account_id
607
+
608
+ # header parameters
609
+ header_params = opts[:header_params] || {}
610
+ # HTTP header 'Accept' (if needed)
611
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
612
+
613
+ # form parameters
614
+ form_params = opts[:form_params] || {}
615
+
616
+ # http body (model)
617
+ post_body = opts[:debug_body]
618
+
619
+ # return_type
620
+ return_type = opts[:debug_return_type] || 'ListConversionAssociations200Response'
621
+
622
+ # auth_names
623
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
624
+
625
+ new_options = opts.merge(
626
+ :operation => :"ConversionsApi.list_conversion_associations",
627
+ :header_params => header_params,
628
+ :query_params => query_params,
629
+ :form_params => form_params,
630
+ :body => post_body,
631
+ :auth_names => auth_names,
632
+ :return_type => return_type
633
+ )
634
+
635
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
636
+ if @api_client.config.debugging
637
+ @api_client.config.logger.debug "API called: ConversionsApi#list_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
638
+ end
639
+ return data, status_code, headers
640
+ end
641
+
642
+ # List conversion destinations
643
+ # Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account. Use the returned `id` as `destinationId` when posting to `POST /v1/ads/conversions`. For Google and LinkedIn, each destination's `type` reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta, `type` is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the `adAccountId` field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).
644
+ # @param account_id [String] SocialAccount ID (metaads, googleads, linkedinads, or tiktokads).
645
+ # @param [Hash] opts the optional parameters
646
+ # @return [ListConversionDestinations200Response]
647
+ def list_conversion_destinations(account_id, opts = {})
648
+ data, _status_code, _headers = list_conversion_destinations_with_http_info(account_id, opts)
649
+ data
650
+ end
651
+
652
+ # List conversion destinations
653
+ # Returns the list of pixels (Meta), conversion actions (Google), or conversion rules (LinkedIn) accessible to the connected ads account. Use the returned &#x60;id&#x60; as &#x60;destinationId&#x60; when posting to &#x60;POST /v1/ads/conversions&#x60;. For Google and LinkedIn, each destination&#39;s &#x60;type&#x60; reflects the conversion type (PURCHASE, LEAD, SIGN_UP, etc.) — the event type is locked to the destination. For Meta, &#x60;type&#x60; is absent: pixels accept any event name per request. For LinkedIn, destinations are returned across every sponsored ad account the connected token can access; the &#x60;adAccountId&#x60; field on each destination identifies the parent ad account and is required for subsequent CRUD calls (update, delete, associations, metrics).
654
+ # @param account_id [String] SocialAccount ID (metaads, googleads, linkedinads, or tiktokads).
655
+ # @param [Hash] opts the optional parameters
656
+ # @return [Array<(ListConversionDestinations200Response, Integer, Hash)>] ListConversionDestinations200Response data, response status code and response headers
657
+ def list_conversion_destinations_with_http_info(account_id, opts = {})
658
+ if @api_client.config.debugging
659
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.list_conversion_destinations ...'
660
+ end
661
+ # verify the required parameter 'account_id' is set
662
+ if @api_client.config.client_side_validation && account_id.nil?
663
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.list_conversion_destinations"
664
+ end
665
+ # resource path
666
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
667
+
668
+ # query parameters
669
+ query_params = opts[:query_params] || {}
670
+
671
+ # header parameters
672
+ header_params = opts[:header_params] || {}
673
+ # HTTP header 'Accept' (if needed)
674
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
675
+
676
+ # form parameters
677
+ form_params = opts[:form_params] || {}
678
+
679
+ # http body (model)
680
+ post_body = opts[:debug_body]
681
+
682
+ # return_type
683
+ return_type = opts[:debug_return_type] || 'ListConversionDestinations200Response'
684
+
685
+ # auth_names
686
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
687
+
688
+ new_options = opts.merge(
689
+ :operation => :"ConversionsApi.list_conversion_destinations",
690
+ :header_params => header_params,
691
+ :query_params => query_params,
692
+ :form_params => form_params,
693
+ :body => post_body,
694
+ :auth_names => auth_names,
695
+ :return_type => return_type
696
+ )
697
+
698
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
699
+ if @api_client.config.debugging
700
+ @api_client.config.logger.debug "API called: ConversionsApi#list_conversion_destinations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
701
+ end
702
+ return data, status_code, headers
703
+ end
704
+
705
+ # Remove associated campaigns
706
+ # Remove one or more campaign associations from this conversion rule. Pass `adAccountId` and `campaignIds` as query parameters (`campaignIds` is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.
707
+ # @param account_id [String]
708
+ # @param destination_id [String]
709
+ # @param ad_account_id [String]
710
+ # @param campaign_ids [String] Comma-separated list of campaign IDs.
711
+ # @param [Hash] opts the optional parameters
712
+ # @return [RemoveConversionAssociations200Response]
713
+ def remove_conversion_associations(account_id, destination_id, ad_account_id, campaign_ids, opts = {})
714
+ data, _status_code, _headers = remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts)
715
+ data
716
+ end
717
+
718
+ # Remove associated campaigns
719
+ # Remove one or more campaign associations from this conversion rule. Pass &#x60;adAccountId&#x60; and &#x60;campaignIds&#x60; as query parameters (&#x60;campaignIds&#x60; is comma-separated). The route also accepts a JSON body with the same fields for clients that prefer DELETE-with-body, but the documented surface is query-only because some SDK code generators (e.g. Python) collapse query + body parameters with the same name into a single kwarg.
720
+ # @param account_id [String]
721
+ # @param destination_id [String]
722
+ # @param ad_account_id [String]
723
+ # @param campaign_ids [String] Comma-separated list of campaign IDs.
724
+ # @param [Hash] opts the optional parameters
725
+ # @return [Array<(RemoveConversionAssociations200Response, Integer, Hash)>] RemoveConversionAssociations200Response data, response status code and response headers
726
+ def remove_conversion_associations_with_http_info(account_id, destination_id, ad_account_id, campaign_ids, opts = {})
727
+ if @api_client.config.debugging
728
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.remove_conversion_associations ...'
729
+ end
730
+ # verify the required parameter 'account_id' is set
731
+ if @api_client.config.client_side_validation && account_id.nil?
732
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.remove_conversion_associations"
733
+ end
734
+ # verify the required parameter 'destination_id' is set
735
+ if @api_client.config.client_side_validation && destination_id.nil?
736
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.remove_conversion_associations"
737
+ end
738
+ # verify the required parameter 'ad_account_id' is set
739
+ if @api_client.config.client_side_validation && ad_account_id.nil?
740
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ConversionsApi.remove_conversion_associations"
741
+ end
742
+ # verify the required parameter 'campaign_ids' is set
743
+ if @api_client.config.client_side_validation && campaign_ids.nil?
744
+ fail ArgumentError, "Missing the required parameter 'campaign_ids' when calling ConversionsApi.remove_conversion_associations"
745
+ end
746
+ # resource path
747
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}/associations'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))
748
+
749
+ # query parameters
750
+ query_params = opts[:query_params] || {}
751
+ query_params[:'adAccountId'] = ad_account_id
752
+ query_params[:'campaignIds'] = campaign_ids
753
+
754
+ # header parameters
755
+ header_params = opts[:header_params] || {}
756
+ # HTTP header 'Accept' (if needed)
757
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
758
+
759
+ # form parameters
760
+ form_params = opts[:form_params] || {}
761
+
762
+ # http body (model)
763
+ post_body = opts[:debug_body]
764
+
765
+ # return_type
766
+ return_type = opts[:debug_return_type] || 'RemoveConversionAssociations200Response'
767
+
768
+ # auth_names
769
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
770
+
771
+ new_options = opts.merge(
772
+ :operation => :"ConversionsApi.remove_conversion_associations",
773
+ :header_params => header_params,
774
+ :query_params => query_params,
775
+ :form_params => form_params,
776
+ :body => post_body,
777
+ :auth_names => auth_names,
778
+ :return_type => return_type
779
+ )
780
+
781
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
782
+ if @api_client.config.debugging
783
+ @api_client.config.logger.debug "API called: ConversionsApi#remove_conversion_associations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
784
+ end
785
+ return data, status_code, headers
786
+ end
787
+
788
+ # Send conversion events
789
+ # Relay one or more conversion events to the target ad platform's native Conversions API. Platform is inferred from the provided `accountId`. Requires the Ads add-on. Supported platforms: - Meta (`metaads`) via Graph API - Google Ads (`googleads`) via Data Manager API `ingestEvents` - LinkedIn (`linkedinads`) via `/rest/conversionEvents` - TikTok (`tiktokads`) via the Offline Events API `/offline/batch/` — OFFLINE conversions only `destinationId` semantics differ per platform: - Meta: pixel (dataset) ID, e.g. `123456789012345` - Google: conversion action resource name, e.g. `customers/1234567890/conversionActions/987654321` - LinkedIn: conversion rule ID or URN, e.g. `104012` or `urn:lla:llaPartnerConversion:104012` - TikTok: Offline Event Set ID, e.g. `7057103914977558530` TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. Callers can list valid destinations via `GET /v1/accounts/{accountId}/conversion-destinations`. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform's normalization spec, including Google's Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn `externalIds` are passed through as plaintext per LinkedIn's spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include `rw_conversions`). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. Dedup: pass a stable `eventId` on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to `transactionId`. Per-platform `eventName` semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta's built-in events; custom strings are accepted. - Google: ignored. The conversion action's category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule's `type` (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it.
790
+ # @param send_conversions_request [SendConversionsRequest]
791
+ # @param [Hash] opts the optional parameters
792
+ # @return [SendConversions200Response]
793
+ def send_conversions(send_conversions_request, opts = {})
794
+ data, _status_code, _headers = send_conversions_with_http_info(send_conversions_request, opts)
795
+ data
796
+ end
797
+
798
+ # Send conversion events
799
+ # Relay one or more conversion events to the target ad platform&#39;s native Conversions API. Platform is inferred from the provided &#x60;accountId&#x60;. Requires the Ads add-on. Supported platforms: - Meta (&#x60;metaads&#x60;) via Graph API - Google Ads (&#x60;googleads&#x60;) via Data Manager API &#x60;ingestEvents&#x60; - LinkedIn (&#x60;linkedinads&#x60;) via &#x60;/rest/conversionEvents&#x60; - TikTok (&#x60;tiktokads&#x60;) via the Offline Events API &#x60;/offline/batch/&#x60; — OFFLINE conversions only &#x60;destinationId&#x60; semantics differ per platform: - Meta: pixel (dataset) ID, e.g. &#x60;123456789012345&#x60; - Google: conversion action resource name, e.g. &#x60;customers/1234567890/conversionActions/987654321&#x60; - LinkedIn: conversion rule ID or URN, e.g. &#x60;104012&#x60; or &#x60;urn:lla:llaPartnerConversion:104012&#x60; - TikTok: Offline Event Set ID, e.g. &#x60;7057103914977558530&#x60; TikTok notes: this path sends OFFLINE conversions (in-store / CRM / call-center), not web-pixel events. Each event must carry an email or phone (TikTok requires at least one). The connected TikTok ads account must have granted the Offline Events permission; older grants must reconnect. Callers can list valid destinations via &#x60;GET /v1/accounts/{accountId}/conversion-destinations&#x60;. All PII (email, phone, names, external IDs) is hashed with SHA-256 server-side per each platform&#39;s normalization spec, including Google&#39;s Gmail-specific dot/plus-suffix stripping. Send plaintext. LinkedIn &#x60;externalIds&#x60; are passed through as plaintext per LinkedIn&#39;s spec; only emails and phones are hashed. For LinkedIn, the connected account must have been authorized after the Conversions API rollout (i.e. the OAuth grant must include &#x60;rw_conversions&#x60;). Older accounts must reconnect. Batching is handled automatically. Meta caps at 1000 events per request and rejects the entire batch if any event is malformed. Google caps at 2000. LinkedIn caps at 5000 and is also all-or-nothing per chunk. Dedup: pass a stable &#x60;eventId&#x60; on every event. Meta and LinkedIn use it to dedupe against browser-side pixel/Insight Tag events; Google maps it to &#x60;transactionId&#x60;. Per-platform &#x60;eventName&#x60; semantics: - Meta: free-form. Standard names (Purchase, Lead, ...) match Meta&#39;s built-in events; custom strings are accepted. - Google: ignored. The conversion action&#39;s category determines the event type. Send the standard name closest to your action for documentation, but the platform will not branch on it. - LinkedIn: ignored. The conversion rule&#39;s &#x60;type&#x60; (LEAD, PURCHASE, etc.) is locked to the destination at rule-creation time. Send the standard name for documentation; LinkedIn does not branch on it.
800
+ # @param send_conversions_request [SendConversionsRequest]
801
+ # @param [Hash] opts the optional parameters
802
+ # @return [Array<(SendConversions200Response, Integer, Hash)>] SendConversions200Response data, response status code and response headers
803
+ def send_conversions_with_http_info(send_conversions_request, opts = {})
804
+ if @api_client.config.debugging
805
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.send_conversions ...'
806
+ end
807
+ # verify the required parameter 'send_conversions_request' is set
808
+ if @api_client.config.client_side_validation && send_conversions_request.nil?
809
+ fail ArgumentError, "Missing the required parameter 'send_conversions_request' when calling ConversionsApi.send_conversions"
810
+ end
811
+ # resource path
812
+ local_var_path = '/v1/ads/conversions'
813
+
814
+ # query parameters
815
+ query_params = opts[:query_params] || {}
816
+
817
+ # header parameters
818
+ header_params = opts[:header_params] || {}
819
+ # HTTP header 'Accept' (if needed)
820
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
821
+ # HTTP header 'Content-Type'
822
+ content_type = @api_client.select_header_content_type(['application/json'])
823
+ if !content_type.nil?
824
+ header_params['Content-Type'] = content_type
825
+ end
826
+
827
+ # form parameters
828
+ form_params = opts[:form_params] || {}
829
+
830
+ # http body (model)
831
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(send_conversions_request)
832
+
833
+ # return_type
834
+ return_type = opts[:debug_return_type] || 'SendConversions200Response'
835
+
836
+ # auth_names
837
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
838
+
839
+ new_options = opts.merge(
840
+ :operation => :"ConversionsApi.send_conversions",
841
+ :header_params => header_params,
842
+ :query_params => query_params,
843
+ :form_params => form_params,
844
+ :body => post_body,
845
+ :auth_names => auth_names,
846
+ :return_type => return_type
847
+ )
848
+
849
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
850
+ if @api_client.config.debugging
851
+ @api_client.config.logger.debug "API called: ConversionsApi#send_conversions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
852
+ end
853
+ return data, status_code, headers
854
+ end
855
+
856
+ # Update a conversion destination
857
+ # Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: `name`, `enabled`, attribution windows, `valueType`, `value`, `attributionType`. The rule's `type` and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.
858
+ # @param account_id [String]
859
+ # @param destination_id [String]
860
+ # @param update_conversion_destination_request [UpdateConversionDestinationRequest]
861
+ # @param [Hash] opts the optional parameters
862
+ # @return [GetConversionDestination200Response]
863
+ def update_conversion_destination(account_id, destination_id, update_conversion_destination_request, opts = {})
864
+ data, _status_code, _headers = update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts)
865
+ data
866
+ end
867
+
868
+ # Update a conversion destination
869
+ # Partial-update a conversion rule. LinkedIn-only today. Whitelisted fields: &#x60;name&#x60;, &#x60;enabled&#x60;, attribution windows, &#x60;valueType&#x60;, &#x60;value&#x60;, &#x60;attributionType&#x60;. The rule&#39;s &#x60;type&#x60; and parent ad account are intentionally not exposed for update — recreate the rule if those need to change.
870
+ # @param account_id [String]
871
+ # @param destination_id [String]
872
+ # @param update_conversion_destination_request [UpdateConversionDestinationRequest]
873
+ # @param [Hash] opts the optional parameters
874
+ # @return [Array<(GetConversionDestination200Response, Integer, Hash)>] GetConversionDestination200Response data, response status code and response headers
875
+ def update_conversion_destination_with_http_info(account_id, destination_id, update_conversion_destination_request, opts = {})
876
+ if @api_client.config.debugging
877
+ @api_client.config.logger.debug 'Calling API: ConversionsApi.update_conversion_destination ...'
878
+ end
879
+ # verify the required parameter 'account_id' is set
880
+ if @api_client.config.client_side_validation && account_id.nil?
881
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ConversionsApi.update_conversion_destination"
882
+ end
883
+ # verify the required parameter 'destination_id' is set
884
+ if @api_client.config.client_side_validation && destination_id.nil?
885
+ fail ArgumentError, "Missing the required parameter 'destination_id' when calling ConversionsApi.update_conversion_destination"
886
+ end
887
+ # verify the required parameter 'update_conversion_destination_request' is set
888
+ if @api_client.config.client_side_validation && update_conversion_destination_request.nil?
889
+ fail ArgumentError, "Missing the required parameter 'update_conversion_destination_request' when calling ConversionsApi.update_conversion_destination"
890
+ end
891
+ # resource path
892
+ local_var_path = '/v1/accounts/{accountId}/conversion-destinations/{destinationId}'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'destinationId' + '}', CGI.escape(destination_id.to_s))
893
+
894
+ # query parameters
895
+ query_params = opts[:query_params] || {}
896
+
897
+ # header parameters
898
+ header_params = opts[:header_params] || {}
899
+ # HTTP header 'Accept' (if needed)
900
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
901
+ # HTTP header 'Content-Type'
902
+ content_type = @api_client.select_header_content_type(['application/json'])
903
+ if !content_type.nil?
904
+ header_params['Content-Type'] = content_type
905
+ end
906
+
907
+ # form parameters
908
+ form_params = opts[:form_params] || {}
909
+
910
+ # http body (model)
911
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_conversion_destination_request)
912
+
913
+ # return_type
914
+ return_type = opts[:debug_return_type] || 'GetConversionDestination200Response'
915
+
916
+ # auth_names
917
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
918
+
919
+ new_options = opts.merge(
920
+ :operation => :"ConversionsApi.update_conversion_destination",
921
+ :header_params => header_params,
922
+ :query_params => query_params,
923
+ :form_params => form_params,
924
+ :body => post_body,
925
+ :auth_names => auth_names,
926
+ :return_type => return_type
927
+ )
928
+
929
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
930
+ if @api_client.config.debugging
931
+ @api_client.config.logger.debug "API called: ConversionsApi#update_conversion_destination\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
932
+ end
933
+ return data, status_code, headers
934
+ end
935
+ end
936
+ end