Camel.toolkits.google calendar toolkit
GoogleCalendarToolkit
A class representing a toolkit for Google Calendar operations.
This class provides methods for creating events, retrieving events, updating events, and deleting events from a Google Calendar.
init
Initializes a new instance of the GoogleCalendarToolkit class.
Parameters:
- timeout (Optional[float]): The timeout value for API requests in seconds. If None, no timeout is applied. (default: :obj:
None
)
create_event
Creates an event in the user’s primary Google Calendar.
Parameters:
- event_title (str): Title of the event.
- start_time (str): Start time in ISO format (YYYY-MM-DDTHH:MM:SS).
- end_time (str): End time in ISO format (YYYY-MM-DDTHH:MM:SS).
- description (str, optional): Description of the event.
- location (str, optional): Location of the event.
- attendees_email (List[str], optional): List of email addresses. (default: :obj:
None
) - timezone (str, optional): Timezone for the event. (default: :obj:
UTC
)
Returns:
dict: A dictionary containing details of the created event.
get_events
Retrieves upcoming events from the user’s primary Google Calendar.
Parameters:
- max_results (int, optional): Maximum number of events to retrieve. (default: :obj:
10
) - time_min (str, optional): The minimum time to fetch events from. If not provided, defaults to the current time. (default: :obj:
None
)
Returns:
Union[List[Dict[str, Any]], Dict[str, Any]]: A list of dictionaries, each containing details of an event, or a dictionary with an error message.
update_event
Updates an existing event in the user’s primary Google Calendar.
Parameters:
- event_id (str): The ID of the event to update.
- event_title (Optional[str]): New title of the event. (default: :obj:
None
) - start_time (Optional[str]): New start time in ISO format (YYYY-MM-DDTHH:MM:SSZ). (default: :obj:
None
) - end_time (Optional[str]): New end time in ISO format (YYYY-MM-DDTHH:MM:SSZ). (default: :obj:
None
) - description (Optional[str]): New description of the event. (default: :obj:
None
) - location (Optional[str]): New location of the event. (default: :obj:
None
) - attendees_email (Optional[List[str]]): List of email addresses. (default: :obj:
None
)
Returns:
Dict[str, Any]: A dictionary containing details of the updated event.
delete_event
Deletes an event from the user’s primary Google Calendar.
Parameters:
- event_id (str): The ID of the event to delete.
Returns:
str: A message indicating the result of the deletion.
get_calendar_details
Returns:
dict: A dictionary containing details about the calendar.
_get_calendar_service
Returns:
Resource: A Google Calendar API service object.
_authenticate
Returns:
Credentials: A Google OAuth2 credentials object.
get_tools
Returns:
List[FunctionTool]: A list of FunctionTool objects representing the functions in the toolkit.