Spec¶
client.spec is a Registry built from one copy of the T3 OpenAPI spec. See
endpoints and the spec.
Registry
¶
Every operation in one copy of the spec.
list
¶
Every endpoint, or every endpoint of one kind.
find
¶
Endpoints whose ID, path, summary or tags contain every word of query.
endpoint
¶
endpoint(name: str, *, method: str | None = None, kind: Kind | Iterable[Kind] | None = None, path_params: Iterable[str] | None = None) -> Endpoint
Find one operation by endpoint ID or path.
One ID or path can name several operations. method, kind and
the names of the path parameters you have narrow it down to one.
check_params
¶
check_params(endpoint: Endpoint, query: Mapping[str, Any], path_values: Mapping[str, Any], *, has_body: bool, python_names: Mapping[str, str] | None = None) -> None
Raise SpecError for missing required parameters, warn about unknown ones.
Endpoint
dataclass
¶
Endpoint(id: str | None, method: str, path: str, kind: Kind, tags: tuple[str, ...] = (), summary: str = '', params: tuple[Param, ...] = (), body_required: bool = False, has_body: bool = False, response_types: tuple[str, ...] = (), public: bool = False, body_type: str | None = None)
One operation (method + path) in the spec.
Attributes:
| Name | Type | Description |
|---|---|---|
body_type |
str | None
|
The JSON schema |
body_is_array
property
¶
True when the JSON body is a list. Most Metrc write routes take one, even for one object.
Param
dataclass
¶
Param(name: str, location: str, required: bool = False, description: str = '', schema: Mapping[str, Any] = dict())
One operation parameter, with $refs resolved.
choices
property
¶
The values the spec allows (its enum, or its items' for an array), else ().
SpecSource
dataclass
¶
SpecSource(kind: SourceKind, host: str, path: Path | None = None, fetched_at: float | None = None, etag: str | None = None)
Which copy of the spec is in use.