Services

External API integrations (pure API calls only).

Services should:

  • Be single-purpose functions that make direct API calls to external systems
  • Be pure functions that handle HTTP transport layer (response.ok)
  • Return consistent { success: boolean, data?: any, error?: string } format
  • NOT handle environment variables, business logic, or orchestrate multiple calls

Examples

Notion Service Functions

  • updatePageUrl(pageId, url) - Updates a Notion page's URL property
  • getPageById(pageId) - Retrieves a single Notion page
  • getDatabaseById(databaseId) - Retrieves a Notion database
  • getDatabasePages(databaseId) - Queries pages from a Notion database
  • getDatabases() - Lists all accessible Notion databases

All functions return the standard {success, data/error, timestamp} format.