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,226 @@
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 MessagingAdsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create Click-to-Call ad
23
+ # Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing `phoneNumber` via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.
24
+ # @param create_call_ad_request [CreateCallAdRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [nil]
27
+ def create_call_ad(create_call_ad_request, opts = {})
28
+ create_call_ad_with_http_info(create_call_ad_request, opts)
29
+ nil
30
+ end
31
+
32
+ # Create Click-to-Call ad
33
+ # Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing `phoneNumber` via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.
34
+ # @param create_call_ad_request [CreateCallAdRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
37
+ def create_call_ad_with_http_info(create_call_ad_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_call_ad ...'
40
+ end
41
+ # verify the required parameter 'create_call_ad_request' is set
42
+ if @api_client.config.client_side_validation && create_call_ad_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'create_call_ad_request' when calling MessagingAdsApi.create_call_ad"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v1/ads/call'
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(create_call_ad_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type]
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"MessagingAdsApi.create_call_ad",
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: MessagingAdsApi#create_call_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Create Click-to-WhatsApp ad (deprecated)
91
+ # Deprecated: use POST /v1/ads/messaging with `destination: whatsapp`. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - **Single-creative**: supply top-level `headline`, `body`, and one of `imageUrl` / `video`. Creates 1 campaign + 1 ad set + 1 ad. - **Multi-creative**: supply a `creatives[]` array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
92
+ # @param ctwa_ad_request_body [CtwaAdRequestBody]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [CreateCtwaAd201Response]
95
+ def create_ctwa_ad(ctwa_ad_request_body, opts = {})
96
+ data, _status_code, _headers = create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts)
97
+ data
98
+ end
99
+
100
+ # Create Click-to-WhatsApp ad (deprecated)
101
+ # Deprecated: use POST /v1/ads/messaging with &#x60;destination: whatsapp&#x60;. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - **Single-creative**: supply top-level &#x60;headline&#x60;, &#x60;body&#x60;, and one of &#x60;imageUrl&#x60; / &#x60;video&#x60;. Creates 1 campaign + 1 ad set + 1 ad. - **Multi-creative**: supply a &#x60;creatives[]&#x60; array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
102
+ # @param ctwa_ad_request_body [CtwaAdRequestBody]
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(CreateCtwaAd201Response, Integer, Hash)>] CreateCtwaAd201Response data, response status code and response headers
105
+ def create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_ctwa_ad ...'
108
+ end
109
+ # verify the required parameter 'ctwa_ad_request_body' is set
110
+ if @api_client.config.client_side_validation && ctwa_ad_request_body.nil?
111
+ fail ArgumentError, "Missing the required parameter 'ctwa_ad_request_body' when calling MessagingAdsApi.create_ctwa_ad"
112
+ end
113
+ # resource path
114
+ local_var_path = '/v1/ads/ctwa'
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(ctwa_ad_request_body)
134
+
135
+ # return_type
136
+ return_type = opts[:debug_return_type] || 'CreateCtwaAd201Response'
137
+
138
+ # auth_names
139
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
140
+
141
+ new_options = opts.merge(
142
+ :operation => :"MessagingAdsApi.create_ctwa_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: MessagingAdsApi#create_ctwa_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
154
+ end
155
+ return data, status_code, headers
156
+ end
157
+
158
+ # Create click-to-message ad (WhatsApp / Messenger / Instagram Direct)
159
+ # Creates a click-to-message ad; `destination` selects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to `destination: whatsapp`).
160
+ # @param create_messaging_ad_request [CreateMessagingAdRequest]
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [nil]
163
+ def create_messaging_ad(create_messaging_ad_request, opts = {})
164
+ create_messaging_ad_with_http_info(create_messaging_ad_request, opts)
165
+ nil
166
+ end
167
+
168
+ # Create click-to-message ad (WhatsApp / Messenger / Instagram Direct)
169
+ # Creates a click-to-message ad; &#x60;destination&#x60; selects where the tapped ad opens a conversation: WhatsApp, the Page&#39;s Messenger inbox or the linked Instagram account&#39;s Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to &#x60;destination: whatsapp&#x60;).
170
+ # @param create_messaging_ad_request [CreateMessagingAdRequest]
171
+ # @param [Hash] opts the optional parameters
172
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
173
+ def create_messaging_ad_with_http_info(create_messaging_ad_request, opts = {})
174
+ if @api_client.config.debugging
175
+ @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_messaging_ad ...'
176
+ end
177
+ # verify the required parameter 'create_messaging_ad_request' is set
178
+ if @api_client.config.client_side_validation && create_messaging_ad_request.nil?
179
+ fail ArgumentError, "Missing the required parameter 'create_messaging_ad_request' when calling MessagingAdsApi.create_messaging_ad"
180
+ end
181
+ # resource path
182
+ local_var_path = '/v1/ads/messaging'
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
+ # HTTP header 'Content-Type'
192
+ content_type = @api_client.select_header_content_type(['application/json'])
193
+ if !content_type.nil?
194
+ header_params['Content-Type'] = content_type
195
+ end
196
+
197
+ # form parameters
198
+ form_params = opts[:form_params] || {}
199
+
200
+ # http body (model)
201
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_messaging_ad_request)
202
+
203
+ # return_type
204
+ return_type = opts[:debug_return_type]
205
+
206
+ # auth_names
207
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
208
+
209
+ new_options = opts.merge(
210
+ :operation => :"MessagingAdsApi.create_messaging_ad",
211
+ :header_params => header_params,
212
+ :query_params => query_params,
213
+ :form_params => form_params,
214
+ :body => post_body,
215
+ :auth_names => auth_names,
216
+ :return_type => return_type
217
+ )
218
+
219
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
220
+ if @api_client.config.debugging
221
+ @api_client.config.logger.debug "API called: MessagingAdsApi#create_messaging_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
222
+ end
223
+ return data, status_code, headers
224
+ end
225
+ end
226
+ end
@@ -0,0 +1,316 @@
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 ReachAndFrequencyApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Cancel a Reach & Frequency reservation
23
+ # Releases a RESERVATION's locked price and inventory. Unreserved predictions expire on their own.
24
+ # @param prediction_id [String]
25
+ # @param account_id [String]
26
+ # @param ad_account_id [String]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [nil]
29
+ def cancel_rf_reservation(prediction_id, account_id, ad_account_id, opts = {})
30
+ cancel_rf_reservation_with_http_info(prediction_id, account_id, ad_account_id, opts)
31
+ nil
32
+ end
33
+
34
+ # Cancel a Reach &amp; Frequency reservation
35
+ # Releases a RESERVATION&#39;s locked price and inventory. Unreserved predictions expire on their own.
36
+ # @param prediction_id [String]
37
+ # @param account_id [String]
38
+ # @param ad_account_id [String]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
41
+ def cancel_rf_reservation_with_http_info(prediction_id, account_id, ad_account_id, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: ReachAndFrequencyApi.cancel_rf_reservation ...'
44
+ end
45
+ # verify the required parameter 'prediction_id' is set
46
+ if @api_client.config.client_side_validation && prediction_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'prediction_id' when calling ReachAndFrequencyApi.cancel_rf_reservation"
48
+ end
49
+ # verify the required parameter 'account_id' is set
50
+ if @api_client.config.client_side_validation && account_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ReachAndFrequencyApi.cancel_rf_reservation"
52
+ end
53
+ # verify the required parameter 'ad_account_id' is set
54
+ if @api_client.config.client_side_validation && ad_account_id.nil?
55
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ReachAndFrequencyApi.cancel_rf_reservation"
56
+ end
57
+ # resource path
58
+ local_var_path = '/v1/ads/rf-predictions/{predictionId}'.sub('{' + 'predictionId' + '}', CGI.escape(prediction_id.to_s))
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+ query_params[:'accountId'] = account_id
63
+ query_params[:'adAccountId'] = ad_account_id
64
+
65
+ # header parameters
66
+ header_params = opts[:header_params] || {}
67
+ # HTTP header 'Accept' (if needed)
68
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
69
+
70
+ # form parameters
71
+ form_params = opts[:form_params] || {}
72
+
73
+ # http body (model)
74
+ post_body = opts[:debug_body]
75
+
76
+ # return_type
77
+ return_type = opts[:debug_return_type]
78
+
79
+ # auth_names
80
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
81
+
82
+ new_options = opts.merge(
83
+ :operation => :"ReachAndFrequencyApi.cancel_rf_reservation",
84
+ :header_params => header_params,
85
+ :query_params => query_params,
86
+ :form_params => form_params,
87
+ :body => post_body,
88
+ :auth_names => auth_names,
89
+ :return_type => return_type
90
+ )
91
+
92
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
93
+ if @api_client.config.debugging
94
+ @api_client.config.logger.debug "API called: ReachAndFrequencyApi#cancel_rf_reservation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
95
+ end
96
+ return data, status_code, headers
97
+ end
98
+
99
+ # Create a Reach & Frequency prediction
100
+ # Creates an R&F prediction — a QUOTE, nothing is bought and no ad entities are created. Provide a date range plus exactly one of `budgetAmount` (Meta predicts reach) or `reach` (Meta predicts the budget). The response carries the estimate and its allowed bounds (min/max budget and reach). Predictions expire on their own; to buy, reserve one via POST /v1/ads/rf-predictions/{predictionId}/reserve and pass the RESERVED id to POST /v1/ads/create with `buyingType: \"RESERVED\"`. Reservation campaigns reject automatic placements, so omitted `placements` default to Facebook feed (+ Instagram stream when a linked IG professional account resolves); Instagram placements require that IG account.
101
+ # @param create_rf_prediction_request [CreateRfPredictionRequest]
102
+ # @param [Hash] opts the optional parameters
103
+ # @return [CreateRfPrediction201Response]
104
+ def create_rf_prediction(create_rf_prediction_request, opts = {})
105
+ data, _status_code, _headers = create_rf_prediction_with_http_info(create_rf_prediction_request, opts)
106
+ data
107
+ end
108
+
109
+ # Create a Reach &amp; Frequency prediction
110
+ # Creates an R&amp;F prediction — a QUOTE, nothing is bought and no ad entities are created. Provide a date range plus exactly one of &#x60;budgetAmount&#x60; (Meta predicts reach) or &#x60;reach&#x60; (Meta predicts the budget). The response carries the estimate and its allowed bounds (min/max budget and reach). Predictions expire on their own; to buy, reserve one via POST /v1/ads/rf-predictions/{predictionId}/reserve and pass the RESERVED id to POST /v1/ads/create with &#x60;buyingType: \&quot;RESERVED\&quot;&#x60;. Reservation campaigns reject automatic placements, so omitted &#x60;placements&#x60; default to Facebook feed (+ Instagram stream when a linked IG professional account resolves); Instagram placements require that IG account.
111
+ # @param create_rf_prediction_request [CreateRfPredictionRequest]
112
+ # @param [Hash] opts the optional parameters
113
+ # @return [Array<(CreateRfPrediction201Response, Integer, Hash)>] CreateRfPrediction201Response data, response status code and response headers
114
+ def create_rf_prediction_with_http_info(create_rf_prediction_request, opts = {})
115
+ if @api_client.config.debugging
116
+ @api_client.config.logger.debug 'Calling API: ReachAndFrequencyApi.create_rf_prediction ...'
117
+ end
118
+ # verify the required parameter 'create_rf_prediction_request' is set
119
+ if @api_client.config.client_side_validation && create_rf_prediction_request.nil?
120
+ fail ArgumentError, "Missing the required parameter 'create_rf_prediction_request' when calling ReachAndFrequencyApi.create_rf_prediction"
121
+ end
122
+ # resource path
123
+ local_var_path = '/v1/ads/rf-predictions'
124
+
125
+ # query parameters
126
+ query_params = opts[:query_params] || {}
127
+
128
+ # header parameters
129
+ header_params = opts[:header_params] || {}
130
+ # HTTP header 'Accept' (if needed)
131
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
132
+ # HTTP header 'Content-Type'
133
+ content_type = @api_client.select_header_content_type(['application/json'])
134
+ if !content_type.nil?
135
+ header_params['Content-Type'] = content_type
136
+ end
137
+
138
+ # form parameters
139
+ form_params = opts[:form_params] || {}
140
+
141
+ # http body (model)
142
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_rf_prediction_request)
143
+
144
+ # return_type
145
+ return_type = opts[:debug_return_type] || 'CreateRfPrediction201Response'
146
+
147
+ # auth_names
148
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
149
+
150
+ new_options = opts.merge(
151
+ :operation => :"ReachAndFrequencyApi.create_rf_prediction",
152
+ :header_params => header_params,
153
+ :query_params => query_params,
154
+ :form_params => form_params,
155
+ :body => post_body,
156
+ :auth_names => auth_names,
157
+ :return_type => return_type
158
+ )
159
+
160
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
161
+ if @api_client.config.debugging
162
+ @api_client.config.logger.debug "API called: ReachAndFrequencyApi#create_rf_prediction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
163
+ end
164
+ return data, status_code, headers
165
+ end
166
+
167
+ # Read a Reach & Frequency prediction
168
+ # @param prediction_id [String]
169
+ # @param account_id [String]
170
+ # @param ad_account_id [String]
171
+ # @param [Hash] opts the optional parameters
172
+ # @return [CreateRfPrediction201Response]
173
+ def get_rf_prediction(prediction_id, account_id, ad_account_id, opts = {})
174
+ data, _status_code, _headers = get_rf_prediction_with_http_info(prediction_id, account_id, ad_account_id, opts)
175
+ data
176
+ end
177
+
178
+ # Read a Reach &amp; Frequency prediction
179
+ # @param prediction_id [String]
180
+ # @param account_id [String]
181
+ # @param ad_account_id [String]
182
+ # @param [Hash] opts the optional parameters
183
+ # @return [Array<(CreateRfPrediction201Response, Integer, Hash)>] CreateRfPrediction201Response data, response status code and response headers
184
+ def get_rf_prediction_with_http_info(prediction_id, account_id, ad_account_id, opts = {})
185
+ if @api_client.config.debugging
186
+ @api_client.config.logger.debug 'Calling API: ReachAndFrequencyApi.get_rf_prediction ...'
187
+ end
188
+ # verify the required parameter 'prediction_id' is set
189
+ if @api_client.config.client_side_validation && prediction_id.nil?
190
+ fail ArgumentError, "Missing the required parameter 'prediction_id' when calling ReachAndFrequencyApi.get_rf_prediction"
191
+ end
192
+ # verify the required parameter 'account_id' is set
193
+ if @api_client.config.client_side_validation && account_id.nil?
194
+ fail ArgumentError, "Missing the required parameter 'account_id' when calling ReachAndFrequencyApi.get_rf_prediction"
195
+ end
196
+ # verify the required parameter 'ad_account_id' is set
197
+ if @api_client.config.client_side_validation && ad_account_id.nil?
198
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling ReachAndFrequencyApi.get_rf_prediction"
199
+ end
200
+ # resource path
201
+ local_var_path = '/v1/ads/rf-predictions/{predictionId}'.sub('{' + 'predictionId' + '}', CGI.escape(prediction_id.to_s))
202
+
203
+ # query parameters
204
+ query_params = opts[:query_params] || {}
205
+ query_params[:'accountId'] = account_id
206
+ query_params[:'adAccountId'] = ad_account_id
207
+
208
+ # header parameters
209
+ header_params = opts[:header_params] || {}
210
+ # HTTP header 'Accept' (if needed)
211
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
212
+
213
+ # form parameters
214
+ form_params = opts[:form_params] || {}
215
+
216
+ # http body (model)
217
+ post_body = opts[:debug_body]
218
+
219
+ # return_type
220
+ return_type = opts[:debug_return_type] || 'CreateRfPrediction201Response'
221
+
222
+ # auth_names
223
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
224
+
225
+ new_options = opts.merge(
226
+ :operation => :"ReachAndFrequencyApi.get_rf_prediction",
227
+ :header_params => header_params,
228
+ :query_params => query_params,
229
+ :form_params => form_params,
230
+ :body => post_body,
231
+ :auth_names => auth_names,
232
+ :return_type => return_type
233
+ )
234
+
235
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
236
+ if @api_client.config.debugging
237
+ @api_client.config.logger.debug "API called: ReachAndFrequencyApi#get_rf_prediction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
238
+ end
239
+ return data, status_code, headers
240
+ end
241
+
242
+ # Reserve a Reach & Frequency prediction
243
+ # Locks the quoted price + inventory until the returned `expiresAt` and mints a NEW prediction id — pass that RESERVED id (not the original) as `rfPredictionId` on POST /v1/ads/create. Release an unused reservation via DELETE.
244
+ # @param prediction_id [String]
245
+ # @param reserve_rf_prediction_request [ReserveRfPredictionRequest]
246
+ # @param [Hash] opts the optional parameters
247
+ # @return [ReserveRfPrediction201Response]
248
+ def reserve_rf_prediction(prediction_id, reserve_rf_prediction_request, opts = {})
249
+ data, _status_code, _headers = reserve_rf_prediction_with_http_info(prediction_id, reserve_rf_prediction_request, opts)
250
+ data
251
+ end
252
+
253
+ # Reserve a Reach &amp; Frequency prediction
254
+ # Locks the quoted price + inventory until the returned &#x60;expiresAt&#x60; and mints a NEW prediction id — pass that RESERVED id (not the original) as &#x60;rfPredictionId&#x60; on POST /v1/ads/create. Release an unused reservation via DELETE.
255
+ # @param prediction_id [String]
256
+ # @param reserve_rf_prediction_request [ReserveRfPredictionRequest]
257
+ # @param [Hash] opts the optional parameters
258
+ # @return [Array<(ReserveRfPrediction201Response, Integer, Hash)>] ReserveRfPrediction201Response data, response status code and response headers
259
+ def reserve_rf_prediction_with_http_info(prediction_id, reserve_rf_prediction_request, opts = {})
260
+ if @api_client.config.debugging
261
+ @api_client.config.logger.debug 'Calling API: ReachAndFrequencyApi.reserve_rf_prediction ...'
262
+ end
263
+ # verify the required parameter 'prediction_id' is set
264
+ if @api_client.config.client_side_validation && prediction_id.nil?
265
+ fail ArgumentError, "Missing the required parameter 'prediction_id' when calling ReachAndFrequencyApi.reserve_rf_prediction"
266
+ end
267
+ # verify the required parameter 'reserve_rf_prediction_request' is set
268
+ if @api_client.config.client_side_validation && reserve_rf_prediction_request.nil?
269
+ fail ArgumentError, "Missing the required parameter 'reserve_rf_prediction_request' when calling ReachAndFrequencyApi.reserve_rf_prediction"
270
+ end
271
+ # resource path
272
+ local_var_path = '/v1/ads/rf-predictions/{predictionId}/reserve'.sub('{' + 'predictionId' + '}', CGI.escape(prediction_id.to_s))
273
+
274
+ # query parameters
275
+ query_params = opts[:query_params] || {}
276
+
277
+ # header parameters
278
+ header_params = opts[:header_params] || {}
279
+ # HTTP header 'Accept' (if needed)
280
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
281
+ # HTTP header 'Content-Type'
282
+ content_type = @api_client.select_header_content_type(['application/json'])
283
+ if !content_type.nil?
284
+ header_params['Content-Type'] = content_type
285
+ end
286
+
287
+ # form parameters
288
+ form_params = opts[:form_params] || {}
289
+
290
+ # http body (model)
291
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(reserve_rf_prediction_request)
292
+
293
+ # return_type
294
+ return_type = opts[:debug_return_type] || 'ReserveRfPrediction201Response'
295
+
296
+ # auth_names
297
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
298
+
299
+ new_options = opts.merge(
300
+ :operation => :"ReachAndFrequencyApi.reserve_rf_prediction",
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(:POST, local_var_path, new_options)
310
+ if @api_client.config.debugging
311
+ @api_client.config.logger.debug "API called: ReachAndFrequencyApi#reserve_rf_prediction\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
312
+ end
313
+ return data, status_code, headers
314
+ end
315
+ end
316
+ end