Source code for langchain_google_community.calendar.move_event
"""Move an event between calendars in Google Calendar."""fromtypingimportOptional,Typefromlangchain_core.callbacksimportCallbackManagerForToolRunfrompydanticimportBaseModel,Fieldfromlangchain_google_community.calendar.baseimportCalendarBaseTool
[docs]classMoveEventSchema(BaseModel):"""Input for CalendarMoveEvent."""event_id:str=Field(...,description="The event ID to move.")origin_calenddar_id:str=Field(...,description="The origin calendar ID.")destination_calendar_id:str=Field(...,description="The destination calendar ID.")send_updates:Optional[str]=Field(default=None,description=("Whether to send updates to attendees.""Allowed values are 'all', 'externalOnly', or 'none'."),)
[docs]classCalendarMoveEvent(CalendarBaseTool):# type: ignore[override, override]"""Tool that move an event between calendars in Google Calendar."""name:str="move_calendar_event"description:str="Use this tool to move an event between calendars."args_schema:Type[MoveEventSchema]=MoveEventSchemadef_run(self,event_id:str,origin_calendar_id:str,destination_calendar_id:str,send_updates:Optional[str]=None,run_manager:Optional[CallbackManagerForToolRun]=None,)->str:"""Run the tool to update an event in Google Calendar."""try:result=(self.api_resource.events().move(eventId=event_id,calendarId=origin_calendar_id,destination=destination_calendar_id,sendUpdates=send_updates,).execute())returnf"Event moved: {result.get('htmlLink')}"exceptExceptionaserror:raiseException(f"An error occurred: {error}")fromerror