Skip to content

Commit 424f14f

Browse files
authored
chore: lint fixes (#148)
1 parent 630b447 commit 424f14f

12 files changed

+621
-469
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ module.exports = {
3434
'ignoreImports': true,
3535
'allow': ['client_id', 'access_type', 'redirect_uris'],
3636
}],
37+
'no-unused-vars': 'off',
3738
},
3839
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ Icon
2424
Network Trash Folder
2525
Temporary Items
2626
.apdisk
27+
node_modules

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
Browser samples for [Google Workspace APIs](https://developers.google.com/gsuite/) docs.
1+
# browser-samples
2+
3+
Browser samples for [Google Workspace APIs](https://developers.google.com/workspace/) docs.
24

35
## APIs
46

drive/picker/helloworld.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@
161161
const fileId = document[google.picker.Document.ID];
162162
console.log(fileId);
163163
const res = await gapi.client.drive.files.get({
164-
'fileId': fileId,
165-
'fields': '*',
164+
'fileId': fileId,
165+
'fields': '*',
166166
});
167167
text += `Drive API response for first document: \n${JSON.stringify(res.result, null, 2)}\n`;
168168
window.document.getElementById('content').innerText = text;

sheets/snippets/base_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
let filesToDelete = [];
15+
const filesToDelete = [];
1616
function deleteFileOnCleanup(fileId) {
1717
filesToDelete.push(fileId);
1818
}

slides/snippets/base_test.js

Lines changed: 90 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
var filesToDelete = [];
15+
const filesToDelete = [];
1616
function deleteFileOnCleanup(fileId) {
1717
filesToDelete.push(fileId);
1818
}
@@ -27,12 +27,14 @@ function tearDown() {
2727
}
2828

2929
function createTestPresentation(callback) {
30-
gapi.client.slides.presentations.create({
31-
title: 'Test Preso',
32-
}).then(function(data) {
33-
deleteFileOnCleanup(data.result.presentationId);
34-
callback(data.result.presentationId);
35-
});
30+
gapi.client.slides.presentations
31+
.create({
32+
title: 'Test Preso',
33+
})
34+
.then(function(data) {
35+
deleteFileOnCleanup(data.result.presentationId);
36+
callback(data.result.presentationId);
37+
});
3638
}
3739

3840
function addSlides(presentationId, num, layout, callback) {
@@ -49,12 +51,14 @@ function addSlides(presentationId, num, layout, callback) {
4951
},
5052
});
5153
}
52-
const response = gapi.client.slides.presentations.batchUpdate({
53-
presentationId: presentationId,
54-
requests: requests,
55-
}).then((response) => {
56-
callback(slideIds);
57-
});
54+
const response = gapi.client.slides.presentations
55+
.batchUpdate({
56+
presentationId: presentationId,
57+
requests: requests,
58+
})
59+
.then((response) => {
60+
callback(slideIds);
61+
});
5862
}
5963

6064
function createTestTextbox(presentationId, pageId, callback) {
@@ -63,72 +67,91 @@ function createTestTextbox(presentationId, pageId, callback) {
6367
magnitude: 350,
6468
unit: 'PT',
6569
};
66-
const requests = [{
67-
createShape: {
68-
objectId: boxId,
69-
shapeType: 'TEXT_BOX',
70-
elementProperties: {
71-
pageObjectId: pageId,
72-
size: {
73-
height: pt350,
74-
width: pt350,
75-
},
76-
transform: {
77-
scaleX: 1,
78-
scaleY: 1,
79-
translateX: 350,
80-
translateY: 100,
81-
unit: 'PT',
70+
const requests = [
71+
{
72+
createShape: {
73+
objectId: boxId,
74+
shapeType: 'TEXT_BOX',
75+
elementProperties: {
76+
pageObjectId: pageId,
77+
size: {
78+
height: pt350,
79+
width: pt350,
80+
},
81+
transform: {
82+
scaleX: 1,
83+
scaleY: 1,
84+
translateX: 350,
85+
translateY: 100,
86+
unit: 'PT',
87+
},
8288
},
8389
},
8490
},
85-
}, {
86-
insertText: {
87-
objectId: boxId,
88-
insertionIndex: 0,
89-
text: 'New Box Text Inserted',
91+
{
92+
insertText: {
93+
objectId: boxId,
94+
insertionIndex: 0,
95+
text: 'New Box Text Inserted',
96+
},
9097
},
91-
}];
92-
const response = gapi.client.slides.presentations.batchUpdate({
93-
presentationId, presentationId,
94-
requests: requests,
95-
}).then((createTextboxResponse) => {
96-
callback(createTextboxResponse.result.replies[0].createShape.objectId);
97-
});
98+
];
99+
const response = gapi.client.slides.presentations
100+
.batchUpdate({
101+
presentationId,
102+
presentationId,
103+
requests: requests,
104+
})
105+
.then((createTextboxResponse) => {
106+
callback(createTextboxResponse.result.replies[0].createShape.objectId);
107+
});
98108
}
99109

100-
function createTestSheetsChart(presentationId, pageId, spreadsheetId, sheetChartId, callback) {
110+
function createTestSheetsChart(
111+
presentationId,
112+
pageId,
113+
spreadsheetId,
114+
sheetChartId,
115+
callback,
116+
) {
101117
const chartId = 'MyChart_01';
102118
const emu4M = {
103119
magnitude: 4000000,
104120
unit: 'EMU',
105121
};
106-
const requests = [{
107-
createSheetsChart: {
108-
objectId: chartId,
109-
spreadsheetId: spreadsheetId,
110-
chartId: sheetChartId,
111-
linkingMode: 'LINKED',
112-
elementProperties: {
113-
pageObjectId: pageId,
114-
size: {
115-
height: emu4M,
116-
width: emu4M,
117-
},
118-
transform: {
119-
scaleX: 1,
120-
scaleY: 1,
121-
translateX: 100000,
122-
translateY: 100000,
123-
unit: 'EMU',
122+
const requests = [
123+
{
124+
createSheetsChart: {
125+
objectId: chartId,
126+
spreadsheetId: spreadsheetId,
127+
chartId: sheetChartId,
128+
linkingMode: 'LINKED',
129+
elementProperties: {
130+
pageObjectId: pageId,
131+
size: {
132+
height: emu4M,
133+
width: emu4M,
134+
},
135+
transform: {
136+
scaleX: 1,
137+
scaleY: 1,
138+
translateX: 100000,
139+
translateY: 100000,
140+
unit: 'EMU',
141+
},
124142
},
125143
},
126144
},
127-
}];
128-
const response = gapi.client.slides.presentations.batchUpdate({
129-
presentationId, presentationId,
130-
requests: requests,
131-
}).then((createSheetsChartResponse) => {
132-
callback(createSheetsChartResponse.result.replies[0].createSheetsChart.objectId);
133-
});
145+
];
146+
const response = gapi.client.slides.presentations
147+
.batchUpdate({
148+
presentationId,
149+
presentationId,
150+
requests: requests,
151+
})
152+
.then((createSheetsChartResponse) => {
153+
callback(
154+
createSheetsChartResponse.result.replies[0].createSheetsChart.objectId,
155+
);
156+
});
134157
}

slides/snippets/slides_create_slide.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,32 @@
1313
// limitations under the License.
1414
// [START slides_create_slide]
1515
function createSlide(presentationId, pageId, callback) {
16-
const requests = [{
17-
createSlide: {
18-
objectId: pageId,
19-
insertionIndex: '1',
20-
slideLayoutReference: {
21-
predefinedLayout: 'TITLE_AND_TWO_COLUMNS',
16+
const requests = [
17+
{
18+
createSlide: {
19+
objectId: pageId,
20+
insertionIndex: '1',
21+
slideLayoutReference: {
22+
predefinedLayout: 'TITLE_AND_TWO_COLUMNS',
23+
},
2224
},
2325
},
24-
}];
26+
];
2527
// If you wish to populate the slide with elements, add element create requests here,
2628
// using the pageId.
2729
// Execute the request.
2830
try {
29-
gapi.client.slides.presentations.batchUpdate({
30-
presentationId: presentationId,
31-
requests: requests,
32-
}).then((createSlideResponse) => {
33-
console.log(`Created slide with ID: ${createSlideResponse.result.replies[0].createSlide.objectId}`);
34-
if (callback) callback(createSlideResponse);
35-
});
31+
gapi.client.slides.presentations
32+
.batchUpdate({
33+
presentationId: presentationId,
34+
requests: requests,
35+
})
36+
.then((createSlideResponse) => {
37+
const objectId =
38+
createSlideResponse.result.replies[0].createSlide.objectId;
39+
console.log(`Created slide with ID: ${objectId}`);
40+
if (callback) callback(createSlideResponse);
41+
});
3642
} catch (err) {
3743
document.getElementById('content').innerText = err.message;
3844
return;

0 commit comments

Comments
 (0)