@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
151 lines (150 loc) • 6.47 kB
TypeScript
import { MapNumberTo, MapStringTo, NullableResultPromise } from "../base-types";
import { IEntity } from "../contracts/base/entity";
import { EntityLoadConfiguration } from "../contracts/querying/entity-load-configuration";
import { IExtendedContentHubClient } from "./extended-client";
export interface IUsersClient {
/**
* Gets the id of the specified user by username.
*
* @param username - The user name
*/
getUserIdAsync(username: string): NullableResultPromise<number>;
/**
* Gets the ids of the specified users by username.
*
* @param usernames - A list of user names
* @returns Array of IDs of type MapStringTo<number>.
*/
getUsernamesToIdsMapAsync(usernames: Array<string>): Promise<MapStringTo<number>>;
/**
* Gets the ids of the specified users by username.
* @param usernames - A list of user names
* @returns Array of IDs of type Array<number> or null.
*/
getUserIdsAsync(usernames: Array<string>): NullableResultPromise<Array<number>>;
/**
* Gets the username of the specified user.
*
* @param id - The id of the user
*/
getUsernameAsync(id: number): NullableResultPromise<string>;
/**
* Gets the usernames of the specified users.
*
* @param ids - The ids of the entities to get
*/
getUsernamesAsync(ids: Array<number>): Promise<MapNumberTo<string>>;
/**
* Gets the specified user entity.
*
* @param id - The id of the user
* @param loadConfiguration - The load configuration
*/
getUserAsync(id: number, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<IEntity>;
/**
* Gets the specified user entities.
*
* @param username - Username of the user
* @param loadConfiguration - The load configuration
*/
getUserAsync(username: string, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<IEntity>;
/**
* Gets the specified user entities.
*
* @param ids - The ids of the users
* @param loadConfiguration - The load configuration
*/
getUsersAsync(ids: Array<number>, loadConfiguration: EntityLoadConfiguration): Promise<Array<IEntity>>;
/**
* Gets the specified user entities.
*
* @param usernames - A list of user names
* @param loadConfiguration - The load configuration
*/
getUsersAsync(usernames: Array<string>, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<Array<IEntity>>;
/**
* Gets the id of the specified user group by name.
*
* @param groupName - The groupName name
*/
getUserGroupIdAsync(groupName: string): NullableResultPromise<number>;
/**
* Gets the ids of the specified user groups by name.
*
* @param groupNames - A list of group names
*/
getUserGroupIdsAsync(groupNames: Array<string>): Promise<MapStringTo<number>>;
/**
* Gets the name of the specified user group
*
* @param number - The id of the user group
*/
getUserGroupNameAsync(id: number): NullableResultPromise<string>;
/**
* Gets the name of the specified user groups.
*
* @param ids - The ids of user groups
*/
getUserGroupNamesAsync(ids: Array<number>): Promise<MapNumberTo<string>>;
/**
* Gets the specified user group entity.
*
* @param id - Id of the user
* @param loadConfiguration - The load configuration
*/
getUserGroupAsync(id: number, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<IEntity>;
/**
* Gets the specified user group entity.
*
* @param groupName - Name of the group
* @param loadConfiguration - The load configuration
*/
getUserGroupAsync(groupName: string, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<IEntity>;
/**
* Gets the specified user group entities.
*
* @param ids - The ids of the user groups
* @param loadConfiguration - The load configuration
*/
getUserGroupsAsync(ids: Array<number>, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<Array<IEntity>>;
/**
* Gets the specified user group entities.
*
* @param groupNames - The names of the user groups
* @param loadConfiguration - The load configuration
*/
getUserGroupsAsync(groupNames: Array<string>, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<Array<IEntity>>;
/**
* Changes the password of the specified user.
*
* @param id - The user id to change the password on
* @param password - The password to reset
*/
setPasswordAsync(id: number, password: string): Promise<void>;
/**
* Resets the password of the specified user.
* This sends an e-mail to the specified user with a link to choose a new password.
*
* @param id - Id of the user
*/
resetPasswordAsync(id: number): Promise<void>;
}
export declare class UsersClient implements IUsersClient {
protected readonly _client: IExtendedContentHubClient;
constructor(client: IExtendedContentHubClient);
getUserIdAsync(username: string): NullableResultPromise<number>;
getUserIdsAsync(usernames: Array<string>): NullableResultPromise<Array<number>>;
getUsernamesToIdsMapAsync(usernames: Array<string>): Promise<MapStringTo<number>>;
getUsernameAsync(id: number): NullableResultPromise<string>;
getUsernamesAsync(ids: Array<number>): Promise<MapNumberTo<string>>;
getUserAsync(param: string | number, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<IEntity>;
getUsersAsync(param: Array<number> | Array<string>, loadConfiguration: EntityLoadConfiguration): Promise<Array<IEntity>>;
getUserGroupIdAsync(groupName: string): NullableResultPromise<number>;
getUserGroupIdsAsync(groupNames: Array<string>): Promise<MapStringTo<number>>;
getUserGroupNameAsync(id: number): NullableResultPromise<string>;
getUserGroupNamesAsync(ids: Array<number>): Promise<MapNumberTo<string>>;
getUserGroupAsync(param: string | number, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<IEntity>;
getUserGroupsAsync(param: Array<number> | Array<string>, loadConfiguration: EntityLoadConfiguration): NullableResultPromise<Array<IEntity>>;
setPasswordAsync(id: number, password: string): Promise<void>;
resetPasswordAsync(id: number): Promise<void>;
}