UNPKG

@evan.network/ui-angular-core

Version:

The angular-core operates as an global and central library for the evan.network Angular 5 frontend development. Using this project you will be able to to the following things:

205 lines (204 loc) 7.44 kB
import { EvanBCCService } from './bcc'; import { EvanCoreService } from './core'; import { EvanDescriptionService } from './description'; import { EvanQueue } from './queue'; import { QueueId } from './queue-utilities'; import { EvanRoutingService } from '../ui/routing'; import { EvanUtilService } from '../utils'; import { SingletonService } from '../singleton-service'; /**************************************************************************************************/ /** * BCC business center API wrapper. Manages: * - bc object initialization * - bc contract creation & loading * - bc member loading * - ... * * @class Injectable EvanBcService */ export declare class EvanBcService { private bcc; private core; private queue; private routing; private singleton; private utils; private descriptionService; /** * loaded business center cache */ private loadedBcs; /** * only load members with this roles */ private whitelist_roles; /** * queue id for checking joining / leaving members */ joinLeaveBcQueueId: QueueId; /** * queue id for applying business center information to the users profile */ profileQueueId: QueueId; /** * do not load bc instances duplicated times */ loadPromises: any; /** * initialize and make it singleton */ constructor(bcc: EvanBCCService, core: EvanCoreService, queue: EvanQueue, routing: EvanRoutingService, singleton: SingletonService, utils: EvanUtilService, descriptionService: EvanDescriptionService); /** * Create a new BCInstance. * * @param {BundleOptions} options bundle options * @return {BCInstance} new BC instance */ createBC(options: any): Promise<any>; /** * Gets the current business center. It is created using the BCBundle.createBC * runtime function. * * Returns: * { * ensDomain, * bcAddress, * businessCenter, * bcRoles, * ipld, * bcProfiles, * description: (<any>description), * dataContract * } * * @param {string} ensDomain bc ens domain * @return {Promise<any>} the initialized business center */ getCurrentBusinessCenter(ensDomain?: string): Promise<any>; /** * Refresh the data of a loaded business center. Have a look at * "getCurrentBusinessCenter" * * @param {string} ensDomain ens domain to load the bc for * @return {Promise<any>} business center object */ reloadBc(ensDomain?: string): Promise<any>; /** * load the members for a contract within an business center * * @param {string|any} contract contract id or contract * object * @param {string} ensDomain ens domain of the business * center * @return {Promise<Array<string>>} members */ getMembers(contract?: any, ensDomain?: string): Promise<Array<string>>; /** * Load profiles for an member array * * @param {Array<string>} members members to load the profiles * for * @param {string} ensDomain ens domain to load the * contact cards from * @return {Promise<any>} profiles analogous to addressbook * profiles */ getProfiles(members?: Array<any>, ensDomain?: string): Promise<any>; /** * Creates an queue id for users profile within a business center * * @param {string} ensDomain ens domain to create the queue id for * @return {QueueId} The profile queue identifier. */ getProfileQueueId(ensDomain?: string): QueueId; /** * Checks if a member is joined to a business center * * @param {string} accountId account id to check * @param {string} ensDomain ens domain of the business center * @return {Promise<boolean>} True if member, False otherwise. */ isMember(accountId?: string, ensDomain?: string): Promise<boolean>; /** * Check if the user has a business center profile * * @param {string} ensDomain ens domain of the business * center * @return {Promise<boolean>} true if profile exists, else false */ profileSet(ensDomain?: string): Promise<boolean>; /** * Save the alias of a user to business center profile * * @param {string} alias alias to save * @param {string} ensDomain ens domain of the business center */ saveProfile(alias: string, ensDomain?: string): Promise<void>; /** * Get your contracts for a specific business center. * * Result: [ this.getBCContract() ] * * @param {string} ensDomain ens domain of the business center * @return {Promise<Array<any>>} The bc contracts. */ getBCContracts(ensDomain: string): Promise<Array<any>>; /** * load a contract of a business center * * Result: { address, isContract, ... } * * @param {string} ensDomain ens domain of the business center * @param {string} contractId The contract identifier * @return {any} The bc contract. */ getBCContract(ensDomain: string, contractId: string): Promise<any>; /** * Gets the join leave bc QueueId. * * @param {string} ensDomain The ens domain * @return {QueueId} The join leave bc queue identifier. */ getJoinLeaveBcQueueId(ensDomain?: string): QueueId; /** * Get the current entries within the profile join / leave queue * * @param {string} ensDomain ens domain of the business center * @return {any} content of the current joining queue */ getJoinLeaveQueue(ensDomain?: string): any; /** * Join a business center using the bc profile QueueId * * @param {string} ensDomain ens domain of the business center */ joinBcViaQueue(ensDomain?: string): Promise<void>; /** * Join a business center using the bc profile QueueId * * @param {string} ensDomain The ens domain */ leaveBcViaQueue(ensDomain?: string): Promise<void>; /** * Run a business-center contract function. * * @param {string} ensDomain ens domain of the business center * @param {string} operation contract function * @return {Promise<void>} resolved when done */ executeOperationOnBC(ensDomain: any, operation: any): Promise<void>; /** * Join a business center * * @param {string} ensDomain ens domain of the business center * @return {Promise<void>} resolved when done */ joinBc(ensDomain?: string): Promise<void>; /** * leave a business center * * @param {string} ensDomain ens domain of the business center * @return {Promise<void>} resolved when done */ leaveBc(ensDomain?: string): Promise<void>; }