Source code for langchain_google_community.calendar.delete_event
"""Delete an event in Google Calendar."""fromtypingimportOptional,Typefromlangchain_core.callbacksimportCallbackManagerForToolRunfrompydanticimportBaseModel,Fieldfromlangchain_google_community.calendar.baseimportCalendarBaseTool
[docs]classDeleteEventSchema(BaseModel):"""Input for CalendarDeleteEvent."""event_id:str=Field(...,description="The event ID to delete.")calendar_id:Optional[str]=Field(default="primary",description="The origin calendar ID.")send_updates:Optional[str]=Field(default=None,description=("Whether to send updates to attendees.""Allowed values are 'all', 'externalOnly', or 'none'."),)
[docs]classCalendarDeleteEvent(CalendarBaseTool):# type: ignore[override, override]"""Tool that delete an event in Google Calendar."""name:str="delete_calendar_event"description:str="Use this tool to delete an event."args_schema:Type[DeleteEventSchema]=DeleteEventSchemadef_run(self,event_id:str,calendar_id:Optional[str]="primary",send_updates:Optional[str]=None,run_manager:Optional[CallbackManagerForToolRun]=None,)->str:"""Run the tool to delete an event in Google Calendar."""try:self.api_resource.events().delete(eventId=event_id,calendarId=calendar_id,sendUpdates=send_updates).execute()return"Event deleted"exceptExceptionaserror:raiseException(f"An error occurred: {error}")fromerror