Class: PinterestSdkClient::CatalogFeedsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CatalogFeedsApi

Returns a new instance of CatalogFeedsApi.



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

def api_client
  @api_client
end

Instance Method Details

#feed_processing_results_list(feed_id, opts = {}) ⇒ FeedProcessingResultsList200Response

List feed processing results Fetch a feed processing results owned by the "operation user_account". Please note that for now the bookmark parameter is not functional and only the first page will be available until it is implemented in some release in the near future. - 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:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :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:



30
31
32
33
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 30

def feed_processing_results_list(feed_id, opts = {})
  data, _status_code, _headers = feed_processing_results_list_with_http_info(feed_id, opts)
  data
end

#feed_processing_results_list_with_http_info(feed_id, opts = {}) ⇒ Array<(FeedProcessingResultsList200Response, Integer, Hash)>

List feed processing results Fetch a feed processing results owned by the &quot;operation user_account&quot;. Please note that for now the bookmark parameter is not functional and only the first page will be available until it is implemented in some release in the near future. - 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:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :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:



43
44
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
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 43

def feed_processing_results_list_with_http_info(feed_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogFeedsApi.feed_processing_results_list ...'
  end
  # verify the required parameter 'feed_id' is set
  if @api_client.config.client_side_validation && feed_id.nil?
    fail ArgumentError, "Missing the required parameter 'feed_id' when calling CatalogFeedsApi.feed_processing_results_list"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && feed_id !~ pattern
    fail ArgumentError, "invalid value for 'feed_id' when calling CatalogFeedsApi.feed_processing_results_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 CatalogFeedsApi.feed_processing_results_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 CatalogFeedsApi.feed_processing_results_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 CatalogFeedsApi.feed_processing_results_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 CatalogFeedsApi.feed_processing_results_list, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/catalogs/feeds/{feed_id}/processing_results'.sub('{feed_id}', CGI.escape(feed_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[:'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] || 'FeedProcessingResultsList200Response'

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

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

#feeds_create(catalogs_feed_create_request_schema, opts = {}) ⇒ CatalogsFeed

Create feed Create a new feed owned by the "operation user_account". - By default, the "operation user_account" is the token user_account. Please, be aware that "default_country" and "default_locale" are not required in the spec for forward compatibility but for now the API will not accept requests without those fields. 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping. 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:



122
123
124
125
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 122

def feeds_create(catalogs_feed_create_request_schema, opts = {})
  data, _status_code, _headers = feeds_create_with_http_info(catalogs_feed_create_request_schema, opts)
  data
end

#feeds_create_with_http_info(catalogs_feed_create_request_schema, opts = {}) ⇒ Array<(CatalogsFeed, Integer, Hash)>

Create feed Create a new feed owned by the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account. Please, be aware that &quot;default_country&quot; and &quot;default_locale&quot; are not required in the spec for forward compatibility but for now the API will not accept requests without those fields. 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping. 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<(CatalogsFeed, Integer, Hash)>)

    CatalogsFeed data, response status code and response headers



133
134
135
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
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 133

def feeds_create_with_http_info(catalogs_feed_create_request_schema, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogFeedsApi.feeds_create ...'
  end
  # verify the required parameter 'catalogs_feed_create_request_schema' is set
  if @api_client.config.client_side_validation && catalogs_feed_create_request_schema.nil?
    fail ArgumentError, "Missing the required parameter 'catalogs_feed_create_request_schema' when calling CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_create, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/feeds'

  # 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_feed_create_request_schema)

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

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

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

#feeds_delete(feed_id, opts = {}) ⇒ CatalogsFeed

Delete feed Delete a feed 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping.

Parameters:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



202
203
204
205
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 202

def feeds_delete(feed_id, opts = {})
  data, _status_code, _headers = feeds_delete_with_http_info(feed_id, opts)
  data
end

#feeds_delete_with_http_info(feed_id, opts = {}) ⇒ Array<(CatalogsFeed, Integer, Hash)>

Delete feed Delete a feed 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping.

Parameters:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    CatalogsFeed data, response status code and response headers



213
214
215
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
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 213

def feeds_delete_with_http_info(feed_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogFeedsApi.feeds_delete ...'
  end
  # verify the required parameter 'feed_id' is set
  if @api_client.config.client_side_validation && feed_id.nil?
    fail ArgumentError, "Missing the required parameter 'feed_id' when calling CatalogFeedsApi.feeds_delete"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && feed_id !~ pattern
    fail ArgumentError, "invalid value for 'feed_id' when calling CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_delete, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/feeds/{feed_id}'.sub('{feed_id}', CGI.escape(feed_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] || 'CatalogsFeed'

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

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

#feeds_get(feed_id, opts = {}) ⇒ CatalogsFeed

Get feed Get a single feed 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping.

Parameters:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



282
283
284
285
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 282

def feeds_get(feed_id, opts = {})
  data, _status_code, _headers = feeds_get_with_http_info(feed_id, opts)
  data
end

#feeds_get_with_http_info(feed_id, opts = {}) ⇒ Array<(CatalogsFeed, Integer, Hash)>

Get feed Get a single feed 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping.

Parameters:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    CatalogsFeed data, response status code and response headers



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

def feeds_get_with_http_info(feed_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogFeedsApi.feeds_get ...'
  end
  # verify the required parameter 'feed_id' is set
  if @api_client.config.client_side_validation && feed_id.nil?
    fail ArgumentError, "Missing the required parameter 'feed_id' when calling CatalogFeedsApi.feeds_get"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && feed_id !~ pattern
    fail ArgumentError, "invalid value for 'feed_id' when calling CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_get, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/feeds/{feed_id}'.sub('{feed_id}', CGI.escape(feed_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] || 'CatalogsFeed'

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

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

#feeds_ingest(feed_id, opts = {}) ⇒ CatalogsFeedIngestion

Ingest feed items Ingest items for a given feed owned by the "operation 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: This endpoint is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



362
363
364
365
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 362

def feeds_ingest(feed_id, opts = {})
  data, _status_code, _headers = feeds_ingest_with_http_info(feed_id, opts)
  data
end

#feeds_ingest_with_http_info(feed_id, opts = {}) ⇒ Array<(CatalogsFeedIngestion, Integer, Hash)>

Ingest feed items Ingest items for a given feed owned by the &quot;operation user_account&quot;. 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: This endpoint is restricted to a specific group of users. If you require access, please reach out to your partner manager.

Parameters:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    CatalogsFeedIngestion data, response status code and response headers



373
374
375
376
377
378
379
380
381
382
383
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
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 373

def feeds_ingest_with_http_info(feed_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogFeedsApi.feeds_ingest ...'
  end
  # verify the required parameter 'feed_id' is set
  if @api_client.config.client_side_validation && feed_id.nil?
    fail ArgumentError, "Missing the required parameter 'feed_id' when calling CatalogFeedsApi.feeds_ingest"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && feed_id !~ pattern
    fail ArgumentError, "invalid value for 'feed_id' when calling CatalogFeedsApi.feeds_ingest, 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 CatalogFeedsApi.feeds_ingest, 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 CatalogFeedsApi.feeds_ingest, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/feeds/{feed_id}/ingest'.sub('{feed_id}', CGI.escape(feed_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] || 'CatalogsFeedIngestion'

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

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

#feeds_list(opts = {}) ⇒ FeedsList200Response

List feeds Fetch feeds 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :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:



444
445
446
447
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 444

def feeds_list(opts = {})
  data, _status_code, _headers = feeds_list_with_http_info(opts)
  data
end

#feeds_list_with_http_info(opts = {}) ⇒ Array<(FeedsList200Response, Integer, Hash)>

List feeds Fetch feeds 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :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:

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

    FeedsList200Response data, response status code and response headers



457
458
459
460
461
462
463
464
465
466
467
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
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 457

def feeds_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogFeedsApi.feeds_list ...'
  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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_list, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/catalogs/feeds'

  # query parameters
  query_params = opts[:query_params] || {}
  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] || 'FeedsList200Response'

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

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

#feeds_update(feed_id, catalogs_feed_update_request_schema, opts = {}) ⇒ CatalogsFeed

Update feed Update a feed 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping. 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:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



534
535
536
537
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 534

def feeds_update(feed_id, catalogs_feed_update_request_schema, opts = {})
  data, _status_code, _headers = feeds_update_with_http_info(feed_id, catalogs_feed_update_request_schema, opts)
  data
end

#feeds_update_with_http_info(feed_id, catalogs_feed_update_request_schema, opts = {}) ⇒ Array<(CatalogsFeed, Integer, Hash)>

Update feed Update a feed 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. For Retail partners, refer to Before you get started with Catalogs. For Hotel partners, refer to Pinterest API for shopping. 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:

  • feed_id (String)

    Unique identifier of a feed.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    CatalogsFeed data, response status code and response headers



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

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

  # verify the required parameter 'catalogs_feed_update_request_schema' is set
  if @api_client.config.client_side_validation && catalogs_feed_update_request_schema.nil?
    fail ArgumentError, "Missing the required parameter 'catalogs_feed_update_request_schema' when calling CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_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 CatalogFeedsApi.feeds_update, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/catalogs/feeds/{feed_id}'.sub('{feed_id}', CGI.escape(feed_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_feed_update_request_schema)

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

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

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

#items_issues_list(processing_result_id, opts = {}) ⇒ ItemsIssuesList200Response

List item issues List item validation issues for a given feed processing result owned by the "operation user_account". Up to 20 random samples of affected items are returned for each error and warning code. Please note that for now query parameters 'item_numbers' and 'item_validation_issue' cannot be used simultaneously until it is implemented in some release in the future. - 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: To get a list of all affected items instead of sampled issues, please refer to Build catalogs report and Get catalogs report endpoints. Moreover, they support multiple types of catalogs. Learn more

Parameters:

  • processing_result_id (String)

    Unique identifier of a feed processing result. It can be acquired from the &quot;id&quot; field of the &quot;items&quot; array within the response of the List processing results for a given feed.

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

    the optional parameters

Options Hash (opts):

  • :item_numbers (Array<Integer>)

    Item number based on order of appearance in the Catalogs Feed. For example, '0' refers to first item found in a feed that was downloaded from a 'location' specified during feed creation.

  • :item_validation_issue (CatalogsItemValidationIssue)

    Filter item validation issues that have a given type of item validation issue.

  • :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:



628
629
630
631
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 628

def items_issues_list(processing_result_id, opts = {})
  data, _status_code, _headers = items_issues_list_with_http_info(processing_result_id, opts)
  data
end

#items_issues_list_with_http_info(processing_result_id, opts = {}) ⇒ Array<(ItemsIssuesList200Response, Integer, Hash)>

List item issues List item validation issues for a given feed processing result owned by the &quot;operation user_account&quot;. Up to 20 random samples of affected items are returned for each error and warning code. Please note that for now query parameters 'item_numbers' and 'item_validation_issue' cannot be used simultaneously until it is implemented in some release in the future. - 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: To get a list of all affected items instead of sampled issues, please refer to Build catalogs report and Get catalogs report endpoints. Moreover, they support multiple types of catalogs. Learn more

Parameters:

  • processing_result_id (String)

    Unique identifier of a feed processing result. It can be acquired from the &quot;id&quot; field of the &quot;items&quot; array within the response of the List processing results for a given feed.

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

    the optional parameters

Options Hash (opts):

  • :item_numbers (Array<Integer>)

    Item number based on order of appearance in the Catalogs Feed. For example, '0' refers to first item found in a feed that was downloaded from a 'location' specified during feed creation.

  • :item_validation_issue (CatalogsItemValidationIssue)

    Filter item validation issues that have a given type of item validation issue.

  • :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:

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

    ItemsIssuesList200Response data, response status code and response headers



643
644
645
646
647
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
# File 'lib/pinterest_sdk/api/catalog_feeds_api.rb', line 643

def items_issues_list_with_http_info(processing_result_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CatalogFeedsApi.items_issues_list ...'
  end
  # verify the required parameter 'processing_result_id' is set
  if @api_client.config.client_side_validation && processing_result_id.nil?
    fail ArgumentError, "Missing the required parameter 'processing_result_id' when calling CatalogFeedsApi.items_issues_list"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && processing_result_id !~ pattern
    fail ArgumentError, "invalid value for 'processing_result_id' when calling CatalogFeedsApi.items_issues_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 CatalogFeedsApi.items_issues_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 CatalogFeedsApi.items_issues_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 CatalogFeedsApi.items_issues_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 CatalogFeedsApi.items_issues_list, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/catalogs/processing_results/{processing_result_id}/item_issues'.sub('{processing_result_id}', CGI.escape(processing_result_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'item_numbers'] = @api_client.build_collection_param(opts[:'item_numbers'], :multi) if !opts[:'item_numbers'].nil?
  query_params[:'item_validation_issue'] = opts[:'item_validation_issue'] if !opts[:'item_validation_issue'].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] || 'ItemsIssuesList200Response'

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

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