From e596e2768ba61e67711c227da1333e6957a145a7 Mon Sep 17 00:00:00 2001 From: Mark Hill Date: Sat, 19 Feb 2022 22:18:01 +1400 Subject: [PATCH 1/3] Added lines for specifying Toggl ID + Calendar ID Unclear how these were originally meant to be specified? --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index 3ce0afc..d6270a3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,10 @@ import { EntriesHash, sync } from './calendar'; export function run() { const scriptProperties = PropertiesService.getScriptProperties(); + + scriptProperties.setProperty('CALENDAR_ID', 'INSERT CALENDAR ID HERE'); + scriptProperties.setProperty('TOGGL_API_TOKEN', 'INSERT TOGGL API TOKEN HERE'); + const togglApiToken = scriptProperties.getProperty('TOGGL_API_TOKEN'); const calendarId = scriptProperties.getProperty('CALENDAR_ID'); From 3ec6ac4b75385b42ebca845bdfb7b6c4a2ec1f55 Mon Sep 17 00:00:00 2001 From: Mark Hill Date: Sat, 19 Feb 2022 22:18:43 +1400 Subject: [PATCH 2/3] Updated URL to current working version --- src/toggl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toggl.ts b/src/toggl.ts index 611d136..2f41050 100644 --- a/src/toggl.ts +++ b/src/toggl.ts @@ -1,4 +1,4 @@ -const baseUrl = 'https://www.toggl.com/api/v8/'; +const baseUrl = 'https://api.track.toggl.com/api/v8/'; export interface Project { id: number; From 80f5d6ebc394c42d0258b57a85eb7240be900d70 Mon Sep 17 00:00:00 2001 From: Mark Hill Date: Sat, 19 Feb 2022 22:22:16 +1400 Subject: [PATCH 3/3] Updated readme to clarify adding properties --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1ad49e6..4eb3347 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ ## Usage -1. Build this script, which will generate `dist/bundle.js`. +1. Insert your `CALENDAR_ID` and `TOGGL_API_TOKEN` properties in the `src/index.ts` file. +1. Build the script, which will generate `dist/bundle.js`. ``` npm install npm run build ``` 1. Upload `dist/index.js` and `dist/bundle.js` to Google Apps Script. If you're using [@google/clasp](https://github.com/google/clasp), edit `scriptId` property in `.clasp.json` and run `npm run deploy`. -1. Set `CALENDAR_ID` and `TOGGL_API_TOKEN` script properties. 1. Create a Time-driven trigger to run `main` function periodically (e.g. every hour). ### Custom variables (script properties)