Class: PinterestSdkClient::AdAccountsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pinterest_sdk/api/ad_accounts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AdAccountsApi

Returns a new instance of AdAccountsApi.



19
20
21
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#ad_account_analytics(ad_account_id, start_date, end_date, columns, granularity, opts = {}) ⇒ Array<Hash<String, Object>>

Get ad account analytics Get analytics for the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to ‘TIME_OF_AD_ACTION’)

Returns:

  • (Array<Hash<String, Object>>)


35
36
37
38
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 35

def (, start_date, end_date, columns, granularity, opts = {})
  data, _status_code, _headers = (, start_date, end_date, columns, granularity, opts)
  data
end

#ad_account_analytics_with_http_info(ad_account_id, start_date, end_date, columns, granularity, opts = {}) ⇒ Array<(Array<Hash<String, Object>>, Integer, Hash)>

Get ad account analytics Get analytics for the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.

Returns:

  • (Array<(Array<Hash<String, Object>>, Integer, Hash)>)

    Array<Hash<String, Object>> data, response status code and response headers



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 53

def (, start_date, end_date, columns, granularity, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_account_analytics ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_account_analytics"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_account_analytics, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ad_account_analytics"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ad_account_analytics"
  end
  # verify the required parameter 'columns' is set
  if @api_client.config.client_side_validation && columns.nil?
    fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ad_account_analytics"
  end
  # verify the required parameter 'granularity' is set
  if @api_client.config.client_side_validation && granularity.nil?
    fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ad_account_analytics"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
    fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
    fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
    fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
  if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
    fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
  query_params[:'granularity'] = granularity
  query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
  query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
  query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
  query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.ad_account_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#ad_account_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ad_accounts_list(opts = {}) ⇒ Paginated

List ad accounts Get a list of the ad_accounts that the "operation user_account" has access to. - This includes ad_accounts they own and ad_accounts that are owned by others who have granted them <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)

  • :include_shared_accounts (Boolean)

    Include shared ad accounts (default to true)

Returns:



153
154
155
156
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 153

def ad_accounts_list(opts = {})
  data, _status_code, _headers = ad_accounts_list_with_http_info(opts)
  data
end

#ad_accounts_list_with_http_info(opts = {}) ⇒ Array<(Paginated, Integer, Hash)>

List ad accounts Get a list of the ad_accounts that the &quot;operation user_account&quot; has access to. - This includes ad_accounts they own and ad_accounts that are owned by others who have granted them &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.

  • :include_shared_accounts (Boolean)

    Include shared ad accounts

Returns:

  • (Array<(Paginated, Integer, Hash)>)

    Paginated data, response status code and response headers



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 165

def ad_accounts_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_accounts_list ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_accounts_list, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_accounts_list, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/ad_accounts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'include_shared_accounts'] = opts[:'include_shared_accounts'] if !opts[:'include_shared_accounts'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Paginated'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.ad_accounts_list",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#ad_accounts_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ad_groups_analytics(ad_account_id, start_date, end_date, ad_group_ids, columns, granularity, opts = {}) ⇒ Array<Hash<String, Object>>

Get ad group analytics Get analytics for the specified ad groups in the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • ad_group_ids (Array<String>)

    List of Ad group Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to ‘TIME_OF_AD_ACTION’)

Returns:

  • (Array<Hash<String, Object>>)


234
235
236
237
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 234

def ad_groups_analytics(, start_date, end_date, ad_group_ids, columns, granularity, opts = {})
  data, _status_code, _headers = ad_groups_analytics_with_http_info(, start_date, end_date, ad_group_ids, columns, granularity, opts)
  data
end

#ad_groups_analytics_with_http_info(ad_account_id, start_date, end_date, ad_group_ids, columns, granularity, opts = {}) ⇒ Array<(Array<Hash<String, Object>>, Integer, Hash)>

Get ad group analytics Get analytics for the specified ad groups in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • ad_group_ids (Array<String>)

    List of Ad group Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.

Returns:

  • (Array<(Array<Hash<String, Object>>, Integer, Hash)>)

    Array<Hash<String, Object>> data, response status code and response headers



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 253

def ad_groups_analytics_with_http_info(, start_date, end_date, ad_group_ids, columns, granularity, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_groups_analytics ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_groups_analytics"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_groups_analytics, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ad_groups_analytics"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ad_groups_analytics"
  end
  # verify the required parameter 'ad_group_ids' is set
  if @api_client.config.client_side_validation && ad_group_ids.nil?
    fail ArgumentError, "Missing the required parameter 'ad_group_ids' when calling AdAccountsApi.ad_groups_analytics"
  end
  if @api_client.config.client_side_validation && ad_group_ids.length > 100
    fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdAccountsApi.ad_groups_analytics, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && ad_group_ids.length < 1
    fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdAccountsApi.ad_groups_analytics, number of items must be greater than or equal to 1.'
  end

  # verify the required parameter 'columns' is set
  if @api_client.config.client_side_validation && columns.nil?
    fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ad_groups_analytics"
  end
  # verify the required parameter 'granularity' is set
  if @api_client.config.client_side_validation && granularity.nil?
    fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ad_groups_analytics"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
    fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
    fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
    fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
  if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
    fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'ad_group_ids'] = @api_client.build_collection_param(ad_group_ids, :multi)
  query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
  query_params[:'granularity'] = granularity
  query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
  query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
  query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
  query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.ad_groups_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#ad_groups_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ad_groups_list(ad_account_id, opts = {}) ⇒ Paginated

List ad groups Get a list of the ad groups in the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :ad_group_ids (Array<String>)

    List of Ad group Ids to use to filter the results.

  • :entity_statuses (Array<String>)

    Entity status

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)

  • :order (String)

    The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :translate_interests_to_names (Boolean)

    Return interests as text names (if value is true) rather than topic IDs. (default to false)

Returns:



371
372
373
374
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 371

def ad_groups_list(, opts = {})
  data, _status_code, _headers = ad_groups_list_with_http_info(, opts)
  data
end

#ad_groups_list_with_http_info(ad_account_id, opts = {}) ⇒ Array<(Paginated, Integer, Hash)>

List ad groups Get a list of the ad groups in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :ad_group_ids (Array<String>)

    List of Ad group Ids to use to filter the results.

  • :entity_statuses (Array<String>)

    Entity status

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.

  • :order (String)

    The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :translate_interests_to_names (Boolean)

    Return interests as text names (if value is true) rather than topic IDs.

Returns:

  • (Array<(Paginated, Integer, Hash)>)

    Paginated data, response status code and response headers



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 388

def ad_groups_list_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_groups_list ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_groups_list"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_groups_list, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 100
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length > 100
    fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be greater than or equal to 1.'
  end

  allowable_values = ["ACTIVE", "PAUSED", "ARCHIVED"]
  if @api_client.config.client_side_validation && opts[:'entity_statuses'] && !opts[:'entity_statuses'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"entity_statuses\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_groups_list, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_groups_list, must be greater than or equal to 1.'
  end

  allowable_values = ["ASCENDING", "DESCENDING"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ad_groups'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].nil?
  query_params[:'ad_group_ids'] = @api_client.build_collection_param(opts[:'ad_group_ids'], :multi) if !opts[:'ad_group_ids'].nil?
  query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
  query_params[:'translate_interests_to_names'] = opts[:'translate_interests_to_names'] if !opts[:'translate_interests_to_names'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Paginated'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.ad_groups_list",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#ad_groups_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ads_analytics(ad_account_id, start_date, end_date, ad_ids, columns, granularity, opts = {}) ⇒ Array<Hash<String, Object>>

Get ad analytics Get analytics for the specified ads in the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • ad_ids (Array<String>)

    List of Ad Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to ‘TIME_OF_AD_ACTION’)

Returns:

  • (Array<Hash<String, Object>>)


494
495
496
497
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 494

def ads_analytics(, start_date, end_date, ad_ids, columns, granularity, opts = {})
  data, _status_code, _headers = ads_analytics_with_http_info(, start_date, end_date, ad_ids, columns, granularity, opts)
  data
end

#ads_analytics_with_http_info(ad_account_id, start_date, end_date, ad_ids, columns, granularity, opts = {}) ⇒ Array<(Array<Hash<String, Object>>, Integer, Hash)>

Get ad analytics Get analytics for the specified ads in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • ad_ids (Array<String>)

    List of Ad Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.

Returns:

  • (Array<(Array<Hash<String, Object>>, Integer, Hash)>)

    Array<Hash<String, Object>> data, response status code and response headers



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 513

def ads_analytics_with_http_info(, start_date, end_date, ad_ids, columns, granularity, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ads_analytics ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ads_analytics"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ads_analytics, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ads_analytics"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ads_analytics"
  end
  # verify the required parameter 'ad_ids' is set
  if @api_client.config.client_side_validation && ad_ids.nil?
    fail ArgumentError, "Missing the required parameter 'ad_ids' when calling AdAccountsApi.ads_analytics"
  end
  if @api_client.config.client_side_validation && ad_ids.length > 100
    fail ArgumentError, 'invalid value for "ad_ids" when calling AdAccountsApi.ads_analytics, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && ad_ids.length < 1
    fail ArgumentError, 'invalid value for "ad_ids" when calling AdAccountsApi.ads_analytics, number of items must be greater than or equal to 1.'
  end

  # verify the required parameter 'columns' is set
  if @api_client.config.client_side_validation && columns.nil?
    fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ads_analytics"
  end
  # verify the required parameter 'granularity' is set
  if @api_client.config.client_side_validation && granularity.nil?
    fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ads_analytics"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
    fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
    fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
    fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
  if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
    fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ads/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'ad_ids'] = @api_client.build_collection_param(ad_ids, :multi)
  query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
  query_params[:'granularity'] = granularity
  query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
  query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
  query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
  query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.ads_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#ads_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#ads_list(ad_account_id, opts = {}) ⇒ Paginated

List ads Get a list of the ads in the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :ad_group_ids (Array<String>)

    List of Ad group Ids to use to filter the results.

  • :ad_ids (Array<String>)

    List of Ad Ids to use to filter the results.

  • :entity_statuses (Array<String>)

    Entity status

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)

  • :order (String)

    The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.

  • :bookmark (String)

    Cursor used to fetch the next page of items

Returns:



631
632
633
634
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 631

def ads_list(, opts = {})
  data, _status_code, _headers = ads_list_with_http_info(, opts)
  data
end

#ads_list_with_http_info(ad_account_id, opts = {}) ⇒ Array<(Paginated, Integer, Hash)>

List ads Get a list of the ads in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :ad_group_ids (Array<String>)

    List of Ad group Ids to use to filter the results.

  • :ad_ids (Array<String>)

    List of Ad Ids to use to filter the results.

  • :entity_statuses (Array<String>)

    Entity status

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.

  • :order (String)

    The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.

  • :bookmark (String)

    Cursor used to fetch the next page of items

Returns:

  • (Array<(Paginated, Integer, Hash)>)

    Paginated data, response status code and response headers



648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 648

def ads_list_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.ads_list ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ads_list"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ads_list, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 100
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ads_list, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ads_list, number of items must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length > 100
    fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ads_list, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ads_list, number of items must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length > 100
    fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdAccountsApi.ads_list, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdAccountsApi.ads_list, number of items must be greater than or equal to 1.'
  end

  allowable_values = ["ACTIVE", "PAUSED", "ARCHIVED"]
  if @api_client.config.client_side_validation && opts[:'entity_statuses'] && !opts[:'entity_statuses'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"entity_statuses\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ads_list, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ads_list, must be greater than or equal to 1.'
  end

  allowable_values = ["ASCENDING", "DESCENDING"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/ads'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].nil?
  query_params[:'ad_group_ids'] = @api_client.build_collection_param(opts[:'ad_group_ids'], :multi) if !opts[:'ad_group_ids'].nil?
  query_params[:'ad_ids'] = @api_client.build_collection_param(opts[:'ad_ids'], :multi) if !opts[:'ad_ids'].nil?
  query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Paginated'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.ads_list",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#ads_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#analytics_create_report(ad_account_id, ads_analytics_create_async_request, opts = {}) ⇒ AdsAnalyticsCreateAsyncResponse

Create async request for an account analytics report This returns a token that you can use to download the report when it is ready. Note that this endpoint requires the parameters to be passed as JSON-formatted in the request body. This endpoint does not support URL query parameters. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • ads_analytics_create_async_request (AdsAnalyticsCreateAsyncRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



754
755
756
757
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 754

def analytics_create_report(, ads_analytics_create_async_request, opts = {})
  data, _status_code, _headers = analytics_create_report_with_http_info(, ads_analytics_create_async_request, opts)
  data
end

#analytics_create_report_with_http_info(ad_account_id, ads_analytics_create_async_request, opts = {}) ⇒ Array<(AdsAnalyticsCreateAsyncResponse, Integer, Hash)>

Create async request for an account analytics report This returns a token that you can use to download the report when it is ready. Note that this endpoint requires the parameters to be passed as JSON-formatted in the request body. This endpoint does not support URL query parameters. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • ads_analytics_create_async_request (AdsAnalyticsCreateAsyncRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 765

def analytics_create_report_with_http_info(, ads_analytics_create_async_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_create_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_create_report"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_create_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'ads_analytics_create_async_request' is set
  if @api_client.config.client_side_validation && ads_analytics_create_async_request.nil?
    fail ArgumentError, "Missing the required parameter 'ads_analytics_create_async_request' when calling AdAccountsApi.analytics_create_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/reports'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(ads_analytics_create_async_request)

  # return_type
  return_type = opts[:debug_return_type] || 'AdsAnalyticsCreateAsyncResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.analytics_create_report",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#analytics_create_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#analytics_get_report(ad_account_id, token, opts = {}) ⇒ AdsAnalyticsGetAsyncResponse

Get the account analytics report created by the async call This returns a URL to an analytics report given a token returned from the post request report creation call. You can use the URL to download the report and it’s valid for an hour. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • token (String)

    Token returned from the post request creation call

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



833
834
835
836
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 833

def analytics_get_report(, token, opts = {})
  data, _status_code, _headers = analytics_get_report_with_http_info(, token, opts)
  data
end

#analytics_get_report_with_http_info(ad_account_id, token, opts = {}) ⇒ Array<(AdsAnalyticsGetAsyncResponse, Integer, Hash)>

Get the account analytics report created by the async call This returns a URL to an analytics report given a token returned from the post request report creation call. You can use the URL to download the report and it&#39;s valid for an hour. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • token (String)

    Token returned from the post request creation call

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 844

def analytics_get_report_with_http_info(, token, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_get_report ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_get_report"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_get_report, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'token' is set
  if @api_client.config.client_side_validation && token.nil?
    fail ArgumentError, "Missing the required parameter 'token' when calling AdAccountsApi.analytics_get_report"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/reports'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'token'] = token

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'AdsAnalyticsGetAsyncResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.analytics_get_report",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#analytics_get_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#campaigns_analytics(ad_account_id, start_date, end_date, campaign_ids, columns, granularity, opts = {}) ⇒ Array<Hash<String, Object>>

Get campaign analytics Get analytics for the specified campaigns in the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to ‘TIME_OF_AD_ACTION’)

Returns:

  • (Array<Hash<String, Object>>)


916
917
918
919
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 916

def campaigns_analytics(, start_date, end_date, campaign_ids, columns, granularity, opts = {})
  data, _status_code, _headers = campaigns_analytics_with_http_info(, start_date, end_date, campaign_ids, columns, granularity, opts)
  data
end

#campaigns_analytics_with_http_info(ad_account_id, start_date, end_date, campaign_ids, columns, granularity, opts = {}) ⇒ Array<(Array<Hash<String, Object>>, Integer, Hash)>

Get campaign analytics Get analytics for the specified campaigns in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.

Returns:

  • (Array<(Array<Hash<String, Object>>, Integer, Hash)>)

    Array<Hash<String, Object>> data, response status code and response headers



935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 935

def campaigns_analytics_with_http_info(, start_date, end_date, campaign_ids, columns, granularity, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.campaigns_analytics ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.campaigns_analytics"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.campaigns_analytics, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.campaigns_analytics"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.campaigns_analytics"
  end
  # verify the required parameter 'campaign_ids' is set
  if @api_client.config.client_side_validation && campaign_ids.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_ids' when calling AdAccountsApi.campaigns_analytics"
  end
  if @api_client.config.client_side_validation && campaign_ids.length > 100
    fail ArgumentError, 'invalid value for "campaign_ids" when calling AdAccountsApi.campaigns_analytics, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && campaign_ids.length < 1
    fail ArgumentError, 'invalid value for "campaign_ids" when calling AdAccountsApi.campaigns_analytics, number of items must be greater than or equal to 1.'
  end

  # verify the required parameter 'columns' is set
  if @api_client.config.client_side_validation && columns.nil?
    fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.campaigns_analytics"
  end
  # verify the required parameter 'granularity' is set
  if @api_client.config.client_side_validation && granularity.nil?
    fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.campaigns_analytics"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
    fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
    fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
    fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
  if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
    fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/campaigns/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'campaign_ids'] = @api_client.build_collection_param(campaign_ids, :multi)
  query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
  query_params[:'granularity'] = granularity
  query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
  query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
  query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
  query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.campaigns_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#campaigns_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#campaigns_list(ad_account_id, opts = {}) ⇒ Paginated

List campaigns Get a list of the campaigns in the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :entity_statuses (Array<String>)

    Entity status

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)

  • :order (String)

    The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.

  • :bookmark (String)

    Cursor used to fetch the next page of items

Returns:



1051
1052
1053
1054
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1051

def campaigns_list(, opts = {})
  data, _status_code, _headers = campaigns_list_with_http_info(, opts)
  data
end

#campaigns_list_with_http_info(ad_account_id, opts = {}) ⇒ Array<(Paginated, Integer, Hash)>

List campaigns Get a list of the campaigns in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :campaign_ids (Array<String>)

    List of Campaign Ids to use to filter the results.

  • :entity_statuses (Array<String>)

    Entity status

  • :page_size (Integer)

    Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.

  • :order (String)

    The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.

  • :bookmark (String)

    Cursor used to fetch the next page of items

Returns:

  • (Array<(Paginated, Integer, Hash)>)

    Paginated data, response status code and response headers



1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1066

def campaigns_list_with_http_info(, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.campaigns_list ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.campaigns_list"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.campaigns_list, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 100
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.campaigns_list, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length < 1
    fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.campaigns_list, number of items must be greater than or equal to 1.'
  end

  allowable_values = ["ACTIVE", "PAUSED", "ARCHIVED"]
  if @api_client.config.client_side_validation && opts[:'entity_statuses'] && !opts[:'entity_statuses'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"entity_statuses\", must include one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.campaigns_list, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.campaigns_list, must be greater than or equal to 1.'
  end

  allowable_values = ["ASCENDING", "DESCENDING"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/campaigns'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].nil?
  query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
  query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Paginated'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.campaigns_list",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#campaigns_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#product_groups_analytics(ad_account_id, start_date, end_date, product_group_ids, columns, granularity, opts = {}) ⇒ Array<Hash<String, Object>>

Get product group analytics Get analytics for the specified product groups in the specified ad_account_id, filtered by the specified options. - The token’s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href="help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts">Business Access</a>: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • product_group_ids (Array<String>)

    List of Product group Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to ‘TIME_OF_AD_ACTION’)

Returns:

  • (Array<Hash<String, Object>>)


1162
1163
1164
1165
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1162

def product_groups_analytics(, start_date, end_date, product_group_ids, columns, granularity, opts = {})
  data, _status_code, _headers = product_groups_analytics_with_http_info(, start_date, end_date, product_group_ids, columns, granularity, opts)
  data
end

#product_groups_analytics_with_http_info(ad_account_id, start_date, end_date, product_group_ids, columns, granularity, opts = {}) ⇒ Array<(Array<Hash<String, Object>>, Integer, Hash)>

Get product group analytics Get analytics for the specified product groups in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;&quot;help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.

Parameters:

  • ad_account_id (String)

    Unique identifier of an ad account.

  • start_date (Date)

    Metric report start date (UTC). Format: YYYY-MM-DD

  • end_date (Date)

    Metric report end date (UTC). Format: YYYY-MM-DD

  • product_group_ids (Array<String>)

    List of Product group Ids to use to filter the results.

  • columns (Array<String>)

    Columns to retrieve. NOTE: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned

  • granularity (Granularity)

    Granularity

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :click_window_days (Integer)

    Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :engagement_window_days (Integer)

    Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.

  • :view_window_days (Integer)

    Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.

  • :conversion_report_time (String)

    The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.

Returns:

  • (Array<(Array<Hash<String, Object>>, Integer, Hash)>)

    Array<Hash<String, Object>> data, response status code and response headers



1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
# File 'lib/pinterest_sdk/api/ad_accounts_api.rb', line 1181

def product_groups_analytics_with_http_info(, start_date, end_date, product_group_ids, columns, granularity, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AdAccountsApi.product_groups_analytics ...'
  end
  # verify the required parameter 'ad_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.product_groups_analytics"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation &&  !~ pattern
    fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.product_groups_analytics, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.product_groups_analytics"
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.product_groups_analytics"
  end
  # verify the required parameter 'product_group_ids' is set
  if @api_client.config.client_side_validation && product_group_ids.nil?
    fail ArgumentError, "Missing the required parameter 'product_group_ids' when calling AdAccountsApi.product_groups_analytics"
  end
  if @api_client.config.client_side_validation && product_group_ids.length > 100
    fail ArgumentError, 'invalid value for "product_group_ids" when calling AdAccountsApi.product_groups_analytics, number of items must be less than or equal to 100.'
  end

  if @api_client.config.client_side_validation && product_group_ids.length < 1
    fail ArgumentError, 'invalid value for "product_group_ids" when calling AdAccountsApi.product_groups_analytics, number of items must be greater than or equal to 1.'
  end

  # verify the required parameter 'columns' is set
  if @api_client.config.client_side_validation && columns.nil?
    fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.product_groups_analytics"
  end
  # verify the required parameter 'granularity' is set
  if @api_client.config.client_side_validation && granularity.nil?
    fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.product_groups_analytics"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
    fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
    fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = [1, 7, 30, 60]
  if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
    fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
  end
  allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
  if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
    fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/ad_accounts/{ad_account_id}/product_groups/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_date'] = start_date
  query_params[:'end_date'] = end_date
  query_params[:'product_group_ids'] = @api_client.build_collection_param(product_group_ids, :multi)
  query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
  query_params[:'granularity'] = granularity
  query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
  query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
  query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
  query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']

  new_options = opts.merge(
    :operation => :"AdAccountsApi.product_groups_analytics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AdAccountsApi#product_groups_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end