ft3.api.events package

Event handling modules.

class Handler(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Object

A simple request handler.

api: Field[Api]
file_paths: Field[list[str]]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('api', 'file_paths')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Request(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Object

A simple request object.

id_: Field[str]
url: Field[str]
path: Field[str]
method: Field[str]
headers: Field[dict[str, str]]
body: Field[Any]
path_params: Field[dict[str | string[StringType], str]]
query_params: Field[dict[str | string[StringType], Any]]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('body', 'headers', 'id_', 'method', 'path', 'path_params', 'query_params', 'url')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ('id_',)
parse_body(operation: Operation, obj_: type[objects.Object] | None = None) Never | None

Parse JSON body from url string and optionally an Object.

Automatically handles translation and injection of id params for PUT requests.

parse_path_params(uri: str, operation: Operation) None

Parse path parameters from a matched path uri.

parse_query_params(method: string[snake_case], operation: Operation, obj_: type[objects.Object] | None = None) None

Parse query parameters from url string and optionally an Object.

class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Response(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Object

A simple response object.

request_id: Field[str]
status_code: Field[Literal[200, 201, 204, 301, 400, 401, 403, 404, 405, 423, 429, 500, 501]]
headers: Field[dict[str, str]]
body: Field[Any]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('body', 'headers', 'request_id', 'status_code')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ('request_id',)
serialize() bytes | str

JSON serialize body if not already a string.

class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

Submodules