import { BehaviorSubject, Subscription } from 'rxjs'; import { DirectoryContact } from '../../models/directoryContact.model'; import { Contact } from '../../models/contact.model'; import { DirectoryInternalSearchResults, DirectorySearchOptions } from '../core/directorySearch.service'; import { Service } from '../../services/service'; export declare const PERSONAL_DIRECTORY_SVC = "PersonalDirectoryService"; /** * @enum {string} * @public * @readonly * @description * Collection of events fired by {@link PersonalDirectoryService} regarding the Personal Directory */ export declare enum PersonalDirectoryEvent { /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_ADD * @description * This event is fired when a new contact is added in the personal directory * The event contains a Contact object * @param {Contact} data containing the information of the personal contact */ PERSONAL_DIRECTORY_ADD = "PERSONAL_DIRECTORY_ADD", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_DELETE * @description * This event is fired when a contact is deleted from the personal directory * The event contains the id of the deleted contact * @param {string} id containing the id of the deleted contact */ PERSONAL_DIRECTORY_DELETE = "PERSONAL_DIRECTORY_DELETE", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_UPDATE * @description * This event is fired when a contact is updated in the personal directory * The event contains a Contact object * @param {Contact} data containing the information of the personal contact */ PERSONAL_DIRECTORY_UPDATE = "PERSONAL_DIRECTORY_UPDATE", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_IMPORT_PROGRESS * @description * This event is fired when import of personal directory is progressing * The event contains a number * @param {number} percent containing the percent of the import */ PERSONAL_DIRECTORY_IMPORT_PROGRESS = "PERSONAL_DIRECTORY_IMPORT_PROGRESS", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_IMPORT_COMPLETION * @description * This event is fired when import of personal directory is completed */ PERSONAL_DIRECTORY_IMPORT_COMPLETION = "PERSONAL_DIRECTORY_IMPORT_COMPLETION", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_DELETE_ALL * @description * This event is fired when all contacts are removed from the personal directory of the user */ PERSONAL_DIRECTORY_DELETE_ALL = "PERSONAL_DIRECTORY_DELETE_ALL", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_TAG_DELETE * @description * This event is fired when a tag is removed from all the personal directory entries * The event contains the name of the removed tag * @param {string} name of the removed tag */ PERSONAL_DIRECTORY_TAG_DELETE = "PERSONAL_DIRECTORY_TAG_DELETE", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_TAG_RENAME * @description * This event is fired when a tag is renamed inside all personal directory entries * The event contains the old anf the new name of the tag * @param {string} Old name of the removed tag * @param {string} New name of the removed tag */ PERSONAL_DIRECTORY_TAG_RENAME = "PERSONAL_DIRECTORY_TAG_RENAME", /** * @public * @event PersonalDirectoryEvent#PERSONAL_DIRECTORY_UPDATE_ALL * @description * This event is fired when all personal directory contacts stored in internal cache have been updated. * This happens for example after a XMPP reconnection, these contacts must be updated again * (thanks to a new 'getPersonalContacts') as during the time of disconnection such contacts may have been * added, updated or deleted by the end-user through another Rainbow client. */ PERSONAL_DIRECTORY_UPDATE_ALL = "PERSONAL_DIRECTORY_UPDATE_ALL" } export declare class PersonalDirectoryService extends Service { private logger; private authService; private eventService; private xmppService; private profileService; private contactService; private countryService; private userInfoService; private errorHelperService; private favoritesService; private rxSubject; xmppManagementHandler: any; serviceReady: BehaviorSubject; private directoryPortalURL; private massProPortalURL; private personalDirectoryEnabled; private deleteAllInProgress; private DEFAULT_CSV_BOM; private DEFAULT_CSV_TYPE; static getInstance(): PersonalDirectoryService; static build(): PersonalDirectoryService; private constructor(); start(): Promise; stop(): Promise; reconnect(): Promise; init(): void; private attachXMPPListeners; private removeXMPPListeners; subscribe(handler: any): Subscription; private onDirectoryManagementReceived; private onPersonalDirectoryImportInitializing; private onPersonalDirectoryImportDeletion; private onPersonalDirectoryImportCreation; private onPersonalDirectoryImportSuccess; private onPersonalDirectyDeletion; private buildContactCardFromXmpp; private onPersonalDirectoryCreation; private onPersonalDirectoryUpdate; /** * Method createPersonalContact * @description This API allows users to create a contact in its personal directory * (API request to {@link https://api.openrainbow.org/directory/#api-directory-PostDirectory Rainbow Company Directory portal - directory - Create a directory entry}) * @memberof PersonalDirectoryService * @public * @param {DirectoryContact} persDirContact a {@link DirectoryContact} The personal contact to create on server * @returns {Promise} The created personal directory contact as a Contact model * @memberof PersonalDirectoryService * @fires PersonalDirectoryEvent#PERSONAL_DIRECTORY_ADD */ createPersonalContact(persDirContact: DirectoryContact): Promise; /** * Method deletePersonalContact * @description This API allows users to delete a personal directory contact * (API request to {@link https://api.openrainbow.org/directory/#api-directory-DeleteDirectory Rainbow Company Directory portal - directory - Delete a directory entry}) * @memberof PersonalDirectoryService * @public * @param {Contact} contact Contact instance associated to the personal directory contact to delete * @returns {Promise} resolves when deletion is done * @fires PersonalDirectoryEvent#PERSONAL_DIRECTORY_DELETE */ deletePersonalContact(contact: Contact): Promise; /** * Method deletePersonalContactById * @description This API allows users to delete a personal directory contact * (API request to {@link https://api.openrainbow.org/directory/#api-directory-DeleteDirectory Rainbow Company Directory portal - directory - Delete a directory entry}) * @memberof PersonalDirectoryService * @public * @param {string} id Identifier of the personal directory contact to delete * @returns {Promise} resolves when deletion is done * @fires PersonalDirectoryEvent#PERSONAL_DIRECTORY_DELETE */ deletePersonalContactById(id: string): Promise; /** * Method deleteAllContacts * @description This API allows users to delete all the contacts present in its personal directory * @memberof PersonalDirectoryService * @public * @returns {Promise} resolves when deletion is done * @fires PersonalDirectoryEvent#PERSONAL_DIRECTORY_DELETE_ALL */ deleteAllPersonalContacts(): Promise; /** * Method updatePersonalContactFromUserData * @description This API allows users to update a personal contact present in its personal directory * (API request to {@link https://api.openrainbow.org/directory/#api-directory-PutDirectory Rainbow Company Directory portal - directory - Update a directory entry}) * @memberof PersonalDirectoryService * @public * @param {Contact} contact Contact instance associated to the personal directory contact to update * @returns {Promise} The created personal directory contact as a Contact model * @fires PersonalDirectoryEvent#PERSONAL_DIRECTORY_UPDATE */ updatePersonalContactFromUserData(contact: Contact): Promise; /** * Method updatePersonalContact * @description This API allows users to update an contact present in its personal directory. * (API request to {@link https://api.openrainbow.org/directory/#api-directory-PutDirectory Rainbow Company Directory portal - directory - Update a directory entry}) * @memberof PersonalDirectoryService * @public * @param {Contact} persDirContact Contact instance associated to the personal directory contact to update * @returns {Promise} The created personal directory contact as a Contact model * @fires PersonalDirectoryEvent#PERSONAL_DIRECTORY_UPDATE */ updatePersonalContact(persDirContact: DirectoryContact): Promise; /** * Method getPersonalContacts * @description This API allows users to retrieve the list of the personal directory contacts of the user with full information pour each of them * (API request to {@link https://api.openrainbow.org/directory/#api-directory-GetDirectoryList Rainbow Company Directory portal - directory - Get a list of directory entries data}) * @memberof PersonalDirectoryService * @public * @param {string} [format] Allows to retrieve more or less contact details in response. * - small: id, directoryType, firstName, lastName * - medium: id, directoryType, firstName, lastName, workPhoneNumbers * - full: all fields. * @returns {Promise<{ contacts: DirectoryContact[]; limit: number; offset: number; total: number }>} object contaning result of search with * { * contacts : {array} // Found personal directory contacts * limit : {number} // Limit specified at the search request, fix in our case by default to max possible. * offset : {number} // The position of first retrieved contact entry * total : {number} // Total number of available personal directory contacts (May be different from the number of returned contacts) * } */ getPersonalContacts(format?: string): Promise<{ contacts: DirectoryContact[]; limit: number; offset: number; total: number; }>; /** * Method getPersonalContactsByCriteria * @description This API allows users to get a list of personal directory contacts data by optionally specifying * - Data format * - Pagination criteria (offset, limit) * - Search criteria (mode, pattern) * (API request to {@link https://api.openrainbow.org/directory/#api-directory-GetDirectoryList Rainbow Company Directory portal - directory - Get a list of directory entries data}) * @memberof PersonalDirectoryService * @public * @param {object} [options] Search filter and criteria specified via the Option object * @property {string} options Option object that may contain the following properties: * @property {string} [options.format='full'] Allows to retrieve more or less contact details in response. * - small: id, directoryType, firstName, lastName * - medium: id, directoryType, firstName, lastName, workPhoneNumbers * - full: all fields. * @property {number} [options.limit] Allows to specify the number personal directory contacts to retrieve. * Default value: 100 * @property {number} [options.offset] Allows to specify the position of first personal directory contact to retrieve * If not specified, the search begins at the beginning, from the the first personal directory contact. * Warning: if offset > total, no results are returned. * @property {string} [options.searchBy] Allows to filter the list of directory entries on phone number or on the name provided in this option. * @property {string} [options.searchPattern] Allows to filter the list of directory entries by the words provided in this option * @returns {Promise<{ contacts: DirectoryContact[]; limit: number; offset: number; total: number }>} object contaning result of search with * { * contacts : {array} // Found personal directory contacts * limit : {number} // Limit specified at the search request * offset : {number} // The position of first retrieved contact entry * total : {number} // Total number of available personal directory contacts (May be different from the number of returned contacts) * } */ getPersonalContactsByCriteria(options?: any): Promise<{ contacts: DirectoryContact[]; limit: number; offset: number; total: number; }>; /** * Method getPersonalContactCardById * @description This API allows users to retrieve from server one contact card in the users's personal directory from its identifier * API request to {@link https://api.openrainbow.org/directory/#api-directory-GetDirectory Rainbow Company Directory portal - directory - Get a directory entry data}) * @memberof PersonalDirectoryService * @public * @param {string} id Identifier of contact to retrieve * @param {string} [format] Allows to retrieve more or less contact details in response. * - small: id, directoryType, firstName, lastName * - medium: id, directoryType, firstName, lastName, workPhoneNumbers * - full: all fields. * @returns {Promise} the {@link DirectoryContact} retrieved */ getPersonalContactCardById(id: string, format?: string): Promise; /** * Method getPersonalContactById * @description This API allows users to retrieve from server a contact in the users's personal directory from its identifier * API request to {@link https://api.openrainbow.org/directory/#api-directory-GetDirectory Rainbow Company Directory portal - directory - Get a directory entry data}) * @memberof PersonalDirectoryService * @public * @param {string} id Identifier of contact to retrieve * @param {string} [format] Allows to retrieve more or less contact details in response. * - small: id, directoryType, firstName, lastName * - medium: id, directoryType, firstName, lastName, workPhoneNumbers * - full: all fields. * @returns {Promise} the retrieved contact */ getPersonalContactById(id: string, format?: string): Promise; /** * Method getNumberPersonalContact * @description This API allows users to retrieve from Contact internal database the personal contacts created by the user * @memberof PersonalDirectoryService * @public * @returns {Contact[]} the retrieved personal contacts */ getMyContacts(): Contact[]; /** * This API allows users to search personal directory contacts by specifying a pattern * (API request to {@link https://api.openrainbow.org/directory/#api-directory-GetDirectoryList Rainbow Company Directory portal - directory - Get a list of directory entries data}) * @public * @description * Search contacts in the personal directory of the user by using a specified pattern to filter items. * This search is only available if the user has the feature PERSONAL_DIRECTORY in its profile. * Concerning 'extendedMode' in 'options' parameter: * If requested and the user has the feature SEARCH_BY_TAGS in its profile, a multi-criteria search will then be performed. * The multi-criteria search applies on fields firstName, lastName, jobTitle, companyName, department and tags. * If this option is not specified or the user does not have the feature SEARCH_BY_TAGS in his profile, * the search is based on names only (first name, last name and company name). * @param {string} searchPattern Pattern to search * @param {DirectorySearchOptions} [options] Search options {@link DirectorySearchOptions} * @returns {Promise} Resolves with an array of {@link DirectoryInternalSearchResults} results and * the total number of directory items matching the criteria. * @memberof PersonalDirectoryService */ searchPersonalContacts(searchPattern: string, options?: DirectorySearchOptions): Promise; /** * Method getPersonalDirectoryContactFromNumber * @memberof PersonalDirectoryService * @public * @param {string} phoneNumber The number * @returns {Contact} Found contact or null otherwise */ getPersonalDirectoryContactFromNumber(phoneNumber: string): Contact | null; /** * Method getPersonalDirectoryTags * @description This API allows users to retrieve from server all the tags assigned to the personal directory entries * (API request to {@link https://api.openrainbow.org/directory/#api-personal_directory_tags-GetPersonalDirectoryTags Rainbow Company Directory portal - personal directory tags - List all tags assigned to personal directory entries * @memberof PersonalDirectoryService * @public * @returns {Promise} tags Array of tags */ getPersonalDirectoryTags(): Promise; /** * Method deletePersonalDirectoryTag * @description This API allows users to delete from server the specified tag assigned to the personal directory entries * (API request to {@link https://api.openrainbow.org/directory/#api-personal_directory_tags-DelPersonalDirectoryTags Rainbow Company Directory portal - personal directory tags - Remove a given tag from all the personal directory entries * @memberof PersonalDirectoryService * @public * @param {string} tag Name of tag to remove * @returns {Promise} Resolves when deletion operation is done */ deletePersonalDirectoryTag(tag: string): Promise; /** * Method renamePersonalDirectoryTag * @description This API allows users to rename a tag for all assigned personal directory entries * (API request to {@link https://api.openrainbow.org/directory/#api-personal_directory_tags-PutPersonalDirectoryTags personal directory tags - Rename a tag for all assigned directory entries * @memberof PersonalDirectoryService * @public * @param {string} tag Name of the tag to be renamed * @param {string} newTagName New name of the tag * @returns {Promise} Resolves when rename operation is done */ renamePersonalDirectoryTag(tag: string, newTagName: string): Promise; /** * Method getPersonalDirectoryTagsStats * @description This API can be used to list all the tags being assigned to the personal directory entries of the logged in user, with the number of directory entries for each tags. * (API request to {@linkhttps://api.openrainbow.org/directory/#api-personal_directory_tags-GetPersonalDirectoryTagsStats personal directory tags - Return stats regarding tags of personal directory entries * @memberof PersonalDirectoryService * @public * @returns {Promise<{ count: number; tag: string }[]>} Array of stats with the number of use (count) and the tag name */ getPersonalDirectoryTagsStats(): Promise<{ count: number; tag: string; }[]>; /** * Method createContactFromPersonalDirectoryData * @description Create a new contact based on Contact model from a personal directory object (DirectoryContact) * @memberof PersonalDirectoryService * @private * @param {DirectoryContact} persDirContact The created personal directory contact * @returns {Contact} Created contact or null if creation failed */ private createContactFromPersonalDirectoryData; /** * Method updateContactFromPersonalDirectoryData * @description Update an existing contact with a personal directory object (DirectoryContact) * @memberof PersonalDirectoryService * @private * @param {DirectoryContact} persDirContact The updated personal directory object * @returns {Contact} Updated contact or null if update failed */ private updateContactFromPersonalDirectoryData; /** * Method createOrUpdateContact * @description Create or update an existing contact with a personal directory object (DirectoryContact) * @memberof PersonalDirectoryService * @private * @param {DirectoryContact} persDirContact A personal directory object just retrieved from server * @returns {Contact} Created or Updated contact */ private createOrUpdateContact; /** * Method createPersonalDirectoryDataFromContact * * Create a personal directory object (DirectoryContact) from a contact based on Contact model * Useful to update on server side a personal directory contact from data stored in a contact * @memberof PersonalDirectoryService * @private * @param {Contact} contactData The contact associated to the given personal directory * @returns {DirectoryContact} Personal directory contact object used for update on server side */ private createPersonalDirectoryDataFromContact; /********************************************************/ /** DOWNLOAD CSV TEMPLATE **/ /********************************************************/ downloadCsvTemplateFile(): Promise; /********************************************************/ /** CHECK CSV FILE CONTENT **/ /********************************************************/ checkDirectoryImportCsvContent(csvContent: any): Promise; /********************************************************/ /** GET CSV FILE IMPORTS HISTORY **/ /********************************************************/ getDirectoryImportReport(): Promise; /********************************************************/ /** IMPORT CSV FILE PERSONAL DIRECTORY **/ /********************************************************/ importPersonalDirectory(csvContent: any): Promise; /********************************************************/ /** EXPORT CSV FILE PERSONAL DIRECTORY **/ /********************************************************/ exportPersonalDirectory(): Promise; } //# sourceMappingURL=personal-directory.service.d.ts.map