Update starlette route path to accomodate hierarchy (#893)
* Update starlette route path to accomodate hierachy Signed-off-by: Abdulazeez Abdulazeez Adeshina <youngestdev@gmail.com> * Update broken routes * Fix formatting Signed-off-by: Abdulazeez Abdulazeez Adeshina <youngestdev@gmail.com> * Add author details and fix flake8 issues Signed-off-by: Abdulazeez Abdulazeez Adeshina <youngestdev@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9ed4d36acb
commit
2b994b8384
+43
-41
@@ -2,9 +2,11 @@
|
||||
#
|
||||
# Authors: Francesco Bartoli <xbartolone@gmail.com>
|
||||
# Tom Kralidis <tomkralidis@gmail.com>
|
||||
# Abdulazeez Abdulazeez Adeshina <youngestdev@gmail.com>
|
||||
#
|
||||
# Copyright (c) 2020 Francesco Bartoli
|
||||
# Copyright (c) 2022 Tom Kralidis
|
||||
# Copyright (c) 2022 Abdulazeez Abdulazeez Adeshina
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation
|
||||
@@ -137,26 +139,8 @@ async def conformance(request: Request):
|
||||
return get_response(api_.conformance(request))
|
||||
|
||||
|
||||
@app.route('/collections')
|
||||
@app.route('/collections/')
|
||||
@app.route('/collections/{path:collection_id}')
|
||||
@app.route('/collections/{path:collection_id}/')
|
||||
async def collections(request: Request, collection_id=None):
|
||||
"""
|
||||
OGC API collections endpoint
|
||||
|
||||
:param request: Starlette Request instance
|
||||
:param collection_id: collection identifier
|
||||
|
||||
:returns: Starlette HTTP Response
|
||||
"""
|
||||
if 'collection_id' in request.path_params:
|
||||
collection_id = request.path_params['collection_id']
|
||||
return get_response(api_.describe_collections(request, collection_id))
|
||||
|
||||
|
||||
@app.route('/collections/{path:collection_id}/queryables')
|
||||
@app.route('/collections/{path:collection_id}/queryables/')
|
||||
@app.route('/collections/{collection_id:path}/queryables')
|
||||
@app.route('/collections/{collection_id:path}/queryables/')
|
||||
async def collection_queryables(request: Request, collection_id=None):
|
||||
"""
|
||||
OGC API collections queryables endpoint
|
||||
@@ -220,10 +204,10 @@ async def get_collection_items_tiles(request: Request, name=None,
|
||||
request, name, tileMatrixSetId, tile_matrix, tileRow, tileCol))
|
||||
|
||||
|
||||
@app.route('/collections/{path:collection_id}/items', methods=['GET', 'POST'])
|
||||
@app.route('/collections/{path:collection_id}/items/', methods=['GET', 'POST'])
|
||||
@app.route('/collections/{path:collection_id}/items/{item_id}')
|
||||
@app.route('/collections/{path:collection_id}/items/{item_id}/')
|
||||
@app.route('/collections/{collection_id:path}/items', methods=['GET', 'POST'])
|
||||
@app.route('/collections/{collection_id:path}/items/', methods=['GET', 'POST'])
|
||||
@app.route('/collections/{collection_id:path}/items/{item_id}')
|
||||
@app.route('/collections/{collection_id:path}/items/{item_id}/')
|
||||
async def collection_items(request: Request, collection_id=None, item_id=None):
|
||||
"""
|
||||
OGC API collections items endpoint
|
||||
@@ -252,7 +236,7 @@ async def collection_items(request: Request, collection_id=None, item_id=None):
|
||||
request, collection_id, item_id))
|
||||
|
||||
|
||||
@app.route('/collections/{path:collection_id}/coverage')
|
||||
@app.route('/collections/{collection_id:path}/coverage')
|
||||
async def collection_coverage(request: Request, collection_id=None):
|
||||
"""
|
||||
OGC API - Coverages coverage endpoint
|
||||
@@ -268,7 +252,7 @@ async def collection_coverage(request: Request, collection_id=None):
|
||||
return get_response(api_.get_collection_coverage(request, collection_id))
|
||||
|
||||
|
||||
@app.route('/collections/{path:collection_id}/coverage/domainset')
|
||||
@app.route('/collections/{collection_id:path}/coverage/domainset')
|
||||
async def collection_coverage_domainset(request: Request, collection_id=None):
|
||||
"""
|
||||
OGC API - Coverages coverage domainset endpoint
|
||||
@@ -285,7 +269,7 @@ async def collection_coverage_domainset(request: Request, collection_id=None):
|
||||
request, collection_id))
|
||||
|
||||
|
||||
@app.route('/collections/{path:collection_id}/coverage/rangetype')
|
||||
@app.route('/collections/{collection_id:path}/coverage/rangetype')
|
||||
async def collection_coverage_rangetype(request: Request, collection_id=None):
|
||||
"""
|
||||
OGC API - Coverages coverage rangetype endpoint
|
||||
@@ -304,8 +288,8 @@ async def collection_coverage_rangetype(request: Request, collection_id=None):
|
||||
|
||||
@app.route('/processes')
|
||||
@app.route('/processes/')
|
||||
@app.route('/processes/{path:process_id}')
|
||||
@app.route('/processes/{path:process_id}/')
|
||||
@app.route('/processes/{process_id}')
|
||||
@app.route('/processes/{process_id}/')
|
||||
async def get_processes(request: Request, process_id=None):
|
||||
"""
|
||||
OGC API - Processes description endpoint
|
||||
@@ -346,8 +330,8 @@ async def get_jobs(request: Request, job_id=None):
|
||||
return get_response(api_.get_jobs(request, job_id))
|
||||
|
||||
|
||||
@app.route('/processes/{path:process_id}/execution', methods=['POST'])
|
||||
@app.route('/processes/{path:process_id}/execution/', methods=['POST'])
|
||||
@app.route('/processes/{process_id}/execution', methods=['POST'])
|
||||
@app.route('/processes/{process_id}/execution/', methods=['POST'])
|
||||
async def execute_process_jobs(request: Request, process_id=None):
|
||||
"""
|
||||
OGC API - Processes jobs endpoint
|
||||
@@ -407,16 +391,16 @@ async def get_job_result_resource(request: Request,
|
||||
request, job_id, resource))
|
||||
|
||||
|
||||
@app.route('/collections/{path:collection_id}/position')
|
||||
@app.route('/collections/{path:collection_id}/area')
|
||||
@app.route('/collections/{path:collection_id}/cube')
|
||||
@app.route('/collections/{path:collection_id}/trajectory')
|
||||
@app.route('/collections/{path:collection_id}/corridor')
|
||||
@app.route('/collections/{path:collection_id}/instances/{instance_id}/position') # noqa
|
||||
@app.route('/collections/{path:collection_id}/instances/{instance_id}/area')
|
||||
@app.route('/collections/{path:collection_id}/instances/{instance_id}/cube')
|
||||
@app.route('/collections/{path:collection_id}/instances/{instance_id}/trajectory') # noqa
|
||||
@app.route('/collections/{path:collection_id}/instances/{instance_id}/corridor') # noqa
|
||||
@app.route('/collections/{collection_id:path}/position')
|
||||
@app.route('/collections/{collection_id:path}/area')
|
||||
@app.route('/collections/{collection_id:path}/cube')
|
||||
@app.route('/collections/{collection_id:path}/trajectory')
|
||||
@app.route('/collections/{collection_id:path}/corridor')
|
||||
@app.route('/collections/{collection_id:path}/instances/{instance_id}/position') # noqa
|
||||
@app.route('/collections/{collection_id:path}/instances/{instance_id}/area')
|
||||
@app.route('/collections/{collection_id:path}/instances/{instance_id}/cube')
|
||||
@app.route('/collections/{collection_id:path}/instances/{instance_id}/trajectory') # noqa
|
||||
@app.route('/collections/{collection_id:path}/instances/{instance_id}/corridor') # noqa
|
||||
async def get_collection_edr_query(request: Request, collection_id=None, instance_id=None): # noqa
|
||||
"""
|
||||
OGC EDR API endpoints
|
||||
@@ -438,6 +422,24 @@ async def get_collection_edr_query(request: Request, collection_id=None, instanc
|
||||
instance_id, query_type))
|
||||
|
||||
|
||||
@app.route('/collections')
|
||||
@app.route('/collections/')
|
||||
@app.route('/collections/{collection_id:path}')
|
||||
@app.route('/collections/{collection_id:path}/')
|
||||
async def collections(request: Request, collection_id=None):
|
||||
"""
|
||||
OGC API collections endpoint
|
||||
|
||||
:param request: Starlette Request instance
|
||||
:param collection_id: collection identifier
|
||||
|
||||
:returns: Starlette HTTP Response
|
||||
"""
|
||||
if 'collection_id' in request.path_params:
|
||||
collection_id = request.path_params['collection_id']
|
||||
return get_response(api_.describe_collections(request, collection_id))
|
||||
|
||||
|
||||
@app.route('/stac')
|
||||
async def stac_catalog_root(request: Request):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user