/** @packageDocumentation * @module iModelHubClient */ import { GuidString } from "@bentley/bentleyjs-core"; import { AuthorizedClientRequestContext, WsgInstance } from "@bentley/itwin-client"; import { IModelBaseHandler } from "./BaseHandler"; import { InstanceIdQuery } from "./HubQuery"; /** Thumbnail size. 'Small' is 400x250 PNG image and 'Large' is a 800x500 PNG image. * @public */ export declare type ThumbnailSize = "Small" | "Large"; /** Base class for Thumbnails. * @public */ export declare abstract class Thumbnail extends WsgInstance { id?: GuidString; } /** Small [[Thumbnail]] class. Small Thumbnail is a 400x250 PNG image. * @public */ export declare class SmallThumbnail extends Thumbnail { } /** Large [[Thumbnail]] class. Large Thumbnail is a 800x500 PNG image. * @public */ export declare class LargeThumbnail extends Thumbnail { } /** Tip [[Thumbnail]] download parameters. See [[ThumbnailHandler.download]]. Tip Thumbnail is generated for the periodically updated master file copy on iModelHub. * @public */ export interface TipThumbnail { /** Id of the iModel's context ([[Project]] or [[Asset]]). */ contextId: string; /** Size of the [[Thumbnail]]. */ size: ThumbnailSize; } /** * Query object for getting [[Thumbnail]]s. You can use this to modify the [[ThumbnailHandler.get]] results. * @public */ export declare class ThumbnailQuery extends InstanceIdQuery { /** * Query [[Thumbnail]]s by [[Version]] id. * @param versionId Id of the version. * @returns This query. * @throws [[IModelHubClientError]] with [IModelHubStatus.UndefinedArgumentError]($bentley) or [IModelHubStatus.InvalidArgumentError]($bentley) if versionId is undefined or it is not a valid [GuidString]($bentley) value. * @internal @deprecated */ byVersionId(versionId: GuidString): this; } /** * Handler for retrieving [[Thumbnail]]s. Use [[IModelClient.Thumbnails]] to get an instance of this class. * @public */ export declare class ThumbnailHandler { private _handler; /** * Constructor for ThumbnailHandler. * @param handler Handler for WSG requests. * @internal */ constructor(handler: IModelBaseHandler); /** Get relative url for tip Thumbnail requests. * @param contextId Id of the context ([[Project]] or [[Asset]]). * @param iModelId Id of the iModel. See [[HubIModel]]. * @param size Size of the thumbnail. */ private getRelativeContextUrl; /** Get relative url for Thumbnail requests. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param size Size of the thumbnail. * @param thumbnailId Id of the thumbnail. */ private getRelativeUrl; /** Check if given thumbnail is TipThumbnail. * @param thumbnail SmallThumbnail, LargeThumbnail or TipThumbnail. */ private isTipThumbnail; /** Download the thumbnail. * @param requestContext The client request context. * * @param url Url to download thumbnail. * @return String for the PNG image that includes the base64 encoded array of the image bytes */ private downloadThumbnail; /** Download the latest iModel's thumbnail. * @param requestContext The client request context. * @param contextId Id of the iTwin context. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param size Size of the thumbnail. Pass 'Small' for 400x250 PNG image, and 'Large' for a 800x500 PNG image. * @return String for the PNG image that includes the base64 encoded array of the image bytes. */ private downloadTipThumbnail; /** Get the [[Thumbnail]]s. Returned Thumbnails are ordered from the latest [[ChangeSet]] to the oldest. * @param requestContext The client request context. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param size Size of the thumbnail. * @param query Optional query object to filter the queried Thumbnails. * @return Array of Thumbnails of the specified size that match the query. * @throws [Common iModelHub errors]($docs/learning/iModelHub/CommonErrors) */ get(requestContext: AuthorizedClientRequestContext, iModelId: GuidString, size: ThumbnailSize, query?: ThumbnailQuery): Promise; /** Download a [[Thumbnail]]. * @param requestContext The client request context. * @param iModelId Id of the iModel. See [[HubIModel]]. * @param thumbnail Small, Large or Tip thumbnail. Use [[ThumbnailHandler.get]] to get a [[SmallThumbnail]] or [[LargeThumbnail]] instance or provide Tip thumbnail information by constructing a [[TipThumbnail]] instance. * @return Base64 encoded string containing the PNG image. * @throws Error if a successful server response contains no content. * @throws [[IModelHubClientError]] with [IModelHubStatus.UndefinedArgumentError]($bentley) or [IModelHubStatus.InvalidArgumentError]($bentley) if one of the arguments is undefined or has an invalid value. * @throws [[ResponseError]] if a network issue occurs. */ download(requestContext: AuthorizedClientRequestContext, iModelId: GuidString, thumbnail: Thumbnail | TipThumbnail): Promise; } //# sourceMappingURL=Thumbnails.d.ts.map