-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathconformance.py
More file actions
40 lines (29 loc) · 1.56 KB
/
conformance.py
File metadata and controls
40 lines (29 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# This is some slightly strange magic to get "static" structures with
# attributes, to make it pleasant to use in an editor with autocompletion.
import dataclasses
from dataclasses import dataclass
from stapi_pydantic.constants import STAPI_VERSION
@dataclass(frozen=True)
class _All:
def all(self) -> list[str]:
return [getattr(self, field.name) for field in dataclasses.fields(self)]
@dataclass(frozen=True)
class _Api(_All):
core: str = f"https://stapi.example.com/v{STAPI_VERSION}/core"
order_statuses: str = f"https://stapi.example.com/v{STAPI_VERSION}/order-statuses"
searches_opportunity: str = f"https://stapi.example.com/v{STAPI_VERSION}/searches-opportunity"
searches_opportunity_statuses: str = f"https://stapi.example.com/v{STAPI_VERSION}/searches-opportunity-statuses"
@dataclass(frozen=True)
class _Product(_All):
opportunities: str = f"https://stapi.example.com/v{STAPI_VERSION}/opportunities"
opportunities_async: str = f"https://stapi.example.com/v{STAPI_VERSION}/opportunities-async"
geojson_point: str = "https://geojson.org/schema/Point.json"
geojson_linestring: str = "https://geojson.org/schema/LineString.json"
geojson_polygon: str = "https://geojson.org/schema/Polygon.json"
geojson_multi_point: str = "https://geojson.org/schema/MultiPoint.json"
geojson_multi_polygon: str = "https://geojson.org/schema/MultiPolygon.json"
geojson_multi_linestring: str = "https://geojson.org/schema/MultiLineString.json"
API = _Api()
"""API (top level) conformances"""
PRODUCT = _Product()
"""Product conformances"""