Changeset View
Changeset View
Standalone View
Standalone View
swh/web/api/views/snapshot.py
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | def api_snapshot(request: Request, snapshot_id: str): | ||||
response = {"results": results, "headers": {}} | response = {"results": results, "headers": {}} | ||||
if results["next_branch"] is not None: | if results["next_branch"] is not None: | ||||
response["headers"]["link-next"] = reverse( | response["headers"]["link-next"] = reverse( | ||||
"api-1-snapshot", | "api-1-snapshot", | ||||
url_args={"snapshot_id": snapshot_id}, | url_args={"snapshot_id": snapshot_id}, | ||||
query_params={ | query_params={ | ||||
"branches_from": results["next_branch"], | "branches_from": results["next_branch"], | ||||
"branches_count": branches_count, | "branches_count": str(branches_count), | ||||
"target_types": target_types, | "target_types": ",".join(target_types) if target_types else None, | ||||
}, | }, | ||||
request=request, | request=request, | ||||
) | ) | ||||
return response | return response |