@@ -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 :
@@ -332,6 +410,52 @@ def get_job_results(job_id: str) -> Dict[str, Any]:
332
410
return response
333
411
334
412
413
+ def create_landing_page_router (client : clients .BaseClient ) -> fastapi .APIRouter :
414
+ """Register the API router exposing the `/` endpoint.
415
+
416
+ Parameters
417
+ ----------
418
+ client : clients.BaseClient
419
+ Client implementing the API endpoints.
420
+
421
+ Returns
422
+ -------
423
+ fastapi.APIRouter
424
+ Router exposing the `/` API endpoint.
425
+ """
426
+ router = fastapi .APIRouter (
427
+ prefix = "" ,
428
+ tags = ["Capabilities" ],
429
+ )
430
+ create_get_landing_page_endpoint (router = router , client = client )
431
+
432
+ return router
433
+
434
+
435
+ def create_conformance_declaration_router (
436
+ client : clients .BaseClient ,
437
+ ) -> fastapi .APIRouter :
438
+ """Register the API router exposing the `/conformance` endpoint.
439
+
440
+ Parameters
441
+ ----------
442
+ client : clients.BaseClient
443
+ Client implementing the API endpoints.
444
+
445
+ Returns
446
+ -------
447
+ fastapi.APIRouter
448
+ Router exposing the `/conformance` API endpoint.
449
+ """
450
+ router = fastapi .APIRouter (
451
+ prefix = "/conformance" ,
452
+ tags = ["ConformanceDeclaration" ],
453
+ )
454
+ create_get_conformance_endpoint (router = router , client = client )
455
+
456
+ return router
457
+
458
+
335
459
def create_processes_router (client : clients .BaseClient ) -> fastapi .APIRouter :
336
460
"""Register the API router collecting the `/processes/...` endpoints.
337
461
0 commit comments