@itwin/access-control-client
Version:
Access control client for the iTwin platform
61 lines • 3.4 kB
TypeScript
/** @packageDocumentation
* @module AccessControlClient
*/
import type { AccessToken } from "@itwin/core-bentley";
import type { IITwinSharesClient } from "../accessControlClientInterfaces/ItwinSharesClient";
import type { BentleyAPIResponse } from "../types/CommonApiTypes";
import type { MultiShareContractResponse, ShareContract, SingleShareContractResponse } from "../types/ShareContract";
import { BaseClient } from "./BaseClient";
/** Client API to perform iTwin share operations.
* @beta
*/
export declare class ITwinSharesClient extends BaseClient implements IITwinSharesClient {
/** Create a new ITwinSharesClient instance
* @param url Optional base URL for the access control service. If not provided, defaults to base url.
*/
constructor(url?: string);
/** Create a new iTwin share
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param iTwinShare The details of the iTwin share to be created
* @remarks
* #### Create
* Creating an iTwin Share allows your iTwin to be publicly accessible, enabling anyone with the `shareKey` to view its data without needing to sign in. To use a share, take the value of the `shareKey` property and prepend it with the `Basic` prefix in the authorization header of your request.
*
* #### Share Contract
* Each share is governed by a share contract that specifies the APIs available for the share and its associated iTwin.
* Only an iTwin admin can create iTwin Shares, and only a maximum of 10 shares can be active at a time per application that created it.
* The share contract expires after 90 days unless a shorter expiration is specified in the request body, with 90 days being the maximum duration. If the expiration property in the request body is left empty, it will default to the maximum duration from the moment of creation.
* A share can be revoked at any time using the Revoke iTwin Share endpoint.
* @returns ITwin Share
* @beta
*/
createITwinShare(accessToken: AccessToken, iTwinId: string, iTwinShare: Partial<Pick<ShareContract, "shareContract"> & {
expiration: string | null;
}>): Promise<BentleyAPIResponse<SingleShareContractResponse>>;
/** Get iTwin share
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param sharedId The id of the iTwin share to be retrieved
* @returns The iTwin share details
* @beta
*/
getITwinShare(accessToken: AccessToken, iTwinId: string, sharedId: string): Promise<BentleyAPIResponse<SingleShareContractResponse>>;
/** Get iTwin shares
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param sharedId The id of the iTwin share to be retrieved
* @returns The iTwin share details
* @beta
*/
getITwinShares(accessToken: AccessToken, iTwinId: string): Promise<BentleyAPIResponse<MultiShareContractResponse>>;
/** Revoke iTwin share
* @param accessToken The client access token string
* @param iTwinId The id of the iTwin
* @param sharedId The id of the iTwin share to be revoked
* @returns No Content
* @beta
*/
revokeITwinShare(accessToken: AccessToken, iTwinId: string, sharedId: string): Promise<BentleyAPIResponse<undefined>>;
}
//# sourceMappingURL=ItwinShares.d.ts.map