def create_item(api_key, collection, name, url=None, custom=None, trackable=None, content=None): """Create a collection with a given @name, belonging to @collection. The fields @url, @custom, @trackable and @content are optional.""" collection = "/api/%s/collection/%s/" % (settings.MANAGEMENT_API_VERSION, collection) data = { 'collection': collection, 'name': name, } if url is not None: data['url'] = url if custom is not None: data['custom'] = custom if trackable is not None: data['trackable'] = trackable if content is not None: data['content'] = content return _create_object(api_key, "item", data)
def create_item(api_key, collection, name, url=None, custom=None, trackable=None, content=None, tags=None): """Create a collection with a given @name, belonging to @collection. The fields @url, @custom, @trackable and @content are optional.""" data = { 'collection': _get_object_uri('collection', collection), 'name': name, } if url is not None: data['url'] = url if custom is not None: data['custom'] = custom if trackable is not None: data['trackable'] = trackable if content is not None: data['content'] = content if tags is not None: data['tags'] = map(lambda uuid: _get_object_uri('tag', uuid), tags) return _create_object(api_key, "item", data)
def create_app(api_key, collection, name): """Create an application with a given @name, belonging to @collection.""" data = { 'collection': _get_object_uri('collection', collection), 'name': name, } return _create_object(api_key, "app", data)
def create_token(api_key, collection, tags=None): "Create a token, belongs to @collection" data = {'collection': _get_object_uri('collection', collection)} if tags is not None: data['tags'] = map(lambda uuid: _get_object_uri('tag', uuid), tags) return _create_object(api_key, "token", data)
def create_video_media(api_key, url, name=None): video_name = name or url.split("/")[-1] return _create_object(api_key, "media", { 'mimetype': 'video', 'name': video_name, 'meta': json.dumps({'video-url': url}) })
def create_video_media(api_key, url, name=None): video_name = name or url.split("/")[-1] return _create_object( api_key, "media", { 'mimetype': 'video', 'name': video_name, 'meta': json.dumps({'video-url': url}) })
def create_bundle(api_key, collection, app, version, tag=None): """Create a bundle with a given @name, belonging to @collection.""" data = { "collection": collection, "version": version, "app": app, } if tag: data["tag"] = tag for object_type, uuid in data.items(): data[object_type] = _get_object_uri(object_type, uuid) return _create_object(api_key, "collectionbundle", data)
def create_item(api_key, collection, name, url=None, custom=None, trackable=None, content=None): """Create a collection with a given @name, belonging to @collection. The fields @url, @custom, @trackable and @content are optional.""" collection = "/api/%s/collection/%s/" % (settings.MANAGEMENT_API_VERSION, collection) data = {"collection": collection, "name": name} if url is not None: data["url"] = url if custom is not None: data["custom"] = custom if trackable is not None: data["trackable"] = trackable if content is not None: data["content"] = content return _create_object(api_key, "item", data)
def create_token(api_key, collection): "Create a token, belongs to @collection" collection = "/api/%s/collection/%s/" % (settings.MANAGEMENT_API_VERSION, collection) data = {'collection': collection} return _create_object(api_key, "token", data)
def create_collection(api_key, name, offline=False): "Create a collection with a given @name (must be unique)" data = {'name': name, 'offline': offline} return _create_object(api_key, "collection", data)
def create_token(api_key, collection): "Create a token, belongs to @collection" data = {'collection': _get_object_uri('collection', collection)} return _create_object(api_key, "token", data)
def create_collection(api_key, name): "Create a collection with a given @name (must be unique)" data = {"name": name} return _create_object(api_key, "collection", data)
def create_token(api_key, collection): "Create a token, belongs to @collection" collection = "/api/%s/collection/%s/" % (settings.MANAGEMENT_API_VERSION, collection) data = {"collection": collection} return _create_object(api_key, "token", data)