forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-apps-script.utilities.d.ts
76 lines (69 loc) · 3.36 KB
/
google-apps-script.utilities.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Type definitions for Google Apps Script 2015-11-12
// 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: Charset
DigestAlgorithm: DigestAlgorithm
MacAlgorithm: 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: string): Byte[];
computeDigest(algorithm: DigestAlgorithm, value: string, charset: Charset): Byte[];
computeHmacSha256Signature(value: string, key: string): Byte[];
computeHmacSha256Signature(value: string, key: string, charset: Charset): 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;
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;
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;