forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-apps-script.groups.d.ts
67 lines (61 loc) · 2.28 KB
/
google-apps-script.groups.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
// 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 module GoogleAppsScript {
export module Groups {
/**
* A group object whose members and those members' roles within the group
* can be queried.
*
* Here's an example which shows the members of a group. Before running it,
* replace the email address of the group with that of one on your domain.
*
* function listGroupMembers() {
* var group = GroupsApp.getGroupByEmail("example@googlegroups.com");
* var s = group.getEmail() + ': ';
* var users = group.getUsers();
* for (var i = 0; i < users.length; i++) {
* var user = users[i];
* s = s + user.getEmail() + ", ";
* }
* Logger.log(s);
* }
*/
export interface Group {
getEmail(): string;
getRole(email: string): Role;
getRole(user: Base.User): Role;
getUsers(): Base.User[];
hasUser(email: string): boolean;
hasUser(user: Base.User): boolean;
}
/**
* This class provides access to Google Groups information. It can be used to
* query information such as a group's email address, or the list of groups in
* which the user is a direct member.
*
* Here's an example that shows how many groups the current user is a member of:
*
* var groups = GroupsApp.getGroups();
* Logger.log('You belong to ' + groups.length + ' groups.');
*/
export interface GroupsApp {
Role: Role
getGroupByEmail(email: string): Group;
getGroups(): Group[];
}
/**
* Possible roles of a user within a group, such as owner or ordinary member.
* Users subscribed to a group have exactly one role within the context of that
* group.
* See also
*
* Group.getRole(email)
*/
export enum Role { OWNER, MANAGER, MEMBER, INVITED, PENDING }
}
}
declare var GroupsApp: GoogleAppsScript.Groups.GroupsApp;