Class: PinterestSdkClient::BoardsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BoardsApi

Returns a new instance of BoardsApi.



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

def api_client
  @api_client
end

Instance Method Details

#board_sections_create(board_id, board_section_create, opts = {}) ⇒ BoardSection

Create board section Create a board section on a board owned by the "operation user_account" - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". - By default, the "operation user_account" is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



29
30
31
32
# File 'lib/pinterest_sdk/api/boards_api.rb', line 29

def board_sections_create(board_id, board_section_create, opts = {})
  data, _status_code, _headers = board_sections_create_with_http_info(board_id, board_section_create, opts)
  data
end

#board_sections_create_with_http_info(board_id, board_section_create, opts = {}) ⇒ Array<(BoardSection, Integer, Hash)>

Create board section Create a board section on a board owned by the &quot;operation user_account&quot; - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    BoardSection data, response status code and response headers



41
42
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
# File 'lib/pinterest_sdk/api/boards_api.rb', line 41

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

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

  # resource path
  local_var_path = '/boards/{board_id}/sections'.sub('{board_id}', CGI.escape(board_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(board_section_create)

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

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

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

#board_sections_delete(board_id, section_id, opts = {}) ⇒ BoardSection

Delete board section Delete a board section on a board owned by the "operation user_account" - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". - By default, the "operation user_account" is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

  • section_id (String)

    Unique identifier of a board section.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



120
121
122
123
# File 'lib/pinterest_sdk/api/boards_api.rb', line 120

def board_sections_delete(board_id, section_id, opts = {})
  data, _status_code, _headers = board_sections_delete_with_http_info(board_id, section_id, opts)
  data
end

#board_sections_delete_with_http_info(board_id, section_id, opts = {}) ⇒ Array<(BoardSection, Integer, Hash)>

Delete board section Delete a board section on a board owned by the &quot;operation user_account&quot; - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

  • section_id (String)

    Unique identifier of a board section.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    BoardSection data, response status code and response headers



132
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
195
196
197
198
199
200
201
202
# File 'lib/pinterest_sdk/api/boards_api.rb', line 132

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

  # verify the required parameter 'section_id' is set
  if @api_client.config.client_side_validation && section_id.nil?
    fail ArgumentError, "Missing the required parameter 'section_id' when calling BoardsApi.board_sections_delete"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && section_id !~ pattern
    fail ArgumentError, "invalid value for 'section_id' when calling BoardsApi.board_sections_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 BoardsApi.board_sections_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 BoardsApi.board_sections_delete, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/boards/{board_id}/sections/{section_id}'.sub('{board_id}', CGI.escape(board_id.to_s)).sub('{section_id}', CGI.escape(section_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] || 'BoardSection'

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

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

#board_sections_list(board_id, opts = {}) ⇒ BoardSectionsList200Response

List board sections Get a list of all board sections from a board owned by the "operation user_account" - or a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". - By default, the "operation user_account" is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

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



212
213
214
215
# File 'lib/pinterest_sdk/api/boards_api.rb', line 212

def board_sections_list(board_id, opts = {})
  data, _status_code, _headers = board_sections_list_with_http_info(board_id, opts)
  data
end

#board_sections_list_pins(board_id, section_id, opts = {}) ⇒ BoardsListPins200Response

List Pins on board section Get a list of the Pins on a board section of a board owned by the "operation user_account" - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". - By default, the "operation user_account" is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

  • section_id (String)

    Unique identifier of a board section.

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



307
308
309
310
# File 'lib/pinterest_sdk/api/boards_api.rb', line 307

def board_sections_list_pins(board_id, section_id, opts = {})
  data, _status_code, _headers = board_sections_list_pins_with_http_info(board_id, section_id, opts)
  data
end

#board_sections_list_pins_with_http_info(board_id, section_id, opts = {}) ⇒ Array<(BoardsListPins200Response, Integer, Hash)>

List Pins on board section Get a list of the Pins on a board section of a board owned by the &quot;operation user_account&quot; - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

  • section_id (String)

    Unique identifier of a board section.

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

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

    BoardsListPins200Response data, response status code and response headers



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
366
367
368
369
370
371
372
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
# File 'lib/pinterest_sdk/api/boards_api.rb', line 321

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

  # verify the required parameter 'section_id' is set
  if @api_client.config.client_side_validation && section_id.nil?
    fail ArgumentError, "Missing the required parameter 'section_id' when calling BoardsApi.board_sections_list_pins"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && section_id !~ pattern
    fail ArgumentError, "invalid value for 'section_id' when calling BoardsApi.board_sections_list_pins, 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 BoardsApi.board_sections_list_pins, 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 BoardsApi.board_sections_list_pins, 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 BoardsApi.board_sections_list_pins, 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 BoardsApi.board_sections_list_pins, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/boards/{board_id}/sections/{section_id}/pins'.sub('{board_id}', CGI.escape(board_id.to_s)).sub('{section_id}', CGI.escape(section_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] || 'BoardsListPins200Response'

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

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

#board_sections_list_with_http_info(board_id, opts = {}) ⇒ Array<(BoardSectionsList200Response, Integer, Hash)>

List board sections Get a list of all board sections from a board owned by the &quot;operation user_account&quot; - or a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

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



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
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/pinterest_sdk/api/boards_api.rb', line 225

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

  # resource path
  local_var_path = '/boards/{board_id}/sections'.sub('{board_id}', CGI.escape(board_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] || 'BoardSectionsList200Response'

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

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

#board_sections_update(board_id, section_id, board_section_update_with_required_body, opts = {}) ⇒ BoardSection

Update board section Update a board section on a board owned by the "operation user_account" - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". - By default, the "operation user_account" is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

  • section_id (String)

    Unique identifier of a board section.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



411
412
413
414
# File 'lib/pinterest_sdk/api/boards_api.rb', line 411

def board_sections_update(board_id, section_id, board_section_update_with_required_body, opts = {})
  data, _status_code, _headers = board_sections_update_with_http_info(board_id, section_id, board_section_update_with_required_body, opts)
  data
end

#board_sections_update_with_http_info(board_id, section_id, board_section_update_with_required_body, opts = {}) ⇒ Array<(BoardSection, Integer, Hash)>

Update board section Update a board section on a board owned by the &quot;operation user_account&quot; - or on a group board that has been shared with this account. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

  • section_id (String)

    Unique identifier of a board section.

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    BoardSection data, response status code and response headers



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
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
# File 'lib/pinterest_sdk/api/boards_api.rb', line 424

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

  # verify the required parameter 'section_id' is set
  if @api_client.config.client_side_validation && section_id.nil?
    fail ArgumentError, "Missing the required parameter 'section_id' when calling BoardsApi.board_sections_update"
  end
  pattern = Regexp.new(/^\d+$/)
  if @api_client.config.client_side_validation && section_id !~ pattern
    fail ArgumentError, "invalid value for 'section_id' when calling BoardsApi.board_sections_update, must conform to the pattern #{pattern}."
  end

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

  # resource path
  local_var_path = '/boards/{board_id}/sections/{section_id}'.sub('{board_id}', CGI.escape(board_id.to_s)).sub('{section_id}', CGI.escape(section_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(board_section_update_with_required_body)

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

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

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

#boards_create(board_create, opts = {}) ⇒ Board

Create board Create a board owned by the "operation user_account". Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". * By default, the "operation user_account" is the token user_account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



511
512
513
514
# File 'lib/pinterest_sdk/api/boards_api.rb', line 511

def boards_create(board_create, opts = {})
  data, _status_code, _headers = boards_create_with_http_info(board_create, opts)
  data
end

#boards_create_with_http_info(board_create, opts = {}) ⇒ Array<(Board, Integer, Hash)>

Create board Create a board owned by the &quot;operation user_account&quot;. Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. * By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    Board data, response status code and response headers



522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/pinterest_sdk/api/boards_api.rb', line 522

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

  # resource path
  local_var_path = '/boards'

  # 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(board_create)

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

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

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

#boards_delete(board_id, opts = {}) ⇒ Board

Delete board Delete a board owned by the "operation user_account". * Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". * By default, the "operation user_account" is the token user_account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



591
592
593
594
# File 'lib/pinterest_sdk/api/boards_api.rb', line 591

def boards_delete(board_id, opts = {})
  data, _status_code, _headers = boards_delete_with_http_info(board_id, opts)
  data
end

#boards_delete_with_http_info(board_id, opts = {}) ⇒ Array<(Board, Integer, Hash)>

Delete board Delete a board owned by the &quot;operation user_account&quot;. * Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. * By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    Board data, response status code and response headers



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
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
# File 'lib/pinterest_sdk/api/boards_api.rb', line 602

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

  # resource path
  local_var_path = '/boards/{board_id}'.sub('{board_id}', CGI.escape(board_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] || 'Board'

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

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

#boards_get(board_id, opts = {}) ⇒ Board

Get board Get a board owned by the operation user_account - or a group board that has been shared with this account. * Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". * By default, the "operation user_account" is the token user_account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



671
672
673
674
# File 'lib/pinterest_sdk/api/boards_api.rb', line 671

def boards_get(board_id, opts = {})
  data, _status_code, _headers = boards_get_with_http_info(board_id, opts)
  data
end

#boards_get_with_http_info(board_id, opts = {}) ⇒ Array<(Board, Integer, Hash)>

Get board Get a board owned by the operation user_account - or a group board that has been shared with this account. * Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. * By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    Board data, response status code and response headers



682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
# File 'lib/pinterest_sdk/api/boards_api.rb', line 682

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

  # resource path
  local_var_path = '/boards/{board_id}'.sub('{board_id}', CGI.escape(board_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] || 'Board'

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

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

#boards_list(opts = {}) ⇒ BoardsList200Response

List boards Get a list of the boards owned by the "operation user_account" + group boards where this account is a collaborator Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". Optional: Specify a privacy type (public, protected, or secret) to indicate which boards to return. * If no privacy is specified, all boards that can be returned (based on the scopes of the token and ad_account role if applicable) will be returned.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :privacy (BoardPrivacyFilter)

    The privacy level of the board

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



753
754
755
756
# File 'lib/pinterest_sdk/api/boards_api.rb', line 753

def boards_list(opts = {})
  data, _status_code, _headers = boards_list_with_http_info(opts)
  data
end

#boards_list_pins(board_id, opts = {}) ⇒ BoardsListPins200Response

List Pins on board Get a list of the Pins on a board owned by the "operation user_account" - or on a group board that has been shared with this account. - Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". - By default, the "operation user_account" is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

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

    the optional parameters

Options Hash (opts):

  • :creative_types (Array<CreativeType>)

    Pin creative types filter. Note: SHOP_THE_PIN has been deprecated. Please use COLLECTION instead.

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



841
842
843
844
# File 'lib/pinterest_sdk/api/boards_api.rb', line 841

def boards_list_pins(board_id, opts = {})
  data, _status_code, _headers = boards_list_pins_with_http_info(board_id, opts)
  data
end

#boards_list_pins_with_http_info(board_id, opts = {}) ⇒ Array<(BoardsListPins200Response, Integer, Hash)>

List Pins on board Get a list of the Pins on a board owned by the &quot;operation user_account&quot; - or on a group board that has been shared with this account. - Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. - By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

  • board_id (String)

    Unique identifier of a board.

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

    the optional parameters

Options Hash (opts):

  • :creative_types (Array<CreativeType>)

    Pin creative types filter. Note: SHOP_THE_PIN has been deprecated. Please use COLLECTION instead.

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

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

    BoardsListPins200Response data, response status code and response headers



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
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
# File 'lib/pinterest_sdk/api/boards_api.rb', line 856

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

  # resource path
  local_var_path = '/boards/{board_id}/pins'.sub('{board_id}', CGI.escape(board_id.to_s))

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

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

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

#boards_list_with_http_info(opts = {}) ⇒ Array<(BoardsList200Response, Integer, Hash)>

List boards Get a list of the boards owned by the &quot;operation user_account&quot; + group boards where this account is a collaborator Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. Optional: Specify a privacy type (public, protected, or secret) to indicate which boards to return. * If no privacy is specified, all boards that can be returned (based on the scopes of the token and ad_account role if applicable) will be returned.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

  • :privacy (BoardPrivacyFilter)

    The privacy level of the board

  • :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<(BoardsList200Response, Integer, Hash)>)

    BoardsList200Response data, response status code and response headers



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

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

  # resource path
  local_var_path = '/boards'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'ad_account_id'] = opts[:'ad_account_id'] if !opts[:'ad_account_id'].nil?
  query_params[:'privacy'] = opts[:'privacy'] if !opts[:'privacy'].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] || 'BoardsList200Response'

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

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

#boards_update(board_id, board_with_update_privacy_update, opts = {}) ⇒ BoardWithUpdatePrivacy

Update board Update a board owned by the "operating user_account". * Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the "operation user_account". * By default, the "operation user_account" is the token user_account.

Parameters:

  • board_id (String)
  • board_with_update_privacy_update (BoardWithUpdatePrivacyUpdate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:



938
939
940
941
# File 'lib/pinterest_sdk/api/boards_api.rb', line 938

def boards_update(board_id, board_with_update_privacy_update, opts = {})
  data, _status_code, _headers = boards_update_with_http_info(board_id, board_with_update_privacy_update, opts)
  data
end

#boards_update_with_http_info(board_id, board_with_update_privacy_update, opts = {}) ⇒ Array<(BoardWithUpdatePrivacy, Integer, Hash)>

Update board Update a board owned by the &quot;operating user_account&quot;. * Optional: Business Access: Specify an ad_account_id to use the owner of that ad_account as the &quot;operation user_account&quot;. * By default, the &quot;operation user_account&quot; is the token user_account.

Parameters:

  • board_id (String)
  • board_with_update_privacy_update (BoardWithUpdatePrivacyUpdate)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :ad_account_id (String)

    Unique identifier of an ad account.

Returns:

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

    BoardWithUpdatePrivacy data, response status code and response headers



950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/pinterest_sdk/api/boards_api.rb', line 950

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

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

  # resource path
  local_var_path = '/boards/{board_id}'.sub('{board_id}', CGI.escape(board_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(board_with_update_privacy_update)

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

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

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