Skip to content

Commit

Permalink
modified info meta response
Browse files Browse the repository at this point in the history
  • Loading branch information
costero-e committed Jul 19, 2024
1 parent 1da70da commit 562bd2c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion beacon/response/build_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ def build_meta(qparams: RequestParams, entity_schema: Optional[DefaultSchemas],
}
return meta

def build_info_meta(qparams: RequestParams, entity_schema: Optional[DefaultSchemas], returned_granularity: Granularity):
""""Builds the `meta` part of the response
We assume that receivedRequest is the evaluated request (qparams) sent by the user.
"""
try:
meta = {
'beaconId': conf.beacon_id,
'apiVersion': conf.api_version,
'returnedSchemas': [entity_schema.value] if entity_schema is not None else []
}
except Exception:
meta = {
'beaconId': conf.beacon_id,
'apiVersion': conf.api_version,
'returnedSchemas': [entity_schema.value] if entity_schema is not None else []
}
return meta

def build_response_summary(exists, num_total_results):
LOG.debug(num_total_results)
if num_total_results is None:
Expand Down Expand Up @@ -234,7 +253,7 @@ def build_beacon_info_response(data, qparams, func_response_type, authorized_dat
authorized_datasets = []

beacon_response = {
'meta': build_meta(qparams, None, Granularity.RECORD),
'meta': build_info_meta(qparams, None, Granularity.RECORD),
'response': {
'id': conf.beacon_id,
'name': conf.beacon_name,
Expand Down

0 comments on commit 562bd2c

Please sign in to comment.