@@ -62,6 +62,84 @@ def make_links_to_job(
62
62
return links
63
63
64
64
65
+ def create_get_landing_page_endpoint (
66
+ router : fastapi .APIRouter , client : clients .BaseClient
67
+ ) -> None :
68
+ """Add the `GET /` endpoint.
69
+
70
+ Parameters
71
+ ----------
72
+ router : fastapi.APIRouter
73
+ Router to which the endpoint should be added.
74
+ client : clients.BaseClient
75
+ Client implementing the `GET /processes` endpoint.
76
+ """
77
+
78
+ @router .get (
79
+ "/" ,
80
+ response_model = models .LandingPage ,
81
+ response_model_exclude_none = True ,
82
+ )
83
+ def get_landing_page (request : fastapi .Request ) -> models .LandingPage :
84
+ """Get the API landing page."""
85
+ links = [
86
+ models .Link (
87
+ href = urllib .parse .urljoin (str (request .base_url ), "openapi.json" ),
88
+ rel = "service-desc" ,
89
+ type = "application/vnd.oai.openapi+json;version=3.0" ,
90
+ title = "OpenAPI service description" ,
91
+ ),
92
+ models .Link (
93
+ href = urllib .parse .urljoin (str (request .base_url ), "conformance" ),
94
+ rel = "http://www.opengis.net/def/rel/ogc/1.0/conformance" ,
95
+ type = "application/json" ,
96
+ title = "Conformance declaration" ,
97
+ ),
98
+ models .Link (
99
+ href = urllib .parse .urljoin (str (request .base_url ), "processes" ),
100
+ rel = "http://www.opengis.net/def/rel/ogc/1.0/processes" ,
101
+ type = "application/json" ,
102
+ title = "Metadata about the processes" ,
103
+ ),
104
+ ]
105
+ landing_page = models .LandingPage (links = links )
106
+
107
+ return landing_page
108
+
109
+
110
+ def create_get_conformance_endpoint (
111
+ router : fastapi .APIRouter , client : clients .BaseClient
112
+ ) -> None :
113
+ """Add the `GET /conformance` endpoint.
114
+
115
+ Parameters
116
+ ----------
117
+ router : fastapi.APIRouter
118
+ Router to which the endpoint should be added.
119
+ client : clients.BaseClient
120
+ Client implementing the `GET /conformance` endpoint.
121
+ """
122
+
123
+ @router .get (
124
+ "" ,
125
+ response_model = models .ConfClass ,
126
+ response_model_exclude_none = True ,
127
+ )
128
+ def get_conformance (request : fastapi .Request ) -> models .ConfClass :
129
+ """Get the API conformance declaration page."""
130
+ conformance = models .ConfClass (
131
+ conformsTo = [
132
+ "http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/core" ,
133
+ "http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/ogc-process-description" ,
134
+ "http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/job-list" ,
135
+ "http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/json" ,
136
+ "http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/oas30" ,
137
+ ]
138
+ )
139
+
140
+ return conformance
141
+
142
+
65
143
def create_get_processes_endpoint (
66
144
router : fastapi .APIRouter , client : clients .BaseClient
67
145
) -> None :
@@ -328,6 +406,52 @@ def get_job_results(job_id: str) -> Dict[str, Any]:
328
406
return response
329
407
330
408
409
+ def create_landing_page_router (client : clients .BaseClient ) -> fastapi .APIRouter :
410
+ """Register the API router exposing the `/` endpoint.
411
+
412
+ Parameters
413
+ ----------
414
+ client : clients.BaseClient
415
+ Client implementing the API endpoints.
416
+
417
+ Returns
418
+ -------
419
+ fastapi.APIRouter
420
+ Router exposing the `/` API endpoint.
421
+ """
422
+ router = fastapi .APIRouter (
423
+ prefix = "" ,
424
+ tags = ["Capabilities" ],
425
+ )
426
+ create_get_landing_page_endpoint (router = router , client = client )
427
+
428
+ return router
429
+
430
+
431
+ def create_conformance_declaration_router (
432
+ client : clients .BaseClient ,
433
+ ) -> fastapi .APIRouter :
434
+ """Register the API router exposing the `/conformance` endpoint.
435
+
436
+ Parameters
437
+ ----------
438
+ client : clients.BaseClient
439
+ Client implementing the API endpoints.
440
+
441
+ Returns
442
+ -------
443
+ fastapi.APIRouter
444
+ Router exposing the `/conformance` API endpoint.
445
+ """
446
+ router = fastapi .APIRouter (
447
+ prefix = "/conformance" ,
448
+ tags = ["ConformanceDeclaration" ],
449
+ )
450
+ create_get_conformance_endpoint (router = router , client = client )
451
+
452
+ return router
453
+
454
+
331
455
def create_processes_router (client : clients .BaseClient ) -> fastapi .APIRouter :
332
456
"""Register the API router collecting the `/processes/...` endpoints.
333
457
0 commit comments