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

43 lines (42 loc) 1.21 kB
import { ALLOWED_CLOUD_CONFIG } from "../internal/internalConstants.js"; import Config from "./BaseConfig.js"; class CloudConfig extends Config { /** * @param {ICloudConfig} userCloudConfig {@link ICloudConfig} * */ constructor(userCloudConfig) { super(); const cloudConfig = this.filterOutNonSupportedKeys(userCloudConfig, ALLOWED_CLOUD_CONFIG); Object.assign(this, cloudConfig); if (!this.cloudName) { throw 'Missing mandatory field cloudName'; } } extend(userCloudConfig) { const cloudConfig = this.filterOutNonSupportedKeys(userCloudConfig, ALLOWED_CLOUD_CONFIG); return new CloudConfig(Object.assign({}, this, cloudConfig)); } /** * @param {string} value Sets the CloudName */ setCloudName(value) { this.cloudName = value; return this; } /** * @param {string} value Sets the API Key */ setApiKey(value) { this.apiKey = value; return this; } /** * @param {string} value Sets the API Secret */ setApiSecret(value) { this.apiSecret = value; return this; } } export default CloudConfig;