Skip to content

Commit 0d5a9c1

Browse files
Merge pull request googleworkspace#2 from gsuitedevs/master
catch up
2 parents a9ee3e8 + c739dd4 commit 0d5a9c1

30 files changed

+945
-111
lines changed

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module.exports = {
1212
"camelcase": "off", // Off for destructuring
1313
"async-await/space-after-async": 2,
1414
"async-await/space-after-await": 2,
15+
"eqeqeq": 2,
1516
"guard-for-in": "off",
1617
"no-var": "off", // ES3
1718
"no-unused-vars": "off" // functions aren't used.

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ width="96px"/>
7878
- [Sending email](gmail/sendingEmails)
7979
- [Mailmerge: Merge a template email with content](gmail/mailmerge)
8080

81+
<img
82+
src="https://www.gstatic.com/images/icons/material/system/2x/people_black_48dp.png"
83+
align="left"
84+
width="96px"/>
85+
### People
86+
- [Listing Connections](people/quickstart)
87+
<br><br>
88+
8189
<img
8290
src="https://www.gstatic.com/images/branding/product/2x/sheets_96dp.png"
8391
align="left"

advanced/gmail.gs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function logRecentHistory() {
8383
if (history && history.length > 0) {
8484
history.forEach(function(record) {
8585
record.messages.forEach(function(message) {
86-
if (changed.indexOf(message.id) == -1) {
86+
if (changed.indexOf(message.id) === -1) {
8787
changed.push(message.id);
8888
}
8989
});

advanced/people.gs

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Copyright Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// [START apps_script_people_get_connections]
17+
/**
18+
* Gets a list of people in the user's contacts.
19+
*/
20+
function getConnections() {
21+
var people = People.People.Connections.list('people/me', {
22+
personFields: 'names,emailAddresses'
23+
});
24+
Logger.log('Connections: %s', JSON.stringify(people, null, 2));
25+
}
26+
// [END apps_script_people_get_connections]
27+
28+
// [START apps_script_people_get_self]
29+
/**
30+
* Gets the own user's profile.
31+
*/
32+
function getSelf() {
33+
var people = People.People.getBatchGet({
34+
resourceNames: ['people/me'],
35+
personFields: 'names,emailAddresses'
36+
});
37+
Logger.log('Myself: %s', JSON.stringify(people, null, 2));
38+
}
39+
// [END apps_script_people_get_self]
40+
41+
// [START apps_script_people_get_account]
42+
/**
43+
* Gets the person information for any Google Account.
44+
* @param {string} accountId The account ID.
45+
*/
46+
function getAccount(accountId) {
47+
var people = People.People.get('people/' + accountId, {
48+
personFields: 'names,emailAddresses'
49+
});
50+
Logger.log('Public Profile: %s', JSON.stringify(people, null, 2));
51+
}
52+
// [END apps_script_people_get_account]

advanced/youtube.gs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function retrieveMyUploads() {
5151
// Channel resource: https://developers.google.com/youtube/v3/docs/channels
5252
var playlistId = item.contentDetails.relatedPlaylists.uploads;
5353
var nextPageToken;
54-
while (nextPageToken != null) {
54+
while (nextPageToken !== null) {
5555
var playlistResponse = YouTube.PlaylistItems.list('snippet', {
5656
playlistId: playlistId,
5757
maxResults: 25,

classroom/snippets/courseUpdate.gs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// [START classroom_update_course]
17+
/**
18+
* Updates the section and room of Google Classroom.
19+
*/
20+
function courseUpdate() {
21+
var courseId = '123456';
22+
var course = Classroom.Courses.get(courseId);
23+
course.section = 'Period 3';
24+
course.room = '302';
25+
var course = Classroom.Courses.update(course, courseId);
26+
Logger.log('Course "%s" updated.', course.name);
27+
}
28+
// [END classroom_update_course]

classroom/snippets/createCourse.gs

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// [START classroom_create_course]
17+
/**
18+
* Creates 10th Grade Biology Course.
19+
*/
20+
function createCourse() {
21+
var course = {
22+
name: '10th Grade Biology',
23+
section: 'Period 2',
24+
descriptionHeading: 'Welcome to 10th Grade Biology',
25+
description: "We'll be learning about about the structure of living creatures from a combination of textbooks, guest lectures, and lab work. Expect to be excited!",
26+
room: '301',
27+
ownerId: 'me',
28+
courseState: 'PROVISIONED'
29+
};
30+
var course = Classroom.Courses.create(course);
31+
Logger.log('Course created: %s (%s)', course.name, course.id)
32+
}
33+
// [END classroom_create_course]

classroom/snippets/getCourse.gs

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// [START classroom_get_course]
17+
/**
18+
* Retrieves course by id.
19+
*/
20+
function getCourse() {
21+
var courseId = '123456';
22+
try {
23+
var course = Classroom.Courses.get(courseId);
24+
Logger.log('Course "%s" found. ', course.name);
25+
} catch (err) {
26+
Logger.log("Course with id "%s" not found", courseId);
27+
}
28+
}
29+
// [END classroom_get_course]

classroom/snippets/listCourses.gs

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* Copyright Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// [START classroom_list_courses]
17+
/**
18+
* Lists all course names and ids.
19+
*/
20+
function listCourses() {
21+
var courses = [];
22+
var pageToken = null;
23+
var optionalArgs = {
24+
pageToken: pageToken,
25+
pageSize: 100
26+
};
27+
while (true) {
28+
var response = Classroom.Courses.list(optionalArgs);
29+
var courses = response.courses;
30+
if (!pageToken) {
31+
break;
32+
}
33+
}
34+
if (courses.length === 0) {
35+
Logger.log("No courses found.");
36+
} else {
37+
Logger.log("Courses:");
38+
for (course in courses) {
39+
Logger.log('%s (%s)', courses[course].name, courses[course].id);
40+
}
41+
}
42+
}
43+
// [END classroom_list_courses]

data-studio/appsscript.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"supportUrl": "https://hooli.xyz/data-studio-connector/support",
99
"description": "Nucleus by Hooli connector lets you connect to your data in Data Studio using Nucleus middle out optimization. You will need an account on hooli.xyz to use this connector. Create your account at https://hooli.xyz/signup",
1010
"shortDescription": "Connect to your data using Nucleus middle out optimization",
11+
"privacyPolicyUrl": "https://hooli.xyz/privacy",
12+
"termsOfServiceUrl": "https://hooli.xyz/tos",
1113
"authType": ["NONE"],
1214
"feeType": ["PAID"],
1315
"sources": ["HOOLI_CHAT_LOG", "ENDFRAME_SERVER_STREAM", "RETINABYTE_USER_ANALYTICS"],
@@ -19,4 +21,4 @@
1921
"https://api.hooli.xyz/",
2022
"https://hooli.xyz/"
2123
]
22-
}
24+
}

0 commit comments

Comments
 (0)