class FlatApi::CollectionApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/flat_api/api/collection_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

add_score_to_collection(collection, score, opts = {}) click to toggle source

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. @param collection Unique identifier of the collection. The following aliases are supported: - `root`: The root collection of the account - `sharedWithMe`: Automatically contains new resources that have been shared individually - `trash`: Automatically contains resources that have been deleted @param score 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`). @param [Hash] opts the optional parameters @option opts [String] :sharing_key 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. @return [ScoreDetails]

# File lib/flat_api/api/collection_api.rb, line 30
def add_score_to_collection(collection, score, opts = {})
  data, _status_code, _headers = add_score_to_collection_with_http_info(collection, score, opts)
  return data
end
add_score_to_collection_with_http_info(collection, score, opts = {}) click to toggle source

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. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param score 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;). @param [Hash] opts the optional parameters @option opts [String] :sharing_key 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. @return [Array<(ScoreDetails, Fixnum, Hash)>] ScoreDetails data, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 42
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' + '}', collection.to_s).sub('{' + 'score' + '}', score.to_s)

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

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'ScoreDetails')
  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 = {}) click to toggle source

Create a new collection This method will create a new collection and add it to your `root` collection. @param body @param [Hash] opts the optional parameters @return [Collection]

# File lib/flat_api/api/collection_api.rb, line 92
def create_collection(body, opts = {})
  data, _status_code, _headers = create_collection_with_http_info(body, opts)
  return data
end
create_collection_with_http_info(body, opts = {}) click to toggle source

Create a new collection This method will create a new collection and add it to your &#x60;root&#x60; collection. @param body @param [Hash] opts the optional parameters @return [Array<(Collection, Fixnum, Hash)>] Collection data, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 102
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 = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(body)
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Collection')
  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 = {}) click to toggle source

Delete the collection This method will schedule the deletion of the collection. Until deleted, the collection will be available in the `trash`. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @return [nil]

# File lib/flat_api/api/collection_api.rb, line 147
def delete_collection(collection, opts = {})
  delete_collection_with_http_info(collection, opts)
  return nil
end
delete_collection_with_http_info(collection, opts = {}) click to toggle source

Delete the collection This method will schedule the deletion of the collection. Until deleted, the collection will be available in the &#x60;trash&#x60;. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 157
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' + '}', collection.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  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 = {}) click to toggle source

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. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param score 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;). @param [Hash] opts the optional parameters @return [nil]

# File lib/flat_api/api/collection_api.rb, line 202
def delete_score_from_collection(collection, score, opts = {})
  delete_score_from_collection_with_http_info(collection, score, opts)
  return nil
end
delete_score_from_collection_with_http_info(collection, score, opts = {}) click to toggle source

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. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param score 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;). @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 213
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' + '}', collection.to_s).sub('{' + 'score' + '}', score.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  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, opts = {}) click to toggle source

Update a collection's metadata

@param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @option opts [CollectionModification] :body @return [Collection]

# File lib/flat_api/api/collection_api.rb, line 262
def edit_collection(collection, opts = {})
  data, _status_code, _headers = edit_collection_with_http_info(collection, opts)
  return data
end
edit_collection_with_http_info(collection, opts = {}) click to toggle source

Update a collection&#39;s metadata

@param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @option opts [CollectionModification] :body @return [Array<(Collection, Fixnum, Hash)>] Collection data, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 273
def edit_collection_with_http_info(collection, 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
  # resource path
  local_var_path = "/collections/{collection}".sub('{' + 'collection' + '}', collection.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(opts[:'body'])
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Collection')
  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 = {}) click to toggle source

Get collection details

@param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @option opts [String] :sharing_key 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. @return [Collection]

# File lib/flat_api/api/collection_api.rb, line 319
def get_collection(collection, opts = {})
  data, _status_code, _headers = get_collection_with_http_info(collection, opts)
  return data
end
get_collection_with_http_info(collection, opts = {}) click to toggle source

Get collection details

@param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @option opts [String] :sharing_key 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. @return [Array<(Collection, Fixnum, Hash)>] Collection data, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 330
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' + '}', collection.to_s)

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

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Collection')
  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 = {}) click to toggle source

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`. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @option opts [String] :sharing_key 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. @option opts [String] :sort Sort @option opts [String] :direction Sort direction @option opts [Integer] :limit This is the maximum number of objects that may be returned (default to 25) @option opts [String] :_next 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. @option opts [String] :previous 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. @return [Array<ScoreDetails>]

# File lib/flat_api/api/collection_api.rb, line 382
def list_collection_scores(collection, opts = {})
  data, _status_code, _headers = list_collection_scores_with_http_info(collection, opts)
  return data
end
list_collection_scores_with_http_info(collection, opts = {}) click to toggle source

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;. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @option opts [String] :sharing_key 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. @option opts [String] :sort Sort @option opts [String] :direction Sort direction @option opts [Integer] :limit This is the maximum number of objects that may be returned @option opts [String] :_next 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. @option opts [String] :previous 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. @return [Array<(Array<ScoreDetails>, Fixnum, Hash)>] Array<ScoreDetails> data, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 398
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
  if @api_client.config.client_side_validation && opts[:'sort'] && !['creationDate', 'modificationDate', 'title'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of creationDate, modificationDate, title'
  end
  if @api_client.config.client_side_validation && opts[:'direction'] && !['asc', 'desc'].include?(opts[:'direction'])
    fail ArgumentError, 'invalid value for "direction", must be one of asc, desc'
  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' + '}', collection.to_s)

  # query parameters
  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 = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<ScoreDetails>')
  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 = {}) click to toggle source

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`. @param [Hash] opts the optional parameters @option opts [String] :parent 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) @option opts [String] :sort Sort @option opts [String] :direction Sort direction @option opts [Integer] :limit This is the maximum number of objects that may be returned (default to 25) @option opts [String] :_next 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. @option opts [String] :previous 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. @return [Array<Collection>]

# File lib/flat_api/api/collection_api.rb, line 468
def list_collections(opts = {})
  data, _status_code, _headers = list_collections_with_http_info(opts)
  return data
end
list_collections_with_http_info(opts = {}) click to toggle source

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;. @param [Hash] opts the optional parameters @option opts [String] :parent 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;. @option opts [String] :sort Sort @option opts [String] :direction Sort direction @option opts [Integer] :limit This is the maximum number of objects that may be returned @option opts [String] :_next 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. @option opts [String] :previous 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. @return [Array<(Array<Collection>, Fixnum, Hash)>] Array<Collection> data, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 483
def list_collections_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: CollectionApi.list_collections ..."
  end
  if @api_client.config.client_side_validation && opts[:'parent'] && !['root', 'sharedWithMe', 'trash'].include?(opts[:'parent'])
    fail ArgumentError, 'invalid value for "parent", must be one of root, sharedWithMe, trash'
  end
  if @api_client.config.client_side_validation && opts[:'sort'] && !['creationDate', 'title'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of creationDate, title'
  end
  if @api_client.config.client_side_validation && opts[:'direction'] && !['asc', 'desc'].include?(opts[:'direction'])
    fail ArgumentError, 'invalid value for "direction", must be one of asc, desc'
  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 = {}
  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 = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Collection>')
  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 = {}) click to toggle source

Untrash a collection This method will restore the collection by removing it from the `trash` and add it back to the `root` collection. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @return [nil]

# File lib/flat_api/api/collection_api.rb, line 547
def untrash_collection(collection, opts = {})
  untrash_collection_with_http_info(collection, opts)
  return nil
end
untrash_collection_with_http_info(collection, opts = {}) click to toggle source

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. @param collection Unique identifier of the collection. The following aliases are supported: - &#x60;root&#x60;: The root collection of the account - &#x60;sharedWithMe&#x60;: Automatically contains new resources that have been shared individually - &#x60;trash&#x60;: Automatically contains resources that have been deleted @param [Hash] opts the optional parameters @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/flat_api/api/collection_api.rb, line 557
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' + '}', collection.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['OAuth2']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  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