UNPKG

@adobe/lightroom-apis

Version:

Adobe Firefly Services library for consuming Lightroom Service APIs.

49 lines (48 loc) 2.19 kB
/************************************************************************* * * ADOBE CONFIDENTIAL * ___________________ * * Copyright 2024 Adobe * All Rights Reserved. * * NOTICE: All information contained herein is, and remains * the property of Adobe and its suppliers, if any. The intellectual * and technical concepts contained herein are proprietary to Adobe * and its suppliers and are protected by all applicable intellectual * property laws, including trade secret and copyright laws. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Adobe. **************************************************************************/ import { ApiResponse } from "@adobe/firefly-services-sdk-core"; import { AsyncJobPromise } from "@adobe/firefly-services-sdk-core/internal"; import { LrJobApiResponse } from "../src/models/LrJobApiResponse"; import { JobStatusLinkResponse } from "../src/models/JobStatusLinkResponse"; type LrJobLinkPromise = Promise<ApiResponse<JobStatusLinkResponse>>; type LrJobStatusFetcher = (...args: any[]) => Promise<ApiResponse<LrJobApiResponse>>; export declare class LrAsyncJobError extends Error { readonly details: JobStatusLinkResponse; constructor(message: string, details: JobStatusLinkResponse); } /** * This is manually created class to handle the async job status for Lightroom APIs */ export declare class LrAsyncJob extends AsyncJobPromise<LrJobApiResponse> { private _jobLinkPromise; private _statusFetcher; private _jobId; constructor(_jobLinkPromise: LrJobLinkPromise, _statusFetcher: LrJobStatusFetcher); protected _fetchJobStatus(): Promise<void>; protected _getNextRetryTimeInMilliSecs(): number; /** * Check the status returned by the server and update the state of the job. * initial state is PENDING * if atleast one output is RUNNING, state is IN_PROGRESS * when all jobs are finished and if any output is FAILED, state is FAILED and error is set * if all outputs are COMPLETED, state is COMPLETED */ private _updateStatus; private ensureJobId; } export {};