Package Exports
- google-calendar-api-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (google-calendar-api-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
google-calendar-api-client
Google Calendar API client for JavaScript. This is created with great influence from those repositories.
- https://github.com/Kubessandra/react-google-calendar-api
- https://github.com/googleapis/google-api-nodejs-client
Installation
// with npm
npm install google-calendar-api-client
// with yarn
yarn add google-calendar-api-clientUsage
Prepare client id and api key. https://console.cloud.google.com/apis/credentials
Init api client with those params.
import { CalendarApiClient } from "google-calendar-api-client";
const apiClient = new CalendarApiClient({
clientId: process.env.CLIENT_ID,
apiKey: process.env.API_KEY,
scope: "https://www.googleapis.com/auth/calendar.events",
discoveryDocs: ["https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest"],
});- Use this.
const listEvents = async () => {
const day = dayjs();
await apiClient.listEvents({
timeMin: day.toISOString(),
timeMax: day.add(1, "month").toISOString(),
maxResults: 20,
singleEvents: true,
orderBy: "startTime",
});
};