feat(google-calendar): add new event trigger

This commit is contained in:
Rıdvan Akca
2023-09-19 12:46:16 +03:00
parent 6a66b65f2a
commit 242b68889a
6 changed files with 100 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
import listCalendars from './list-calendars';
export default [listCalendars];

View File

@@ -0,0 +1,36 @@
import { IGlobalVariable, IJSONObject } from '@automatisch/types';
export default {
name: 'List calendars',
key: 'listCalendars',
async run($: IGlobalVariable) {
const drives: {
data: IJSONObject[];
} = {
data: [],
};
const params = {
pageToken: undefined as unknown as string,
};
do {
const { data } = await $.http.get(`/v3/users/me/calendarList`, {
params,
});
params.pageToken = data.nextPageToken;
if (data.items) {
for (const calendar of data.items) {
drives.data.push({
value: calendar.id,
name: calendar.summary,
});
}
}
} while (params.pageToken);
return drives;
},
};