httk.serve.optimade.model.request¶
Classes¶
Represent an incoming OPTIMADE request from the web layer. |
|
Represent a slice requested via |
|
Represent validated URL query parameters of an OPTIMADE request. |
|
Represent the result of validating a |
|
Represent an endpoint response for serialization by the web layer. |
Module Contents¶
- class httk.serve.optimade.model.request.RawRequest[source]¶
Represent an incoming OPTIMADE request from the web layer.
Only
baseurlandrepresentationare mandatory; missing information is derived fromrepresentationduring validation.- Parameters:
baseurl – Base URL used when generating response links.
representation – Request path and query representation.
relurl – Relative request URL, when supplied by the web layer.
querystr – Raw query string.
query – Parsed query parameters.
endpoint – Preselected endpoint, when supplied by the caller.
request_id – Preselected entry identifier, when supplied by the caller.
version – API version declared by the caller.
- class httk.serve.optimade.model.request.RequestedSlice[source]¶
Represent a slice requested via
dimension_slices.The values are stored exactly as given (a
Nonecomponent means the client omitted it and the default applies). Per the OPTIMADE specification,stopis inclusive.- Parameters:
start – Inclusive first index, or
Nonefor the default.stop – Inclusive last index, or
Nonefor the default.step – Slice step, or
Nonefor the default.
- class httk.serve.optimade.model.request.ValidatedParameters[source]¶
Represent validated URL query parameters of an OPTIMADE request.
- Parameters:
response_format – Requested response format.
page_limit – Maximum number of entries in a page.
page_offset – Number of matching entries to skip.
response_fields – Comma-separated requested response fields.
filter – Raw OPTIMADE filter expression.
sort – Raw OPTIMADE sort expression.
include – Raw related-entry inclusion request.
as_of – Nanosecond timestamp cutoff for timestamp-capable stored sources; timestamp-disabled sources may serve current state and generic providers ignore it.
dimension_slices – Requested slices keyed by dimension name.
- dimension_slices: dict[str, RequestedSlice][source]¶
- class httk.serve.optimade.model.request.ValidatedRequest[source]¶
Represent the result of validating a
RawRequest.- Parameters:
baseurl – Base URL used when generating response links.
representation – Original request representation.
endpoint – Validated endpoint name.
version – Validated OPTIMADE version.
query – Validated query parameters.
url_version – Version segment present in the request URL.
request_id – Validated entry identifier.
recognized_response_fields – Requested fields known to the schema.
unrecognized_response_fields – Requested fields not known to the schema.
sort_fields – Validated sort fields and directions.
include_paths – Validated related-entry paths.
property_metadata_requested – Whether property metadata was requested.
partial_data_parts – Entry, identifier, and property for partial data.
partial_data_offset – Offset into a partial-data response.
warnings – Warnings collected while processing the request.
- query: ValidatedParameters[source]¶
- class httk.serve.optimade.model.request.EndpointResponse[source]¶
Represent an endpoint response for serialization by the web layer.
Either
json_response(a JSON:API document) orcontent(a raw body) is set.- Parameters:
response_code – HTTP status code.
response_msg – HTTP status title.
content_type – Response media type.
encoding – Response character encoding.
content – Raw response body, when the response is not JSON.
json_response – JSON:API response document, when the response is JSON.