Skip to content

Google Calendar API client for JavaScript written by TypeScript.

License

Notifications You must be signed in to change notification settings

trfv/google-calendar-api-client

Repository files navigation

google-calendar-api-client

npm npm bundle size npm (downloads)

Google Calendar API client for JavaScript. This is created with great influence from those repositories.

Installation

// with npm
npm install google-calendar-api-client

// with yarn
yarn add google-calendar-api-client

Usage

  1. Prepare client id and api key. https://console.cloud.google.com/apis/credentials

  2. 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"],
});
  1. 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",
  });
};

About

Google Calendar API client for JavaScript written by TypeScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published