/** Module: ScriptProperties */ type ScriptProperties = typeof ScriptProperties; declare namespace ScriptProperties { /** * Deletes all properties. * *
* ScriptProperties.deleteAllProperties();
*
*
* @returns this object, for chaining
*/
function deleteAllProperties(): ScriptProperties
/**
* Deletes the property with the given key.
*
*
* ScriptProperties.deleteProperty('special');
*
*
* @param key - key for property to delete
*
* @returns this object, for chaining
*/
function deleteProperty(
key: string
): ScriptProperties
/**
* Get all of the available keys.
*/
function getKeys(): string[]
/**
* Get all of the available properties at once.
*
* This gives a copy, not a live view, so changing the properties on the returned object won't * update them in storage and vice versa. * *
* ScriptProperties.setProperties({
* "cow" : "moo",
* "sheep" : "baa",
* "chicken" : "cluck"
* });
*
* // Logs "A cow goes: moo"
* Logger.log("A cow goes: %s", ScriptProperties.getProperty("cow"));
*
* // This makes a copy. Any changes that happen here will not
* // be written back to properties.
* var animalSounds = ScriptProperties.getProperties();
*
* // Logs:
* // A chicken goes cluck!
* // A cow goes moo!
* // A sheep goes baa!
* for(var kind in animalSounds) {
* Logger.log("A %s goes %s!", kind, animalSounds[kind]);
* }
*
*
* @returns a copy of the properties containing key-value pairs
*/
function getProperties(): object
/**
* Returns the value associated with the provided key, or null if there is no such value.
*
*
* var specialValue = ScriptProperties.getProperty('special');
*
*
* @param key - key for the value to retrieve
*
* @returns the value associated with the key
*/
function getProperty(
key: string
): string
/**
* Bulk-sets all the properties drawn from the given object.
*
*
* ScriptProperties.setProperties({special: 'sauce', 'meaning': 42});
*
*
* @param properties - an object containing the properties to set.
*
* @returns this object, for chaining
*/
function setProperties(
properties: object
): ScriptProperties
/**
* Bulk-sets all the properties drawn from the given object.
*
*
* // This deletes all other properties
* ScriptProperties.setProperties({special: 'sauce', 'meaning': 42}, true);
*
*
* @param properties - an object containing the properties to set.
* @param deleteAllOthers - whether to delete all existing properties.
*
* @returns this object, for chaining
*/
function setProperties(
properties: object,
deleteAllOthers: Boolean
): ScriptProperties
/**
* Persists the specified in value with the provided key. Any existing value associated with this
* key will be overwritten.
*
*
* ScriptProperties.setProperty('special', 'sauce');
*
*
* @param key - key for property
* @param value - value to associate with the key
*
* @returns this object, for chaining
*/
function setProperty(
key: string,
value: string
): ScriptProperties
}