/** * @module BubbleTags */ import { Bubble, BubbleRB, BubbleTag } from '../../models/bubble.model'; import { RBEvent } from '../../models'; import { Subscription } from 'rxjs'; import { Service } from '../service'; /** @internal */ export declare const BUBBLE_TAG_SVC = "BubbleTagService"; /** * @eventProperty * This enum lists all the `RBEvent` events generated by the BubbleTagService. * They can be listened to using the `bubbleTagService.subscribe()` API. */ export declare enum BubbleTagServiceEvents { /** * @eventProperty * This `RBEvent` is send when the bubbleTag service is started */ ON_SERVICE_STARTED = "ON_SERVICE_STARTED", /** * @eventProperty * This `RBEvent` is send when the tag list is modified */ ON_TAGS_UPDATED = "ON_TAGS_UPDATED" } export interface BubbleTagService { /** * Subscribe to the bubbleTag service events; All events send to the callback are of type `RBEvent` * @param callback - The callback function that will be called when events are received */ subscribe(handler: (event: RBEvent) => any, eventNames?: BubbleTagServiceEvents | BubbleTagServiceEvents[]): Subscription; /** * Returns an array of all available bubble tags */ getAllBubbleTags(): BubbleTag[]; /** * Return the bubble tags hashmap (key = tagName) */ getBubbleTagsMap(): Record; /** * Method to create a new bubble tag * @param bubble - The bubble to hang the tag on * @param tagName - Name of the tag to create * @param tagColor - Color of the tag to create in hexadecimal color code (default #ff9900) */ createBubbleTag(bubble: Bubble, tagName: string, tagColor?: string): Promise; /** * Attach to the given bubble a list of existing tags * Please note that this new tag list will override current list * @param bubble - the bubble to tag * @param tags - array of tags */ setBubbleTags(bubble: Bubble, tags: BubbleTag[]): Promise; /** * Find local bubbles by tag * Takes into account tags separated by space * @param searchedTag - tag to find * @param exactMatch - whether we find exact matching tags */ findBubblesByTag(searchedTag: string, exactMatch?: boolean): Promise; /** * This method deletes a tag from one or more bubbles. * @param tagName - Name of tag to remove * @param bubbles - List of bubbles from which to remove the tag */ deleteBubbleTag(tagName: string, bubbles: Bubble[]): Promise; /** * This method permits to update a bubble tag (name and/or color). * @param tag - tag to rename. * @param newTagName - new tag name. * @param color - color value for the tag. */ updateBubbleTag(tag: BubbleTag, newTagName: string, color?: string): Promise; } /** @internal */ export declare class BubbleTagServiceRB extends Service implements BubbleTagService { private authService; private logger; private errorHelperService; private portalURL; private bubbleService; private xmppService; private xmppHandler?; private findBubblesReady; private findBubblesPromise?; private rxSubject; allTags: BubbleTag[]; tagsMap: Record; static getInstance(): BubbleTagServiceRB; static build(): BubbleTagServiceRB; private constructor(); start(): Promise; reconnect(): Promise; stop(): Promise; /** * Subscribe to updates from the service (all events are of RBEvent type); * @param handler - The call-back function that will be subscribed to the RxJS subject * @param eventNames - array of event to listen */ subscribe(handler: (event: RBEvent) => any, eventNames?: BubbleTagServiceEvents | BubbleTagServiceEvents[]): Subscription; /** * BubbleTag service events send to other services via sendEvent() * Can listen to it via bubbleTagService.subscribe() API * @param name - the name of the event * @param data - the data to be send */ sendEvent(name: BubbleTagServiceEvents, data?: any): void; /** * This init methods executes two subsequents requests to the server. * 1) First, it get the list of existing tags (name and color) and build a tag hashmap indexed by the tag name. * This hashmap contains the following structure (name, color, bubbleIds = [] ). * 2) Then a second request retreive for each tag name the list of bubbleIds with this tag * These info allow us to fill the bubbleIds entry of the hashmap. * 3) Finnaly the allTags array is filled by hashmap values. */ private init; private attachListeners; private removeBubbleFromCache; private removeBubbleFromTagInCache; private addBubbleToTagInCache; getAllBubbleTags(): BubbleTag[]; getBubbleTagsMap(): Record; createBubbleTag(bubble: Bubble, tagName: string, tagColor?: string): Promise; setBubbleTags(bubble: Bubble, tags: BubbleTag[]): Promise; updateBubbleTag(tag: BubbleTag, newTagName: string, color?: string): Promise; deleteBubbleTag(tagName: string, bubbles: Bubble[]): Promise; findBubblesByTag(searchedTag: string, exactMatch?: boolean): Promise; private lazyLoadMissingTaggedBubbles; findBubblesByTag2(searchedTag: string, exactMatch?: boolean): BubbleRB[]; } //# sourceMappingURL=bubbleTag.service.d.ts.map