import OlapicMediaEntity from 'OlapicDevKit-ES6/src/core/entities/media/media.entity.js'
OlapicMediaEntity
Extends:
This represents the Olapic media in DevKit. This is one of the most important entities since most of the Olapic contents are based on media.
Constructor Summary
Public Constructor | ||
public |
constructor(data: Object) The class constructor that receives the media information. |
Member Summary
Public Members | ||
public |
An alias/name for the entity. |
|
public get |
A shortcut method to get access to the media handler object. |
Method Summary
Public Methods | ||
public |
Gets all the categories related to this media. |
|
public |
Gets all the streams related to this media. |
|
public |
Gets the user that uploaded the media. |
|
public |
Report the media to be removed. |
Inherited Summary
From class OlapicEntity | ||
public get |
A quick shortcut for the entities so they can access their own entities handler. |
|
public |
An alias/name for the entity, for debug purposes. |
|
public |
The entity information. |
|
public |
Access the entity data using a path-like format. |
|
public |
A utility method that returns the entity name/alias. |
Public Constructors
public constructor(data: Object) source
The class constructor that receives the media information.
Override:
OlapicEntity#constructorParams:
Name | Type | Attribute | Description |
data | Object | All the information for the media. |
Public Members
public get handler: OlapicMediaHandler: * source
A shortcut method to get access to the media handler object.
Override:
OlapicEntity#handlerPublic Methods
public getRelatedCategories(): Promise<Array, Error> source
Gets all the categories related to this media.
Return:
Promise<Array, Error> | A list of related categories or an |
Example:
.getRelatedCategories().then((categories) => {
console.log('Categories: ', categories);
});
public getRelatedStreams(): Promise<Array, Error> source
Gets all the streams related to this media.
Example:
.getRelatedStreams().then((streams) => {
console.log('Streams: ', streams);
});
public getUser(): Promise<OlapicUserEntity, Error> source
Gets the user that uploaded the media.
Return:
Promise<OlapicUserEntity, Error> | A promise with the user entity or an |
Example:
.getUser().then((user) => {
console.log(user.get('name'));
});
public report(email: String, reason: String): Promise<Object, Error> source
Report the media to be removed.
Return:
Promise<Object, Error> | A response object from the API if the media was successfully
reported, or an |
TODO:
- Improve the response for when the media was successfully to something more than just the API response.