Class: PinterestSdkClient::CatalogProductGroupsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CatalogProductGroupsApi

Returns a new instance of CatalogProductGroupsApi.



19
20
21
# File 'lib/pinterest_sdk/api/catalog_product_groups_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/catalog_product_groups_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#catalogs_product_group_pins_list(product_group_id, opts = {}) ⇒ CatalogsProductGroupPinsList200Response

List products by product group Get a list of product pins for a given Catalogs Product Group Id owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :pin_metrics (Boolean)

    Specify whether to return 90d and lifetime Pin metrics. Total comments and total reactions are only available with lifetime Pin metrics. If Pin was created before `2023-03-20` lifetime metrics will only be available for Video and Idea Pin formats. Lifetime metrics are available for all Pin formats since then. (default to false)

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

Returns:



31
32
33
34
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 31

def catalogs_product_group_pins_list(product_group_id, opts = {})
  data, _status_code, _headers = catalogs_product_group_pins_list_with_http_info(product_group_id, opts)
  data
end

#catalogs_product_group_pins_list_with_http_info(product_group_id, opts = {}) ⇒ Array<(CatalogsProductGroupPinsList200Response, Integer, Hash)>

List products by product group Get a list of product pins for a given Catalogs Product Group Id owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :pin_metrics (Boolean)

    Specify whether to return 90d and lifetime Pin metrics. Total comments and total reactions are only available with lifetime Pin metrics. If Pin was created before `2023-03-20` lifetime metrics will only be available for Video and Idea Pin formats. Lifetime metrics are available for all Pin formats since then. (default to false)

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

Returns:



45
46
47
48
49
50
51
52
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
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 45

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

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_group_pins_list, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_group_pins_list, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 250
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CatalogProductGroupsApi.catalogs_product_group_pins_list, must be smaller than or equal to 250.'
  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 CatalogProductGroupsApi.catalogs_product_group_pins_list, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/catalogs/product_groups/{product_group_id}/products'.sub('{product_group_id}', CGI.escape(product_group_id.to_s))

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_group_pins_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: CatalogProductGroupsApi#catalogs_product_group_pins_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_create(catalogs_product_groups_create_request_schema, opts = {}) ⇒ CatalogsVerticalProductGroup

Create product group Create product group to use in Catalogs owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. "Catalog-based product groups" can include items from all data sources (feeds and API) and are available to both non-retail catalogs with any data sources and retail catalogs with API-created items. If your catalog only contains retail items created via feeds, you should use the "retail feed-based" option. Learn more Note: Access to the Creative Assets catalog type is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



125
126
127
128
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 125

def catalogs_product_groups_create(catalogs_product_groups_create_request_schema, opts = {})
  data, _status_code, _headers = catalogs_product_groups_create_with_http_info(catalogs_product_groups_create_request_schema, opts)
  data
end

#catalogs_product_groups_create_many(catalogs_product_groups_create_many_request_items, opts = {}) ⇒ Array<String>

Create product groups Create product group to use in Catalogs owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more Note: Access to the Creative Assets catalog type is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

  • (Array<String>)


205
206
207
208
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 205

def catalogs_product_groups_create_many(catalogs_product_groups_create_many_request_items, opts = {})
  data, _status_code, _headers = catalogs_product_groups_create_many_with_http_info(catalogs_product_groups_create_many_request_items, opts)
  data
end

#catalogs_product_groups_create_many_with_http_info(catalogs_product_groups_create_many_request_items, opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

Create product groups Create product group to use in Catalogs owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more Note: Access to the Creative Assets catalog type is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    Array data, response status code and response headers



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
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
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 216

def catalogs_product_groups_create_many_with_http_info(catalogs_product_groups_create_many_request_items, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogProductGroupsApi.catalogs_product_groups_create_many ...'
  end
  # verify the required parameter 'catalogs_product_groups_create_many_request_items' is set
  if @api_client.config.client_side_validation && catalogs_product_groups_create_many_request_items.nil?
    fail ArgumentError, "Missing the required parameter 'catalogs_product_groups_create_many_request_items' when calling CatalogProductGroupsApi.catalogs_product_groups_create_many"
  end
  if @api_client.config.client_side_validation && catalogs_product_groups_create_many_request_items.length > 1000
    fail ArgumentError, 'invalid value for "catalogs_product_groups_create_many_request_items" when calling CatalogProductGroupsApi.catalogs_product_groups_create_many, number of items must be less than or equal to 1000.'
  end

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

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_create_many, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_create_many, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/product_groups/multiple'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # 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(catalogs_product_groups_create_many_request_items)

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_groups_create_many",
    :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: CatalogProductGroupsApi#catalogs_product_groups_create_many\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_create_with_http_info(catalogs_product_groups_create_request_schema, opts = {}) ⇒ Array<(CatalogsVerticalProductGroup, Integer, Hash)>

Create product group Create product group to use in Catalogs owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. &quot;Catalog-based product groups&quot; can include items from all data sources (feeds and API) and are available to both non-retail catalogs with any data sources and retail catalogs with API-created items. If your catalog only contains retail items created via feeds, you should use the &quot;retail feed-based&quot; option. Learn more Note: Access to the Creative Assets catalog type is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 136

def catalogs_product_groups_create_with_http_info(catalogs_product_groups_create_request_schema, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogProductGroupsApi.catalogs_product_groups_create ...'
  end
  # verify the required parameter 'catalogs_product_groups_create_request_schema' is set
  if @api_client.config.client_side_validation && catalogs_product_groups_create_request_schema.nil?
    fail ArgumentError, "Missing the required parameter 'catalogs_product_groups_create_request_schema' when calling CatalogProductGroupsApi.catalogs_product_groups_create"
  end
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_create, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_create, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/product_groups'

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # 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(catalogs_product_groups_create_request_schema)

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_groups_create",
    :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: CatalogProductGroupsApi#catalogs_product_groups_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_delete(product_group_id, opts = {}) ⇒ CatalogsVerticalProductGroup

Delete product group Delete a product group owned by the "operation user_account" from being in use in Catalogs. - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



293
294
295
296
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 293

def catalogs_product_groups_delete(product_group_id, opts = {})
  data, _status_code, _headers = catalogs_product_groups_delete_with_http_info(product_group_id, opts)
  data
end

#catalogs_product_groups_delete_many(id, opts = {}) ⇒ nil

Delete product groups Delete product groups owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • id (Array<Integer>)

    Comma-separated list of product group ids

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

  • (nil)


373
374
375
376
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 373

def catalogs_product_groups_delete_many(id, opts = {})
  catalogs_product_groups_delete_many_with_http_info(id, opts)
  nil
end

#catalogs_product_groups_delete_many_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete product groups Delete product groups owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • id (Array<Integer>)

    Comma-separated list of product group ids

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    nil, response status code and response headers



384
385
386
387
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
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 384

def catalogs_product_groups_delete_many_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogProductGroupsApi.catalogs_product_groups_delete_many ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CatalogProductGroupsApi.catalogs_product_groups_delete_many"
  end
  if @api_client.config.client_side_validation && id.length > 1000
    fail ArgumentError, 'invalid value for "id" when calling CatalogProductGroupsApi.catalogs_product_groups_delete_many, number of items must be less than or equal to 1000.'
  end

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

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_delete_many, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_delete_many, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/product_groups/multiple'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'id'] = @api_client.build_collection_param(id, :csv)
  query_params[:'ad_account_id'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?

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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_groups_delete_many",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogProductGroupsApi#catalogs_product_groups_delete_many\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_delete_with_http_info(product_group_id, opts = {}) ⇒ Array<(CatalogsVerticalProductGroup, Integer, Hash)>

Delete product group Delete a product group owned by the &quot;operation user_account&quot; from being in use in Catalogs. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



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
358
359
360
361
362
363
364
365
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 304

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

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_delete, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_delete, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/product_groups/{product_group_id}'.sub('{product_group_id}', CGI.escape(product_group_id.to_s))

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_groups_delete",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogProductGroupsApi#catalogs_product_groups_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_get(product_group_id, opts = {}) ⇒ CatalogsVerticalProductGroup

Get product group Get a single product group for a given Catalogs Product Group Id owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



457
458
459
460
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 457

def catalogs_product_groups_get(product_group_id, opts = {})
  data, _status_code, _headers = catalogs_product_groups_get_with_http_info(product_group_id, opts)
  data
end

#catalogs_product_groups_get_with_http_info(product_group_id, opts = {}) ⇒ Array<(CatalogsVerticalProductGroup, Integer, Hash)>

Get product group Get a single product group for a given Catalogs Product Group Id owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 468

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

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_get, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_get, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/product_groups/{product_group_id}'.sub('{product_group_id}', CGI.escape(product_group_id.to_s))

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_groups_get",
    :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: CatalogProductGroupsApi#catalogs_product_groups_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_list(opts = {}) ⇒ CatalogsProductGroupsList200Response

List product groups Get a list of product groups for a given Catalogs Feed Id owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :id (Array<Integer>)

    Comma-separated list of product group ids

  • :feed_id (String)

    Filter entities for a given feed_id. If not given, all feeds are considered.

  • :catalog_id (String)

    Filter entities for a given catalog_id. If not given, all catalogs are considered.

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

Returns:



541
542
543
544
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 541

def catalogs_product_groups_list(opts = {})
  data, _status_code, _headers = catalogs_product_groups_list_with_http_info(opts)
  data
end

#catalogs_product_groups_list_with_http_info(opts = {}) ⇒ Array<(CatalogsProductGroupsList200Response, Integer, Hash)>

List product groups Get a list of product groups for a given Catalogs Feed Id owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :id (Array<Integer>)

    Comma-separated list of product group ids

  • :feed_id (String)

    Filter entities for a given feed_id. If not given, all feeds are considered.

  • :catalog_id (String)

    Filter entities for a given catalog_id. If not given, all catalogs are considered.

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :bookmark (String)

    Cursor used to fetch the next page of items

  • :page_size (Integer)

    Maximum number of items to include in a single page. See documentation on Pagination for more information. (default to 25)

Returns:



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
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 556

def catalogs_product_groups_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogProductGroupsApi.catalogs_product_groups_list ...'
  end
  if @api_client.config.client_side_validation && !opts[:'id'].nil? && opts[:'id'].length > 1000
    fail ArgumentError, 'invalid value for "opts[:"id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_list, number of items must be less than or equal to 1000.'
  end

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

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'feed_id'].nil? && opts[:'feed_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"feed_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_list, must conform to the pattern #{pattern}."
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'catalog_id'].nil? && opts[:'catalog_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"catalog_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_list, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_list, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_list, must conform to the pattern #{pattern}."
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 250
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CatalogProductGroupsApi.catalogs_product_groups_list, must be smaller than or equal to 250.'
  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 CatalogProductGroupsApi.catalogs_product_groups_list, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/catalogs/product_groups'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :csv) if !opts[:'id'].nil?
  query_params[:'feed_id'] = opts[:'feed_id'] if !opts[:'feed_id'].nil?
  query_params[:'catalog_id'] = opts[:'catalog_id'] if !opts[:'catalog_id'].nil?
  query_params[:'ad_account_id'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
  query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_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: CatalogProductGroupsApi#catalogs_product_groups_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_product_counts_get(product_group_id, opts = {}) ⇒ CatalogsProductGroupProductCountsVertical

Get product counts Get a product counts for a given Catalogs Product Group owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



647
648
649
650
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 647

def catalogs_product_groups_product_counts_get(product_group_id, opts = {})
  data, _status_code, _headers = catalogs_product_groups_product_counts_get_with_http_info(product_group_id, opts)
  data
end

#catalogs_product_groups_product_counts_get_with_http_info(product_group_id, opts = {}) ⇒ Array<(CatalogsProductGroupProductCountsVertical, Integer, Hash)>

Get product counts Get a product counts for a given Catalogs Product Group owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Learn more

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



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
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 658

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

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_product_counts_get, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_product_counts_get, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/product_groups/{product_group_id}/product_counts'.sub('{product_group_id}', CGI.escape(product_group_id.to_s))

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_groups_product_counts_get",
    :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: CatalogProductGroupsApi#catalogs_product_groups_product_counts_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#catalogs_product_groups_update(product_group_id, catalogs_product_groups_update_request_schema, opts = {}) ⇒ CatalogsVerticalProductGroup

Update single product group Update product group owned by the "operation user_account" to use in Catalogs. - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. "Catalog-based product groups" can include items from all data sources (feeds and API) and are available to both non-retail catalogs with any data sources and retail catalogs with API-created items. If your catalog only contains retail items created via feeds, you should use the "retail feed-based" option. Learn more Note: Access to the Creative Assets catalog type is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



728
729
730
731
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 728

def catalogs_product_groups_update(product_group_id, catalogs_product_groups_update_request_schema, opts = {})
  data, _status_code, _headers = catalogs_product_groups_update_with_http_info(product_group_id, catalogs_product_groups_update_request_schema, opts)
  data
end

#catalogs_product_groups_update_with_http_info(product_group_id, catalogs_product_groups_update_request_schema, opts = {}) ⇒ Array<(CatalogsVerticalProductGroup, Integer, Hash)>

Update single product group Update product group owned by the &quot;operation user_account&quot; to use in Catalogs. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. &quot;Catalog-based product groups&quot; can include items from all data sources (feeds and API) and are available to both non-retail catalogs with any data sources and retail catalogs with API-created items. If your catalog only contains retail items created via feeds, you should use the &quot;retail feed-based&quot; option. Learn more Note: Access to the Creative Assets catalog type is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

  • product_group_id (String)

    Unique identifier of a product group

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
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
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 740

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

  # verify the required parameter 'catalogs_product_groups_update_request_schema' is set
  if @api_client.config.client_side_validation && catalogs_product_groups_update_request_schema.nil?
    fail ArgumentError, "Missing the required parameter 'catalogs_product_groups_update_request_schema' when calling CatalogProductGroupsApi.catalogs_product_groups_update"
  end
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.catalogs_product_groups_update, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.catalogs_product_groups_update, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/product_groups/{product_group_id}'.sub('{product_group_id}', CGI.escape(product_group_id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # 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(catalogs_product_groups_update_request_schema)

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.catalogs_product_groups_update",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogProductGroupsApi#catalogs_product_groups_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#products_by_product_group_filter_list(catalogs_list_products_by_filter_request, opts = {}) ⇒ CatalogsProductGroupPinsList200Response

List products by filter List products Pins owned by the "operation user_account" that meet the criteria specified in the Catalogs Product Group Filter given in the request. - This endpoint has been implemented in POST to allow for complex filters. This specific POST endpoint is designed to be idempotent. - By default, the "operation user_account" is the token user_account. Optional: Business Access: Specify an ad_account_id (obtained via List ad accounts) to use the owner of that ad_account as the "operation user_account". In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Note: This endpoint only supports RETAIL catalog at the moment. Learn more

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. See documentation on Pagination for more information. (default to 25)

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :pin_metrics (Boolean)

    Specify whether to return 90d and lifetime Pin metrics. Total comments and total reactions are only available with lifetime Pin metrics. If Pin was created before `2023-03-20` lifetime metrics will only be available for Video and Idea Pin formats. Lifetime metrics are available for all Pin formats since then. (default to false)

Returns:



821
822
823
824
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 821

def products_by_product_group_filter_list(catalogs_list_products_by_filter_request, opts = {})
  data, _status_code, _headers = products_by_product_group_filter_list_with_http_info(catalogs_list_products_by_filter_request, opts)
  data
end

#products_by_product_group_filter_list_with_http_info(catalogs_list_products_by_filter_request, opts = {}) ⇒ Array<(CatalogsProductGroupPinsList200Response, Integer, Hash)>

List products by filter List products Pins owned by the &quot;operation user_account&quot; that meet the criteria specified in the Catalogs Product Group Filter given in the request. - This endpoint has been implemented in POST to allow for complex filters. This specific POST endpoint is designed to be idempotent. - By default, the &quot;operation user_account&quot; is the token user_account. Optional: Business Access: Specify an `ad_account_id` (obtained via List ad accounts) to use the owner of that ad_account as the &quot;operation user_account&quot;. In order to do this, the token user_account must have one of the following Business Access roles on the ad_account: Owner, Admin, Catalogs Manager. Note: This endpoint only supports RETAIL catalog at the moment. Learn more

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. See documentation on Pagination for more information. (default to 25)

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :pin_metrics (Boolean)

    Specify whether to return 90d and lifetime Pin metrics. Total comments and total reactions are only available with lifetime Pin metrics. If Pin was created before `2023-03-20` lifetime metrics will only be available for Video and Idea Pin formats. Lifetime metrics are available for all Pin formats since then. (default to false)

Returns:



835
836
837
838
839
840
841
842
843
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
901
902
903
904
905
906
907
# File 'lib/pinterest_sdk/api/catalog_product_groups_api.rb', line 835

def products_by_product_group_filter_list_with_http_info(catalogs_list_products_by_filter_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogProductGroupsApi.products_by_product_group_filter_list ...'
  end
  # verify the required parameter 'catalogs_list_products_by_filter_request' is set
  if @api_client.config.client_side_validation && catalogs_list_products_by_filter_request.nil?
    fail ArgumentError, "Missing the required parameter 'catalogs_list_products_by_filter_request' when calling CatalogProductGroupsApi.products_by_product_group_filter_list"
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 250
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling CatalogProductGroupsApi.products_by_product_group_filter_list, must be smaller than or equal to 250.'
  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 CatalogProductGroupsApi.products_by_product_group_filter_list, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'].to_s.length > 18
    fail ArgumentError, 'invalid value for "opts[:"ad_account_id"]" when calling CatalogProductGroupsApi.products_by_product_group_filter_list, the character length must be smaller than or equal to 18.'
  end

  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && !opts[:'ad_account_id'].nil? && opts[:'ad_account_id'] !~ pattern
    fail ArgumentError, "invalid value for 'opts[:\"ad_account_id\"]' when calling CatalogProductGroupsApi.products_by_product_group_filter_list, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/products/get_by_product_group_filters'

  # 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[:'ad_account_id'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
  query_params[:'pin_metrics'] = opts[:'pin_metrics'] if !opts[:'pin_metrics'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # 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(catalogs_list_products_by_filter_request)

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

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

  new_options = opts.merge(
    :operation => :"CatalogProductGroupsApi.products_by_product_group_filter_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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CatalogProductGroupsApi#products_by_product_group_filter_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end