@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
48 lines (47 loc) • 1.82 kB
TypeScript
import { NullableResultPromise } from "../base-types";
import { IPolicy } from "../contracts/policies/policy";
import { IUserGroupPolicy } from "../contracts/policies/user-group-policy";
import { IUserPolicy } from "../contracts/policies/user-policy";
import { IExtendedContentHubClient } from "./extended-client";
/**
* Contains functionality to get and update policies.
*/
export interface IPoliciesClient {
/**
* Gets the policy from specified user.
*
* @remarks
* The specified user group id must be a strictly positive number.
*
* @param userGroupId - Id of the user group to get the policy from
* @returns The policy or null when it was not found.
*/
getUserGroupPolicyAsync(userGroupId: number): NullableResultPromise<IUserGroupPolicy>;
/**
* Gets the policy from specified user.
*
* @remarks
* The specified user id must be a strictly positive number.
*
* @param userId - Id of the user to get the policy from
* @returns The policy or null when it was not found.
*/
getUserPolicyAsync(userId: number): NullableResultPromise<IUserPolicy>;
/**
* Updates the specified policy.
*
* @remarks
* Throws an error when the policy could not be saved because a validation error occurred.
*
* @param policy - The policy to update
*/
updateAsync(policy: IPolicy): Promise<void>;
}
export declare class PoliciesClient implements IPoliciesClient {
private readonly _client;
constructor(client: IExtendedContentHubClient);
getUserGroupPolicyAsync(userGroupId: number): NullableResultPromise<IUserGroupPolicy>;
getUserPolicyAsync(userId: number): NullableResultPromise<IUserPolicy>;
updateAsync(policy: IPolicy): Promise<void>;
private getPolicyResourceAsync;
}