Skip to content

Commit

Permalink
Make compatible with newer googleapis.
Browse files Browse the repository at this point in the history
  • Loading branch information
rimesc committed Oct 24, 2020
1 parent e6ae4b5 commit c37af12
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 72 deletions.
116 changes: 51 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
"@types/backoff": "^2.5.0",
"@types/moment": "^2.13.0",
"@types/moment-timezone": "^0.5.6",
"@types/node": "^10.3.4",
"@types/node": "^14.14.2",
"@types/yargs": "^11.0.0",
"backoff": "^2.5.0",
"bottleneck": "^2.5.1",
"google-auth-library": "1.6.1",
"google-auth-library": "3.1.2",
"googleapis": "39.1.0",
"moment": "2.22.2",
"moment-timezone": "^0.5.20",
"readline": "^1.3.0",
"yargs": "^11.0.0"
},
"devDependencies": {
"typescript": "^2.9.2"
"typescript": "^3.2.0"
},
"scripts": {
"build": "tsc",
Expand Down
4 changes: 2 additions & 2 deletions src/app/api/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Utilities for makng async API calls, with rate limiting and backoff.
*/

import { AxiosResponse } from 'axios';
import { GaxiosResponse } from 'gaxios';
import Bottleneck from "bottleneck"
import * as backoff from "backoff";

Expand All @@ -12,7 +12,7 @@ const limiter = new Bottleneck({
});

/** Equivalent to BodyResponseCallback<T>. */
type ResponseHandler<T> = (err: Error | null, res?: AxiosResponse<T> | null) => void;
type ResponseHandler<T> = (err: Error | null, res?: GaxiosResponse<T> | null) => void;

type ApiError = Error & {code: number | string, errors?: {reason: string}[]};

Expand Down
4 changes: 2 additions & 2 deletions src/app/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async function loadTable(): Promise<TableRow[]> {
async function loadEvents(): Promise<calendar.Event[]> {
return calendar.list({
calendarId: CALENDAR_ID,
privateExtendedProperty: `createdBy=${CREATED_BY}`,
privateExtendedProperty: [`createdBy=${CREATED_BY}`],
orderBy: 'startTime',
singleEvents: true,
}).then(events => events.items);
Expand All @@ -59,7 +59,7 @@ async function loadEvents(): Promise<calendar.Event[]> {
async function clearEvents(): Promise<void[]> {
const request = {
calendarId: CALENDAR_ID,
privateExtendedProperty: `createdBy=${CREATED_BY}`,
privateExtendedProperty: [`createdBy=${CREATED_BY}`],
singleEvents: true,
};
const events = await calendar.list(request);
Expand Down

0 comments on commit c37af12

Please sign in to comment.