Skip to content

Commit da7839a

Browse files
committed
chore: delint previous changes
1 parent cda0959 commit da7839a

File tree

52 files changed

+954
-958
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+954
-958
lines changed

apps-script/execute/index.js

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,60 +19,60 @@
1919
* Load the API and make an API call. Display the results on the screen.
2020
*/
2121
function callScriptFunction() {
22-
const scriptId = "<ENTER_YOUR_SCRIPT_ID_HERE>";
22+
const scriptId = '<ENTER_YOUR_SCRIPT_ID_HERE>';
2323

2424
// Call the Apps Script API run method
2525
// 'scriptId' is the URL parameter that states what script to run
2626
// 'resource' describes the run request body (with the function name
2727
// to execute)
2828
try {
29-
gapi.client.script.scripts.run({
30-
'scriptId': scriptId,
31-
'resource': {
32-
'function': 'getFoldersUnderRoot'
33-
}
34-
}).then(function(resp) {
35-
let result = resp.result;
36-
if (result.error && result.error.status) {
37-
// The API encountered a problem before the script
38-
// started executing.
39-
appendPre('Error calling API:');
40-
appendPre(JSON.stringify(result, null, 2));
41-
} else if (result.error) {
42-
// The API executed, but the script returned an error.
29+
gapi.client.script.scripts.run({
30+
'scriptId': scriptId,
31+
'resource': {
32+
'function': 'getFoldersUnderRoot',
33+
},
34+
}).then(function(resp) {
35+
const result = resp.result;
36+
if (result.error && result.error.status) {
37+
// The API encountered a problem before the script
38+
// started executing.
39+
appendPre('Error calling API:');
40+
appendPre(JSON.stringify(result, null, 2));
41+
} else if (result.error) {
42+
// The API executed, but the script returned an error.
4343

44-
// Extract the first (and only) set of error details.
45-
// The values of this object are the script's 'errorMessage' and
46-
// 'errorType', and an array of stack trace elements.
47-
let error = result.error.details[0];
48-
appendPre('Script error message: ' + error.errorMessage);
44+
// Extract the first (and only) set of error details.
45+
// The values of this object are the script's 'errorMessage' and
46+
// 'errorType', and an array of stack trace elements.
47+
const error = result.error.details[0];
48+
appendPre('Script error message: ' + error.errorMessage);
4949

50-
if (error.scriptStackTraceElements) {
51-
// There may not be a stacktrace if the script didn't start
52-
// executing.
53-
appendPre('Script error stacktrace:');
54-
for (let i = 0; i < error.scriptStackTraceElements.length; i++) {
55-
let trace = error.scriptStackTraceElements[i];
56-
appendPre('\t' + trace.function + ':' + trace.lineNumber);
57-
}
50+
if (error.scriptStackTraceElements) {
51+
// There may not be a stacktrace if the script didn't start
52+
// executing.
53+
appendPre('Script error stacktrace:');
54+
for (let i = 0; i < error.scriptStackTraceElements.length; i++) {
55+
const trace = error.scriptStackTraceElements[i];
56+
appendPre('\t' + trace.function + ':' + trace.lineNumber);
5857
}
59-
} else {
60-
// The structure of the result will depend upon what the Apps
61-
// Script function returns. Here, the function returns an Apps
62-
// Script Object with String keys and values, and so the result
63-
// is treated as a JavaScript object (folderSet).
58+
}
59+
} else {
60+
// The structure of the result will depend upon what the Apps
61+
// Script function returns. Here, the function returns an Apps
62+
// Script Object with String keys and values, and so the result
63+
// is treated as a JavaScript object (folderSet).
6464

65-
let folderSet = result.response.result;
66-
if (Object.keys(folderSet).length == 0) {
67-
appendPre('No folders returned!');
68-
} else {
69-
appendPre('Folders under your root folder:');
70-
Object.keys(folderSet).forEach(function(id){
71-
appendPre('\t' + folderSet[id] + ' (' + id + ')');
72-
});
73-
}
65+
const folderSet = result.response.result;
66+
if (Object.keys(folderSet).length == 0) {
67+
appendPre('No folders returned!');
68+
} else {
69+
appendPre('Folders under your root folder:');
70+
Object.keys(folderSet).forEach(function(id) {
71+
appendPre('\t' + folderSet[id] + ' (' + id + ')');
72+
});
7473
}
75-
});
74+
}
75+
});
7676
} catch (err) {
7777
document.getElementById('content').innerText = err.message;
7878
return;

drive/metadisplayer/metadisplayer.html

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131
<script>
3232
// The API key obtained from the Google API Console.
3333
// Replace with your own API key, or your own key.
34-
var API_KEY = "<YOUR_API_KEY>";
34+
var API_KEY = '<YOUR_API_KEY>';
3535

3636
// The Client ID obtained from the Google API Console. Replace with your own Client ID.
37-
var CLIENT_ID = "<YOUR_CLIENT_ID>";
37+
var CLIENT_ID = '<YOUR_CLIENT_ID>';
3838

3939
// The APP ID obtained from the Google API Console. Replace with your own APP ID and
4040
// keep in sync with API_KEY and CLIENT_ID.
41-
var APP_ID = "<YOUR_APP_ID>";
41+
var APP_ID = '<YOUR_APP_ID>';
4242

4343
// API discovery doc URL for APIs used by this example
44-
var DISCOVERY_DOCS = "https://www.googleapis.com/discovery/v1/apis/drive/v3/rest";
44+
var DISCOVERY_DOCS = 'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest';
4545

4646
// Authorization scopes required by the API; multiple scopes can be
4747
// included, separated by spaces.
@@ -67,8 +67,8 @@
6767
gapi.client.init({
6868
client_id: CLIENT_ID,
6969
discoveryDocs: [DISCOVERY_DOCS],
70-
scope: SCOPES
71-
}).then(function () {
70+
scope: SCOPES,
71+
}).then(function() {
7272
GoogleAuth = gapi.auth2.getAuthInstance();
7373
GoogleUser = GoogleAuth.currentUser.get();
7474
pickFileButton.style.display = 'block';
@@ -83,8 +83,8 @@
8383
function handlePickFileButtonClick() {
8484
if (!GoogleUser.hasGrantedScopes(SCOPES)) {
8585
GoogleUser.grant({
86-
scope: SCOPES
87-
}).then(displayPicker, function(err) {
86+
scope: SCOPES,
87+
}).then(displayPicker, function(err) {
8888
// Handle error/declined auth...
8989
});
9090
} else {
@@ -99,17 +99,17 @@
9999
*/
100100
function displayPicker() {
101101
// Fetch current token
102-
let authResponse = GoogleUser.getAuthResponse(true);
103-
104-
var view = new google.picker.View(google.picker.ViewId.DOCS);
105-
var picker = new google.picker.PickerBuilder()
106-
.enableFeature(google.picker.Feature.SUPPORT_DRIVES)
107-
.setAppId(APP_ID)
108-
.setOAuthToken(authResponse.access_token)
109-
.addView(view)
110-
.setDeveloperKey(API_KEY)
111-
.setCallback(pickerCallback)
112-
.build();
102+
const authResponse = GoogleUser.getAuthResponse(true);
103+
104+
const view = new google.picker.View(google.picker.ViewId.DOCS);
105+
const picker = new google.picker.PickerBuilder()
106+
.enableFeature(google.picker.Feature.SUPPORT_DRIVES)
107+
.setAppId(APP_ID)
108+
.setOAuthToken(authResponse.access_token)
109+
.addView(view)
110+
.setDeveloperKey(API_KEY)
111+
.setCallback(pickerCallback)
112+
.build();
113113
picker.setVisible(true);
114114
}
115115

@@ -118,14 +118,14 @@
118118
* the picked documents and from calling get on the fileId.
119119
*/
120120
function pickerCallback(data) {
121-
var document = data[google.picker.Response.DOCUMENTS][0];
121+
const document = data[google.picker.Response.DOCUMENTS][0];
122122
// The following information is passed to the callback, while other has to be
123123
// retrieved by calling files.get() on a file (below)
124-
var fileName = document[google.picker.Document.NAME];
125-
var URL = document[google.picker.Document.URL];
126-
var lastModifiedDate = document[google.picker.Document.LAST_EDITED_UTC];
127-
var date = new Date(lastModifiedDate);
128-
var fileId = document[google.picker.Document.ID];
124+
const fileName = document[google.picker.Document.NAME];
125+
const URL = document[google.picker.Document.URL];
126+
const lastModifiedDate = document[google.picker.Document.LAST_EDITED_UTC];
127+
const date = new Date(lastModifiedDate);
128+
const fileId = document[google.picker.Document.ID];
129129

130130
appendPre('Filename: ' + fileName);
131131
appendPre('URL: ' + URL);
@@ -134,9 +134,9 @@
134134
// Called to get the lastModifyingUser
135135
gapi.client.drive.files.get({
136136
'fileId': fileId,
137-
'fields': 'lastModifyingUser'
138-
}).then(function(response) {
139-
appendPre('Last Modified User: ' + response.result.lastModifyingUser.displayName);
137+
'fields': 'lastModifyingUser',
138+
}).then(function(response) {
139+
appendPre('Last Modified User: ' + response.result.lastModifyingUser.displayName);
140140
}, function(err) {
141141
// Handle error...
142142
});
@@ -146,8 +146,8 @@
146146
* Helper method to display content to the screen.
147147
*/
148148
function appendPre(message) {
149-
var pre = document.getElementById('content');
150-
var textContent = document.createTextNode(message + '\n');
149+
const pre = document.getElementById('content');
150+
const textContent = document.createTextNode(message + '\n');
151151
pre.appendChild(textContent);
152152
}
153153

sheets/snippets/base_test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ function deleteFileOnCleanup(fileId) {
1818
}
1919

2020
function tearDown() {
21-
for (var i = 0; i < filesToDelete.length; ++i) {
22-
var presentationId = filesToDelete[i];
21+
for (let i = 0; i < filesToDelete.length; ++i) {
22+
const presentationId = filesToDelete[i];
2323
gapi.client.drive.files.delete({
24-
fileId: presentationId
24+
fileId: presentationId,
2525
});
2626
}
2727
}
2828

2929
function cleanup() {
3030
return this.driveService.then((drive) => {
31-
var deleteFile = Promise.denodeify(drive.files.delete).bind(drive.files);
31+
const deleteFile = Promise.denodeify(drive.files.delete).bind(drive.files);
3232
return this.filesToDelete.map((id) => deleteFile({fileId: id}));
3333
});
3434
};
3535

3636
function createTestSpreadsheet(callback) {
3737
gapi.client.sheets.spreadsheets.create({
3838
properties: {
39-
title: 'Test Spreadsheet'
40-
}
39+
title: 'Test Spreadsheet',
40+
},
4141
}).then(function(sheet) {
4242
deleteFileOnCleanup(sheet.result.spreadsheetId);
4343
callback(sheet.result.spreadsheetId);
@@ -55,17 +55,17 @@ function populateValues(spreadsheetId, callback) {
5555
startRowIndex: 0,
5656
endRowIndex: 10,
5757
startColumnIndex: 0,
58-
endColumnIndex: 10
58+
endColumnIndex: 10,
5959
},
6060
cell: {
6161
userEnteredValue: {
62-
stringValue: 'Hello'
63-
}
62+
stringValue: 'Hello',
63+
},
6464
},
65-
fields: 'userEnteredValue'
66-
}
67-
}]
68-
}
65+
fields: 'userEnteredValue',
66+
},
67+
}],
68+
},
6969
}).then((response) => {
7070
callback(spreadsheetId);
7171
});

sheets/snippets/index.html

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,33 @@ <h3>Snippets - Javascript</h3>
6262
const API_KEY = '<YOUR_API_KEY>';
6363

6464
// Discovery doc URL for APIs used by the quickstart
65-
const DISCOVERY_DOCS = [
66-
"https://www.googleapis.com/discovery/v1/apis/drive/v3/rest",
67-
"https://sheets.googleapis.com/$discovery/rest?version=v4",
65+
const DISCOVERY_DOCS = [
66+
'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest',
67+
'https://sheets.googleapis.com/$discovery/rest?version=v4',
6868
];
6969

7070
// Authorization scopes required by the API; multiple scopes can be
7171
// included, separated by spaces.
7272
const SCOPES = [
73-
"https://www.googleapis.com/auth/drive",
74-
"https://www.googleapis.com/auth/spreadsheets"
75-
];
73+
'https://www.googleapis.com/auth/drive',
74+
'https://www.googleapis.com/auth/spreadsheets',
75+
];
7676

7777
let tokenClient;
7878
let gapiInited = false;
7979
let gisInited = false;
8080

8181
document.getElementById('authorize_button').style.visibility = 'hidden';
8282
document.getElementById('signout_button').style.visibility = 'hidden';
83-
let assert = chai.assert;
83+
const assert = chai.assert;
8484
mocha.setup('bdd');
8585

8686
/**
8787
* Callback after api.js is loaded.
8888
*/
8989
function gapiLoaded() {
9090
gapi.load('client', intializeGapiClient);
91-
}
91+
}
9292

9393
/**
9494
* Callback after the API client is loaded. Loads the
@@ -112,8 +112,8 @@ <h3>Snippets - Javascript</h3>
112112
scope: SCOPES.join(' '),
113113
callback: '', // defined later
114114
});
115-
gisInited = true;
116-
maybeEnableButtons();
115+
gisInited = true;
116+
maybeEnableButtons();
117117
}
118118

119119
/**
@@ -135,24 +135,23 @@ <h3>Snippets - Javascript</h3>
135135
}
136136
document.getElementById('signout_button').style.visibility = 'visible';
137137
document.getElementById('authorize_button').innerText = 'Refresh';
138-
try
139-
{
140-
describe('Google Sheets API', function() {
141-
this.timeout(10000);
142-
it('should create a spreadsheet', testCreateSpreadsheet);
143-
it('should batch update a spreadsheet', testBatchUpdateSpreadsheet);
144-
it('should get spreadsheet values', testGetSpreadsheetValues);
145-
it('should batch get spreadsheet values', testBatchGetSpreadsheetValues);
146-
it('should update spreadsheet values', testUpdateSpreadsheetValues);
147-
it('should batch update spreadsheet values', testBatchUpdateSpreadsheetValues);
148-
it('should append values to a spreadsheet', testAppendSpreadsheetValues);
149-
it('should create pivot tables', testCreatePivotTables);
150-
it('should conditionally format', testConditionallyFormat);
151-
});
152-
} catch(err) {
153-
document.getElementById('content').innerText = err.message;
154-
return;
155-
}
138+
try {
139+
describe('Google Sheets API', function() {
140+
this.timeout(10000);
141+
it('should create a spreadsheet', testCreateSpreadsheet);
142+
it('should batch update a spreadsheet', testBatchUpdateSpreadsheet);
143+
it('should get spreadsheet values', testGetSpreadsheetValues);
144+
it('should batch get spreadsheet values', testBatchGetSpreadsheetValues);
145+
it('should update spreadsheet values', testUpdateSpreadsheetValues);
146+
it('should batch update spreadsheet values', testBatchUpdateSpreadsheetValues);
147+
it('should append values to a spreadsheet', testAppendSpreadsheetValues);
148+
it('should create pivot tables', testCreatePivotTables);
149+
it('should conditionally format', testConditionallyFormat);
150+
});
151+
} catch (err) {
152+
document.getElementById('content').innerText = err.message;
153+
return;
154+
}
156155
after(tearDown);
157156
mocha.run();
158157
};
@@ -165,7 +164,7 @@ <h3>Snippets - Javascript</h3>
165164
// Skip display of account chooser and consent dialog for an existing session.
166165
tokenClient.requestAccessToken({prompt: ''});
167166
}
168-
}
167+
}
169168

170169
/**
171170
* Sign out the user upon button click.
@@ -179,7 +178,7 @@ <h3>Snippets - Javascript</h3>
179178
document.getElementById('authorize_button').innerText = 'Authorize';
180179
document.getElementById('signout_button').style.visibility = 'hidden';
181180
}
182-
}
181+
}
183182

184183
</script>
185184
<script async defer src="https://apis.google.com/js/api.js" onload="gapiLoaded()"></script>

0 commit comments

Comments
 (0)