feat(calendar): add Google Meet and attachment support for events#248
feat(calendar): add Google Meet and attachment support for events#248tuannvm wants to merge 2 commits intogemini-cli-extensions:mainfrom
Conversation
Signed-off-by: Tommy Nguyen <tuannvm@hotmail.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the calendar event management capabilities by integrating Google Meet and file attachment support directly into the event creation and update processes. These additions provide users with more robust tools for organizing meetings and sharing relevant documents, all while maintaining existing security protocols and requiring no new authentication. The changes streamline event setup and improve the overall utility of the calendar service. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for creating Google Meet links and adding attachments to calendar events. The changes are well-structured, introducing a shared Zod schema for the new parameters and a helper function to avoid code duplication in the CalendarService. The new functionality is also thoroughly covered by new tests. I have a couple of suggestions to improve code robustness and test maintainability.
| if (addGoogleMeet) { | ||
| event.conferenceData = { | ||
| createRequest: { | ||
| requestId: `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`, |
There was a problem hiding this comment.
For generating a requestId, it's better practice to use a more robust method for generating unique IDs than Math.random(). I'd suggest using crypto.randomUUID() to ensure uniqueness and avoid potential collisions, however unlikely.\n\nYou'll need to add import { randomUUID } from 'crypto'; at the top of the file.
| requestId: `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`, | |
| requestId: randomUUID(), |
| }); | ||
| }); | ||
|
|
||
| describe('createEvent with Google Meet', () => { |
There was a problem hiding this comment.
There's some duplication in the test setup. The beforeEach block that mocks calendarList.list is repeated in the describe blocks for 'createEvent with attachments', 'updateEvent with Google Meet', and 'updateEvent with attachments'.\n\nTo improve maintainability and reduce code duplication, you could nest these describe blocks within a parent describe and define the beforeEach hook once there. For example:\n\ntypescript\ndescribe('create/update events with Google Meet and attachments', () => {\n beforeEach(async () => {\n mockCalendarAPI.calendarList.list.mockResolvedValue({\n data: {\n items: [{ id: 'primary', primary: true }],\n },\n });\n });\n\n describe('createEvent with Google Meet', () => {\n // ... tests\n });\n\n describe('createEvent with attachments', () => {\n // ... tests\n });\n\n // ... and so on for updateEvent\n});\n
Signed-off-by: Tommy Nguyen <tuannvm@hotmail.com>
Summary
Fixes #247 —
calendar.createEventandcalendar.updateEventnow supportaddGoogleMeetandattachmentsparameters. No new OAuth scopes required.Use Case
Schedule a meeting with a Meet link and attach the agenda doc in one call:
calendar.createEventwithaddGoogleMeet: trueandattachments: [{fileUrl: "https://drive.google.com/open?id=..."}]Or add a Meet link to an existing event:
calendar.updateEventwitheventIdandaddGoogleMeet: trueChanges
EventAttachmentinterface,addGoogleMeet/attachmentsfields toCreateEventInputandUpdateEventInput, and a privateapplyMeetAndAttachmentshelper shared between create and updateeventMeetAndAttachmentsSchemaZod schema (following theemailComposeSchemapattern) and spread into both tool registrationsTesting
Tested locally and successfully created a calendar, along with the Google Meet link and attached doc.