Skip to content

API Reference

phantasos

phantasos — generate native, self-contained Python SDKs from OpenAPI specs.

CursorPagination

Bases: _Component

Cursor pagination: items under data_field, cursor under page_info.

Source code in src/phantasos/config.py
29
30
31
32
33
34
35
36
class CursorPagination(_Component):
    """Cursor pagination: items under `data_field`, cursor under page_info."""

    data_field: str = "data"
    page_info_field: str = "page_info"
    cursor_field: str = "cursor"
    has_next_field: str = "has_next_page"
    template: str = "pagination/cursor.py.jinja"

Facade

Bases: _Component

Resource facade: binds generated *Api classes as client..

Source code in src/phantasos/config.py
48
49
50
51
class Facade(_Component):
    """Resource facade: binds generated *Api classes as client.<resource>."""

    template: str = "facade/client.py.jinja"

NestedError

Bases: _Component

Error message at body[error_field][message_field] (+ optional code).

Source code in src/phantasos/config.py
39
40
41
42
43
44
45
class NestedError(_Component):
    """Error message at ``body[error_field][message_field]`` (+ optional code)."""

    error_field: str = "error"
    message_field: str = "message"
    code_field: str = "code"
    template: str = "errors/nested_error.py.jinja"

OAuthClientCredentials

Bases: _Component

OAuth2 client-credentials auth (Basic creds, form body).

Source code in src/phantasos/config.py
17
18
19
20
21
22
23
24
25
26
class OAuthClientCredentials(_Component):
    """OAuth2 client-credentials auth (Basic creds, form body)."""

    token_url: str
    scope_env: str = "SCOPE"
    client_id_env: str = "CLIENT_ID"
    client_secret_env: str = "CLIENT_SECRET"  # noqa: S105  env-var name, not a secret
    base_url_env: str = "BASE_URL"
    config_class_name: str = "SdkConfiguration"
    template: str = "auth/oauth_client_credentials.py.jinja"