// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class Download extends APIResource { /** * Retrieve the status and the url of a batch download assets request */ getStatus( jobID: string, query: DownloadGetStatusParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/assets/download/${jobID}`, { query, ...options }); } /** * Request a link to download the given `assetId` in the given `targetFormat` */ request( assetID: string, params: DownloadRequestParams, options?: RequestOptions, ): APIPromise { const { projectId, ...body } = params; return this._client.post(path`/assets/${assetID}/download`, { query: { projectId }, body, ...options }); } /** * Request a link to batch download assets (batch limited to 1000 assets) */ requestBatch( params: DownloadRequestBatchParams, options?: RequestOptions, ): APIPromise { const { projectId, ...body } = params; return this._client.post('/assets/download', { query: { projectId }, body, ...options }); } } export interface DownloadGetStatusResponse { /** * The job id associated with the download request */ jobId: string; /** * The current job status */ jobStatus: string; /** * The download url */ downloadUrl?: string; } export interface DownloadRequestResponse { /** * The signed URL to download the asset in the given format */ url: string; } export interface DownloadRequestBatchResponse { /** * The job id associated with the download request */ jobId: string; } export interface DownloadGetStatusParams { /** * The projectId used for ownership resource management. Either to assert ownership * or to set the owner of the resource(s) */ projectId?: string; } export interface DownloadRequestParams { /** * Query param: The projectId used for ownership resource management. Either to * assert ownership or to set the owner of the resource(s) */ projectId?: string; /** * Body param: The format to download the asset in */ targetFormat?: | 'gif' | 'heif' | 'jpeg' | 'jpg' | 'png' | 'svg' | 'webp' | 'avif' | 'tif' | 'tiff' | 'glb' | 'fbx' | 'obj'; } export interface DownloadRequestBatchParams { /** * Body param */ options: DownloadRequestBatchParams.Options; /** * Body param */ query: DownloadRequestBatchParams.Query; /** * Query param: The projectId used for ownership resource management. Either to * assert ownership or to set the owner of the resource(s) */ projectId?: string; } export namespace DownloadRequestBatchParams { export interface Options { /** * A file naming convention as a string with the following available parameters: * (seed used to generate the asset) (index of the asset in the * inference) (prompt of the inference) (prompt of the * generator) Example: "---" */ fileNameTemplate: string; /** * Flag to prevent grouping assets in directories and store them flat */ flat?: boolean; } export interface Query { /** * Every individual assets specified will be included in the archive */ assetIds: Array; /** * All assets issued from the provided inference ids will be included in the * archive */ inferenceIds: Array; /** * All assets issued from the provided model ids will be included in the archive */ modelIds: Array; } } export declare namespace Download { export { type DownloadGetStatusResponse as DownloadGetStatusResponse, type DownloadRequestResponse as DownloadRequestResponse, type DownloadRequestBatchResponse as DownloadRequestBatchResponse, type DownloadGetStatusParams as DownloadGetStatusParams, type DownloadRequestParams as DownloadRequestParams, type DownloadRequestBatchParams as DownloadRequestBatchParams, }; }