Integrations — Google Calendar & Keywords¶
The integrations package provides external service integrations: Google Calendar sync and keyword automation.
Google Calendar¶
Account Manager¶
- class jot.integrations.gcal.account_manager.GoogleCalendarAccountManager[source]¶
Bases:
objectManage multiple Google Calendar accounts
- ACCOUNTS_DIR = PosixPath('/home/runner/.jot/gcal-accounts')¶
- discover_accounts()[source]¶
Discover all configured Google Calendar accounts
- Returns:
Account names (subdirectories with credentials.json)
- Return type:
- get_account_path(account_name)[source]¶
Get path to account directory
- Parameters:
account_name – Name of the account
- Returns:
Path to account directory
- Return type:
Path
Authentication¶
- class jot.integrations.gcal.auth.GoogleCalendarAuth(account_name='default')[source]¶
Bases:
objectHandle Google Calendar OAuth authentication
- SCOPES = ['https://www.googleapis.com/auth/calendar']¶
- __init__(account_name='default')[source]¶
Initialize with account-specific credentials directory
- Parameters:
account_name – Name of the Google Calendar account (default: ‘default’)
- get_credentials()[source]¶
Get or refresh OAuth credentials
- Returns:
Credentials object
- Raises:
FileNotFoundError – If credentials.json not found
Events¶
Google Calendar event management
- jot.integrations.gcal.events.create_gcal_event(service, task_text, start_time=None, duration_minutes=15, description=None)[source]¶
Create a Google Calendar event from task text
- Parameters:
service – Google Calendar API service object
task_text – Task text to use as event summary
start_time – Optional timezone-aware datetime for event start (default: now rounded to 15 min)
duration_minutes – Event duration in minutes (default: 15)
description – Optional event description (default: ‘Created from jot task’)
- Returns:
Event link (htmlLink) or None if failed
- Raises:
HttpError – If API call fails
- jot.integrations.gcal.events.fetch_gcal_events(service, date=None, days=1, direction='future')[source]¶
Fetch events from Google Calendar for a specific date or date range
- Parameters:
service – Google Calendar API service object
date – datetime.date object (default: today)
days – Number of days to fetch events for (1-7)
direction – ‘future’ for upcoming days, ‘past’ for previous days
- Returns:
str, ‘start’: datetime/None, ‘end’: datetime/None, ‘all_day’: bool, ‘date’: date, ‘description’: str} Returns empty list if no events found
- Return type:
List of dicts with {‘summary’
- Raises:
HttpError – If API call fails
Keywords¶
KeywordHandler¶
- class jot.integrations.keywords.handler.KeywordHandler(project_registry=None)[source]¶
Bases:
ConfigMixin,HandlersMixinManages keyword detection and action routing for task automation
- MAX_KEYWORD_LENGTH = 50¶
- __init__(project_registry=None)[source]¶
Initialize keyword handler with built-in handlers.
- Parameters:
project_registry – Optional ProjectRegistry for project name routing
- extract_keyword(task_text)[source]¶
Extract keyword from task text if present.
Keyword format: “keyword: rest of task text” - First word must end with ‘:’ - Keyword must be alphanumeric + hyphens/underscores - Case-insensitive (normalized to lowercase) - Project names are checked first before treating as action keyword
- Returns:
(keyword, original_text, project_name) or (None, text, None)
- Return type:
- register(keyword, handler_func, auto_trigger=False, description='')[source]¶
Register a keyword action handler.
Config Mixin¶
Config mixin — load and create keyword configuration.
Handlers Mixin¶
Handlers mixin — built-in keyword action handlers.