UNPKG

@cloudinary/url-gen

Version:

Cloudinary URL-Gen SDK ========================= [![Build Status](https://api.travis-ci.com/cloudinary/js-url-gen.svg?branch=master)](https://app.travis-ci.com/github/cloudinary/js-url-gen) ## About The Cloudinary URL-Gen SDK allows you to quickly and eas

38 lines (34 loc) 1.42 kB
'use strict'; var Action = require('./Action-34aa7481.cjs'); var Qualifier = require('./Qualifier-6633a22f.cjs'); var colorSpace = require('./colorSpace-e71e2b55.cjs'); var internalConstants = require('./internalConstants-06bd58ae.cjs'); /** * @description Specifies the color space to use. * @memberOf Actions.Delivery * @extends SDK.Action * @see Visit {@link Actions.Delivery|Delivery} for an example */ class DeliveryColorSpaceAction extends Action.Action { /** * Create a new DeliveryColorSpaceAction * @param mode */ constructor(mode) { super(); this._actionModel = {}; this._actionModel = { actionType: 'colorSpace', mode: (internalConstants.COLOR_SPACE_MODE_TO_COLOR_SPACE_MODEL_MODE_MAP[mode] || mode) }; this.addQualifier(new Qualifier.Qualifier('cs', colorSpace.ColorSpace[mode] ? colorSpace.ColorSpace[mode]() : mode)); } static fromJson(actionModel) { const { mode } = actionModel; const colorSpaceMode = internalConstants.COLOR_SPACE_MODEL_MODE_TO_COLOR_SPACE_MODE_MAP[mode] || mode; // We are using this() to allow inheriting classes to use super.fromJson.apply(this, [actionModel]) // This allows the inheriting classes to determine the class to be created return new this(colorSpaceMode); } } exports.DeliveryColorSpaceAction = DeliveryColorSpaceAction;