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.

1.3 KB
Raw Blame
from products.warehouse_sources.sources.sdk import IncrementalField, incremental_field

BASE_URL = "https://api.gleif.org/api/v1"

# GLEIF caps `page[size]` at 200 (verified live; 201 returns 400).
PAGE_SIZE = 200

LEI_RECORDS = "LeiRecords"
LEI_ISSUERS = "LeiIssuers"
ENTITY_LEGAL_FORMS = "EntityLegalForms"
REGISTRATION_AUTHORITIES = "RegistrationAuthorities"
COUNTRIES = "Countries"
JURISDICTIONS = "Jurisdictions"
REGIONS = "Regions"

ENDPOINTS = (
    LEI_RECORDS,
    LEI_ISSUERS,
    ENTITY_LEGAL_FORMS,
    REGISTRATION_AUTHORITIES,
    COUNTRIES,
    JURISDICTIONS,
    REGIONS,
)

ENDPOINT_PATHS: dict[str, str] = {
    LEI_RECORDS: "/lei-records",
    LEI_ISSUERS: "/lei-issuers",
    ENTITY_LEGAL_FORMS: "/entity-legal-forms",
    REGISTRATION_AUTHORITIES: "/registration-authorities",
    COUNTRIES: "/countries",
    JURISDICTIONS: "/jurisdictions",
    REGIONS: "/regions",
}

# Only `lei-records` exposes a server-side timestamp filter (verified live:
# `filter[registration.lastUpdateDate]=>=DATE`). The reference tables (issuers, legal forms,
# registration authorities, countries, jurisdictions, regions) change rarely and expose no filter, so
# they sync full refresh only.
INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {
    LEI_RECORDS: [incremental_field("last_update_date")],
}