Home Reference Source Repository
public class | source

OlapicMediaEntity

Extends:

OlapicEntity → OlapicMediaEntity

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

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(email: String, reason: String): Promise<Object, Error>

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

get(path: string): *

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#constructor

Params:

NameTypeAttributeDescription
data Object

All the information for the media.

Public Members

public alias: String source

An alias/name for the entity.

Override:

OlapicEntity#alias

public get handler: OlapicMediaHandler: * source

A shortcut method to get access to the media handler object.

Override:

OlapicEntity#handler

Return:

OlapicMediaHandler

the handler object for this specific type of entity.

Public 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 Error object if something goes wrong.

Example:

.getRelatedCategories().then((categories) => {
    console.log('Categories: ', categories);
});

public getRelatedStreams(): Promise<Array, Error> source

Gets all the streams related to this media.

Return:

Promise<Array, Error>

A list of related streams or an Error object if something goes wrong.

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 Error object if something goes wrong.

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.

Params:

NameTypeAttributeDescription
email String

The email address of the person reporting the media.

reason String

The reason the media should be taken down.

Return:

Promise<Object, Error>

A response object from the API if the media was successfully reported, or an Error object if something went wrong.

TODO:

  • Improve the response for when the media was successfully to something more than just the API response.