httk.serve.optimade.endpoints.meta

Build OPTIMADE response metadata and collected warning entries.

Functions

merge_collected_warnings(json_response)

Merge the innermost active report collection into response metadata.

generate_meta(*, representation, api_version, config)

Build the OPTIMADE response metadata object.

Module Contents

httk.serve.optimade.endpoints.meta.merge_collected_warnings(json_response)[source]

Merge the innermost active report collection into response metadata.

Parameters:

json_response (dict[str, Any]) – JSON:API document whose meta.warnings is updated.

httk.serve.optimade.endpoints.meta.generate_meta(*, representation, api_version, config, data_returned=None, more_data_available=False, data_available=None, warnings=None, last_id=None)[source]

Build the OPTIMADE response metadata object.

Parameters:
  • representation (str) – Request representation recorded in metadata.

  • api_version (str) – OPTIMADE version used for the response.

  • config (httk.serve.optimade.model.config.OptimadeConfig) – Service metadata configuration.

  • data_returned (int | None) – Total data objects for the current filter query, independent of pagination.

  • more_data_available (bool) – Whether another page is available.

  • data_available (int | None) – Total data objects available in the database for the endpoint (unfiltered).

  • warnings (list[dict[str, Any]] | None) – Warnings already associated with the request.

  • last_id (str | None) – Identifier of the final returned entry.

Returns:

OPTIMADE metadata mapping.

Return type:

dict[str, Any]