Coverage for gws-app/gws/base/edit/api.py: 100%
45 statements
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-23 20:06 +0200
« prev ^ index » next coverage.py v7.17.0, created at 2026-10-23 20:06 +0200
1"""Request and response types of the edit API."""
3from typing import Optional
5import gws
6import gws.lib.mime
9class GetModelsRequest(gws.Request):
10 """Request for the editable models of a project."""
12 pass
15class GetModelsResponse(gws.Response):
16 """Editable models of a project."""
18 models: list[gws.ext.props.model]
19 """Model props."""
22class GetFeaturesRequest(gws.Request):
23 """Request for features of editable models."""
25 modelUids: list[str]
26 """Uids of the models to search."""
27 crs: Optional[gws.CrsName]
28 """CRS of ``extent``, the project map CRS by default."""
29 extent: Optional[gws.Extent]
30 """Search extent."""
31 featureUids: Optional[list[str]]
32 """Return only features with these uids."""
33 keyword: Optional[str]
34 """Search keyword."""
35 resolution: Optional[float]
36 """Map resolution."""
37 shapes: Optional[list[gws.ShapeProps]]
38 """Search shapes, combined into one."""
39 tolerance: Optional[str]
40 """Search tolerance, e.g. ``10px`` or ``5m``. A number without a unit is in pixels. 10 pixels by default."""
43class GetFeaturesResponse(gws.Response):
44 """Features of editable models."""
46 features: list[gws.FeatureProps]
47 """Feature props."""
50class GetRelatableFeaturesRequest(gws.Request):
51 """Request for features that can be linked in a related field."""
53 modelUid: str
54 """Uid of the model that has the field."""
55 fieldName: str
56 """Name of the related field."""
57 keyword: Optional[str]
58 """Search keyword."""
61class GetRelatableFeaturesResponse(gws.Response):
62 """Features that can be linked in a related field."""
64 features: list[gws.FeatureProps]
65 """Feature props."""
68class GetFeatureRequest(gws.Request):
69 """Request for a single feature."""
71 modelUid: str
72 """Model uid."""
73 featureUid: str
74 """Feature uid."""
77class GetFeatureResponse(gws.Response):
78 """A single feature."""
80 feature: gws.FeatureProps
81 """Feature props."""
84class InitFeatureRequest(gws.Request):
85 """Request to initialize a new feature."""
87 modelUid: str
88 """Model uid."""
89 feature: gws.FeatureProps
90 """Props of the new feature."""
93class InitFeatureResponse(gws.Response):
94 """A new feature with initial values."""
96 feature: gws.FeatureProps
97 """Feature props."""
100class WriteFeatureRequest(gws.Request):
101 """Request to save a new or existing feature."""
103 modelUid: str
104 """Model uid."""
105 feature: gws.FeatureProps
106 """Feature props. ``isNew`` decides between create and update."""
109class WriteFeatureResponse(gws.Response):
110 """Result of saving a feature."""
112 validationErrors: list[gws.ModelValidationError]
113 """Validation errors. If not empty, the feature was not saved."""
114 feature: gws.FeatureProps
115 """The saved feature, read back from the model."""
118class DeleteFeatureRequest(gws.Request):
119 """Request to delete a feature."""
121 modelUid: str
122 """Model uid."""
123 feature: gws.FeatureProps
124 """Props of the feature to delete."""
127class DeleteFeatureResponse(gws.Response):
128 """Result of deleting a feature."""
130 pass