@adobe/lightroom-apis
Version:
Adobe Firefly Services library for consuming Lightroom Service APIs.
165 lines (164 loc) • 6.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LightroomAsyncClient = void 0;
const internal_1 = require("@adobe/firefly-services-sdk-core/internal");
// Package.json import for package details
const package_json_1 = require("./../package.json");
/**
* LightroomAsyncClient
* LightroomAsync API client to use the LightroomAsync API services
*/
class LightroomAsyncClient extends internal_1.BaseServiceClient {
constructor(config) {
const urlMap = new Map([["production", "https://image.adobe.io"]]);
const environment = config.serviceEnvironment
? config.serviceEnvironment
: internal_1.BaseServiceClient.getEnvFromVersion(package_json_1.version);
const internalConfig = Object.assign(Object.assign({}, config), { baseUrl: internal_1.BaseServiceClient.getBaseUrl(urlMap, environment) });
super(internalConfig);
/**
* Get Status API
* Get job status of a Lightroom job
* @param jobId The job to get status for
* @param options Additional options to send any additional data or cancel the request
* @returns LrJobApiResponse Job status
* @throws {ApiError}
*/
this.lrJobStatus = (jobId, options) => {
return this._httpRequest.request({
method: "GET",
url: "/lrService/status/{jobId}",
path: {
jobId
},
signal: options === null || options === void 0 ? void 0 : options.signal
});
};
}
/**
* Auto Straighten API
* Auto Straighten an image. Applies the Auto Upright transformation on an image
* @param requestBody Request body for auto straighten api
* @param options Additional options to send any additional data or cancel the request
* @returns JobStatusLinkResponse response
* @throws {ApiError}
*/
autoStraightenImageAsync(requestBody, options) {
return this._httpRequest.request({
method: "POST",
url: "/lrService/autoStraighten",
body: requestBody,
mediaType: "application/json",
errors: {
400: `InputValidationError`,
402: `Trial Limit Exceeded Error`,
403: `Unauthorized`,
404: `Requested resource was not found`,
409: `Unable to upload asset`,
410: `Asset Link Invalid`
},
signal: options === null || options === void 0 ? void 0 : options.signal
});
}
/**
* Auto Tone API
* Automatically correct exposure, contrast, sharpness, saturation on an image
* @param requestBody Request body for applyAutoTone api
* @param options Additional options to send any additional data or cancel the request
* @returns JobStatusLinkResponse response
* @throws {ApiError}
*/
applyAutoToneAsync(requestBody, options) {
return this._httpRequest.request({
method: "POST",
url: "/lrService/autoTone",
body: requestBody,
mediaType: "application/json",
errors: {
400: `InputValidationError`,
402: `Trial Limit Exceeded Error`,
403: `Unauthorized`,
404: `Requested resource was not found`,
409: `Unable to upload asset`,
410: `Asset Link Invalid`
},
signal: options === null || options === void 0 ? void 0 : options.signal
});
}
/**
* Apply Lightroom Edits API
* Apply one or more Lightroom edits ( exposure, contrast, sharpness, saturation ) to an image.
* @param requestBody Request body for edit api
* @param options Additional options to send any additional data or cancel the request
* @returns JobStatusLinkResponse response
* @throws {ApiError}
*/
applyEditsAsync(requestBody, options) {
return this._httpRequest.request({
method: "POST",
url: "/lrService/edit",
body: requestBody,
mediaType: "application/json",
errors: {
400: `InputValidationError`,
402: `Trial Limit Exceeded Error`,
403: `Unauthorized`,
404: `Requested resource was not found`,
409: `Unable to upload asset`,
410: `Asset Link Invalid`
},
signal: options === null || options === void 0 ? void 0 : options.signal
});
}
/**
* Apply Lightroom Presets API
* Apply one or more XMP Lightroom presets to the given image, by using the given preset XMP file(s).
* @param requestBody Request body for presets api
* @param options Additional options to send any additional data or cancel the request
* @returns JobStatusLinkResponse response
* @throws {ApiError}
*/
applyPresetAsync(requestBody, options) {
return this._httpRequest.request({
method: "POST",
url: "/lrService/presets",
body: requestBody,
mediaType: "application/json",
errors: {
400: `InputValidationError`,
402: `Trial Limit Exceeded Error`,
403: `Unauthorized`,
404: `Requested resource was not found`,
409: `Unable to upload asset`,
410: `Asset Link Invalid`
},
signal: options === null || options === void 0 ? void 0 : options.signal
});
}
/**
* Add XMP to Image API
* Apply XMP based Lightroom preset to an image. XMP content is passed inline to the api.
* @param requestBody Request body for xmp api
* @param options Additional options to send any additional data or cancel the request
* @returns JobStatusLinkResponse response
* @throws {ApiError}
*/
applyPresetFromXmpContentAsync(requestBody, options) {
return this._httpRequest.request({
method: "POST",
url: "/lrService/xmp",
body: requestBody,
mediaType: "application/json",
errors: {
400: `InputValidationError`,
402: `Trial Limit Exceeded Error`,
403: `Unauthorized`,
404: `Requested resource was not found`,
409: `Unable to upload asset`,
410: `Asset Link Invalid`
},
signal: options === null || options === void 0 ? void 0 : options.signal
});
}
}
exports.LightroomAsyncClient = LightroomAsyncClient;