late-sdk 0.0.549 → 0.0.551
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +72 -74
- data/docs/AdAccountsApi.md +915 -0
- data/docs/AdCampaignsApi.md +615 -15
- data/docs/AdCreativesApi.md +815 -0
- data/docs/AdInsightsApi.md +415 -0
- data/docs/AdTargetingApi.md +371 -0
- data/docs/AnalyticsApi.md +7 -7
- data/docs/ConversionsApi.md +890 -0
- data/docs/LeadGenApi.md +527 -0
- data/docs/MessagingAdsApi.md +215 -0
- data/docs/ReachAndFrequencyApi.md +294 -0
- data/docs/TrackingTagsApi.md +141 -0
- data/docs/YouTubeDailyViewsResponse.md +2 -0
- data/docs/YouTubeDemographicsResponse.md +2 -0
- data/docs/YouTubeVideoRetentionResponse.md +2 -0
- data/lib/zernio-sdk/api/ad_accounts_api.rb +958 -0
- data/lib/zernio-sdk/api/ad_campaigns_api.rb +618 -12
- data/lib/zernio-sdk/api/ad_creatives_api.rb +826 -0
- data/lib/zernio-sdk/api/ad_insights_api.rb +446 -0
- data/lib/zernio-sdk/api/ad_targeting_api.rb +404 -0
- data/lib/zernio-sdk/api/analytics_api.rb +8 -8
- data/lib/zernio-sdk/api/conversions_api.rb +936 -0
- data/lib/zernio-sdk/api/lead_gen_api.rb +547 -0
- data/lib/zernio-sdk/api/messaging_ads_api.rb +226 -0
- data/lib/zernio-sdk/api/reach_and_frequency_api.rb +316 -0
- data/lib/zernio-sdk/api/tracking_tags_api.rb +137 -0
- data/lib/zernio-sdk/models/you_tube_daily_views_response.rb +11 -1
- data/lib/zernio-sdk/models/you_tube_demographics_response.rb +11 -1
- data/lib/zernio-sdk/models/you_tube_video_retention_response.rb +11 -1
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +8 -1
- data/openapi.yaml +321 -162
- data/spec/api/ad_accounts_api_spec.rb +206 -0
- data/spec/api/ad_campaigns_api_spec.rb +119 -6
- data/spec/api/ad_creatives_api_spec.rb +182 -0
- data/spec/api/ad_insights_api_spec.rb +120 -0
- data/spec/api/ad_targeting_api_spec.rb +101 -0
- data/spec/api/analytics_api_spec.rb +4 -4
- data/spec/api/conversions_api_spec.rb +199 -0
- data/spec/api/lead_gen_api_spec.rb +131 -0
- data/spec/api/messaging_ads_api_spec.rb +71 -0
- data/spec/api/reach_and_frequency_api_spec.rb +87 -0
- data/spec/api/tracking_tags_api_spec.rb +25 -0
- data/spec/models/you_tube_daily_views_response_spec.rb +6 -0
- data/spec/models/you_tube_demographics_response_spec.rb +6 -0
- data/spec/models/you_tube_video_retention_response_spec.rb +6 -0
- data/zernio-sdk-0.0.551.gem +0 -0
- metadata +35 -7
- data/docs/AdsApi.md +0 -5278
- data/lib/zernio-sdk/api/ads_api.rb +0 -5391
- data/spec/api/ads_api_spec.rb +0 -1015
- data/zernio-sdk-0.0.549.gem +0 -0
|
@@ -0,0 +1,446 @@
|
|
|
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 AdInsightsApi
|
|
17
|
+
attr_accessor :api_client
|
|
18
|
+
|
|
19
|
+
def initialize(api_client = ApiClient.default)
|
|
20
|
+
@api_client = api_client
|
|
21
|
+
end
|
|
22
|
+
# Submit an async insights report run
|
|
23
|
+
# Submits an asynchronous Meta insights report. Same query surface as GET /v1/ads/insights, but in the JSON body; Meta processes the report server-side, which is the right choice for long ranges or large accounts where the sync query is slow or rate-limited. Returns a `reportRunId` to poll via GET /v1/ads/insights/reports/{reportRunId}.
|
|
24
|
+
# @param create_ad_insights_report_request [CreateAdInsightsReportRequest]
|
|
25
|
+
# @param [Hash] opts the optional parameters
|
|
26
|
+
# @return [CreateAdInsightsReport202Response]
|
|
27
|
+
def create_ad_insights_report(create_ad_insights_report_request, opts = {})
|
|
28
|
+
data, _status_code, _headers = create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts)
|
|
29
|
+
data
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Submit an async insights report run
|
|
33
|
+
# Submits an asynchronous Meta insights report. Same query surface as GET /v1/ads/insights, but in the JSON body; Meta processes the report server-side, which is the right choice for long ranges or large accounts where the sync query is slow or rate-limited. Returns a `reportRunId` to poll via GET /v1/ads/insights/reports/{reportRunId}.
|
|
34
|
+
# @param create_ad_insights_report_request [CreateAdInsightsReportRequest]
|
|
35
|
+
# @param [Hash] opts the optional parameters
|
|
36
|
+
# @return [Array<(CreateAdInsightsReport202Response, Integer, Hash)>] CreateAdInsightsReport202Response data, response status code and response headers
|
|
37
|
+
def create_ad_insights_report_with_http_info(create_ad_insights_report_request, opts = {})
|
|
38
|
+
if @api_client.config.debugging
|
|
39
|
+
@api_client.config.logger.debug 'Calling API: AdInsightsApi.create_ad_insights_report ...'
|
|
40
|
+
end
|
|
41
|
+
# verify the required parameter 'create_ad_insights_report_request' is set
|
|
42
|
+
if @api_client.config.client_side_validation && create_ad_insights_report_request.nil?
|
|
43
|
+
fail ArgumentError, "Missing the required parameter 'create_ad_insights_report_request' when calling AdInsightsApi.create_ad_insights_report"
|
|
44
|
+
end
|
|
45
|
+
# resource path
|
|
46
|
+
local_var_path = '/v1/ads/insights/reports'
|
|
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_ad_insights_report_request)
|
|
66
|
+
|
|
67
|
+
# return_type
|
|
68
|
+
return_type = opts[:debug_return_type] || 'CreateAdInsightsReport202Response'
|
|
69
|
+
|
|
70
|
+
# auth_names
|
|
71
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
72
|
+
|
|
73
|
+
new_options = opts.merge(
|
|
74
|
+
:operation => :"AdInsightsApi.create_ad_insights_report",
|
|
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: AdInsightsApi#create_ad_insights_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
86
|
+
end
|
|
87
|
+
return data, status_code, headers
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Get ad analytics
|
|
91
|
+
# Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
|
|
92
|
+
# @param ad_id [String]
|
|
93
|
+
# @param [Hash] opts the optional parameters
|
|
94
|
+
# @option opts [Date] :from_date Start of date range (YYYY-MM-DD). Defaults to 90 days ago.
|
|
95
|
+
# @option opts [Date] :to_date End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
96
|
+
# @option opts [String] :breakdowns Comma-separated breakdown dimensions. **Meta**: age, gender, country, publisher_platform, device_platform, region. **TikTok**: gender, age, country_code, platform, ac, language. **LinkedIn** (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.
|
|
97
|
+
# @return [GetAdAnalytics200Response]
|
|
98
|
+
def get_ad_analytics(ad_id, opts = {})
|
|
99
|
+
data, _status_code, _headers = get_ad_analytics_with_http_info(ad_id, opts)
|
|
100
|
+
data
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Get ad analytics
|
|
104
|
+
# Returns detailed performance analytics for an ad. Includes summary metrics, a daily timeline over the requested date range, and optional demographic breakdowns (Meta and TikTok only). If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
|
|
105
|
+
# @param ad_id [String]
|
|
106
|
+
# @param [Hash] opts the optional parameters
|
|
107
|
+
# @option opts [Date] :from_date Start of date range (YYYY-MM-DD). Defaults to 90 days ago.
|
|
108
|
+
# @option opts [Date] :to_date End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
109
|
+
# @option opts [String] :breakdowns Comma-separated breakdown dimensions. **Meta**: age, gender, country, publisher_platform, device_platform, region. **TikTok**: gender, age, country_code, platform, ac, language. **LinkedIn** (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.
|
|
110
|
+
# @return [Array<(GetAdAnalytics200Response, Integer, Hash)>] GetAdAnalytics200Response data, response status code and response headers
|
|
111
|
+
def get_ad_analytics_with_http_info(ad_id, opts = {})
|
|
112
|
+
if @api_client.config.debugging
|
|
113
|
+
@api_client.config.logger.debug 'Calling API: AdInsightsApi.get_ad_analytics ...'
|
|
114
|
+
end
|
|
115
|
+
# verify the required parameter 'ad_id' is set
|
|
116
|
+
if @api_client.config.client_side_validation && ad_id.nil?
|
|
117
|
+
fail ArgumentError, "Missing the required parameter 'ad_id' when calling AdInsightsApi.get_ad_analytics"
|
|
118
|
+
end
|
|
119
|
+
# resource path
|
|
120
|
+
local_var_path = '/v1/ads/{adId}/analytics'.sub('{' + 'adId' + '}', CGI.escape(ad_id.to_s))
|
|
121
|
+
|
|
122
|
+
# query parameters
|
|
123
|
+
query_params = opts[:query_params] || {}
|
|
124
|
+
query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
|
|
125
|
+
query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
|
|
126
|
+
query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil?
|
|
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
|
+
|
|
133
|
+
# form parameters
|
|
134
|
+
form_params = opts[:form_params] || {}
|
|
135
|
+
|
|
136
|
+
# http body (model)
|
|
137
|
+
post_body = opts[:debug_body]
|
|
138
|
+
|
|
139
|
+
# return_type
|
|
140
|
+
return_type = opts[:debug_return_type] || 'GetAdAnalytics200Response'
|
|
141
|
+
|
|
142
|
+
# auth_names
|
|
143
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
144
|
+
|
|
145
|
+
new_options = opts.merge(
|
|
146
|
+
:operation => :"AdInsightsApi.get_ad_analytics",
|
|
147
|
+
:header_params => header_params,
|
|
148
|
+
:query_params => query_params,
|
|
149
|
+
:form_params => form_params,
|
|
150
|
+
:body => post_body,
|
|
151
|
+
:auth_names => auth_names,
|
|
152
|
+
:return_type => return_type
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
156
|
+
if @api_client.config.debugging
|
|
157
|
+
@api_client.config.logger.debug "API called: AdInsightsApi#get_ad_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
158
|
+
end
|
|
159
|
+
return data, status_code, headers
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Poll an async insights report run
|
|
163
|
+
# Status and results for a report run created via POST /v1/ads/insights/reports. While the job runs, returns `status` and `percentCompletion`. Once `status` is \"Job Completed\" the response also carries a `data` page, cursor-paginated via `limit` / `after`.
|
|
164
|
+
# @param report_run_id [String]
|
|
165
|
+
# @param account_id [String] Zernio SocialAccount id used to resolve the Meta token (must be the same connection that created the run).
|
|
166
|
+
# @param [Hash] opts the optional parameters
|
|
167
|
+
# @option opts [Integer] :limit (default to 25)
|
|
168
|
+
# @option opts [String] :after
|
|
169
|
+
# @return [GetAdInsightsReport200Response]
|
|
170
|
+
def get_ad_insights_report(report_run_id, account_id, opts = {})
|
|
171
|
+
data, _status_code, _headers = get_ad_insights_report_with_http_info(report_run_id, account_id, opts)
|
|
172
|
+
data
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Poll an async insights report run
|
|
176
|
+
# Status and results for a report run created via POST /v1/ads/insights/reports. While the job runs, returns `status` and `percentCompletion`. Once `status` is \"Job Completed\" the response also carries a `data` page, cursor-paginated via `limit` / `after`.
|
|
177
|
+
# @param report_run_id [String]
|
|
178
|
+
# @param account_id [String] Zernio SocialAccount id used to resolve the Meta token (must be the same connection that created the run).
|
|
179
|
+
# @param [Hash] opts the optional parameters
|
|
180
|
+
# @option opts [Integer] :limit (default to 25)
|
|
181
|
+
# @option opts [String] :after
|
|
182
|
+
# @return [Array<(GetAdInsightsReport200Response, Integer, Hash)>] GetAdInsightsReport200Response data, response status code and response headers
|
|
183
|
+
def get_ad_insights_report_with_http_info(report_run_id, account_id, opts = {})
|
|
184
|
+
if @api_client.config.debugging
|
|
185
|
+
@api_client.config.logger.debug 'Calling API: AdInsightsApi.get_ad_insights_report ...'
|
|
186
|
+
end
|
|
187
|
+
# verify the required parameter 'report_run_id' is set
|
|
188
|
+
if @api_client.config.client_side_validation && report_run_id.nil?
|
|
189
|
+
fail ArgumentError, "Missing the required parameter 'report_run_id' when calling AdInsightsApi.get_ad_insights_report"
|
|
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 AdInsightsApi.get_ad_insights_report"
|
|
194
|
+
end
|
|
195
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
|
|
196
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdInsightsApi.get_ad_insights_report, must be smaller than or equal to 500.'
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
200
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdInsightsApi.get_ad_insights_report, must be greater than or equal to 1.'
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# resource path
|
|
204
|
+
local_var_path = '/v1/ads/insights/reports/{reportRunId}'.sub('{' + 'reportRunId' + '}', CGI.escape(report_run_id.to_s))
|
|
205
|
+
|
|
206
|
+
# query parameters
|
|
207
|
+
query_params = opts[:query_params] || {}
|
|
208
|
+
query_params[:'accountId'] = account_id
|
|
209
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
210
|
+
query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
|
|
211
|
+
|
|
212
|
+
# header parameters
|
|
213
|
+
header_params = opts[:header_params] || {}
|
|
214
|
+
# HTTP header 'Accept' (if needed)
|
|
215
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
216
|
+
|
|
217
|
+
# form parameters
|
|
218
|
+
form_params = opts[:form_params] || {}
|
|
219
|
+
|
|
220
|
+
# http body (model)
|
|
221
|
+
post_body = opts[:debug_body]
|
|
222
|
+
|
|
223
|
+
# return_type
|
|
224
|
+
return_type = opts[:debug_return_type] || 'GetAdInsightsReport200Response'
|
|
225
|
+
|
|
226
|
+
# auth_names
|
|
227
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
228
|
+
|
|
229
|
+
new_options = opts.merge(
|
|
230
|
+
:operation => :"AdInsightsApi.get_ad_insights_report",
|
|
231
|
+
:header_params => header_params,
|
|
232
|
+
:query_params => query_params,
|
|
233
|
+
:form_params => form_params,
|
|
234
|
+
:body => post_body,
|
|
235
|
+
:auth_names => auth_names,
|
|
236
|
+
:return_type => return_type
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
240
|
+
if @api_client.config.debugging
|
|
241
|
+
@api_client.config.logger.debug "API called: AdInsightsApi#get_ad_insights_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
242
|
+
end
|
|
243
|
+
return data, status_code, headers
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Get campaign analytics
|
|
247
|
+
# Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns. Breakdowns are fetched live from Meta at the campaign level (one call per dimension, no per-ad fan-out), so an agency dashboard gets campaign-level age/gender/etc. without summing thousands of per-ad reads. `campaignId` is the platform campaign id; pass `platform` when a campaign id could be ambiguous across platforms. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
|
|
248
|
+
# @param campaign_id [String] Platform campaign id (platformCampaignId).
|
|
249
|
+
# @param [Hash] opts the optional parameters
|
|
250
|
+
# @option opts [String] :platform Disambiguate when the campaign id exists across platforms (e.g. facebook, instagram).
|
|
251
|
+
# @option opts [Date] :from_date Start of date range (YYYY-MM-DD). Defaults to 90 days ago.
|
|
252
|
+
# @option opts [Date] :to_date End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
253
|
+
# @option opts [String] :breakdowns Comma-separated breakdown dimensions. **Meta**: age, gender, country, publisher_platform, device_platform, region, platform_position, impression_device, video_asset, image_asset, body_asset, title_asset. **LinkedIn** (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.
|
|
254
|
+
# @return [GetCampaignAnalytics200Response]
|
|
255
|
+
def get_campaign_analytics(campaign_id, opts = {})
|
|
256
|
+
data, _status_code, _headers = get_campaign_analytics_with_http_info(campaign_id, opts)
|
|
257
|
+
data
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Get campaign analytics
|
|
261
|
+
# Returns performance analytics for a whole campaign in one call: summary metrics, a daily timeline over the requested date range (summed across the campaign's ads), and optional demographic breakdowns. Breakdowns are fetched live from Meta at the campaign level (one call per dimension, no per-ad fan-out), so an agency dashboard gets campaign-level age/gender/etc. without summing thousands of per-ad reads. `campaignId` is the platform campaign id; pass `platform` when a campaign id could be ambiguous across platforms. If no date range is provided, defaults to the last 90 days. Date range is capped at 730 days max.
|
|
262
|
+
# @param campaign_id [String] Platform campaign id (platformCampaignId).
|
|
263
|
+
# @param [Hash] opts the optional parameters
|
|
264
|
+
# @option opts [String] :platform Disambiguate when the campaign id exists across platforms (e.g. facebook, instagram).
|
|
265
|
+
# @option opts [Date] :from_date Start of date range (YYYY-MM-DD). Defaults to 90 days ago.
|
|
266
|
+
# @option opts [Date] :to_date End of date range (YYYY-MM-DD). Defaults to today. Max 730-day range.
|
|
267
|
+
# @option opts [String] :breakdowns Comma-separated breakdown dimensions. **Meta**: age, gender, country, publisher_platform, device_platform, region, platform_position, impression_device, video_asset, image_asset, body_asset, title_asset. **LinkedIn** (firmographics): job_title, job_function, seniority, industry, company, company_size, country, region. Rows carry the raw pivot `value` plus a resolved `name`. LinkedIn serves these aggregated over the whole range, delays the data 12-24h, and omits segments with fewer than 3 events.
|
|
268
|
+
# @return [Array<(GetCampaignAnalytics200Response, Integer, Hash)>] GetCampaignAnalytics200Response data, response status code and response headers
|
|
269
|
+
def get_campaign_analytics_with_http_info(campaign_id, opts = {})
|
|
270
|
+
if @api_client.config.debugging
|
|
271
|
+
@api_client.config.logger.debug 'Calling API: AdInsightsApi.get_campaign_analytics ...'
|
|
272
|
+
end
|
|
273
|
+
# verify the required parameter 'campaign_id' is set
|
|
274
|
+
if @api_client.config.client_side_validation && campaign_id.nil?
|
|
275
|
+
fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdInsightsApi.get_campaign_analytics"
|
|
276
|
+
end
|
|
277
|
+
# resource path
|
|
278
|
+
local_var_path = '/v1/ads/campaigns/{campaignId}/analytics'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
|
|
279
|
+
|
|
280
|
+
# query parameters
|
|
281
|
+
query_params = opts[:query_params] || {}
|
|
282
|
+
query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
|
|
283
|
+
query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
|
|
284
|
+
query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
|
|
285
|
+
query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil?
|
|
286
|
+
|
|
287
|
+
# header parameters
|
|
288
|
+
header_params = opts[:header_params] || {}
|
|
289
|
+
# HTTP header 'Accept' (if needed)
|
|
290
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
291
|
+
|
|
292
|
+
# form parameters
|
|
293
|
+
form_params = opts[:form_params] || {}
|
|
294
|
+
|
|
295
|
+
# http body (model)
|
|
296
|
+
post_body = opts[:debug_body]
|
|
297
|
+
|
|
298
|
+
# return_type
|
|
299
|
+
return_type = opts[:debug_return_type] || 'GetCampaignAnalytics200Response'
|
|
300
|
+
|
|
301
|
+
# auth_names
|
|
302
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
303
|
+
|
|
304
|
+
new_options = opts.merge(
|
|
305
|
+
:operation => :"AdInsightsApi.get_campaign_analytics",
|
|
306
|
+
:header_params => header_params,
|
|
307
|
+
:query_params => query_params,
|
|
308
|
+
:form_params => form_params,
|
|
309
|
+
:body => post_body,
|
|
310
|
+
:auth_names => auth_names,
|
|
311
|
+
:return_type => return_type
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
315
|
+
if @api_client.config.debugging
|
|
316
|
+
@api_client.config.logger.debug "API called: AdInsightsApi#get_campaign_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
317
|
+
end
|
|
318
|
+
return data, status_code, headers
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# Flexible live insights query
|
|
322
|
+
# Live, flexible insights query against Meta's Graph API. Unlike GET /v1/ads/{adId}/analytics (fixed metric set, cached), this forwards caller-chosen `fields`, `breakdowns` and `filtering` to any Meta insights node and returns Meta's rows verbatim. `objectId` selects the node: an ad account, campaign, ad set or ad platform id. `level` sets row granularity independently of the node. Semantic validation is Meta's: an unknown field or invalid breakdown combination returns a 400 carrying Meta's message. For long ranges or agency-scale accounts prefer the async variant (POST /v1/ads/insights/reports).
|
|
323
|
+
# @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
|
|
324
|
+
# @param object_id [String] Meta insights node: act_<n>, campaign id, ad set id or ad id.
|
|
325
|
+
# @param [Hash] opts the optional parameters
|
|
326
|
+
# @option opts [String] :level Row granularity
|
|
327
|
+
# @option opts [String] :fields Comma-separated Graph insights fields (e.g. spend,impressions,frequency,website_purchase_roas). Omitted = Meta's default set.
|
|
328
|
+
# @option opts [String] :breakdowns Comma-separated Graph breakdowns (e.g. age,gender or publisher_platform).
|
|
329
|
+
# @option opts [String] :action_breakdowns Comma-separated Graph action breakdowns. Segments the actions[] arrays in each row.
|
|
330
|
+
# @option opts [String] :action_attribution_windows Comma-separated Meta attribution windows. Action values are returned keyed per window.
|
|
331
|
+
# @option opts [String] :action_report_time When actions are counted: impression, conversion or mixed.
|
|
332
|
+
# @option opts [Boolean] :use_unified_attribution_setting Use the ad sets' own attribution settings for action counting.
|
|
333
|
+
# @option opts [String] :filtering JSON array of Meta filter objects: [{\"field\", \"operator\", \"value\"}]. Applied server-side by Meta.
|
|
334
|
+
# @option opts [String] :date_preset Meta date_preset (e.g. last_7d, last_30d, this_month). Mutually exclusive with fromDate/toDate.
|
|
335
|
+
# @option opts [Date] :from_date Start of range (YYYY-MM-DD); requires toDate.
|
|
336
|
+
# @option opts [Date] :to_date End of range (YYYY-MM-DD); requires fromDate.
|
|
337
|
+
# @option opts [String] :time_increment Days per row (1-90), monthly, or all_days.
|
|
338
|
+
# @option opts [Integer] :limit Rows per page (default to 25)
|
|
339
|
+
# @option opts [String] :after Cursor from paging.after of the previous page.
|
|
340
|
+
# @return [QueryAdInsights200Response]
|
|
341
|
+
def query_ad_insights(account_id, object_id, opts = {})
|
|
342
|
+
data, _status_code, _headers = query_ad_insights_with_http_info(account_id, object_id, opts)
|
|
343
|
+
data
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
# Flexible live insights query
|
|
347
|
+
# Live, flexible insights query against Meta's Graph API. Unlike GET /v1/ads/{adId}/analytics (fixed metric set, cached), this forwards caller-chosen `fields`, `breakdowns` and `filtering` to any Meta insights node and returns Meta's rows verbatim. `objectId` selects the node: an ad account, campaign, ad set or ad platform id. `level` sets row granularity independently of the node. Semantic validation is Meta's: an unknown field or invalid breakdown combination returns a 400 carrying Meta's message. For long ranges or agency-scale accounts prefer the async variant (POST /v1/ads/insights/reports).
|
|
348
|
+
# @param account_id [String] Zernio SocialAccount id (posting or ads variant) used to resolve the Meta token.
|
|
349
|
+
# @param object_id [String] Meta insights node: act_<n>, campaign id, ad set id or ad id.
|
|
350
|
+
# @param [Hash] opts the optional parameters
|
|
351
|
+
# @option opts [String] :level Row granularity
|
|
352
|
+
# @option opts [String] :fields Comma-separated Graph insights fields (e.g. spend,impressions,frequency,website_purchase_roas). Omitted = Meta's default set.
|
|
353
|
+
# @option opts [String] :breakdowns Comma-separated Graph breakdowns (e.g. age,gender or publisher_platform).
|
|
354
|
+
# @option opts [String] :action_breakdowns Comma-separated Graph action breakdowns. Segments the actions[] arrays in each row.
|
|
355
|
+
# @option opts [String] :action_attribution_windows Comma-separated Meta attribution windows. Action values are returned keyed per window.
|
|
356
|
+
# @option opts [String] :action_report_time When actions are counted: impression, conversion or mixed.
|
|
357
|
+
# @option opts [Boolean] :use_unified_attribution_setting Use the ad sets' own attribution settings for action counting.
|
|
358
|
+
# @option opts [String] :filtering JSON array of Meta filter objects: [{\"field\", \"operator\", \"value\"}]. Applied server-side by Meta.
|
|
359
|
+
# @option opts [String] :date_preset Meta date_preset (e.g. last_7d, last_30d, this_month). Mutually exclusive with fromDate/toDate.
|
|
360
|
+
# @option opts [Date] :from_date Start of range (YYYY-MM-DD); requires toDate.
|
|
361
|
+
# @option opts [Date] :to_date End of range (YYYY-MM-DD); requires fromDate.
|
|
362
|
+
# @option opts [String] :time_increment Days per row (1-90), monthly, or all_days.
|
|
363
|
+
# @option opts [Integer] :limit Rows per page (default to 25)
|
|
364
|
+
# @option opts [String] :after Cursor from paging.after of the previous page.
|
|
365
|
+
# @return [Array<(QueryAdInsights200Response, Integer, Hash)>] QueryAdInsights200Response data, response status code and response headers
|
|
366
|
+
def query_ad_insights_with_http_info(account_id, object_id, opts = {})
|
|
367
|
+
if @api_client.config.debugging
|
|
368
|
+
@api_client.config.logger.debug 'Calling API: AdInsightsApi.query_ad_insights ...'
|
|
369
|
+
end
|
|
370
|
+
# verify the required parameter 'account_id' is set
|
|
371
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
372
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AdInsightsApi.query_ad_insights"
|
|
373
|
+
end
|
|
374
|
+
# verify the required parameter 'object_id' is set
|
|
375
|
+
if @api_client.config.client_side_validation && object_id.nil?
|
|
376
|
+
fail ArgumentError, "Missing the required parameter 'object_id' when calling AdInsightsApi.query_ad_insights"
|
|
377
|
+
end
|
|
378
|
+
allowable_values = ["ad", "adset", "campaign", "account"]
|
|
379
|
+
if @api_client.config.client_side_validation && opts[:'level'] && !allowable_values.include?(opts[:'level'])
|
|
380
|
+
fail ArgumentError, "invalid value for \"level\", must be one of #{allowable_values}"
|
|
381
|
+
end
|
|
382
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
|
|
383
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdInsightsApi.query_ad_insights, must be smaller than or equal to 500.'
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
387
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AdInsightsApi.query_ad_insights, must be greater than or equal to 1.'
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# resource path
|
|
391
|
+
local_var_path = '/v1/ads/insights'
|
|
392
|
+
|
|
393
|
+
# query parameters
|
|
394
|
+
query_params = opts[:query_params] || {}
|
|
395
|
+
query_params[:'accountId'] = account_id
|
|
396
|
+
query_params[:'objectId'] = object_id
|
|
397
|
+
query_params[:'level'] = opts[:'level'] if !opts[:'level'].nil?
|
|
398
|
+
query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?
|
|
399
|
+
query_params[:'breakdowns'] = opts[:'breakdowns'] if !opts[:'breakdowns'].nil?
|
|
400
|
+
query_params[:'actionBreakdowns'] = opts[:'action_breakdowns'] if !opts[:'action_breakdowns'].nil?
|
|
401
|
+
query_params[:'actionAttributionWindows'] = opts[:'action_attribution_windows'] if !opts[:'action_attribution_windows'].nil?
|
|
402
|
+
query_params[:'actionReportTime'] = opts[:'action_report_time'] if !opts[:'action_report_time'].nil?
|
|
403
|
+
query_params[:'useUnifiedAttributionSetting'] = opts[:'use_unified_attribution_setting'] if !opts[:'use_unified_attribution_setting'].nil?
|
|
404
|
+
query_params[:'filtering'] = opts[:'filtering'] if !opts[:'filtering'].nil?
|
|
405
|
+
query_params[:'datePreset'] = opts[:'date_preset'] if !opts[:'date_preset'].nil?
|
|
406
|
+
query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
|
|
407
|
+
query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
|
|
408
|
+
query_params[:'timeIncrement'] = opts[:'time_increment'] if !opts[:'time_increment'].nil?
|
|
409
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
410
|
+
query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
|
|
411
|
+
|
|
412
|
+
# header parameters
|
|
413
|
+
header_params = opts[:header_params] || {}
|
|
414
|
+
# HTTP header 'Accept' (if needed)
|
|
415
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
416
|
+
|
|
417
|
+
# form parameters
|
|
418
|
+
form_params = opts[:form_params] || {}
|
|
419
|
+
|
|
420
|
+
# http body (model)
|
|
421
|
+
post_body = opts[:debug_body]
|
|
422
|
+
|
|
423
|
+
# return_type
|
|
424
|
+
return_type = opts[:debug_return_type] || 'QueryAdInsights200Response'
|
|
425
|
+
|
|
426
|
+
# auth_names
|
|
427
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
428
|
+
|
|
429
|
+
new_options = opts.merge(
|
|
430
|
+
:operation => :"AdInsightsApi.query_ad_insights",
|
|
431
|
+
:header_params => header_params,
|
|
432
|
+
:query_params => query_params,
|
|
433
|
+
:form_params => form_params,
|
|
434
|
+
:body => post_body,
|
|
435
|
+
:auth_names => auth_names,
|
|
436
|
+
:return_type => return_type
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
440
|
+
if @api_client.config.debugging
|
|
441
|
+
@api_client.config.logger.debug "API called: AdInsightsApi#query_ad_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
442
|
+
end
|
|
443
|
+
return data, status_code, headers
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
end
|