import OlapicCustomerEntity from 'olapic-devkit/src/core/entities/customer/customer.entity.js'
OlapicCustomerEntity
Extends:
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 |
constructor(data: Object) 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 |
createUser(name: string, email: string): Promise<OlapicUserEntity, Error> Creates a new user to upload media for the customer. |
|
public |
Gets a user to upload media for the customer. |
|
public |
searchCategory(tag: String): Promise<OlapicCategoryEntity, Error> Searches for the customer category based on its tag key. |
|
public |
searchStream(tag: String): Promise<OlapicStreamEntity, Error> 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 |
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#constructorParams:
Name | Type | Attribute | Description |
data | Object | All the information for the customer. |
Public Members
public get handler: OlapicCustomersHandler: * source
A shortcut method to get access to the customers handler object.
Override:
OlapicEntity#handlerPublic Methods
public createUser(name: string, email: string): Promise<OlapicUserEntity, Error> source
Creates a new user to upload media for the customer.
Return:
Promise<OlapicUserEntity, Error> | A promise with the user entity or an |
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 |
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:
Name | Type | Attribute | Description |
tag | String | The category tag key. |
Return:
Promise<OlapicCategoryEntity, Error> | A promise with the catgory entity or an
|
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:
Name | Type | Attribute | Description |
tag | String | The stream tag key. |
Return:
Promise<OlapicStreamEntity, Error> | A promise with the stream entity or an |
Example:
.searchStream('shoes').then((stream) => {
console.log(stream.get('name'));
});