Install

npm install @agentic/google-docs googleapis @google-cloud/local-auth

Example Usage

import { GoogleDriveClient } from '@agentic/google-drive'
import { authenticate } from '@google-cloud/local-auth'
import { google } from 'googleapis'

// (in a real app, store these auth credentials and reuse them)
const auth = await authenticate({
  scopes: ['https://www.googleapis.com/auth/documents.readonly'],
  keyfilePath: process.env.GOOGLE_CREDENTIALS_PATH
})
const docs = google.docs({ version: 'v1', auth })
const client = new GoogleDocsClient({ docs })

const document = await client.getDocument({ documentId: 'TODO' })
console.log(document)