Add all 13 integration modules (Notion, Google Drive, Google Sheets, Airtable, Dropbox, OneDrive, MEGA, Nextcloud, Google Calendar, Apple Calendar/CalDAV, Slack, Discord, Home Assistant) with fields(), connect(), and test() implementations. Add config/integrations/*.yaml.example files and gitignore rules for live config files. Add 5 new registry/schema tests bringing total to 193 passing.
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
from __future__ import annotations
|
|
from scripts.integrations.base import IntegrationBase
|
|
|
|
|
|
class NotionIntegration(IntegrationBase):
|
|
name = "notion"
|
|
label = "Notion"
|
|
tier = "paid"
|
|
|
|
def __init__(self):
|
|
self._token = ""
|
|
self._database_id = ""
|
|
|
|
def fields(self) -> list[dict]:
|
|
return [
|
|
{"key": "token", "label": "Integration Token", "type": "password",
|
|
"placeholder": "secret_…", "required": True,
|
|
"help": "Settings → Connections → Develop or manage integrations → New integration"},
|
|
{"key": "database_id", "label": "Database ID", "type": "text",
|
|
"placeholder": "32-character ID from Notion URL", "required": True,
|
|
"help": "Open your Notion database → Share → Copy link → extract the ID"},
|
|
]
|
|
|
|
def connect(self, config: dict) -> bool:
|
|
self._token = config.get("token", "")
|
|
self._database_id = config.get("database_id", "")
|
|
return bool(self._token and self._database_id)
|
|
|
|
def test(self) -> bool:
|
|
try:
|
|
from notion_client import Client
|
|
db = Client(auth=self._token).databases.retrieve(self._database_id)
|
|
return bool(db)
|
|
except Exception:
|
|
return False
|