Add Google Sheets service - #18
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis pull request introduces Google Sheets API integration to the packages/nodes project. It adds a GoogleSheetsService class with OAuth2 authentication, utility scripts for token generation and authorization, a test/demo script, and supporting configuration files. The .gitignore is updated to exclude generated token files. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant repl.js as repl.js<br/>(Auth URL Gen)
participant Browser
participant GoogleAuth as Google OAuth2
participant token.js as token.js<br/>(Token Exchange)
User->>repl.js: npm run repl
repl.js->>GoogleAuth: generateAuthUrl(offline, sheets scope)
GoogleAuth-->>repl.js: auth URL
repl.js-->>User: Display URL + visit prompt
User->>Browser: Visit auth URL
Browser->>GoogleAuth: Authorize access
GoogleAuth-->>Browser: Return code in redirect
User->>token.js: npm run token (with code)
token.js->>GoogleAuth: exchangeCodeForToken(code)
GoogleAuth-->>token.js: {access_token, refresh_token, expiry_date}
token.js-->>User: Display tokens
sequenceDiagram
participant test.ts as test.ts<br/>(Test Script)
participant Service as GoogleSheetsService
participant GoogleAPI as Google Sheets API
test.ts->>test.ts: Load credentials from env/.hardcoded
test.ts->>Service: new GoogleSheetsService(credentials)
Service->>Service: Initialize OAuth2 client<br/>with credentials
Service->>GoogleAPI: Create sheets client
test.ts->>Service: readRows({spreadsheetId, range})
Service->>GoogleAPI: sheets.spreadsheets.values.get()
GoogleAPI-->>Service: {values: [[...],...]}
Service-->>test.ts: Return row values
test.ts-->>test.ts: Log results or error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.