JSPM

google-calendar-api-client

0.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q52747F
  • License MIT

Google Calendar API client for JavaScript.

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

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",
  });
};