Base Models#

validate_list_to_single(v)[source]#

Converts a list to a single value (the last element of the list)

Query parameters (in a URI) can be specified multiple times. Therefore, we will always convert them to a list in flask. But that means we have to convert them to single values here

class RestModelBase[source]#

Bases: BaseModel

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class CommonBulkGetBody(*, ids, include=None, exclude=None, missing_ok=False)[source]#

Bases: RestModelBase

Common URL parameters for “get_*” functions

These functions typically take a list for ids, and a bool for missing_ok

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • ids (list[int])

  • include (list[str] | None)

  • exclude (list[str] | None)

  • missing_ok (bool)

ids: list[int]#
include: list[str] | None#
exclude: list[str] | None#
missing_ok: bool#
model_config = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class CommonBulkGetNamesBody(*, names, include=None, exclude=None, missing_ok=False)[source]#

Bases: RestModelBase

Common URL parameters for “get_*” functions

These functions typically take a list for ids, and a bool for missing_ok

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • names (list[str])

  • include (list[str] | None)

  • exclude (list[str] | None)

  • missing_ok (bool)

names: list[str]#
include: list[str] | None#
exclude: list[str] | None#
missing_ok: bool#
model_config = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class ProjURLParameters(*, include=None, exclude=None)[source]#

Bases: RestModelBase

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • include (list[str] | None)

  • exclude (list[str] | None)

include: list[str] | None#
exclude: list[str] | None#
model_config = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class QueryModelBase(*, limit=None, cursor=None)[source]#

Bases: RestModelBase

Common parameters for query_* functions, without include/exclude

These can be either URL parameters or part of a POST body

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • limit (int | None)

  • cursor (int | None)

limit: int | None#
cursor: int | None#
classmethod validate_lists(v)[source]#
model_config = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class QueryProjModelBase(*, include=None, exclude=None, limit=None, cursor=None)[source]#

Bases: QueryModelBase, ProjURLParameters

Common parameters for query_* functions, with include/exclude (projection)

These can be either URL parameters or part of a POST body

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:
  • include (list[str] | None)

  • exclude (list[str] | None)

  • limit (int | None)

  • cursor (int | None)

model_config = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod validate_lists(v)#
limit#
cursor#
include#
exclude#
class QueryIteratorBase(client, query_filters, batch_limit)[source]#

Bases: Generic[T]

Base class for all query result iterators

Query iterators are used to iterate intelligently over the result of a query. This handles pagination, where only batches are downloaded from the server.

Parameters:
reset()[source]#

Starts retrieval of results from the beginning again