forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-apps-script.content.d.ts
59 lines (53 loc) · 1.9 KB
/
google-apps-script.content.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
// 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" />
declare namespace GoogleAppsScript {
export module Content {
/**
* Service for returning text content from a script.
*
* You can serve up text in various forms. For example, publish this script as a web app.
*
* function doGet() {
* return ContentService.createTextOutput("Hello World");
* }
*/
export interface ContentService {
MimeType: MimeType
createTextOutput(): TextOutput;
createTextOutput(content: string): TextOutput;
}
/**
* An enum for mime types that can be served from a script.
*/
export enum MimeType { ATOM, CSV, ICAL, JAVASCRIPT, JSON, RSS, TEXT, VCARD, XML }
/**
* A TextOutput object that can be served from a script.
*
* Due to security considerations, scripts cannot directly return text content to a browser.
* Instead, the browser is redirected to googleusercontent.com, which will display it without any
* further sanitization or manipulation.
*
* You can return text content like this:
*
* function doGet() {
* return ContentService.createPlainTextOutput("hello world!");
* }
*
* ContentService
*/
export interface TextOutput {
append(addedContent: string): TextOutput;
clear(): TextOutput;
downloadAsFile(filename: string): TextOutput;
getContent(): string;
getFileName(): string;
getMimeType(): MimeType;
setContent(content: string): TextOutput;
setMimeType(mimeType: MimeType): TextOutput;
}
}
}
declare var ContentService: GoogleAppsScript.Content.ContentService;