mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
This PR updates Google Apps Script types. (2017-05-12 -> 2018-07-11) This is a generated type definition. CC: @erickoledadevrel --- - [x] Use a meaningful title for the pull request. Include the name of the package modified. - [x] Test the change in your own code. (Compile and run.) - [x] Add or edit tests to reflect the change. (Run with `npm test`.) - [x] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request). - [x] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes). - [x] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present). ``` npm run lint google-apps-script definitely-typed@0.0.2 lint /Users/timmerman/Documents/github/DefinitelyTyped dtslint types "google-apps-script" # No result. ``` If changing an existing definition: - [x] Provide a URL to documentation or source code which provides context for the suggested changes: https://developers.google.com/apps-script/reference/ - [x] Increase the version number in the header if appropriate. - The version should be bumped by the publisher. - [x] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dtslint/dt.json" }`.
58 lines
2.2 KiB
TypeScript
58 lines
2.2 KiB
TypeScript
// Type definitions for Google Apps Script 2018-07-11
|
|
// Project: https://developers.google.com/apps-script/
|
|
// Definitions by: motemen <https://github.com/motemen/>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/// <reference path="google-apps-script.types.d.ts" />
|
|
|
|
declare namespace GoogleAppsScript {
|
|
export module Cache {
|
|
/**
|
|
* A reference to a particular cache.
|
|
*
|
|
* This class allows you to insert, retrieve, and remove items from a cache. This can be
|
|
* particularly useful when you want frequent access to an expensive or slow resource. For example,
|
|
* say you have an RSS feed at example.com that takes 20 seconds to fetch, but you want to speed up
|
|
* access on an average request.
|
|
*
|
|
* function getRssFeed() {
|
|
* var cache = CacheService.getScriptCache();
|
|
* var cached = cache.get("rss-feed-contents");
|
|
* if (cached != null) {
|
|
* return cached;
|
|
* }
|
|
* var result = UrlFetchApp.fetch("http://example.com/my-slow-rss-feed.xml"); // takes 20 seconds
|
|
* var contents = result.getContentText();
|
|
* cache.put("rss-feed-contents", contents, 1500); // cache for 25 minutes
|
|
* return contents;
|
|
* }
|
|
*/
|
|
export interface Cache {
|
|
get(key: string): string;
|
|
getAll(keys: string[]): Object;
|
|
put(key: string, value: string): void;
|
|
put(key: string, value: string, expirationInSeconds: Integer): void;
|
|
putAll(values: Object): void;
|
|
putAll(values: Object, expirationInSeconds: Integer): void;
|
|
remove(key: string): void;
|
|
removeAll(keys: string[]): void;
|
|
}
|
|
|
|
/**
|
|
* CacheService allows you to access a cache for short term storage of data.
|
|
*
|
|
* This class lets you get a specific cache instance. Public caches are for things that are not
|
|
* dependent on which user is accessing your script. Private caches are for things which are
|
|
* user-specific, like settings or recent activity.
|
|
*/
|
|
export interface CacheService {
|
|
getDocumentCache(): Cache;
|
|
getScriptCache(): Cache;
|
|
getUserCache(): Cache;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
declare var CacheService: GoogleAppsScript.Cache.CacheService;
|