Skip to content

Commit

Permalink
chore: Format files (#206)
Browse files Browse the repository at this point in the history
* chore: Format files

* Revert to using google styles for linting

* Use single quotes

* Fix inconsistent quote properties

* Fix invalid or missing license headers check

* Fix lint

* Fix copyright
  • Loading branch information
vinay-google authored Sep 6, 2022
1 parent 0ec84e5 commit 1217971
Show file tree
Hide file tree
Showing 144 changed files with 1,780 additions and 1,555 deletions.
3 changes: 1 addition & 2 deletions adminSDK/directory/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
7 changes: 4 additions & 3 deletions adminSDK/reports/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -103,7 +102,9 @@ async function listLoginEvents(auth) {

console.log('Logins:');
activities.forEach((activity) => {
console.log(`${activity.id.time}: ${activity.actor.email} (${activity.events[0].name})`);
console.log(
`${activity.id.time}: ${activity.actor.email} (${activity.events[0].name})`,
);
});
}

Expand Down
3 changes: 1 addition & 2 deletions adminSDK/reseller/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
7 changes: 4 additions & 3 deletions apps-script/execute/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +27,9 @@ async function callAppsScript() {

// Get credentials and build service
// TODO (developer) - Use appropriate auth mechanism for your app
const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const script = google.script({version: 'v1', auth});

try {
Expand Down
27 changes: 14 additions & 13 deletions apps-script/quickstart/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -83,7 +82,6 @@ async function authorize() {
return client;
}


/**
* Creates a new script project, upload a file, and log the script's URL.
* @param {google.auth.OAuth2} auth An authorized OAuth2 client.
Expand All @@ -99,16 +97,19 @@ async function callAppsScript(auth) {
scriptId: res.data.scriptId,
auth,
resource: {
files: [{
name: 'hello',
type: 'SERVER_JS',
source: 'function helloWorld() {\n console.log("Hello, world!");\n}',
}, {
name: 'appsscript',
type: 'JSON',
source: '{\"timeZone\":\"America/New_York\",\"exceptionLogging\":' +
'\"CLOUD\"}',
}],
files: [
{
name: 'hello',
type: 'SERVER_JS',
source: 'function helloWorld() {\n console.log("Hello, world!");\n}',
},
{
name: 'appsscript',
type: 'JSON',
source:
'{"timeZone":"America/New_York","exceptionLogging":' + '"CLOUD"}',
},
],
},
});
console.log(`https://script.google.com/d/${res.data.scriptId}/edit`);
Expand Down
5 changes: 2 additions & 3 deletions calendar/quickstart/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -91,7 +90,7 @@ async function listEvents(auth) {
const calendar = google.calendar({version: 'v3', auth});
const res = await calendar.events.list({
calendarId: 'primary',
timeMin: (new Date()).toISOString(),
timeMin: new Date().toISOString(),
maxResults: 10,
singleEvents: true,
orderBy: 'startTime',
Expand Down
3 changes: 1 addition & 2 deletions classroom/quickstart/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions docs/quickstart/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions drive/activity-v2/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -91,7 +90,7 @@ async function authorize() {
async function listDriveActivity(auth) {
const service = google.driveactivity({version: 'v2', auth});
const params = {
'pageSize': 10,
pageSize: 10,
};
const res = await service.activity.query({requestBody: params});
const activities = res.data.activities;
Expand All @@ -105,8 +104,9 @@ async function listDriveActivity(auth) {
const action = getActionInfo(activity.primaryActionDetail);
const actors = activity.actors.map(getActorInfo);
const targets = activity.targets.map(getTargetInfo);
console.log(`${time}: ${truncated(actors)}, ${action}, ` +
`${truncated(targets)}`);
console.log(
`${time}: ${truncated(actors)}, ${action}, ` + `${truncated(targets)}`,
);
});
}

Expand Down
3 changes: 1 addition & 2 deletions drive/quickstart/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/**
* @license
* Copyright Google Inc.
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ async function fetchAppdataFolder() {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive.appdata'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive.appdata',
});
const service = google.drive({version: 'v2', auth});
try {
const file = await service.files.get({
Expand Down
5 changes: 3 additions & 2 deletions drive/snippets/drive_v2/appdata_snippets/list_appdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ async function listAppdata() {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive.appdata'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive.appdata',
});
const service = google.drive({version: 'v2', auth});
try {
const res = await service.files.list({
Expand All @@ -44,5 +46,4 @@ async function listAppdata() {
}
// [END drive_list_appdata]


module.exports = listAppdata;
16 changes: 9 additions & 7 deletions drive/snippets/drive_v2/appdata_snippets/upload_appdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ async function uploadAppdata() {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive.appdata'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive.appdata',
});
const service = google.drive({version: 'v2', auth});
const fileMetadata = {
'title': 'config.json',
'parents': [{
'id': 'appDataFolder',
}],
title: 'config.json',
parents: [
{
id: 'appDataFolder',
},
],
};
const media = {
mimeType: 'application/json',
Expand All @@ -53,6 +57,4 @@ async function uploadAppdata() {
}
// [END drive_upload_appdata]


module.exports = uploadAppdata;

5 changes: 3 additions & 2 deletions drive/snippets/drive_v2/change_snippets/fetch_changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ async function fetchChanges() {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});
let pageToken;
try {
Expand All @@ -45,5 +47,4 @@ async function fetchChanges() {
}
// [END drive_fetch_changes]


module.exports = fetchChanges;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ async function fetchStartPageToken() {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});
try {
const res = await service.changes.getStartPageToken();
Expand Down
8 changes: 5 additions & 3 deletions drive/snippets/drive_v2/drive_snippets/create_drive.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ async function createDrive() {
const {google} = require('googleapis');
const uuid = require('uuid');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});

const driveMetadata = {
'name': 'Project resources',
name: 'Project resources',
};
const requestId = uuid.v4();
try {
const Drive= await service.drives.insert({
const Drive = await service.drives.insert({
resource: driveMetadata,
requestId: requestId,
fields: 'id',
Expand Down
12 changes: 9 additions & 3 deletions drive/snippets/drive_v2/drive_snippets/recover_drives.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ async function recoverDrives(userEmail) {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});
const drives = [];
const newOrganizerPermission = {
Expand All @@ -45,15 +47,19 @@ async function recoverDrives(userEmail) {
});
Array.prototype.push.apply(drives, res.data.items);
for (const drive of res.data.items) {
console.log('Found shared drive without organizer:', drive.name, drive.id);
console.log(
'Found shared drive without organizer:',
drive.name,
drive.id,
);
await service.permissions.insert({
resource: newOrganizerPermission,
fileId: drive.id,
useDomainAdminAccess: true,
supportsAllDrives: true,
fields: 'id',
});
};
}
pageToken = res.nextPageToken;
} catch (err) {
// TODO(developer) - Handle error
Expand Down
8 changes: 5 additions & 3 deletions drive/snippets/drive_v2/file snippets/create_folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ async function createFolder() {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});
const fileMetadata = {
'title': 'Invoices',
'mimeType': 'application/vnd.google-apps.folder',
title: 'Invoices',
mimeType: 'application/vnd.google-apps.folder',
};
try {
const file = await service.files.insert({
Expand Down
9 changes: 5 additions & 4 deletions drive/snippets/drive_v2/file snippets/create_shortcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ async function createShortcut() {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});
const fileMetadata = {
'title': 'Project plan',
'mimeType': 'application/vnd.google-apps.drive-sdk',
title: 'Project plan',
mimeType: 'application/vnd.google-apps.drive-sdk',
};

try {
Expand All @@ -47,4 +49,3 @@ async function createShortcut() {
// [END drive_create_shortcut]

module.exports = createShortcut;

6 changes: 4 additions & 2 deletions drive/snippets/drive_v2/file snippets/download_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ async function downloadFile(fileId) {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});

try {
Expand All @@ -41,7 +43,7 @@ async function downloadFile(fileId) {
// TODO(developer) - Handle error
throw err;
}
};
}
// [END drive_download_file]

module.exports = downloadFile;
4 changes: 3 additions & 1 deletion drive/snippets/drive_v2/file snippets/export_pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ async function exportPdf(fileId) {
const {GoogleAuth} = require('google-auth-library');
const {google} = require('googleapis');

const auth = new GoogleAuth({scopes: 'https://www.googleapis.com/auth/drive'});
const auth = new GoogleAuth({
scopes: 'https://www.googleapis.com/auth/drive',
});
const service = google.drive({version: 'v2', auth});

try {
Expand Down
Loading

0 comments on commit 1217971

Please sign in to comment.