layrz-sdk 3.1.13__py3-none-any.whl → 3.1.14__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.
Potentially problematic release.
This version of layrz-sdk might be problematic. Click here for more details.
- layrz_sdk/__init__.py +1 -1
- layrz_sdk/constants.py +5 -5
- layrz_sdk/entities/__init__.py +129 -129
- layrz_sdk/entities/asset.py +60 -60
- layrz_sdk/entities/asset_operation_mode.py +31 -31
- layrz_sdk/entities/broadcast_request.py +12 -12
- layrz_sdk/entities/broadcast_response.py +12 -12
- layrz_sdk/entities/broadcast_result.py +20 -20
- layrz_sdk/entities/broadcast_status.py +28 -28
- layrz_sdk/entities/case.py +52 -48
- layrz_sdk/entities/case_ignored_status.py +26 -26
- layrz_sdk/entities/case_status.py +23 -23
- layrz_sdk/entities/charts/axis_config.py +15 -15
- layrz_sdk/entities/charts/bar_chart.py +175 -175
- layrz_sdk/entities/charts/chart_alignment.py +27 -27
- layrz_sdk/entities/charts/chart_color.py +44 -44
- layrz_sdk/entities/charts/chart_configuration.py +10 -10
- layrz_sdk/entities/charts/chart_data_serie.py +19 -19
- layrz_sdk/entities/charts/chart_data_serie_type.py +28 -28
- layrz_sdk/entities/charts/chart_data_type.py +27 -27
- layrz_sdk/entities/charts/chart_render_technology.py +30 -30
- layrz_sdk/entities/charts/column_chart.py +201 -201
- layrz_sdk/entities/charts/html_chart.py +38 -38
- layrz_sdk/entities/charts/line_chart.py +248 -248
- layrz_sdk/entities/charts/map_center_type.py +22 -22
- layrz_sdk/entities/charts/map_chart.py +108 -108
- layrz_sdk/entities/charts/map_point.py +22 -22
- layrz_sdk/entities/charts/number_chart.py +54 -54
- layrz_sdk/entities/charts/pie_chart.py +131 -131
- layrz_sdk/entities/charts/radar_chart.py +81 -81
- layrz_sdk/entities/charts/radial_bar_chart.py +131 -131
- layrz_sdk/entities/charts/scatter_chart.py +210 -210
- layrz_sdk/entities/charts/scatter_serie.py +13 -13
- layrz_sdk/entities/charts/scatter_serie_item.py +8 -8
- layrz_sdk/entities/charts/table_chart.py +54 -54
- layrz_sdk/entities/charts/table_header.py +8 -8
- layrz_sdk/entities/charts/table_row.py +9 -9
- layrz_sdk/entities/charts/timeline_chart.py +79 -79
- layrz_sdk/entities/charts/timeline_serie.py +10 -10
- layrz_sdk/entities/charts/timeline_serie_item.py +12 -12
- layrz_sdk/entities/checkpoint.py +17 -17
- layrz_sdk/entities/comment.py +16 -16
- layrz_sdk/entities/custom_field.py +10 -10
- layrz_sdk/entities/custom_report_page.py +40 -40
- layrz_sdk/entities/device.py +13 -13
- layrz_sdk/entities/event.py +23 -23
- layrz_sdk/entities/geofence.py +11 -11
- layrz_sdk/entities/last_message.py +12 -12
- layrz_sdk/entities/message.py +23 -23
- layrz_sdk/entities/outbound_service.py +10 -10
- layrz_sdk/entities/position.py +116 -116
- layrz_sdk/entities/presence_type.py +16 -16
- layrz_sdk/entities/report.py +289 -289
- layrz_sdk/entities/report_col.py +40 -40
- layrz_sdk/entities/report_configuration.py +8 -8
- layrz_sdk/entities/report_data_type.py +28 -28
- layrz_sdk/entities/report_format.py +27 -27
- layrz_sdk/entities/report_header.py +43 -43
- layrz_sdk/entities/report_page.py +15 -15
- layrz_sdk/entities/report_row.py +28 -28
- layrz_sdk/entities/sensor.py +11 -11
- layrz_sdk/entities/text_alignment.py +26 -26
- layrz_sdk/entities/trigger.py +11 -11
- layrz_sdk/entities/user.py +10 -10
- layrz_sdk/entities/waypoint.py +18 -18
- layrz_sdk/helpers/__init__.py +5 -5
- layrz_sdk/helpers/color.py +44 -44
- layrz_sdk/lcl/__init__.py +5 -5
- layrz_sdk/lcl/core.py +848 -848
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/METADATA +49 -49
- layrz_sdk-3.1.14.dist-info/RECORD +75 -0
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/WHEEL +1 -1
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/licenses/LICENSE +6 -6
- layrz_sdk-3.1.13.dist-info/RECORD +0 -75
- {layrz_sdk-3.1.13.dist-info → layrz_sdk-3.1.14.dist-info}/top_level.txt +0 -0
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
"""Timeline chart entities"""
|
|
2
|
-
|
|
3
|
-
import sys
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
7
|
-
|
|
8
|
-
from .chart_alignment import ChartAlignment
|
|
9
|
-
from .timeline_serie import TimelineSerie
|
|
10
|
-
|
|
11
|
-
if sys.version_info >= (3, 11):
|
|
12
|
-
from typing import Self
|
|
13
|
-
else:
|
|
14
|
-
from typing_extensions import Self
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class TimelineChart(BaseModel):
|
|
18
|
-
"""Timeline chart configuration"""
|
|
19
|
-
|
|
20
|
-
series: list[TimelineSerie] = Field(description='List of series to be displayed in the chart', default_factory=list)
|
|
21
|
-
title: str = Field(description='Title of the chart', default='Chart')
|
|
22
|
-
align: ChartAlignment = Field(description='Alignment of the chart', default=ChartAlignment.CENTER)
|
|
23
|
-
|
|
24
|
-
def render(self: Self) -> dict[str, Any]:
|
|
25
|
-
"""
|
|
26
|
-
Render chart to a graphic Library.
|
|
27
|
-
|
|
28
|
-
:param technology: The technology to use to render the chart.
|
|
29
|
-
:type technology: ChartRenderTechnology
|
|
30
|
-
|
|
31
|
-
:return: The configuration of the chart.
|
|
32
|
-
:rtype: dict[str, Any]
|
|
33
|
-
"""
|
|
34
|
-
return {'library': 'APEXCHARTS', 'configuration': self._render_apexcharts()}
|
|
35
|
-
|
|
36
|
-
def _render_apexcharts(self: Self) -> dict[str, Any]:
|
|
37
|
-
"""
|
|
38
|
-
Converts the configuration of the chart to Javascript library ApexCharts.
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
series = []
|
|
42
|
-
|
|
43
|
-
for serie in self.series:
|
|
44
|
-
data = []
|
|
45
|
-
|
|
46
|
-
for item in serie.data:
|
|
47
|
-
data.append(
|
|
48
|
-
{
|
|
49
|
-
'x': item.name,
|
|
50
|
-
'y': [item.start_at.timestamp() * 1000, item.end_at.timestamp() * 1000],
|
|
51
|
-
'fillColor': item.color,
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
series.append({'name': serie.label, 'data': data})
|
|
56
|
-
|
|
57
|
-
config = {
|
|
58
|
-
'series': series,
|
|
59
|
-
'title': {
|
|
60
|
-
'text': self.title,
|
|
61
|
-
'align': self.align.value,
|
|
62
|
-
'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
|
|
63
|
-
},
|
|
64
|
-
'chart': {
|
|
65
|
-
'type': 'rangeBar',
|
|
66
|
-
'animations': {'enabled': False},
|
|
67
|
-
'toolbar': {'show': False},
|
|
68
|
-
'zoom': {'enabled': False},
|
|
69
|
-
},
|
|
70
|
-
'xaxis': {'type': 'datetime'},
|
|
71
|
-
'plotOptions': {
|
|
72
|
-
'bar': {
|
|
73
|
-
'horizontal': True,
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
'dataLabels': {'enabled': True},
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return config
|
|
1
|
+
"""Timeline chart entities"""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
from .chart_alignment import ChartAlignment
|
|
9
|
+
from .timeline_serie import TimelineSerie
|
|
10
|
+
|
|
11
|
+
if sys.version_info >= (3, 11):
|
|
12
|
+
from typing import Self
|
|
13
|
+
else:
|
|
14
|
+
from typing_extensions import Self
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TimelineChart(BaseModel):
|
|
18
|
+
"""Timeline chart configuration"""
|
|
19
|
+
|
|
20
|
+
series: list[TimelineSerie] = Field(description='List of series to be displayed in the chart', default_factory=list)
|
|
21
|
+
title: str = Field(description='Title of the chart', default='Chart')
|
|
22
|
+
align: ChartAlignment = Field(description='Alignment of the chart', default=ChartAlignment.CENTER)
|
|
23
|
+
|
|
24
|
+
def render(self: Self) -> dict[str, Any]:
|
|
25
|
+
"""
|
|
26
|
+
Render chart to a graphic Library.
|
|
27
|
+
|
|
28
|
+
:param technology: The technology to use to render the chart.
|
|
29
|
+
:type technology: ChartRenderTechnology
|
|
30
|
+
|
|
31
|
+
:return: The configuration of the chart.
|
|
32
|
+
:rtype: dict[str, Any]
|
|
33
|
+
"""
|
|
34
|
+
return {'library': 'APEXCHARTS', 'configuration': self._render_apexcharts()}
|
|
35
|
+
|
|
36
|
+
def _render_apexcharts(self: Self) -> dict[str, Any]:
|
|
37
|
+
"""
|
|
38
|
+
Converts the configuration of the chart to Javascript library ApexCharts.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
series = []
|
|
42
|
+
|
|
43
|
+
for serie in self.series:
|
|
44
|
+
data = []
|
|
45
|
+
|
|
46
|
+
for item in serie.data:
|
|
47
|
+
data.append(
|
|
48
|
+
{
|
|
49
|
+
'x': item.name,
|
|
50
|
+
'y': [item.start_at.timestamp() * 1000, item.end_at.timestamp() * 1000],
|
|
51
|
+
'fillColor': item.color,
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
series.append({'name': serie.label, 'data': data})
|
|
56
|
+
|
|
57
|
+
config = {
|
|
58
|
+
'series': series,
|
|
59
|
+
'title': {
|
|
60
|
+
'text': self.title,
|
|
61
|
+
'align': self.align.value,
|
|
62
|
+
'style': {'fontFamily': 'Fira Sans Condensed', 'fontSize': '20px', 'fontWeight': 'normal'},
|
|
63
|
+
},
|
|
64
|
+
'chart': {
|
|
65
|
+
'type': 'rangeBar',
|
|
66
|
+
'animations': {'enabled': False},
|
|
67
|
+
'toolbar': {'show': False},
|
|
68
|
+
'zoom': {'enabled': False},
|
|
69
|
+
},
|
|
70
|
+
'xaxis': {'type': 'datetime'},
|
|
71
|
+
'plotOptions': {
|
|
72
|
+
'bar': {
|
|
73
|
+
'horizontal': True,
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
'dataLabels': {'enabled': True},
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return config
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from pydantic import BaseModel, Field
|
|
2
|
-
|
|
3
|
-
from .timeline_serie_item import TimelineSerieItem
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TimelineSerie(BaseModel):
|
|
7
|
-
"""Chart Data Serie for Timeline charts"""
|
|
8
|
-
|
|
9
|
-
data: list[TimelineSerieItem] = Field(description='List of data points', default_factory=list)
|
|
10
|
-
label: str = Field(description='Label of the serie')
|
|
1
|
+
from pydantic import BaseModel, Field
|
|
2
|
+
|
|
3
|
+
from .timeline_serie_item import TimelineSerieItem
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TimelineSerie(BaseModel):
|
|
7
|
+
"""Chart Data Serie for Timeline charts"""
|
|
8
|
+
|
|
9
|
+
data: list[TimelineSerieItem] = Field(description='List of data points', default_factory=list)
|
|
10
|
+
label: str = Field(description='Label of the serie')
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TimelineSerieItem(BaseModel):
|
|
7
|
-
"""Chart Data Serie Item for Timeline Charts"""
|
|
8
|
-
|
|
9
|
-
name: str = Field(description='Name of the item')
|
|
10
|
-
start_at: datetime = Field(description='Start date of the item')
|
|
11
|
-
end_at: datetime = Field(description='End date of the item')
|
|
12
|
-
color: str = Field(description='Color of the item')
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TimelineSerieItem(BaseModel):
|
|
7
|
+
"""Chart Data Serie Item for Timeline Charts"""
|
|
8
|
+
|
|
9
|
+
name: str = Field(description='Name of the item')
|
|
10
|
+
start_at: datetime = Field(description='Start date of the item')
|
|
11
|
+
end_at: datetime = Field(description='End date of the item')
|
|
12
|
+
color: str = Field(description='Color of the item')
|
layrz_sdk/entities/checkpoint.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"""Checkpoints entitites"""
|
|
2
|
-
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from .waypoint import Waypoint
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Checkpoint(BaseModel):
|
|
11
|
-
"""Checkpoint entity definition"""
|
|
12
|
-
|
|
13
|
-
pk: int = Field(description='Checkpoint ID')
|
|
14
|
-
asset_id: int = Field(description='Asset ID')
|
|
15
|
-
waypoints: list[Waypoint] = Field(description='List of waypoints', default_factory=list)
|
|
16
|
-
start_at: datetime = Field(description='Checkpoint start date')
|
|
17
|
-
end_at: datetime = Field(description='Checkpoint end date')
|
|
1
|
+
"""Checkpoints entitites"""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
from .waypoint import Waypoint
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Checkpoint(BaseModel):
|
|
11
|
+
"""Checkpoint entity definition"""
|
|
12
|
+
|
|
13
|
+
pk: int = Field(description='Checkpoint ID')
|
|
14
|
+
asset_id: int = Field(description='Asset ID')
|
|
15
|
+
waypoints: list[Waypoint] = Field(description='List of waypoints', default_factory=list)
|
|
16
|
+
start_at: datetime = Field(description='Checkpoint start date')
|
|
17
|
+
end_at: datetime = Field(description='Checkpoint end date')
|
layrz_sdk/entities/comment.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"""Comment entity"""
|
|
2
|
-
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from .user import User
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Comment(BaseModel):
|
|
11
|
-
"""Comment entity"""
|
|
12
|
-
|
|
13
|
-
pk: int = Field(description='Comment ID')
|
|
14
|
-
content: str = Field(description='Comment content')
|
|
15
|
-
user: User = Field(description='Operator/User what commented the case')
|
|
16
|
-
submitted_at: datetime = Field(description='Date of comment submission')
|
|
1
|
+
"""Comment entity"""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
from .user import User
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Comment(BaseModel):
|
|
11
|
+
"""Comment entity"""
|
|
12
|
+
|
|
13
|
+
pk: int = Field(description='Comment ID')
|
|
14
|
+
content: str = Field(description='Comment content')
|
|
15
|
+
user: User = Field(description='Operator/User what commented the case')
|
|
16
|
+
submitted_at: datetime = Field(description='Date of comment submission')
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"""Custom Field entitiy"""
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class CustomField(BaseModel):
|
|
7
|
-
"""Custom field definition"""
|
|
8
|
-
|
|
9
|
-
name: str = Field(description='Defines the name of the custom field')
|
|
10
|
-
value: str = Field(description='Defines the value of the custom field')
|
|
1
|
+
"""Custom Field entitiy"""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CustomField(BaseModel):
|
|
7
|
+
"""Custom field definition"""
|
|
8
|
+
|
|
9
|
+
name: str = Field(description='Defines the name of the custom field')
|
|
10
|
+
value: str = Field(description='Defines the value of the custom field')
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
from collections.abc import Callable
|
|
2
|
-
from typing import Any, Protocol, runtime_checkable
|
|
3
|
-
|
|
4
|
-
from pydantic import BaseModel, ConfigDict, Field
|
|
5
|
-
from xlsxwriter.worksheet import Worksheet
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@runtime_checkable
|
|
9
|
-
class BuilderFunction(Protocol):
|
|
10
|
-
"""
|
|
11
|
-
Protocol for the builder function.
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
def __call__(self, *, sheet: Worksheet, **kwargs: Any) -> None: ...
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class CustomReportPage(BaseModel):
|
|
18
|
-
"""
|
|
19
|
-
Custom report page
|
|
20
|
-
Basically it's a wrapper of the `xlswriter` worksheet that uses a function to construct the page
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
model_config = ConfigDict(
|
|
24
|
-
from_attributes=True,
|
|
25
|
-
arbitrary_types_allowed=True,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
name: str = Field(description='Name of the page. Length should be less than 60 characters')
|
|
29
|
-
builder: Callable[[Worksheet], None] | None = Field(
|
|
30
|
-
description=('Function to build the page. The only argument is the worksheet object'),
|
|
31
|
-
default=None,
|
|
32
|
-
)
|
|
33
|
-
extended_builder: BuilderFunction | None = Field(
|
|
34
|
-
description=(
|
|
35
|
-
'Function to build the page. The first argument is the worksheet object, '
|
|
36
|
-
'and the rest are the kwargs to give support for the builder function.'
|
|
37
|
-
'\n Currently, the only supported kwarg is `workbook` which is the workbook object'
|
|
38
|
-
),
|
|
39
|
-
default=None,
|
|
40
|
-
)
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from typing import Any, Protocol, runtime_checkable
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
5
|
+
from xlsxwriter.worksheet import Worksheet
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@runtime_checkable
|
|
9
|
+
class BuilderFunction(Protocol):
|
|
10
|
+
"""
|
|
11
|
+
Protocol for the builder function.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __call__(self, *, sheet: Worksheet, **kwargs: Any) -> None: ...
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CustomReportPage(BaseModel):
|
|
18
|
+
"""
|
|
19
|
+
Custom report page
|
|
20
|
+
Basically it's a wrapper of the `xlswriter` worksheet that uses a function to construct the page
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
model_config = ConfigDict(
|
|
24
|
+
from_attributes=True,
|
|
25
|
+
arbitrary_types_allowed=True,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
name: str = Field(description='Name of the page. Length should be less than 60 characters')
|
|
29
|
+
builder: Callable[[Worksheet], None] | None = Field(
|
|
30
|
+
description=('Function to build the page. The only argument is the worksheet object'),
|
|
31
|
+
default=None,
|
|
32
|
+
)
|
|
33
|
+
extended_builder: BuilderFunction | None = Field(
|
|
34
|
+
description=(
|
|
35
|
+
'Function to build the page. The first argument is the worksheet object, '
|
|
36
|
+
'and the rest are the kwargs to give support for the builder function.'
|
|
37
|
+
'\n Currently, the only supported kwarg is `workbook` which is the workbook object'
|
|
38
|
+
),
|
|
39
|
+
default=None,
|
|
40
|
+
)
|
layrz_sdk/entities/device.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"""Device entitiy"""
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Device(BaseModel):
|
|
7
|
-
"""Device entity"""
|
|
8
|
-
|
|
9
|
-
pk: int = Field(description='Defines the primary key of the device')
|
|
10
|
-
name: str = Field(description='Defines the name of the device')
|
|
11
|
-
ident: str = Field(description='Defines the identifier of the device')
|
|
12
|
-
protocol: str = Field(description='Defines the protocol of the device')
|
|
13
|
-
is_primary: bool = Field(default=False, description='Defines if the device is the primary device')
|
|
1
|
+
"""Device entitiy"""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Device(BaseModel):
|
|
7
|
+
"""Device entity"""
|
|
8
|
+
|
|
9
|
+
pk: int = Field(description='Defines the primary key of the device')
|
|
10
|
+
name: str = Field(description='Defines the name of the device')
|
|
11
|
+
ident: str = Field(description='Defines the identifier of the device')
|
|
12
|
+
protocol: str = Field(description='Defines the protocol of the device')
|
|
13
|
+
is_primary: bool = Field(default=False, description='Defines if the device is the primary device')
|
layrz_sdk/entities/event.py
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"""Event entity"""
|
|
2
|
-
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
from typing import Optional
|
|
5
|
-
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
7
|
-
|
|
8
|
-
from .geofence import Geofence
|
|
9
|
-
from .message import Message
|
|
10
|
-
from .presence_type import PresenceType
|
|
11
|
-
from .trigger import Trigger
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class Event(BaseModel):
|
|
15
|
-
"""Event entity definition"""
|
|
16
|
-
|
|
17
|
-
pk: int = Field(description='Event ID')
|
|
18
|
-
trigger: Trigger = Field(description='Event trigger')
|
|
19
|
-
asset_id: int = Field(description='Asset ID')
|
|
20
|
-
message: Message = Field(description='Message')
|
|
21
|
-
activated_at: datetime = Field(description='Event activation date')
|
|
22
|
-
geofence: Optional[Geofence] = Field(default=None, description='Geofence object')
|
|
23
|
-
presence_type: Optional[PresenceType] = Field(default=None, description='Presence type object')
|
|
1
|
+
"""Event entity"""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
from .geofence import Geofence
|
|
9
|
+
from .message import Message
|
|
10
|
+
from .presence_type import PresenceType
|
|
11
|
+
from .trigger import Trigger
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Event(BaseModel):
|
|
15
|
+
"""Event entity definition"""
|
|
16
|
+
|
|
17
|
+
pk: int = Field(description='Event ID')
|
|
18
|
+
trigger: Trigger = Field(description='Event trigger')
|
|
19
|
+
asset_id: int = Field(description='Asset ID')
|
|
20
|
+
message: Message = Field(description='Message')
|
|
21
|
+
activated_at: datetime = Field(description='Event activation date')
|
|
22
|
+
geofence: Optional[Geofence] = Field(default=None, description='Geofence object')
|
|
23
|
+
presence_type: Optional[PresenceType] = Field(default=None, description='Presence type object')
|
layrz_sdk/entities/geofence.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"""Geofence entity"""
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Geofence(BaseModel):
|
|
7
|
-
"""Geofence entity"""
|
|
8
|
-
|
|
9
|
-
pk: int = Field(description='Defines the primary key of the geofence')
|
|
10
|
-
name: str = Field(description='Defines the name of the geofence')
|
|
11
|
-
color: str = Field(description='Defines the color of the geofence')
|
|
1
|
+
"""Geofence entity"""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Geofence(BaseModel):
|
|
7
|
+
"""Geofence entity"""
|
|
8
|
+
|
|
9
|
+
pk: int = Field(description='Defines the primary key of the geofence')
|
|
10
|
+
name: str = Field(description='Defines the name of the geofence')
|
|
11
|
+
color: str = Field(description='Defines the color of the geofence')
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"""LastMessage entity"""
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
from .asset import Asset
|
|
6
|
-
from .message import Message
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class LastMessage(Message, BaseModel):
|
|
10
|
-
"""LastMessage definition"""
|
|
11
|
-
|
|
12
|
-
asset: Asset = Field(description='Defines the asset of the last message')
|
|
1
|
+
"""LastMessage entity"""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
from .asset import Asset
|
|
6
|
+
from .message import Message
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class LastMessage(Message, BaseModel):
|
|
10
|
+
"""LastMessage definition"""
|
|
11
|
+
|
|
12
|
+
asset: Asset = Field(description='Defines the asset of the last message')
|
layrz_sdk/entities/message.py
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"""Message entity"""
|
|
2
|
-
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
from typing import Any, TypeAlias
|
|
5
|
-
|
|
6
|
-
from pydantic import BaseModel, Field
|
|
7
|
-
|
|
8
|
-
from layrz_sdk.constants import UTC
|
|
9
|
-
|
|
10
|
-
from .position import Position
|
|
11
|
-
|
|
12
|
-
PayloadType: TypeAlias = dict[str, Any]
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class Message(BaseModel):
|
|
16
|
-
"""Message definition"""
|
|
17
|
-
|
|
18
|
-
pk: int
|
|
19
|
-
asset_id: int
|
|
20
|
-
position: Position = Field(default_factory=lambda: Position())
|
|
21
|
-
payload: PayloadType = Field(default_factory=dict)
|
|
22
|
-
sensors: PayloadType = Field(default_factory=dict)
|
|
23
|
-
received_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
|
|
1
|
+
"""Message entity"""
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import Any, TypeAlias
|
|
5
|
+
|
|
6
|
+
from pydantic import BaseModel, Field
|
|
7
|
+
|
|
8
|
+
from layrz_sdk.constants import UTC
|
|
9
|
+
|
|
10
|
+
from .position import Position
|
|
11
|
+
|
|
12
|
+
PayloadType: TypeAlias = dict[str, Any]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Message(BaseModel):
|
|
16
|
+
"""Message definition"""
|
|
17
|
+
|
|
18
|
+
pk: int
|
|
19
|
+
asset_id: int
|
|
20
|
+
position: Position = Field(default_factory=lambda: Position())
|
|
21
|
+
payload: PayloadType = Field(default_factory=dict)
|
|
22
|
+
sensors: PayloadType = Field(default_factory=dict)
|
|
23
|
+
received_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"""Service entity"""
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class OutboundService(BaseModel):
|
|
7
|
-
"""Outbound service definition"""
|
|
8
|
-
|
|
9
|
-
pk: int = Field(description='Service ID')
|
|
10
|
-
name: str = Field(description='Service name')
|
|
1
|
+
"""Service entity"""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class OutboundService(BaseModel):
|
|
7
|
+
"""Outbound service definition"""
|
|
8
|
+
|
|
9
|
+
pk: int = Field(description='Service ID')
|
|
10
|
+
name: str = Field(description='Service name')
|