@cloudinary/url-gen
Version:
Cloudinary URL-Gen SDK ========================= [](https://app.travis-ci.com/github/cloudinary/js-url-gen) ## About The Cloudinary URL-Gen SDK allows you to quickly and eas
37 lines (33 loc) • 1.45 kB
JavaScript
;
var Action = require('./Action-34aa7481.cjs');
var FormatQualifier = require('./FormatQualifier-ffbb8eb3.cjs');
var Qualifier = require('./Qualifier-6633a22f.cjs');
var internalConstants = require('./internalConstants-4e8f184f.cjs');
/**
* @description Qualifies the delivery of an asset.
* @memberOf Actions.Delivery
* @extends SDK.Action
*/
class DeliveryAction extends Action.Action {
/**
* @param {string} deliveryKey A generic Delivery Action Key (such as q, f, dn, etc.)
* @param {string} deliveryType A Format Qualifiers for the action, such as Quality.auto()
* @param {string} modelProperty internal model property of the action, for example quality uses `level` while dpr uses `density`
* @see Visit {@link Actions.Delivery|Delivery} for an example
*/
constructor(deliveryKey, deliveryType, modelProperty) {
super();
this._actionModel = {};
let deliveryTypeValue;
if (deliveryType instanceof FormatQualifier.FormatQualifier) {
deliveryTypeValue = deliveryType.getValue();
}
else {
deliveryTypeValue = deliveryType;
}
this._actionModel.actionType = internalConstants.DELIVERY_MODE_TO_ACTION_TYPE_MAP[deliveryKey];
this._actionModel[modelProperty] = deliveryTypeValue;
this.addQualifier(new Qualifier.Qualifier(deliveryKey, deliveryType));
}
}
exports.DeliveryAction = DeliveryAction;