httk.serve.optimade.endpoints.entries¶
Attributes¶
Functions¶
|
Build a JSON:API collection response for an entry endpoint. |
|
Build a JSON:API single-resource response for an entry identifier. |
Module Contents¶
- httk.serve.optimade.endpoints.entries.generate_entry_endpoint_reply(request, config, data, data_available=None, related_resolver=None)[source]¶
Build a JSON:API collection response for an entry endpoint.
- Parameters:
request (httk.serve.optimade.model.request.ValidatedRequest) – Validated request controlling links and field selection.
config (httk.serve.optimade.model.config.OptimadeConfig) – Service configuration for metadata and links.
data (httk.serve.optimade.model.results.QueryResults) – Query results for the current page.
data_available (int | None) – Unfiltered endpoint total for the current instant, or
Noneto omit it.related_resolver (RelatedResolver | None) – Optional depth-one resolver for included resources.
- Returns:
JSON:API collection document.
- Return type:
- httk.serve.optimade.endpoints.entries.generate_single_entry_endpoint_reply(request, config, data, data_available=None, related_resolver=None)[source]¶
Build a JSON:API single-resource response for an entry identifier.
- Parameters:
request (httk.serve.optimade.model.request.ValidatedRequest) – Validated request controlling links and field selection.
config (httk.serve.optimade.model.config.OptimadeConfig) – Service configuration for metadata and links.
data (httk.serve.optimade.model.results.QueryResults) – Query results expected to contain at most one row.
data_available (int | None) – Unfiltered endpoint total for the current instant, or
Noneto omit it.related_resolver (RelatedResolver | None) – Optional depth-one resolver for included resources.
- Returns:
JSON:API single-resource document.
- Raises:
httk.serve.optimade.model.errors.OptimadeError – If the query yields multiple rows or another page.
- Return type: