1.0.0 • Published 9 months ago

@qte/nest-google-calendar v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Nest Google Calendar API wrapper

Thin wrapper around Google Calendar API for Nest.

Installation

yarn add @qte/nest-google-calendar

Usage

// *.module.ts
import { Module } from '@nestjs/common'
import { GoogleCalendarModule } from '@qte/nest-google-calendar'

@Module({
  imports: [GoogleCalendarModule],
  // ...
})
export class AppModule {}
// *.service.ts
import { Injectable } from '@nestjs/common'
import { GoogleCalendarService } from '@qte/nest-google-calendar'

@Injectable()
export class MyService {
  constructor(private readonly googleCalendarService: GoogleCalendarService) {}

  async getEvents() {
    const events = await this.googleCalendarService.getEvents({
      timeMin: new Date('2023-01-01'), // Get all events that start after this date
      timeMax: new Date('2023-12-31'), // Get all events that start before this date
      access_token: '...', // Google OAuth2 access token
    })
    return events
  }
}

API Reference

The package uses the Google Calendar v3 API

1.0.0

9 months ago