diff --git a/src/lib/filelink.spec.ts b/src/lib/filelink.spec.ts index 950d0918..20cbf0f1 100644 --- a/src/lib/filelink.spec.ts +++ b/src/lib/filelink.spec.ts @@ -198,6 +198,11 @@ describe('filelink', () => { expect(filelink.toString()).toBe('https://customDomain.com/DEFAULT_API_KEY/5aYkEQJSQCmYShsoCnZN'); }); + it('should be able to autoImage transformation', () => { + filelink.autoImage(); + expect(filelink.toString()).toBe('https://customDomain.com/DEFAULT_API_KEY/auto_image/5aYkEQJSQCmYShsoCnZN'); + }); + it('should be able to add flip', () => { filelink.flip(); expect(filelink.toString()).toBe('https://customDomain.com/DEFAULT_API_KEY/flip/5aYkEQJSQCmYShsoCnZN'); diff --git a/src/lib/filelink.ts b/src/lib/filelink.ts index 7ba1e596..16b9d126 100644 --- a/src/lib/filelink.ts +++ b/src/lib/filelink.ts @@ -21,6 +21,7 @@ import { getValidator } from './../schema/validator'; import { resolveHost, b64 } from './utils'; import { FilestackError, FilestackErrorType } from './../filestack_error'; import Debug from 'debug'; +import { booleanLiteral } from '@babel/types'; const debug = Debug('fs:filelink'); /** @@ -277,6 +278,10 @@ export interface BorderParams { background?: string; } +export interface CompressParams { + metadata?: boolean; +} + export interface SharpenParams { amount: number; } @@ -721,6 +726,17 @@ export class Filelink { * Transformations part */ + /** + * Add autoimage transformation + * + * @see https://www.filestack.com/docs/api/processing/#auto-image-conversion + * @returns this + * @memberof Filelink + */ + autoImage() { + return this.addTask('auto_image', true); + } + /** * Adds flip transformation * @@ -776,6 +792,17 @@ export class Filelink { return this.addTask('monochrome', true); } + /** + * Add compress transformation + * + * @see https://www.filestack.com/docs/api/processing/#compress + * @returns this + * @memberof Filelink + */ + compress(params?: CompressParams) { + return this.addTask('compress', params || true); + } + /** * Adds negative transformation * diff --git a/src/schema/transforms.schema.ts b/src/schema/transforms.schema.ts index ed384ab4..2ae02d42 100644 --- a/src/schema/transforms.schema.ts +++ b/src/schema/transforms.schema.ts @@ -25,6 +25,10 @@ export const TransformSchema = { type: 'boolean', additionalProperties: false, }, + auto_image: { + type: 'boolean', + additionalProperties: false, + }, no_metadata: { type: 'boolean', additionalProperties: false,