Skip to content

Commit

Permalink
chore: lint fixes (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoehnelt authored Nov 21, 2022
1 parent 630b447 commit 424f14f
Show file tree
Hide file tree
Showing 12 changed files with 621 additions and 469 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ module.exports = {
'ignoreImports': true,
'allow': ['client_id', 'access_type', 'redirect_uris'],
}],
'no-unused-vars': 'off',
},
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Icon
Network Trash Folder
Temporary Items
.apdisk
node_modules
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Browser samples for [Google Workspace APIs](https://developers.google.com/gsuite/) docs.
# browser-samples

Browser samples for [Google Workspace APIs](https://developers.google.com/workspace/) docs.

## APIs

Expand Down
4 changes: 2 additions & 2 deletions drive/picker/helloworld.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@
const fileId = document[google.picker.Document.ID];
console.log(fileId);
const res = await gapi.client.drive.files.get({
'fileId': fileId,
'fields': '*',
'fileId': fileId,
'fields': '*',
});
text += `Drive API response for first document: \n${JSON.stringify(res.result, null, 2)}\n`;
window.document.getElementById('content').innerText = text;
Expand Down
2 changes: 1 addition & 1 deletion sheets/snippets/base_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

let filesToDelete = [];
const filesToDelete = [];
function deleteFileOnCleanup(fileId) {
filesToDelete.push(fileId);
}
Expand Down
157 changes: 90 additions & 67 deletions slides/snippets/base_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

var filesToDelete = [];
const filesToDelete = [];
function deleteFileOnCleanup(fileId) {
filesToDelete.push(fileId);
}
Expand All @@ -27,12 +27,14 @@ function tearDown() {
}

function createTestPresentation(callback) {
gapi.client.slides.presentations.create({
title: 'Test Preso',
}).then(function(data) {
deleteFileOnCleanup(data.result.presentationId);
callback(data.result.presentationId);
});
gapi.client.slides.presentations
.create({
title: 'Test Preso',
})
.then(function(data) {
deleteFileOnCleanup(data.result.presentationId);
callback(data.result.presentationId);
});
}

function addSlides(presentationId, num, layout, callback) {
Expand All @@ -49,12 +51,14 @@ function addSlides(presentationId, num, layout, callback) {
},
});
}
const response = gapi.client.slides.presentations.batchUpdate({
presentationId: presentationId,
requests: requests,
}).then((response) => {
callback(slideIds);
});
const response = gapi.client.slides.presentations
.batchUpdate({
presentationId: presentationId,
requests: requests,
})
.then((response) => {
callback(slideIds);
});
}

function createTestTextbox(presentationId, pageId, callback) {
Expand All @@ -63,72 +67,91 @@ function createTestTextbox(presentationId, pageId, callback) {
magnitude: 350,
unit: 'PT',
};
const requests = [{
createShape: {
objectId: boxId,
shapeType: 'TEXT_BOX',
elementProperties: {
pageObjectId: pageId,
size: {
height: pt350,
width: pt350,
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 350,
translateY: 100,
unit: 'PT',
const requests = [
{
createShape: {
objectId: boxId,
shapeType: 'TEXT_BOX',
elementProperties: {
pageObjectId: pageId,
size: {
height: pt350,
width: pt350,
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 350,
translateY: 100,
unit: 'PT',
},
},
},
},
}, {
insertText: {
objectId: boxId,
insertionIndex: 0,
text: 'New Box Text Inserted',
{
insertText: {
objectId: boxId,
insertionIndex: 0,
text: 'New Box Text Inserted',
},
},
}];
const response = gapi.client.slides.presentations.batchUpdate({
presentationId, presentationId,
requests: requests,
}).then((createTextboxResponse) => {
callback(createTextboxResponse.result.replies[0].createShape.objectId);
});
];
const response = gapi.client.slides.presentations
.batchUpdate({
presentationId,
presentationId,
requests: requests,
})
.then((createTextboxResponse) => {
callback(createTextboxResponse.result.replies[0].createShape.objectId);
});
}

function createTestSheetsChart(presentationId, pageId, spreadsheetId, sheetChartId, callback) {
function createTestSheetsChart(
presentationId,
pageId,
spreadsheetId,
sheetChartId,
callback,
) {
const chartId = 'MyChart_01';
const emu4M = {
magnitude: 4000000,
unit: 'EMU',
};
const requests = [{
createSheetsChart: {
objectId: chartId,
spreadsheetId: spreadsheetId,
chartId: sheetChartId,
linkingMode: 'LINKED',
elementProperties: {
pageObjectId: pageId,
size: {
height: emu4M,
width: emu4M,
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 100000,
translateY: 100000,
unit: 'EMU',
const requests = [
{
createSheetsChart: {
objectId: chartId,
spreadsheetId: spreadsheetId,
chartId: sheetChartId,
linkingMode: 'LINKED',
elementProperties: {
pageObjectId: pageId,
size: {
height: emu4M,
width: emu4M,
},
transform: {
scaleX: 1,
scaleY: 1,
translateX: 100000,
translateY: 100000,
unit: 'EMU',
},
},
},
},
}];
const response = gapi.client.slides.presentations.batchUpdate({
presentationId, presentationId,
requests: requests,
}).then((createSheetsChartResponse) => {
callback(createSheetsChartResponse.result.replies[0].createSheetsChart.objectId);
});
];
const response = gapi.client.slides.presentations
.batchUpdate({
presentationId,
presentationId,
requests: requests,
})
.then((createSheetsChartResponse) => {
callback(
createSheetsChartResponse.result.replies[0].createSheetsChart.objectId,
);
});
}
34 changes: 20 additions & 14 deletions slides/snippets/slides_create_slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,32 @@
// limitations under the License.
// [START slides_create_slide]
function createSlide(presentationId, pageId, callback) {
const requests = [{
createSlide: {
objectId: pageId,
insertionIndex: '1',
slideLayoutReference: {
predefinedLayout: 'TITLE_AND_TWO_COLUMNS',
const requests = [
{
createSlide: {
objectId: pageId,
insertionIndex: '1',
slideLayoutReference: {
predefinedLayout: 'TITLE_AND_TWO_COLUMNS',
},
},
},
}];
];
// If you wish to populate the slide with elements, add element create requests here,
// using the pageId.
// Execute the request.
try {
gapi.client.slides.presentations.batchUpdate({
presentationId: presentationId,
requests: requests,
}).then((createSlideResponse) => {
console.log(`Created slide with ID: ${createSlideResponse.result.replies[0].createSlide.objectId}`);
if (callback) callback(createSlideResponse);
});
gapi.client.slides.presentations
.batchUpdate({
presentationId: presentationId,
requests: requests,
})
.then((createSlideResponse) => {
const objectId =
createSlideResponse.result.replies[0].createSlide.objectId;
console.log(`Created slide with ID: ${objectId}`);
if (callback) callback(createSlideResponse);
});
} catch (err) {
document.getElementById('content').innerText = err.message;
return;
Expand Down
Loading

0 comments on commit 424f14f

Please sign in to comment.