DefinitelyTyped/types/google-apps-script/google-apps-script.utilities.d.ts
Grant Timmerman 9f25bcc456 Update Google Apps Script Types (2017-05-12 -> 2018-07-11) (#27235)
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" }`.
2018-07-13 15:05:15 -07:00

84 lines
3.8 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" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Utilities {
/**
* A typesafe enum for character sets.
*/
export enum Charset { US_ASCII, UTF_8 }
/**
* Selector of Digest algorithm
*/
export enum DigestAlgorithm { MD2, MD5, SHA_1, SHA_256, SHA_384, SHA_512 }
/**
* Selector of MAC algorithm
*/
export enum MacAlgorithm { HMAC_MD5, HMAC_SHA_1, HMAC_SHA_256, HMAC_SHA_384, HMAC_SHA_512 }
/**
* This service provides utilities for string encoding/decoding, date formatting, JSON manipulation,
* and other miscellaneous tasks.
*/
export interface Utilities {
Charset: typeof Charset;
DigestAlgorithm: typeof DigestAlgorithm;
MacAlgorithm: typeof MacAlgorithm;
base64Decode(encoded: string): Byte[];
base64Decode(encoded: string, charset: Charset): Byte[];
base64DecodeWebSafe(encoded: string): Byte[];
base64DecodeWebSafe(encoded: string, charset: Charset): Byte[];
base64Encode(data: Byte[]): string;
base64Encode(data: string): string;
base64Encode(data: string, charset: Charset): string;
base64EncodeWebSafe(data: Byte[]): string;
base64EncodeWebSafe(data: string): string;
base64EncodeWebSafe(data: string, charset: Charset): string;
computeDigest(algorithm: DigestAlgorithm, value: Byte[]): Byte[];
computeDigest(algorithm: DigestAlgorithm, value: string): Byte[];
computeDigest(algorithm: DigestAlgorithm, value: string, charset: Charset): Byte[];
computeHmacSha256Signature(value: Byte[], key: Byte[]): Byte[];
computeHmacSha256Signature(value: string, key: string): Byte[];
computeHmacSha256Signature(value: string, key: string, charset: Charset): Byte[];
computeHmacSignature(algorithm: MacAlgorithm, value: Byte[], key: Byte[]): Byte[];
computeHmacSignature(algorithm: MacAlgorithm, value: string, key: string): Byte[];
computeHmacSignature(algorithm: MacAlgorithm, value: string, key: string, charset: Charset): Byte[];
computeRsaSha256Signature(value: string, key: string): Byte[];
computeRsaSha256Signature(value: string, key: string, charset: Charset): Byte[];
formatDate(date: Date, timeZone: string, format: string): string;
formatString(template: string, ...args: Object[]): string;
getUuid(): string;
gzip(blob: Base.BlobSource): Base.Blob;
gzip(blob: Base.BlobSource, name: string): Base.Blob;
newBlob(data: Byte[]): Base.Blob;
newBlob(data: Byte[], contentType: string): Base.Blob;
newBlob(data: Byte[], contentType: string, name: string): Base.Blob;
newBlob(data: string): Base.Blob;
newBlob(data: string, contentType: string): Base.Blob;
newBlob(data: string, contentType: string, name: string): Base.Blob;
parseCsv(csv: string): string[][];
parseCsv(csv: string, delimiter: Char): string[][];
sleep(milliseconds: Integer): void;
ungzip(blob: Base.BlobSource): Base.Blob;
unzip(blob: Base.BlobSource): Base.Blob[];
zip(blobs: Base.BlobSource[]): Base.Blob;
zip(blobs: Base.BlobSource[], name: string): Base.Blob;
jsonParse(jsonString: string): Object;
jsonStringify(obj: Object): string;
}
}
}
declare var Charset: GoogleAppsScript.Utilities.Charset;
declare var DigestAlgorithm: GoogleAppsScript.Utilities.DigestAlgorithm;
declare var MacAlgorithm: GoogleAppsScript.Utilities.MacAlgorithm;
declare var Utilities: GoogleAppsScript.Utilities.Utilities;