Home Reference Source Repository
public class | source

OlapicCustomerEntity

Extends:

OlapicEntity → OlapicCustomerEntity

This represents the Olapic customers in DevKit. This is one of the most important entities, and once connected, you can find your customer entity in the singleton .customer property.

Example:

let devkit = OlapicDevKit.getInstance('<YOU-API-KEY>');
devkit.connect().then((customer) => {
    console.log(customer.get('name'));
});

Constructor Summary

Public Constructor
public

The class constructor that receives the customer information.

Member Summary

Public Members
public

An alias/name for the entity.

public get

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

Method Summary

Public Methods
public

Creates a new user to upload media for the customer.

public

Gets a user to upload media for the customer.

public

Searches for the customer category based on its tag key.

public

Searches for the customer stream based on its tag key.

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 customer information.

Override:

OlapicEntity#constructor

Params:

NameTypeAttributeDescription
data Object

All the information for the customer.

Public Members

public alias: String source

An alias/name for the entity.

Override:

OlapicEntity#alias

public get handler: OlapicCustomersHandler: * source

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

Override:

OlapicEntity#handler

Return:

OlapicCustomersHandler

the handler object for this specific type of entity.

Public Methods

public createUser(name: string, email: string): Promise<OlapicUserEntity, Error> source

Creates a new user to upload media for the customer.

Params:

NameTypeAttributeDescription
name string

The new user name.

email string

The new user email address.

Return:

Promise<OlapicUserEntity, Error>

A promise with the user entity or an Error object if something goes wrong.

Example:

.createUser('myName', '[email protected]').then((user) => {
    console.log(user.get('name'));
});

public getUser(): Promise<OlapicUserEntity, Error> source

Gets a user to upload media for the customer.

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 searchCategory(tag: String): Promise<OlapicCategoryEntity, Error> source

Searches for the customer category based on its tag key.

Params:

NameTypeAttributeDescription
tag String

The category tag key.

Return:

Promise<OlapicCategoryEntity, Error>

A promise with the catgory entity or an Error object if something goes wrong.

Example:

.searchCategory('shoes').then((category) => {
    console.log(category.get('name'));
});

public searchStream(tag: String): Promise<OlapicStreamEntity, Error> source

Searches for the customer stream based on its tag key.

Params:

NameTypeAttributeDescription
tag String

The stream tag key.

Return:

Promise<OlapicStreamEntity, Error>

A promise with the stream entity or an Error object if something goes wrong.

Example:

.searchStream('shoes').then((stream) => {
    console.log(stream.get('name'));
});