Skip to content

Googlecalendar

flowtask.interfaces.GoogleCalendar

GoogleCalendarClient

GoogleCalendarClient(*args, credentials=None, **kwargs)

Bases: GoogleClient, ABC

Google Calendar Client for managing calendar events.

check_event_start_time async

check_event_start_time(event_start_time)

Check if the current time has reached or passed the event's start time and trigger an action if so.

Parameters:

Name Type Description Default
event_start_time datetime

The start time of the event to check.

required

create_event async

create_event(calendar_id, event)

Create an event in the specified Google Calendar.

Parameters:

Name Type Description Default
calendar_id str

The ID of the calendar to add the event to.

required
event dict

The event details.

required

Returns:

Name Type Description
dict Dict

Details of the created event.

create_subscription async

create_subscription(webhook_url, client_state='secret_string', expiration_hours=1)

Create a subscription to receive notifications when events are created, updated, or deleted in the calendar.

Parameters:

Name Type Description Default
webhook_url str

The webhook URL that will receive the notifications.

required
client_state str

A client secret string for verifying notifications.

'secret_string'
expiration_hours int

Duration for which the subscription should be valid (maximum is 4230 minutes or 7 days).

1

Returns:

Name Type Description
dict dict

The response from Microsoft Graph API with subscription details.

delete_event async

delete_event(calendar_id, event_id)

Delete an event from the specified calendar.

Parameters:

Name Type Description Default
calendar_id str

The ID of the calendar.

required
event_id str

The ID of the event to delete.

required

get_client async

get_client()

Get the Google Calendar client, with caching.

get_event async

get_event(calendar_id, event_id)

Retrieve details of a specific event.

Parameters:

Name Type Description Default
calendar_id str

The ID of the calendar.

required
event_id str

The ID of the event.

required

Returns:

Name Type Description
dict Dict

Details of the event.

list_events async

list_events(calendar_id, time_min, time_max, max_results=10)

List events in a specified time range.

Parameters:

Name Type Description Default
calendar_id str

The ID of the calendar to list events from.

required
time_min datetime

Start time to retrieve events.

required
time_max datetime

End time to retrieve events.

required
max_results int

Maximum number of events to retrieve (default is 10).

10

Returns:

Name Type Description
list List[Dict]

List of events within the time range.

setup_watch async

setup_watch(calendar_id, webhook_url, channel_id)

Sets up a watch on the specified calendar to receive notifications when events are created, updated, or deleted.

Parameters:

Name Type Description Default
calendar_id str

The ID of the calendar to monitor.

required
webhook_url str

The URL of the webhook endpoint to receive notifications.

required
channel_id str

Unique ID for this notification channel.

required

Returns:

Name Type Description
dict Dict

The response from the Google Calendar API containing the channel information.

update_event async

update_event(calendar_id, event_id, updated_event)

Update an existing event in the calendar.

Parameters:

Name Type Description Default
calendar_id str

The ID of the calendar containing the event.

required
event_id str

The ID of the event to update.

required
updated_event dict

The updated event details.

required

Returns:

Name Type Description
dict Dict

Details of the updated event.