Class: FlatApi::CollectionApi

Inherits:
Object
  • Object
show all
Defined in:
lib/flat_api/api/collection_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CollectionApi

Returns a new instance of CollectionApi.



19
20
21
# File 'lib/flat_api/api/collection_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/flat_api/api/collection_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_score_to_collection(collection, score, opts = {}) ⇒ ScoreDetails

Add a score to the collection This operation will add a score to a collection. The default behavior will make the score available across multiple collections. You must have the capability ‘canAddScores` on the provided `collection` to perform the action.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `app`: Alias for the current app collection - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted

  • score (String)

    Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. `ScoreDetails.id`) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with `drive-` (e.g. `drive-0B000000000`).

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a `privacy` mode set to `privateLink` and the current user is not a collaborator of the document.

Returns:



29
30
31
32
# File 'lib/flat_api/api/collection_api.rb', line 29

def add_score_to_collection(collection, score, opts = {})
  data, _status_code, _headers = add_score_to_collection_with_http_info(collection, score, opts)
  data
end

#add_score_to_collection_with_http_info(collection, score, opts = {}) ⇒ Array<(ScoreDetails, Integer, Hash)>

Add a score to the collection This operation will add a score to a collection. The default behavior will make the score available across multiple collections. You must have the capability &#x60;canAddScores&#x60; on the provided &#x60;collection&#x60; to perform the action.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

  • score (String)

    Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. &#x60;ScoreDetails.id&#x60;) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with &#x60;drive-&#x60; (e.g. &#x60;drive-0B000000000&#x60;).

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a &#x60;privacy&#x60; mode set to &#x60;privateLink&#x60; and the current user is not a collaborator of the document.

Returns:

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

    ScoreDetails 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
# File 'lib/flat_api/api/collection_api.rb', line 41

def add_score_to_collection_with_http_info(collection, score, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.add_score_to_collection ...'
  end
  # verify the required parameter 'collection' is set
  if @api_client.config.client_side_validation && collection.nil?
    fail ArgumentError, "Missing the required parameter 'collection' when calling CollectionApi.add_score_to_collection"
  end
  # verify the required parameter 'score' is set
  if @api_client.config.client_side_validation && score.nil?
    fail ArgumentError, "Missing the required parameter 'score' when calling CollectionApi.add_score_to_collection"
  end
  # resource path
  local_var_path = '/collections/{collection}/scores/{score}'.sub('{' + 'collection' + '}', CGI.escape(collection.to_s)).sub('{' + 'score' + '}', CGI.escape(score.to_s))

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

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

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

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

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

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

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

#create_collection(body, opts = {}) ⇒ Collection

Create a new collection This method will create a new collection and add it to your ‘root` collection.

Parameters:

Returns:



99
100
101
102
# File 'lib/flat_api/api/collection_api.rb', line 99

def create_collection(body, opts = {})
  data, _status_code, _headers = create_collection_with_http_info(body, opts)
  data
end

#create_collection_with_http_info(body, opts = {}) ⇒ Array<(Collection, Integer, Hash)>

Create a new collection This method will create a new collection and add it to your &#x60;root&#x60; collection.

Parameters:

Returns:

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

    Collection data, response status code and response headers



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/flat_api/api/collection_api.rb', line 109

def create_collection_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.create_collection ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling CollectionApi.create_collection"
  end
  # resource path
  local_var_path = '/collections'

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

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

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

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

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

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

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

#delete_collection(collection, opts = {}) ⇒ nil

Delete the collection This method will schedule the deletion of the collection. Until deleted, the collection will be available in the ‘trash`.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Returns:

  • (nil)


167
168
169
170
# File 'lib/flat_api/api/collection_api.rb', line 167

def delete_collection(collection, opts = {})
  delete_collection_with_http_info(collection, opts)
  nil
end

#delete_collection_with_http_info(collection, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete the collection This method will schedule the deletion of the collection. Until deleted, the collection will be available in the &#x60;trash&#x60;.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/flat_api/api/collection_api.rb', line 177

def delete_collection_with_http_info(collection, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.delete_collection ...'
  end
  # verify the required parameter 'collection' is set
  if @api_client.config.client_side_validation && collection.nil?
    fail ArgumentError, "Missing the required parameter 'collection' when calling CollectionApi.delete_collection"
  end
  # resource path
  local_var_path = '/collections/{collection}'.sub('{' + 'collection' + '}', CGI.escape(collection.to_s))

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#delete_score_from_collection(collection, score, opts = {}) ⇒ nil

Delete a score from the collection This method will delete a score from the collection. Unlike [‘DELETE /scores/score`](#operation/deleteScore), this score will not remove the score from your account, but only from the collection. This can be used to move a score from one collection to another, or simply remove a score from one collection when this one is contained in multiple collections.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

  • score (String)

    Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. &#x60;ScoreDetails.id&#x60;) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with &#x60;drive-&#x60; (e.g. &#x60;drive-0B000000000&#x60;).

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a &#x60;privacy&#x60; mode set to &#x60;privateLink&#x60; and the current user is not a collaborator of the document.

Returns:

  • (nil)


232
233
234
235
# File 'lib/flat_api/api/collection_api.rb', line 232

def delete_score_from_collection(collection, score, opts = {})
  delete_score_from_collection_with_http_info(collection, score, opts)
  nil
end

#delete_score_from_collection_with_http_info(collection, score, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a score from the collection This method will delete a score from the collection. Unlike [&#x60;DELETE /scores/score&#x60;](#operation/deleteScore), this score will not remove the score from your account, but only from the collection. This can be used to move a score from one collection to another, or simply remove a score from one collection when this one is contained in multiple collections.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

  • score (String)

    Unique identifier of the score document. This can be a Flat Score unique identifier (i.e. &#x60;ScoreDetails.id&#x60;) or, if the score is also a Google Drive file, the Drive file unique identifier prefixed with &#x60;drive-&#x60; (e.g. &#x60;drive-0B000000000&#x60;).

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a &#x60;privacy&#x60; mode set to &#x60;privateLink&#x60; and the current user is not a collaborator of the document.

Returns:

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

    nil, response status code and response headers



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
# File 'lib/flat_api/api/collection_api.rb', line 244

def delete_score_from_collection_with_http_info(collection, score, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.delete_score_from_collection ...'
  end
  # verify the required parameter 'collection' is set
  if @api_client.config.client_side_validation && collection.nil?
    fail ArgumentError, "Missing the required parameter 'collection' when calling CollectionApi.delete_score_from_collection"
  end
  # verify the required parameter 'score' is set
  if @api_client.config.client_side_validation && score.nil?
    fail ArgumentError, "Missing the required parameter 'score' when calling CollectionApi.delete_score_from_collection"
  end
  # resource path
  local_var_path = '/collections/{collection}/scores/{score}'.sub('{' + 'collection' + '}', CGI.escape(collection.to_s)).sub('{' + 'score' + '}', CGI.escape(score.to_s))

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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

#edit_collection(collection, body, opts = {}) ⇒ Collection

Update a collection’s metadata

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Returns:



302
303
304
305
# File 'lib/flat_api/api/collection_api.rb', line 302

def edit_collection(collection, body, opts = {})
  data, _status_code, _headers = edit_collection_with_http_info(collection, body, opts)
  data
end

#edit_collection_with_http_info(collection, body, opts = {}) ⇒ Array<(Collection, Integer, Hash)>

Update a collection&#39;s metadata

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Returns:

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

    Collection data, response status code and response headers



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/flat_api/api/collection_api.rb', line 312

def edit_collection_with_http_info(collection, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.edit_collection ...'
  end
  # verify the required parameter 'collection' is set
  if @api_client.config.client_side_validation && collection.nil?
    fail ArgumentError, "Missing the required parameter 'collection' when calling CollectionApi.edit_collection"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling CollectionApi.edit_collection"
  end
  # resource path
  local_var_path = '/collections/{collection}'.sub('{' + 'collection' + '}', CGI.escape(collection.to_s))

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

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

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

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

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

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

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

#get_collection(collection, opts = {}) ⇒ Collection

Get collection details

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a &#x60;privacy&#x60; mode set to &#x60;privateLink&#x60; and the current user is not a collaborator of the document.

Returns:



374
375
376
377
# File 'lib/flat_api/api/collection_api.rb', line 374

def get_collection(collection, opts = {})
  data, _status_code, _headers = get_collection_with_http_info(collection, opts)
  data
end

#get_collection_with_http_info(collection, opts = {}) ⇒ Array<(Collection, Integer, Hash)>

Get collection details

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a &#x60;privacy&#x60; mode set to &#x60;privateLink&#x60; and the current user is not a collaborator of the document.

Returns:

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

    Collection data, response status code and response headers



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/flat_api/api/collection_api.rb', line 384

def get_collection_with_http_info(collection, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.get_collection ...'
  end
  # verify the required parameter 'collection' is set
  if @api_client.config.client_side_validation && collection.nil?
    fail ArgumentError, "Missing the required parameter 'collection' when calling CollectionApi.get_collection"
  end
  # resource path
  local_var_path = '/collections/{collection}'.sub('{' + 'collection' + '}', CGI.escape(collection.to_s))

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

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

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

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

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

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

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

#list_collection_scores(collection, opts = {}) ⇒ Array<ScoreDetails>

List the scores contained in a collection Use this method to list the scores contained in a collection. If no sort option is provided, the scores are sorted by ‘modificationDate` `desc`. For example, to list the scores contained in your app collection, you can use `GET /v2/collections/app/scores`.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a &#x60;privacy&#x60; mode set to &#x60;privateLink&#x60; and the current user is not a collaborator of the document.

  • :sort (String)

    Sort

  • :direction (String)

    Sort direction

  • :limit (Integer)

    This is the maximum number of objects that may be returned (default to 25)

  • :_next (String)

    An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

  • :previous (String)

    An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

Returns:



444
445
446
447
# File 'lib/flat_api/api/collection_api.rb', line 444

def list_collection_scores(collection, opts = {})
  data, _status_code, _headers = list_collection_scores_with_http_info(collection, opts)
  data
end

#list_collection_scores_with_http_info(collection, opts = {}) ⇒ Array<(Array<ScoreDetails>, Integer, Hash)>

List the scores contained in a collection Use this method to list the scores contained in a collection. If no sort option is provided, the scores are sorted by &#x60;modificationDate&#x60; &#x60;desc&#x60;. For example, to list the scores contained in your app collection, you can use &#x60;GET /v2/collections/app/scores&#x60;.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Options Hash (opts):

  • :sharing_key (String)

    This sharing key must be specified to access to a score or collection with a &#x60;privacy&#x60; mode set to &#x60;privateLink&#x60; and the current user is not a collaborator of the document.

  • :sort (String)

    Sort

  • :direction (String)

    Sort direction

  • :limit (Integer)

    This is the maximum number of objects that may be returned (default to 25)

  • :_next (String)

    An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

  • :previous (String)

    An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

Returns:

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

    Array<ScoreDetails> data, response status code and response headers



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
526
527
528
# File 'lib/flat_api/api/collection_api.rb', line 460

def list_collection_scores_with_http_info(collection, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.list_collection_scores ...'
  end
  # verify the required parameter 'collection' is set
  if @api_client.config.client_side_validation && collection.nil?
    fail ArgumentError, "Missing the required parameter 'collection' when calling CollectionApi.list_collection_scores"
  end
  allowable_values = ["creationDate", "modificationDate", "title"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'direction'] && !allowable_values.include?(opts[:'direction'])
    fail ArgumentError, "invalid value for \"direction\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CollectionApi.list_collection_scores, must be smaller than or equal to 100.'
  end

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

  # resource path
  local_var_path = '/collections/{collection}/scores'.sub('{' + 'collection' + '}', CGI.escape(collection.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'sharingKey'] = opts[:'sharing_key'] if !opts[:'sharing_key'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?
  query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?

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

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

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

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

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

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

#list_collections(opts = {}) ⇒ Array<Collection>

List the collections Use this method to list the user’s collections contained in ‘parent` (by default in the `root` collection). If no sort option is provided, the collections are sorted by `creationDate` `desc`. Note that this method will not include the `parent` collection in the listing. For example, if you need the details of the `root` collection, you can use `GET /v2/collections/root`. To fetch your app collection details, you can use `GET /v2/collections/app`.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :parent (String)

    List the collection contained in this &#x60;parent&#x60; collection. This option doesn&#39;t provide a complete multi-level collection support. When sharing a collection with someone, this one will have as &#x60;parent&#x60; &#x60;sharedWithMe&#x60;. (default to ‘root’)

  • :sort (String)

    Sort

  • :direction (String)

    Sort direction

  • :limit (Integer)

    This is the maximum number of objects that may be returned (default to 25)

  • :_next (String)

    An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

  • :previous (String)

    An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

Returns:



540
541
542
543
# File 'lib/flat_api/api/collection_api.rb', line 540

def list_collections(opts = {})
  data, _status_code, _headers = list_collections_with_http_info(opts)
  data
end

#list_collections_with_http_info(opts = {}) ⇒ Array<(Array<Collection>, Integer, Hash)>

List the collections Use this method to list the user&#39;s collections contained in &#x60;parent&#x60; (by default in the &#x60;root&#x60; collection). If no sort option is provided, the collections are sorted by &#x60;creationDate&#x60; &#x60;desc&#x60;. Note that this method will not include the &#x60;parent&#x60; collection in the listing. For example, if you need the details of the &#x60;root&#x60; collection, you can use &#x60;GET /v2/collections/root&#x60;. To fetch your app collection details, you can use &#x60;GET /v2/collections/app&#x60;.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :parent (String)

    List the collection contained in this &#x60;parent&#x60; collection. This option doesn&#39;t provide a complete multi-level collection support. When sharing a collection with someone, this one will have as &#x60;parent&#x60; &#x60;sharedWithMe&#x60;. (default to ‘root’)

  • :sort (String)

    Sort

  • :direction (String)

    Sort direction

  • :limit (Integer)

    This is the maximum number of objects that may be returned (default to 25)

  • :_next (String)

    An opaque string cursor to fetch the next page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

  • :previous (String)

    An opaque string cursor to fetch the previous page of data. The paginated API URLs are returned in the &#x60;Link&#x60; header when requesting the API. These URLs will contain a &#x60;next&#x60; and &#x60;previous&#x60; cursor based on the available data.

Returns:

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

    Array<Collection> data, response status code and response headers



555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'lib/flat_api/api/collection_api.rb', line 555

def list_collections_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.list_collections ...'
  end
  allowable_values = ["creationDate", "title"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'direction'] && !allowable_values.include?(opts[:'direction'])
    fail ArgumentError, "invalid value for \"direction\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CollectionApi.list_collections, must be smaller than or equal to 100.'
  end

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

  # resource path
  local_var_path = '/collections'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'parent'] = opts[:'parent'] if !opts[:'parent'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'direction'] = opts[:'direction'] if !opts[:'direction'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?
  query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?

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

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

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

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

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

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

#untrash_collection(collection, opts = {}) ⇒ nil

Untrash a collection This method will restore the collection by removing it from the ‘trash` and add it back to the `root` collection.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Returns:

  • (nil)


626
627
628
629
# File 'lib/flat_api/api/collection_api.rb', line 626

def untrash_collection(collection, opts = {})
  untrash_collection_with_http_info(collection, opts)
  nil
end

#untrash_collection_with_http_info(collection, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Untrash a collection This method will restore the collection by removing it from the &#x60;trash&#x60; and add it back to the &#x60;root&#x60; collection.

Parameters:

  • collection (String)

    Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;app&#x60;: Alias for the current app collection - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'lib/flat_api/api/collection_api.rb', line 636

def untrash_collection_with_http_info(collection, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CollectionApi.untrash_collection ...'
  end
  # verify the required parameter 'collection' is set
  if @api_client.config.client_side_validation && collection.nil?
    fail ArgumentError, "Missing the required parameter 'collection' when calling CollectionApi.untrash_collection"
  end
  # resource path
  local_var_path = '/collections/{collection}/untrash'.sub('{' + 'collection' + '}', CGI.escape(collection.to_s))

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

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

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

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