UNPKG

@cloudinary/url-gen

Version:

You are invited to influence our new SDK [Click here to view github discussion](https://github.com/cloudinary/js-url-gen/discussions/602) =========================

80 lines (79 loc) 2.99 kB
/** * Class for defining account configuration options. * @constructor Configuration * @param {Object} options - The account configuration parameters to set. * @see <a href="https://cloudinary.com/documentation/solution_overview#configuration_parameters" * target="_new">Available configuration options</a> */ declare class Configuration { private configuration; constructor(options: {}); /** * Initializes the configuration. This method is a convenience method that invokes both * {@link Configuration#fromEnvironment|fromEnvironment()} (Node.js environment only) * and {@link Configuration#fromDocument|fromDocument()}. * It first tries to retrieve the configuration from the environment variable. * If not available, it tries from the document meta tags. * @function Configuration#init * @return {Configuration} returns `this` for chaining * @see fromDocument * @see fromEnvironment */ init(): this; /** * Set a new configuration item * @function Configuration#set * @param {string} name - the name of the item to set * @param {*} value - the value to be set * @return {Configuration} * */ set(name: string | boolean, value: any): this; /** * Get the value of a configuration item * @function Configuration#get * @param {string} name - the name of the item to set * @return {*} the configuration item */ get(name: string): any; merge(config: any): this; /** * Initialize Cloudinary from HTML meta tags. * @function Configuration#fromDocument * @return {Configuration} * @example <meta name="cloudinary_cloud_name" content="mycloud"> * */ fromDocument(): this; /** * Initialize Cloudinary from the `CLOUDINARY_URL` environment variable. * * This function will only run under Node.js environment. * @function Configuration#fromEnvironment * @requires Node.js */ fromEnvironment(): this; /** * Create or modify the Cloudinary client configuration * * Warning: `config()` returns the actual internal configuration object. modifying it will change the configuration. * * This is a backward compatibility method. For new code, use get(), merge() etc. * @function Configuration#config * @param {hash|string|boolean} new_config * @param {string} new_value * @returns {*} configuration, or value * * @see {@link fromEnvironment} for initialization using environment variables * @see {@link fromDocument} for initialization using HTML meta tags */ config(new_config: string, new_value: string): any; /** * Returns a copy of the configuration parameters * @function Configuration#toOptions * @returns {Object} a key:value collection of the configuration parameters */ toOptions(): any; } export declare const CONFIG_PARAMS: string[]; export default Configuration;