Skip to content

Models & resources

models

VndbModel

Bases: BaseModel

Base for all VNDB response models.

Allows population either by the API's response key (via per-field aliases on subclasses) or by the Python field name.

Page

Bases: BaseModel, Generic[T]

The VNDB query response envelope.

resource

QueryResource

QueryResource(
    client: Client, endpoint: str, model: type[ModelT]
)

Bases: Generic[ModelT]

A typed, synchronous query resource bound to one VNDB endpoint + model.

query

query(
    *,
    filters: Predicate | list[Any] | str | None = None,
    fields: str | None = None,
    sort: str | None = None,
    reverse: bool | None = None,
    results: int | None = None,
    page: int | None = None,
    count: bool | None = None,
    user: str | None = None,
    compact_filters: bool | None = None,
    normalized_filters: bool | None = None,
) -> Page[ModelT]

Query the endpoint and return a typed Page.

Parameters:

Name Type Description Default
filters Predicate | list[Any] | str | None

Filter predicate, raw list, or a compact filter string returned from a previous Page (round-tripping).

None
fields str | None

Comma-separated field list; defaults to field_spec for the bound model.

None
sort str | None

Field name to sort by.

None
reverse bool | None

Reverse the sort order when True.

None
results int | None

Maximum number of results to return.

None
page int | None

Page number (1-based).

None
count bool | None

When True the API populates Page.count.

None
user str | None

User ID for endpoints that require one (e.g. ulist).

None
compact_filters bool | None

Request flag asking the API to echo the compact filter string back in the returned Page.

None
normalized_filters bool | None

Request flag asking the API to echo the normalised filter list back in the returned Page.

None

AsyncQueryResource

AsyncQueryResource(
    client: AsyncClient, endpoint: str, model: type[ModelT]
)

Bases: Generic[ModelT]

A typed, asynchronous query resource bound to one VNDB endpoint + model.

query async

query(
    *,
    filters: Predicate | list[Any] | str | None = None,
    fields: str | None = None,
    sort: str | None = None,
    reverse: bool | None = None,
    results: int | None = None,
    page: int | None = None,
    count: bool | None = None,
    user: str | None = None,
    compact_filters: bool | None = None,
    normalized_filters: bool | None = None,
) -> Page[ModelT]

Query the endpoint and return a typed Page.

Parameters:

Name Type Description Default
filters Predicate | list[Any] | str | None

Filter predicate, raw list, or a compact filter string returned from a previous Page (round-tripping).

None
fields str | None

Comma-separated field list; defaults to field_spec for the bound model.

None
sort str | None

Field name to sort by.

None
reverse bool | None

Reverse the sort order when True.

None
results int | None

Maximum number of results to return.

None
page int | None

Page number (1-based).

None
count bool | None

When True the API populates Page.count.

None
user str | None

User ID for endpoints that require one (e.g. ulist).

None
compact_filters bool | None

Request flag asking the API to echo the compact filter string back in the returned Page.

None
normalized_filters bool | None

Request flag asking the API to echo the normalised filter list back in the returned Page.

None