From b2b8bccaa636c133ea8888a80a2686ccfb715fbc Mon Sep 17 00:00:00 2001 From: Bradley Bickford Date: Sun, 20 Nov 2022 19:04:47 -0500 Subject: [PATCH] Committing psuedo functional GCal Pull It's not exactly a good test, but it's something. Need to do some more work in the creation and management of calendars. --- calendarpulltest.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 calendarpulltest.js diff --git a/calendarpulltest.js b/calendarpulltest.js new file mode 100644 index 0000000..164dd5d --- /dev/null +++ b/calendarpulltest.js @@ -0,0 +1,27 @@ +const { google } = require('googleapis'); +const { googlePrivateKey, googleClientEmail, googleProjectNumber } = require('./config.json'); + +const SCOPES = ['https://www.googleapis.com/auth/calendar']; + +async function main() { + const jwtClient = new google.auth.JWT( + googleClientEmail, + null, + googlePrivateKey, + SCOPES, + ); + + const calendar = new google.calendar({ + version: 'v3', + project: googleProjectNumber, + auth: jwtClient, + }); + + const response = calendar.calendarList.list({}); + console.log('Output: ' + response.data); +} + +main().catch(e => { + console.error(e); + throw e; +}); \ No newline at end of file