import { GenericService } from "./GenericService"; export {}; import { Logger } from "../common/Logger"; import { Contact } from "../common/models/Contact"; import { EventEmitter } from "events"; import { Core } from "../Core"; declare class GroupsService extends GenericService { private _groups; static getClassName(): string; getClassName(): string; static getAccessorName(): string; getAccessorName(): string; constructor(_core: Core, _eventEmitter: EventEmitter, _logger: Logger, _startConfig: { start_up: boolean; optional: boolean; }); start(_options: any): Promise; stop(): Promise; init(useRestAtStartup: boolean): Promise; /** * @public * @nodered true * @method createGroup * @instance * @param {string} name The name of the group to create * @param {string} comment The comment of the group to create * @param {boolean} isFavorite If true, the group is flagged as favorite * @description * Create a new group
* @async * @category Groups MANAGEMENT * @return {Promise} The result * @fulfil {Group} - Created group object or an error object depending on the result * @category async */ createGroup(name: string, comment: string, isFavorite: boolean): Promise; /** * @public * @nodered true * @method deleteGroup * @instance * @param {Object} group The group to delete * @description * Delete an owned group
* @async * @category Groups MANAGEMENT * @return {Promise} The result * @fulfil {Group} - Deleted group object or an error object depending on the result * @category async */ deleteGroup(group: any): Promise; /** * @public * @nodered true * @method deleteAllGroups * @instance * @async * @category Groups MANAGEMENT * @description * Delete all existing owned groups
* Return a promise
* @return {Object} Nothing or an error object depending on the result */ deleteAllGroups(): Promise; /** * @public * @nodered true * @method updateGroupName * @instance * @async * @category Groups MANAGEMENT * @param {Object} group The group to update * @param {string} name The new name of the group * @description * Update the name of a group
* @return {Promise} The result * @fulfil {Group} - Updated group object or an error object depending on the result * @category async */ updateGroupName(group: any, name: string): Promise; /** * @public * @nodered true * @method updateGroupComment * @instance * @async * @category Groups MANAGEMENT * @param {Object} group The group to update * @param {string} comment The new comment of the group * @description * Update the comment of a group
* @return {Promise} The result * @fulfil {Group} - Updated group object or an error object depending on the result * @category async */ updateGroupComment(group: any, comment: string): Promise; /** * @private * @category Groups MANAGEMENT * @description * Internal method
*/ getGroups(): Promise; /** * @public * @nodered true * @method setGroupAsFavorite * @since 1.67.0 * @async * @category Groups MANAGEMENT * @instance * @param {Object} group The group * @description * Set a group as a favorite one of the curent loggued in user.
* @return {Promise} The result * @fulfil {Group} - Updated group or an error object depending on the result * @category async */ setGroupAsFavorite(group: any): Promise; /** * @public * @nodered true * @method unsetGroupAsFavorite * @since 1.67.0 * @category Groups MANAGEMENT * @async * @instance * @param {Object} group The group * @description * Remove the favorite state of a group of the curent loggued in user.
* @return {Promise} The result * @fulfil {Group} - Updated group or an error object depending on the result * @category async */ unsetGroupAsFavorite(group: any): Promise; /** * @public * @nodered true * @method getAll * @category Groups MANAGEMENT * @instance * @return {Array} The list of existing groups with following fields: id, name, comment, isFavorite, owner, creationDate, array of users in the group * @description * Return the list of existing groups
*/ getAll(): any; /** * @public * @nodered true * @method getFavoriteGroups * @category Groups MANAGEMENT * @instance * @return {Array} The list of favorite groups with following fields: id, name, comment, isFavorite, owner, creationDate, array of users in the group * @description * Return the list of favorite groups
*/ getFavoriteGroups(): any; /** * @public * @nodered true * @method getGroupById * @category Groups MANAGEMENT * @instance * @async * @param {String} id group Id of the group to found * @return {Promise} The group found if exist or undefined * @description * Return a group by its id
*/ getGroupById(id: string, forceServerSearch?: boolean): Promise; /** * @public * @nodered true * @method getGroupByName * @category Groups MANAGEMENT * @instance * @async * @param {String} name Name of the group to found * @param {boolean} forceServerSearch=false force the update from server. * @return {Promise} The group found if exist or undefined * @description * Return a group by its id
*/ getGroupByName(name: string, forceServerSearch?: boolean): Promise; /** * @public * @nodered true * @method addUserInGroup * @instance * @async * @category Groups USERS * @param {Contact} contact The user to add in group * @param {Object} group The group * @description * Add a contact in a group
* @return {Promise} The result * * * | Champ | Type | Description | * | --- | --- | --- | * | data | Object | Group Object. | * | id | String | Group unique identifier. | * | name | String | Group name. | * | comment | String | Group comment. | * | isFavorite | Boolean | Is group flagged as favorite. | * | owner | String | Rainbow Id of group owner. | * | creationDate | Date-Time | Creation date of the group (read only, set automatically during group creation). | * | users | String\[\] | List of Rainbow users being in the group. | * * @fulfil {Group} - Updated group with the new contact added or an error object depending on the result * @category async */ addUserInGroup(contact: Contact, group: any): Promise; /** * @public * @nodered true * @method removeUserFromGroup * @instance * @async * @category Groups USERS * @param {Contact} contact The user to remove from the group * @param {Object} group The destination group * @description * Remove a contact from a group
* @return {Promise} The result * @fulfil {Group} - Updated group without the removed contact or an error object depending on the result * @category async */ removeUserFromGroup(contact: Contact, group: any): Promise; /** * @private * @method _onGroupCreated * @instance * @param {Object} data Contains the groupId of the created group * @description * Method called when a group is created
*/ _onGroupCreated(data: any): Promise; /** * @private * @method _onGroupDeleted * @instance * @param {Object} data Contains the groupId of the deleted group * @description * Method called when a group is deleted
*/ _onGroupDeleted(data: any): Promise; /** * @private * @method _onGroupUpdated * @instance * @param {Object} data Contains the groupId of the updated group * @description * Method called when a group is updated (name, comment, isFavorite)
*/ _onGroupUpdated(data: any): Promise; /** * @private * @method _onUserAddedInGroup * @instance * @param {Object} data Contains the groupId and the userId * @description * Method called when a user is added to a group
*/ _onUserAddedInGroup(data: any): Promise; /** * @private * @method _onUserRemovedFromGroup * @instance * @param {Object} data Contains the groupId and the userId * @description * Method called when a user is removed from a group
*/ _onUserRemovedFromGroup(data: any): Promise; } export { GroupsService as GroupsService };