google-calendar-api-client
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.5 • Public • Published

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

    Install

    npm i google-calendar-api-client

    DownloadsWeekly Downloads

    5

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    35.1 kB

    Total Files

    9

    Last publish

    Collaborators

    • trfv