Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

2.2 KB
Raw Blame
from typing import Literal

from products.warehouse_sources.sources.sdk import frozen


@frozen
class AttioEndpointConfig:
    name: str
    path: str
    primary_key: str = "record_id"
    partition_key: str = "created_at"
    method: Literal["GET", "POST"] = "GET"
    page_size: int = 500
    pagination: Literal["offset", "cursor"] = "offset"


# Attio API doesn't support updatedAt filtering, so only full refresh is supported
ATTIO_ENDPOINTS: dict[str, AttioEndpointConfig] = {
    "companies": AttioEndpointConfig(
        name="companies",
        path="/v2/objects/companies/records/query",
        method="POST",
        primary_key="record_id",
    ),
    "people": AttioEndpointConfig(
        name="people",
        path="/v2/objects/people/records/query",
        method="POST",
        primary_key="record_id",
    ),
    "deals": AttioEndpointConfig(
        name="deals",
        path="/v2/objects/deals/records/query",
        method="POST",
        primary_key="record_id",
    ),
    "users": AttioEndpointConfig(
        name="users",
        path="/v2/objects/users/records/query",
        method="POST",
        primary_key="record_id",
    ),
    "workspaces": AttioEndpointConfig(
        name="workspaces",
        path="/v2/objects/workspaces/records/query",
        method="POST",
        primary_key="record_id",
    ),
    "lists": AttioEndpointConfig(
        name="lists",
        path="/v2/lists",
        method="GET",
        primary_key="list_id",
    ),
    "notes": AttioEndpointConfig(
        name="notes",
        path="/v2/notes",
        method="GET",
        primary_key="note_id",
        page_size=50,
    ),
    "tasks": AttioEndpointConfig(
        name="tasks",
        path="/v2/tasks",
        method="GET",
        primary_key="task_id",
    ),
    "workspace_members": AttioEndpointConfig(
        name="workspace_members",
        path="/v2/workspace_members",
        method="GET",
        primary_key="workspace_member_id",
    ),
    "activities": AttioEndpointConfig(
        name="activities",
        path="/v2/activities",
        method="GET",
        primary_key="activity_id",
        pagination="cursor",
    ),
}

ENDPOINTS = tuple(ATTIO_ENDPOINTS.keys())