import { DirectoryContact } from '../../models/directoryContact.model'; import { DirectoryInternalSearchResults, DirectorySearchOptions } from '../core/directorySearch.service'; import { Contact } from '../../models/contact.model'; import { Company } from '../../models/company.model'; import { Service } from '../../services/service'; export declare const COMPANY_DIRECTORY_SVC = "CompanyDirectoryService"; /** * @enum {string} * @public * @readonly * @description * Collection of events fired by {@link CompanyDirectoryService} */ export declare enum CompanyDirectoryEvent { /** * @public * @event CompanyDirectoryEvent#ADMIN_DIRECTORY_CHANGE * @description * This event is fired when directory changes * The event contains a {@link DirectoryContact} object * @param {DirectoryContact} data containeing id: ID of invitation, action: action of invitation, status: status of invitation */ ADMIN_DIRECTORY_CHANGE = "ADMIN_DIRECTORY_CHANGE", /** * @public * @event CompanyDirectoryEvent#ON_COMPANY_BANNER_UPDATED * @description * This event is fired when the banner of a company changes * The event contains the identifier of the company * @param {string} id Identifier of company updated */ ON_COMPANY_BANNER_UPDATED = "ON_COMPANY_BANNER_UPDATED" } export declare class CompanyDirectoryService extends Service { private logger; private authService; private eventService; private profileService; private contactService; private countryService; private userInfoService; private errorHelperService; private companies; static getInstance(): CompanyDirectoryService; static build(): CompanyDirectoryService; protected constructor(); /** * Get a list of directory entries data (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 * Get a list of contacts from company's directory * @param string - companyId Allows to filter the list of directory entries on the companyIds provided in this option * @param page - Allow to specify the page number to retrieve * @param pageSize - Allow to specify the number of phone book entries to retrieve * @param searchPattern - Allows to filter the list of directory entries by the words provided in this option * @param searchBy - Allows to filter the list of directory entries on the number provided in this option. * @param format - Allows to retrieve more or less entry details in response. Possible values are: * - small: id, firstName, lastName * - medium: id, companyId, firstName, lastName, workPhoneNumbers * - full: all fields. * @returns {Promise<{ contacts: DirectoryContact[]; limit: number; offset: number; total: number }>} object contaning result of search * @memberof CompanyDirectoryService */ getDirectoryContacts(companyId: string, page?: number, pageSize?: number, searchPattern?: string, searchBy?: 'phoneNumbers' | 'tags' | 'name', format?: string): Promise<{ contacts: DirectoryContact[]; limit: number; offset: number; total: number; }>; /** * This API allows administrators to create an entry in the directory of a company they administrate. (API request to {@link https://api.openrainbow.org/directory/#api-directory-PostDirectory Rainbow Company Directory portal - directory - Create a directory entry}) * @public * @description * Creates a company directory contact * @param {DirectoryContact} entry a {@link DirectoryContact} object to create on server * @returns {Promise} The created company directory contact * @memberof CompanyDirectoryService * @fires CompanyDirectoryEvent#ADMIN_DIRECTORY_CHANGE */ createDirectoryContact(entry: DirectoryContact): Promise; /** * This API allows users to get an entry of the directory of a company they administrate. (API request to {@link https://api.openrainbow.org/directory/#api-directory-GetDirectory Rainbow Company Directory portal - directory - Get a directory entry data}) * @public * @description * Retrieve a company directory contact from its identifier * @param {string} id Identifier of contact to retrieve * @param {string} [format] Allows to retrieve more or less entry details in response. Possible values are: * - small: id, firstName, lastName * - medium: id, companyId, firstName, lastName, workPhoneNumbers * - full: all fields. * @returns {Promise} the {@link DirectoryContact} retrieved * @memberof CompanyDirectoryService */ getDirectoryContact(id: string, format?: string): Promise; /** * This API allows administrators to update an entry in the directory of a company they administrate. (API request to {@link https://api.openrainbow.org/directory/#api-directory-PutDirectory Rainbow Company Directory portal - directory - Update a directory entry}) * @public * @description * Updates a company directory contact * @param {({ id: string; tags: string[] } | DirectoryContact)} entry of an existing company directory contact or a data object containing a company contact's ID and tags * @returns {Promise} the {@link DirectoryContact} updated * @memberof CompanyDirectoryService */ updateDirectoryContact(entry: { id: string; tags: string[]; } | DirectoryContact): Promise; /** * This API allows administrators to delete an entry in the directory of a company they administrate. (API request to {@link https://api.openrainbow.org/directory/#api-directory-DeleteDirectory Rainbow Company Directory portal - directory - Delete a directory entry}) * @public * @description * Deletes a company directory contact from comany's directory * @param {string} id Identifier of contact to delete * @returns {Promise} resolves when delete is done * @memberof CompanyDirectoryService */ deleteDirectoryContact(id: string): Promise; /** * This API allows users to search business 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 business directory of one or more companies by using a specified pattern to filter items. * 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 CompanyDirectoryService */ searchBusinessContacts(searchPattern: string, options?: DirectorySearchOptions): Promise; private createAndUpdateContact; /** * Get a list of directory entries data (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 a company by name * @param {string} searchPattern text to search * @param {string} [companyId] If specified, search only in the given company * @returns {Promise} Resolves with an array of {@link Company} results * @memberof CompanyDirectoryService */ searchCompanies(searchPattern: string, companyId?: string): Promise; /** * * @public * @description * Get the company's logo * @param {Company} company for which we want the logo * @returns {Promise} Resolves with the company with the logo * @memberof CompanyDirectoryService */ getCompanyLogo(company: Company): Promise; /** * * @public * @description * Get the company's banner * @param {Company} company for which we want the banner * @returns {Promise} Resolves with the company with the banner * @memberof CompanyDirectoryService */ getCompanyBanner(company: Company): Promise; /** * * @public * @description * Get a {@link Company} by its identifier * @param {string} companyId ID of company to retrieve * @returns {Company} Company found. undefined if none found * @memberof CompanyDirectoryService */ getCompanyById(companyId: string): Company; /** * * @public * @description * Method retrieve all company's directory contact * @param {string} companyId Identifier of company to retrieve * @returns {Promise<{ contacts: DirectoryContact[]; limit: number }>} Resolves with object contaning result of search * @memberof CompanyDirectoryService */ getAllDirectoryContacts(companyId: string): Promise<{ contacts: DirectoryContact[]; limit: number; }>; buildDirectoryCsvBlob(companyId: string): Promise; /** * @public * @description * Methods exports a csv file from specified company directory * @param {string} companyId identifier of company * @returns {Promise<{fileBlob: Blob; fileName: string}>} Resolves with the file blob and name * @memberof CompanyDirectoryService */ exportDirectoryCsvFile(companyId: string): Promise<{ fileBlob: Blob; fileName: string; }>; /** * This API allows users to get an entry of the personal/business directory from its identifier * @private * @description * Retrieve a personal/business directory contact from its identifier AND store it in Contact database * @memberof CompanyDirectoryService * @param {string} id Identifier of contact to retrieve * @param {boolean} forceServer Indicate if the contact must be retrieved from the server instead of the internal cache. * Beware ! It may not be present in the latter and in this case, a request to server is still necessary. * @returns {Promise} Created contact or null if creation failed or Contact id not found */ getDirectoryContactById(id: string, forceServer?: boolean): Promise; private createAndUpdateDirectoryContact; getAvailableShortCodes(companyId: string): Promise<{ type: string; code: string; }[]>; } //# sourceMappingURL=company-directory.service.d.ts.map