/** * @module DirectorySearch */ import { Service } from '../../services/service'; import { Contact } from '../../models/contact.model'; import { User } from '../../models'; export declare const DIRECTORY_SEARCH_SVC = "DirectorySearchService"; /** * List of different directories in which users or contacts can be searched by name. */ export declare enum DirectoryType { /** * Network of Rainbow users of the logged-in user * This directory type is more of a container than a directory an refers to the network of Rainbow users of the logged-in user. * This network also known as 'roster' contains users who have been explicitly invited by the logged-in user * to share their online status. * No profile feature is required to use this directory. * Any Rainbow user, including those belonging to the default company, can use this directory. */ RAINBOW_USERS_NETWORK = "RAINBOW_USERS_NETWORK", /** * Directory for Rainbow Users. * No profile feature is required to use this directory. * Any Rainbow user, including those belonging to the default company, can use this directory. * The directory scope corresponds to all Rainbow public users and users being in companies visible to the logged-in user. * This visibility depends on that defined for the logged-in user and the company to which he belongs. */ RAINBOW_USERS = "RAINBOW_USERS", /** * Directory for Rainbow Business Contacts. * No profile feature is required to use this directory. * However, a user of a default company cannot use this directory. * A search request will be rejected if this directory cannot be used. */ RAINBOW_BUSINESS_CONTACTS_DIRECTORY = "RAINBOW_BUSINESS_CONTACTS_DIRECTORY", /** * Directory for Rainbow Personal Contacts. * This directory is available only if the user has the profile feature PERSONAL_DIRECTORY. * A user of a default company cannot use this directory either. * A search request will be rejected if this directory cannot be used. */ RAINBOW_PERSONAL_CONTACTS_DIRECTORY = "RAINBOW_PERSONAL_CONTACTS_DIRECTORY", /** * Directory for PBX users. * This directory is available only if the user has the profile feature TELEPHONY_PHONE_BOOK. * A user of a default company cannot use this directory either. * A search request will be rejected if this directory cannot be used. */ RAINBOW_PBX_USERS = "RAINBOW_PBX_USERS", /** * Directory for Microsoft Azure AD users/Microsoft O365 contacts. * This directory is available only if the user has the profile feature MSO365_DIRECTORY_SEARCH. * A user of a default company cannot use this directory either. * A search request will be rejected if this directory cannot be used. */ MICROSOFT_O365_USERS = "MICROSOFT_O365_USERS", /** * Directory for Microsoft Outlook personal contacts. * This directory is available only if the user has the profile feature MSO365_DIRECTORY_SEARCH. * A user of a default company cannot use this directory either. * A search request will be rejected if this directory cannot be used. */ MICROSOFT_OUTLOOK_CONTACTS = "MICROSOFT_OUTLOOK_CONTACTS" } /** * Specified how the company specified in the search option will be managed in the search scope. */ export declare enum CompanyScopeType { /** * Refine the search by specifying that only users in my company are being searched for. */ MY_COMPANY = "MY_COMPANY", /** * Refine the search by excluding users from my company. */ MY_COMPANY_EXCLUDED = "MY_COMPANY_EXCLUDED" } /** * List of parameters associated with the company filter option. */ export interface CompanyOptions { /** * This information indicates how the company criterion will be handled in the search field. * This option is managed differently depending on the directory type, as described below: * - RAINBOW_USERS_NETWORK: This option is not available. * - RAINBOW_USERS: All options defined by CompanyScopeType are available. * - RAINBOW_BUSINESS_CONTACTS_DIRECTORY: Only MY_COMPANY scope type can be specified. * - RAINBOW_PERSONAL_CONTACTS_DIRECTORY: This option is not available. * - MICROSOFT_O365_USERS: This option is not available. * - RAINBOW_PBX_USERS: This option is not available. * - MICROSOFT_OUTLOOK_CONTACTS: This option is not available. * * If the option value is not compatible with the specified directory, the request will be rejected and an error logged. */ companyScope: CompanyScopeType; } /** * List of options for refining the search and specifying the results to be provided. */ export interface DirectorySearchOptions { /** * The number of results to return. * Limit value must be in range [1..100]. Default value is 20. * If the value is not in the authorized range, the request will be rejected and an error logged. */ limit?: number; /** * Allows to search the user/contact on extended fields. [default value=false] * Default value is false. * In addition to the name-fields used by a "basic" search, an extended search will be carried out on addition fields * such as the job title or the company name for example. * The complete list of fields used in a extended search is described below. * This extended search is only available to user having the feature SEARCH_BY_TAGS in their profile. * If this option is set but the user does not have the feature SEARCH_BY_TAGS, the option is ignored and the search is performed in simple mode. * Furthermore, a warning is logged. * This option is managed differently depending on the directory type, as described below: * - RAINBOW_USERS_NETWORK: * The extended search is not available. * - RAINBOW_USERS: * This extended search applies on the following fields: firstName, lastName, company name, job title, department and tags. * - RAINBOW_BUSINESS_CONTACTS_DIRECTORY: * This extended search applies on the following fields: firstName, lastName, company name, job title, department and tags. * - RAINBOW_PERSONAL_CONTACTS_DIRECTORY: * This extended search applies on the following fields: firstName, lastName, company name, job title, department and tags. * - RAINBOW_PBX_USERS: * The extended search is not available. * - MICROSOFT_O365_USERS: * This extended search applies on the following fields: firstName, lastName, company name, job title and department. * - MICROSOFT_OUTLOOK_CONTACTS: * The extended search is not available. */ extendedMode?: boolean; /** * Company filter to refine the search to include or exclude users/contacts of the connected users's company. * Default value is null meaning that no company filter is specified. * This option is only valid for searches in RAINBOW_USERS and RAINBOW_BUSINESS_CONTACTS_DIRECTORY directories. * If the option is specified but not managed for the given directory type, it will be ignored. */ company?: CompanyOptions; } /** * List of data provided as the result of a directory search. */ export interface DirectorySearchResults { /** * The list of users (as User model) matching the search criteria. */ users: User[]; /** * Indicates whether there are more results available. * If this flag is true and the contact/user searched for is not present in the results list, then the user can * - request more results (via 'limit' option) for the same query * - refine the search */ moreResultsAvailable: boolean; } /** * List of data provided as results by an internal directory search service (users, Personal, Company, O365, PBX) implemented in the Web Client. * @internal */ export interface DirectoryInternalSearchResults { /** * contacts The list of items (as Contact model) matching the search criteria. */ contacts: Contact[]; /** * Total number of directory entries matching the criteria * If this total number is not known (e.g. not returned by the server), this field is set to undefined. * NOTE: This information is not managed by DirectorySearch service and NOT returned to the client (SDK, UCaaS) */ total: number | undefined; } export interface DirectorySearchService { /** * This API returns the list of directories that can be used for a search by the logged-in user. * @returns List of directories usable by the logged-in user. */ getAvailableDirectories(): DirectoryType[]; /** * This API allows to search Rainbow users or contacts in a specified directory. * It will finds a users/contacts that match a search criteria applied on names properties; depending on the type of directory. * Search options can be specified for * - Managing the number of expected results. * - Activating the extended search mode. * This mode allows to apply the search on more extensive names fields (than first and last names); depending on the type of directory. * - Refining the search the search by including an additional company criterion to include or exclude users/contacts of a company. * This option is only available for certain directories. * * As a result, the search will return * - An array of results (as User model) depending on the number parameter. * - A flag indicating whether more results are available. * * Notes: * - A search always returns the first N results found. * Results are not paginated, and it is not possible to specify an offset. * - The total number of results is not available. * @param searchPattern - The search criteria * @param directory - The type of directory to be searched * @param options - Options for refining the search and specifying the results to be provided. * @throws Error - In the event of a problem with the options supplied (e.g. their value) or encountered during query processing. */ searchByName(searchPattern: string, directory: DirectoryType, options?: DirectorySearchOptions): Promise; } /** * @internal */ export declare class DirectorySearchServiceRB extends Service implements DirectorySearchService { private mainService; private logger; private errorHelperService; private profileService; private contactService; private directoryService; private office365AdService; private personalDirectoryService; private companyDirectoryService; private phonebookService; private userInDefaultCompany; /** * Returns the DirectorySearch service singleton */ static getInstance(): DirectorySearchServiceRB; static build(): DirectorySearchServiceRB; private constructor(); start(): Promise; stop(): Promise; /** * Check the options (if present) specified in the Directory search request * @param directory - The type of directory to be searched * @param options - The request options to check * @throws Error - In the event of a problem with the options supplied, in particular their value. */ private checkRequestOptions; /** * Initializes some options with default values * Adapt the limit of results to search by changing it to +1. * This will allow us to know if there are more results than requested and thus manage the flag 'moreResultsAvailable' * in the final response to the SDK client. * @param options - The request options to initialze */ private fillInternalSearchOptions; /** * This API returns the list of directories that can be used for a search by the logged-in user. */ getAvailableDirectories(): DirectoryType[]; /** * This API allows to search Rainbow users or contacts in a specified directory. * It will find users/directory contacts that match a search criteria applied on names properties; depending on the type of directory. * Search options can be specified for * - Managing the number of expected results. * - Activating the extended search mode * This mode allows to apply the search on more extensive names fields (than first and last names); depending on the type of directory. * - Refining the search the search by including an additional company criterion to include or exclude users/contacts of a company. * This option is only available for certain directories. * As a result, the search will return * - An array of results (as User model) depending on the number parameter. * - A flag indicating whether more results are available. * Notes: * - A search always returns the first N results found. * Results are not paginated, and it is not possible to specify an offset. * - The total number of results is not available. * @param searchPattern - The search criteria * @param directory - The type of directory to be searched * @param options - Options for refining the search and specifying the results to be provided. * @throws Error - In the event of a problem with the options supplied (e.g. their value) or encountered during query processing. */ searchByName(searchPattern: string, directory: DirectoryType, options?: DirectorySearchOptions): Promise; } //# sourceMappingURL=directorySearch.service.d.ts.map