/** * Represents the result of a share operation. */ import { EntityShareRequest } from '../../icc-api/model/requests/EntityShareRequest'; import RequestedPermissionEnum = EntityShareRequest.RequestedPermissionEnum; export interface ShareResult { /** * Return the updated entity if the share operation was successful, else throw an error. */ get updatedEntityOrThrow(): T; /** * Map the result of a successful share operation to another type. * @param f The mapping function. * @return If the share result was successful a new share result containing the result of the mapping function, else the original share result. */ mapSuccess(f: (t: T) => U): ShareResult; /** * Async version of {@link mapSuccess}. */ mapSuccessAsync(f: (t: T) => Promise): Promise>; } /** * Represents the result of a successful share operation. */ export declare class ShareResultSuccess implements ShareResult { private readonly updatedEntity; /** * @param updatedEntity The entity with updated encrypted metadata. */ constructor(updatedEntity: T); get updatedEntityOrThrow(): T; mapSuccess(f: (t: T) => U): ShareResult; mapSuccessAsync(f: (t: T) => Promise): Promise>; } /** * Represents the result of a failed share operation. */ export declare class ShareResultFailure implements ShareResult { readonly errorsDetails: { entityId: string; delegateId: string; request?: { shareSecretIds?: string[]; shareEncryptionKeys?: string[]; shareOwningEntityIds?: string[]; requestedPermissions: RequestedPermissionEnum; }; updatedForMigration: boolean; code?: number; reason?: string; }[]; readonly message: string; /** * @param errorsDetails Details of the errors, as returned by the server. * @param message Human-friendly error message, should provide additional context that the server may not have had, for example if the original user * request was modified by the crypto API for migration purposes. */ constructor(errorsDetails: { entityId: string; delegateId: string; request?: { shareSecretIds?: string[]; shareEncryptionKeys?: string[]; shareOwningEntityIds?: string[]; requestedPermissions: RequestedPermissionEnum; }; updatedForMigration: boolean; code?: number; reason?: string; }[], message: string); get updatedEntityOrThrow(): never; mapSuccess(f: (t: never) => U): ShareResult; mapSuccessAsync(f: (t: never) => Promise): Promise>; }