wizata-dsapi 1.2.6__py3-none-any.whl → 1.2.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wizata_dsapi/__init__.py +1 -1
- wizata_dsapi/api_config.py +7 -1
- wizata_dsapi/twin.py +108 -1
- wizata_dsapi/version.py +1 -1
- {wizata_dsapi-1.2.6.dist-info → wizata_dsapi-1.2.8.dist-info}/METADATA +1 -1
- {wizata_dsapi-1.2.6.dist-info → wizata_dsapi-1.2.8.dist-info}/RECORD +9 -9
- {wizata_dsapi-1.2.6.dist-info → wizata_dsapi-1.2.8.dist-info}/LICENSE.txt +0 -0
- {wizata_dsapi-1.2.6.dist-info → wizata_dsapi-1.2.8.dist-info}/WHEEL +0 -0
- {wizata_dsapi-1.2.6.dist-info → wizata_dsapi-1.2.8.dist-info}/top_level.txt +0 -0
wizata_dsapi/__init__.py
CHANGED
|
@@ -18,7 +18,7 @@ from .group_system import GroupSystem
|
|
|
18
18
|
from .bucket import Bucket
|
|
19
19
|
|
|
20
20
|
# Sql Entities (Dto)
|
|
21
|
-
from .twin import Twin, TwinBlockType
|
|
21
|
+
from .twin import Twin, TwinBlockType, TwinType
|
|
22
22
|
from .datapoint import DataPoint, BusinessType, Label, Unit, Category, InputModeType
|
|
23
23
|
from .datastore import DataStore
|
|
24
24
|
from .insight import Insight
|
wizata_dsapi/api_config.py
CHANGED
|
@@ -14,7 +14,7 @@ from .solution_component import SolutionComponent
|
|
|
14
14
|
from .business_label import BusinessLabel
|
|
15
15
|
from .twinregistration import TwinRegistration, TwinRegistrationProperty
|
|
16
16
|
from .trigger import Trigger
|
|
17
|
-
from .twin import Twin
|
|
17
|
+
from .twin import Twin, TwinType
|
|
18
18
|
from .pipeline import Pipeline
|
|
19
19
|
from .pipeline_image import PipelineImage
|
|
20
20
|
from .insight import Insight
|
|
@@ -147,5 +147,11 @@ _registry = {
|
|
|
147
147
|
"class": Twin,
|
|
148
148
|
"cloud_dsapi": ['lists', 'get_by_id', 'get_by_key', 'create', 'update', 'delete', 'search'],
|
|
149
149
|
"cloud_context": ['get_by_id', 'get_by_key', 'create', 'update', 'delete', 'search']
|
|
150
|
+
},
|
|
151
|
+
"twintypes":
|
|
152
|
+
{
|
|
153
|
+
"class": TwinType,
|
|
154
|
+
"cloud_dsapi": [ 'get_by_id', 'create', 'update', 'delete'],
|
|
155
|
+
"cloud_context": [ 'get_by_id', 'create', 'update', 'delete' ]
|
|
150
156
|
}
|
|
151
157
|
}
|
wizata_dsapi/twin.py
CHANGED
|
@@ -2,6 +2,7 @@ import uuid
|
|
|
2
2
|
from .api_dto import ApiDto
|
|
3
3
|
from enum import Enum
|
|
4
4
|
import re
|
|
5
|
+
import json
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def is_valid_hex_color(color):
|
|
@@ -13,8 +14,96 @@ def is_valid_hex_color(color):
|
|
|
13
14
|
return True
|
|
14
15
|
|
|
15
16
|
|
|
17
|
+
class TwinType(ApiDto):
|
|
18
|
+
"""
|
|
19
|
+
twin type
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def route(cls):
|
|
24
|
+
return "twintypes"
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def from_dict(cls, data):
|
|
28
|
+
obj = TwinType()
|
|
29
|
+
obj.from_json(data)
|
|
30
|
+
return obj
|
|
31
|
+
|
|
32
|
+
def __init__(self,
|
|
33
|
+
twin_type_id: uuid.UUID = None,
|
|
34
|
+
name: str = None,
|
|
35
|
+
icon: str = None,
|
|
36
|
+
color: str = None,
|
|
37
|
+
description: str = None):
|
|
38
|
+
if twin_type_id is None:
|
|
39
|
+
self.twin_type_id = uuid.uuid4()
|
|
40
|
+
else:
|
|
41
|
+
self.twin_type_id = twin_type_id
|
|
42
|
+
self.name = name
|
|
43
|
+
self.icon = icon
|
|
44
|
+
self.color = color
|
|
45
|
+
if color is not None:
|
|
46
|
+
is_valid_hex_color(color)
|
|
47
|
+
self.description = description
|
|
48
|
+
self.createdById = None
|
|
49
|
+
self.createdDate = None
|
|
50
|
+
self.updatedById = None
|
|
51
|
+
self.updatedDate = None
|
|
52
|
+
|
|
53
|
+
def api_id(self) -> str:
|
|
54
|
+
return str(self.twin_type_id).upper()
|
|
55
|
+
|
|
56
|
+
def endpoint(self) -> str:
|
|
57
|
+
return "TwinTypes"
|
|
58
|
+
|
|
59
|
+
def from_json(self, obj):
|
|
60
|
+
if "id" in obj.keys():
|
|
61
|
+
self.twin_type_id = uuid.UUID(obj["id"])
|
|
62
|
+
if "name" in obj.keys() and obj["name"] is not None:
|
|
63
|
+
self.name = obj["name"]
|
|
64
|
+
if "color" in obj.keys() and obj["color"] is not None:
|
|
65
|
+
is_valid_hex_color(str(obj["color"]))
|
|
66
|
+
self.color = str(obj["color"])
|
|
67
|
+
if "icon" in obj.keys() and obj["icon"] is not None:
|
|
68
|
+
self.icon = str(obj["icon"])
|
|
69
|
+
if "description" in obj.keys() and obj["description"] is not None:
|
|
70
|
+
self.description = str(obj["description"])
|
|
71
|
+
if "createdById" in obj.keys() and obj["createdById"] is not None:
|
|
72
|
+
self.createdById = obj["createdById"]
|
|
73
|
+
if "createdDate" in obj.keys() and obj["createdDate"] is not None:
|
|
74
|
+
self.createdDate = obj["createdDate"]
|
|
75
|
+
if "updatedById" in obj.keys() and obj["updatedById"] is not None:
|
|
76
|
+
self.updatedById = obj["updatedById"]
|
|
77
|
+
if "updatedDate" in obj.keys() and obj["updatedDate"] is not None:
|
|
78
|
+
self.updatedDate = obj["updatedDate"]
|
|
79
|
+
|
|
80
|
+
def to_json(self, target: str = None):
|
|
81
|
+
obj = {
|
|
82
|
+
"id": str(self.twin_type_id)
|
|
83
|
+
}
|
|
84
|
+
if self.name is not None:
|
|
85
|
+
obj["name"] = str(self.name)
|
|
86
|
+
if self.color is not None:
|
|
87
|
+
obj["color"] = str(self.color)
|
|
88
|
+
if self.description is not None:
|
|
89
|
+
obj["description"] = str(self.description)
|
|
90
|
+
if self.icon is not None:
|
|
91
|
+
obj["icon"] = str(self.icon)
|
|
92
|
+
if self.createdById is not None:
|
|
93
|
+
obj["createdById"] = str(self.createdById)
|
|
94
|
+
if self.createdDate is not None:
|
|
95
|
+
obj["createdDate"] = str(self.createdDate)
|
|
96
|
+
if self.updatedById is not None:
|
|
97
|
+
obj["updatedById"] = str(self.updatedById)
|
|
98
|
+
if self.updatedDate is not None:
|
|
99
|
+
obj["updatedDate"] = str(self.updatedDate)
|
|
100
|
+
return obj
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
16
104
|
class TwinBlockType(Enum):
|
|
17
105
|
"""
|
|
106
|
+
deprecated - replaced by TwinType
|
|
18
107
|
digital twin block type
|
|
19
108
|
- area
|
|
20
109
|
- machine
|
|
@@ -59,8 +148,11 @@ class Twin(ApiDto):
|
|
|
59
148
|
return obj
|
|
60
149
|
|
|
61
150
|
def __init__(self, twin_id=None, hardware_id=None, name=None, parent_id=None, ttype=TwinBlockType.MACHINE,
|
|
151
|
+
type_id:uuid.UUID = None,
|
|
62
152
|
latitude_id: uuid.UUID = None, longitude_id: uuid.UUID = None, color: str = None, icon: str = None,
|
|
63
|
-
latitude: float = None, longitude: float = None,
|
|
153
|
+
latitude: float = None, longitude: float = None,
|
|
154
|
+
extra_properties: dict = None,
|
|
155
|
+
description: str = None):
|
|
64
156
|
if twin_id is None:
|
|
65
157
|
self.twin_id = uuid.uuid4()
|
|
66
158
|
else:
|
|
@@ -69,6 +161,7 @@ class Twin(ApiDto):
|
|
|
69
161
|
self.name = name
|
|
70
162
|
self.parent_id = parent_id
|
|
71
163
|
self.type = ttype
|
|
164
|
+
self.type_id = type_id
|
|
72
165
|
self.description = description
|
|
73
166
|
self.latitude = latitude
|
|
74
167
|
self.longitude = longitude
|
|
@@ -78,6 +171,7 @@ class Twin(ApiDto):
|
|
|
78
171
|
is_valid_hex_color(color)
|
|
79
172
|
self.color = color
|
|
80
173
|
self.icon = icon
|
|
174
|
+
self.extra_properties = extra_properties
|
|
81
175
|
self.createdById = None
|
|
82
176
|
self.createdDate = None
|
|
83
177
|
self.updatedById = None
|
|
@@ -98,6 +192,8 @@ class Twin(ApiDto):
|
|
|
98
192
|
self.name = obj["name"]
|
|
99
193
|
if "parentId" in obj.keys() and obj["parentId"] is not None:
|
|
100
194
|
self.parent_id = uuid.UUID(obj["parentId"])
|
|
195
|
+
if "twinTypeId" in obj.keys() and obj["twinTypeId"] is not None:
|
|
196
|
+
self.type_id = uuid.UUID(obj["twinTypeId"])
|
|
101
197
|
if "latitude" in obj.keys() and obj["latitude"] is not None:
|
|
102
198
|
self.latitude = float(obj["latitude"])
|
|
103
199
|
if "longitude" in obj.keys() and obj["longitude"] is not None:
|
|
@@ -115,6 +211,11 @@ class Twin(ApiDto):
|
|
|
115
211
|
self.description = str(obj["description"])
|
|
116
212
|
if "type" in obj.keys():
|
|
117
213
|
self.type = TwinBlockType(str(obj["type"]))
|
|
214
|
+
if "extraProperties" in obj.keys():
|
|
215
|
+
if isinstance(obj["extraProperties"], str):
|
|
216
|
+
self.extra_properties = json.loads(obj["extraProperties"])
|
|
217
|
+
else:
|
|
218
|
+
self.extra_properties = obj["extraProperties"]
|
|
118
219
|
if "createdById" in obj.keys() and obj["createdById"] is not None:
|
|
119
220
|
self.createdById = obj["createdById"]
|
|
120
221
|
if "createdDate" in obj.keys() and obj["createdDate"] is not None:
|
|
@@ -134,6 +235,8 @@ class Twin(ApiDto):
|
|
|
134
235
|
obj["name"] = str(self.name)
|
|
135
236
|
if self.parent_id is not None:
|
|
136
237
|
obj["parentId"] = str(self.parent_id)
|
|
238
|
+
if self.type_id is not None:
|
|
239
|
+
obj["twinTypeId"] = str(self.type_id)
|
|
137
240
|
if self.type is not None and isinstance(self.type, TwinBlockType):
|
|
138
241
|
obj["type"] = self.type.value
|
|
139
242
|
if self.color is not None:
|
|
@@ -150,6 +253,10 @@ class Twin(ApiDto):
|
|
|
150
253
|
obj["longitudeSensorId"] = str(self.longitude_id)
|
|
151
254
|
if self.icon is not None:
|
|
152
255
|
obj["icon"] = str(self.icon)
|
|
256
|
+
if self.extra_properties is not None:
|
|
257
|
+
if not isinstance(self.extra_properties, dict):
|
|
258
|
+
raise ValueError('on twin extra properties must be None or a JSON serializable dict')
|
|
259
|
+
obj["extraProperties"] = json.dumps(self.extra_properties)
|
|
153
260
|
if self.createdById is not None:
|
|
154
261
|
obj["createdById"] = str(self.createdById)
|
|
155
262
|
if self.createdDate is not None:
|
wizata_dsapi/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.2.
|
|
1
|
+
__version__ = "1.2.8"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
wizata_dsapi/__init__.py,sha256=
|
|
2
|
-
wizata_dsapi/api_config.py,sha256=
|
|
1
|
+
wizata_dsapi/__init__.py,sha256=4J-4ssj9oyI_5vv2_vMOR5ZFYQxrcHrmv900KOQEFYY,2010
|
|
2
|
+
wizata_dsapi/api_config.py,sha256=pyGPyoCrfOFl-C6DlDRdQbQWDG2Y_oB4gvzjh2wYb8w,5300
|
|
3
3
|
wizata_dsapi/api_dto.py,sha256=-NdaTRvw5jW5xFGpIhY8U0-SdvzW2t6QD26y0UPApU0,2238
|
|
4
4
|
wizata_dsapi/api_interface.py,sha256=DURk-0ey16T8sV5e2Y2G_YybPEusJvZuY0oD5L7AnXo,10903
|
|
5
5
|
wizata_dsapi/bucket.py,sha256=Zz9olv-pymikAutGitSuGWrAPiawOTW86JDDHG4ugTc,1150
|
|
@@ -29,9 +29,9 @@ wizata_dsapi/solution_component.py,sha256=8gbZWx2h_xUqI_pAXa3goqAnR5Y-GDMii8MeGl
|
|
|
29
29
|
wizata_dsapi/streamlit_utils.py,sha256=sXBdygktbixV828Zg01Nl27_a4F8zGFc4RY0C8g-1bc,1942
|
|
30
30
|
wizata_dsapi/template.py,sha256=h2f3dLduJ4WhreVxJXuFIB3pinnI3c39WxBms0bCgos,13007
|
|
31
31
|
wizata_dsapi/trigger.py,sha256=w3BZYP-L3SUwvaT0oCTanh_Ewn57peZvlt7vxzHv9J8,5129
|
|
32
|
-
wizata_dsapi/twin.py,sha256=
|
|
32
|
+
wizata_dsapi/twin.py,sha256=_iYbbKw_m8flEzdnwGbA-NvSUiyQQDgCTa9vJeEggRg,10556
|
|
33
33
|
wizata_dsapi/twinregistration.py,sha256=Mi6-YuwroiEXc0c1hgrOaphh4hNVoHupxOnXedVtJtE,13377
|
|
34
|
-
wizata_dsapi/version.py,sha256=
|
|
34
|
+
wizata_dsapi/version.py,sha256=CfVXm0wwlKPW0khOcwhWw61TpgtZiLijCePsAIOK3aU,22
|
|
35
35
|
wizata_dsapi/wizard_function.py,sha256=RbM7W7Gf-6Rhp_1dU9DBYkHaciknGAGvuAndhAS_vyo,942
|
|
36
36
|
wizata_dsapi/wizard_request.py,sha256=v6BaqKLKvTWmUSo0_gda9FabAQz5x_-GOH1Av50GzFo,3762
|
|
37
37
|
wizata_dsapi/wizata_dsapi_client.py,sha256=Qz54vYoxRLBUa21Q55K5Oo1qtZpW9ucuXi4BX1N85oE,78716
|
|
@@ -42,8 +42,8 @@ wizata_dsapi/plots/__init__.py,sha256=qgnSFqrjOPur-807M8uh5awIfjM1ZHXUXcAqHc-r2l
|
|
|
42
42
|
wizata_dsapi/plots/common.py,sha256=jdPsJqLHBwSKc6dX83BSGPqSRxzIVNHSYO5yI_8sjGk,6568
|
|
43
43
|
wizata_dsapi/scripts/__init__.py,sha256=hAxiETSQf0qOHde1si1tEAJU48seqEgHrchCzS2-LvQ,80
|
|
44
44
|
wizata_dsapi/scripts/common.py,sha256=efwq-Rd0lvYljIs3gSFz9izogBD7asOU2cTK-IvHTkM,4244
|
|
45
|
-
wizata_dsapi-1.2.
|
|
46
|
-
wizata_dsapi-1.2.
|
|
47
|
-
wizata_dsapi-1.2.
|
|
48
|
-
wizata_dsapi-1.2.
|
|
49
|
-
wizata_dsapi-1.2.
|
|
45
|
+
wizata_dsapi-1.2.8.dist-info/LICENSE.txt,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
46
|
+
wizata_dsapi-1.2.8.dist-info/METADATA,sha256=WRikpYQRfPcBEkfk239lutdBmdl7ApxLsglLGMdmySk,2187
|
|
47
|
+
wizata_dsapi-1.2.8.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
48
|
+
wizata_dsapi-1.2.8.dist-info/top_level.txt,sha256=-OeTJbEnh5DuWyTOHtvw0Dw3LRg3G27TNS6W4ZtfwPs,13
|
|
49
|
+
wizata_dsapi-1.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|