예제 #1
0
def add_collections_to_collection(collection, collections, api_key=None):
    """
    Add Collection to a Collection.

    :param collection: The Collection to add Collections to.
    :type collection: str
    :param collections: The Collections to add.
    :type collections: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection', collection)
    assertions.datatype_list_of_str('collections', collections)
    url = '/collections/{}/collections'.format(collection)
    return utils.request('POST', url, data=collections, api_key=api_key)
예제 #2
0
def add_collections_to_collection(collection_id, collection_ids, api_key=None):
    """
    Add Collection to a Collection.

    :param collection_id: The Collection to add Collections to.
    :type collection_id: str
    :param collection_ids:
    :type collection_ids: list of str
    :param api_key:
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection_id', collection_id)
    assertions.datatype_list_of_str('collection_ids', collection_ids)
    url = '/collections/{}/collections'.format(collection_id)
    return utils.request('POST', url, data=collection_ids, api_key=api_key)
예제 #3
0
def add_collection_thngs(collection, thngs, api_key=None):
    """
    Add Thngs to a Collection.

    :param collection: The Collection to add Thngs to.
    :type collection: str
    :param thngs: The Thngs to add to the Collection.
    :type thngs: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection', collection)
    assertions.datatype_list_of_str('thngs', thngs)
    url = '/collections/{}/thngs'.format(collection)
    return utils.request('PUT', url, data=thngs, api_key=api_key)
예제 #4
0
def add_collection_thngs(collection_id, thng_ids, api_key=None):
    """
    Add Thngs to a Collection.

    :param collection_id: The Collection to add Thngs to.
    :type collection_id: str
    :param thng_ids:
    :type thng_ids: list of str
    :param api_key:
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection_id', collection_id)
    assertions.datatype_list_of_str('thng_ids', thng_ids, '')
    url = '/collections/{}/thngs'.format(collection_id)
    return utils.request('PUT', url, data=thng_ids, api_key=api_key)
예제 #5
0
def add_collections_to_collection(collection_id, collection_ids, api_key=None):
    """
    Add Collection to a Collection.

    :param collection_id: The Collection to add Collections to.
    :type collection_id: str
    :param collection_ids:
    :type collection_ids: list of str
    :param api_key:
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection_id', collection_id)
    assertions.datatype_list_of_str('collection_ids', collection_ids)
    url = '/collections/{}/collections'.format(collection_id)
    return utils.request('POST', url, data=collection_ids, api_key=api_key)
예제 #6
0
def add_collection_thngs(collection_id, thng_ids, api_key=None):
    """
    Add Thngs to a Collection.

    :param collection_id: The Collection to add Thngs to.
    :type collection_id: str
    :param thng_ids:
    :type thng_ids: list of str
    :param api_key:
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection_id', collection_id)
    assertions.datatype_list_of_str('thng_ids', thng_ids, '')
    url = '/collections/{}/thngs'.format(collection_id)
    return utils.request('PUT', url, data=thng_ids, api_key=api_key)
예제 #7
0
def add_collection_thngs(collection, thngs, api_key=None, request_kwargs=None):
    """
    Add Thngs to a Collection.

    :param collection: The Collection to add Thngs to.
    :type collection: str
    :param thngs: The Thngs to add to the Collection.
    :type thngs: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection', collection)
    assertions.datatype_list_of_str('thngs', thngs)
    url = '/collections/{}/thngs'.format(collection)
    return utils.request('PUT', url, data=thngs, api_key=api_key,
                         **(request_kwargs or {}))
예제 #8
0
def add_collections_to_collection(collection, collections, api_key=None,
                                  request_kwargs=None):
    """
    Add Collection to a Collection.

    :param collection: The Collection to add Collections to.
    :type collection: str
    :param collections: The Collections to add.
    :type collections: list of str
    :param api_key: The API key to authorize request against.
    :type api_key: str
    :return
    :rtype
    """
    assertions.datatype_str('collection', collection)
    assertions.datatype_list_of_str('collections', collections)
    url = '/collections/{}/collections'.format(collection)
    return utils.request('POST', url, data=collections, api_key=api_key,
                         **(request_kwargs or {}))