layrz-sdk 4.0.4__py3-none-any.whl → 4.0.6__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.

@@ -3,7 +3,7 @@
3
3
  from datetime import time, timedelta
4
4
  from typing import Any, Self
5
5
 
6
- from pydantic import BaseModel, Field
6
+ from pydantic import BaseModel, Field, field_validator
7
7
 
8
8
  from .destination_phone import DestinationPhone
9
9
  from .notification_type import TwilioNotificationType
@@ -181,11 +181,21 @@ class Operation(BaseModel):
181
181
  description='Defines the URI for the sound effect of the operation. Only when sound_effect is set to CUSTOM.',
182
182
  )
183
183
 
184
- duration: timedelta = Field(
184
+ duration: timedelta | None = Field(
185
185
  default_factory=lambda: timedelta(seconds=5),
186
186
  description='Defines the duration of the operation',
187
187
  )
188
188
 
189
+ @field_validator('duration', mode='before')
190
+ def validate_duration(cls, value: Any) -> timedelta:
191
+ if value is None:
192
+ return timedelta(seconds=0)
193
+ if isinstance(value, timedelta):
194
+ return value
195
+ if isinstance(value, (int, float)):
196
+ return timedelta(seconds=value)
197
+ return timedelta(seconds=0)
198
+
189
199
  credentials: dict[str, Any] = Field(
190
200
  default_factory=dict,
191
201
  description='Defines the credentials for the operation',
@@ -275,8 +275,18 @@ class OperationPayload(BaseModel):
275
275
  alias='icon',
276
276
  )
277
277
 
278
- duration: timedelta = Field(
278
+ duration: timedelta | None = Field(
279
279
  default_factory=lambda: timedelta(seconds=0),
280
280
  description='Defines the duration of the in-app notification',
281
281
  alias='duration',
282
282
  )
283
+
284
+ @field_validator('duration', mode='before')
285
+ def validate_duration(cls, value: Any) -> timedelta:
286
+ if value is None:
287
+ return timedelta(seconds=0)
288
+ if isinstance(value, timedelta):
289
+ return value
290
+ if isinstance(value, (int, float)):
291
+ return timedelta(seconds=value)
292
+ return timedelta(seconds=0)
@@ -3,7 +3,7 @@
3
3
  from datetime import time, timedelta
4
4
  from typing import Any
5
5
 
6
- from pydantic import BaseModel, Field
6
+ from pydantic import BaseModel, Field, field_validator
7
7
 
8
8
  from .trigger_kind import TriggerCaseKind, TriggerCommentPattern, TriggerGeofenceKind, TriggerKind
9
9
  from .weekday import Weekday
@@ -92,6 +92,13 @@ class Trigger(BaseModel):
92
92
  description='Defines the fields for manual action in the trigger',
93
93
  )
94
94
 
95
+ @field_validator('manual_action_fields', mode='before')
96
+ def validate_manual_action_fields(cls, value: Any) -> list[dict[str, Any]]:
97
+ """Ensure manual_action_fields is a list of dictionaries."""
98
+ if isinstance(value, list):
99
+ return value
100
+ return []
101
+
95
102
  formula: str | None = Field(
96
103
  default=None,
97
104
  description='Defines the formula of the trigger, this formula is only LCL (Layrz Computation Language) compatible',
@@ -114,6 +121,16 @@ class Trigger(BaseModel):
114
121
  description='Defines the priority of the trigger',
115
122
  )
116
123
 
124
+ @field_validator('priority', mode='before')
125
+ def validate_priority(cls, value: Any) -> int:
126
+ """Ensure priority is an integer."""
127
+ if isinstance(value, int):
128
+ return value
129
+ try:
130
+ return int(value)
131
+ except (ValueError, TypeError):
132
+ return 0
133
+
117
134
  color: str | None = Field(
118
135
  default='#2196F3',
119
136
  description='Defines the color of the trigger',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: layrz-sdk
3
- Version: 4.0.4
3
+ Version: 4.0.6
4
4
  Summary: Layrz SDK for Python
5
5
  Author-email: "Golden M, Inc." <software@goldenm.com>
6
6
  Maintainer-email: Kenny Mochizuki <kenny@goldenm.com>, Luis Reyes <lreyes@goldenm.com>, Kasen Li <kli@goldenm.com>, Miguel Zauzich <miguel@goldenm.com>, Angel Prieto <aprieto@goldenm.com>
@@ -33,9 +33,9 @@ layrz_sdk/entities/geofence_category.py,sha256=h9elE_NqDXeOPGGjtwI2AQacl2ijCJP05
33
33
  layrz_sdk/entities/last_message.py,sha256=QNgF0xCQ6uLFDMmKQCjSRhGS1Bq7akw5pv6ZIiFlwfY,268
34
34
  layrz_sdk/entities/message.py,sha256=uCfnrDcgZfnfcnRaE2djJcLJK75frIeF3aUhXPj7zco,997
35
35
  layrz_sdk/entities/notification_type.py,sha256=WTAFt8cOczXHsIk4RIDbakbtW_JqlvAg7PdW8EVqDew,669
36
- layrz_sdk/entities/operation.py,sha256=sURDl8TRiATXZr4KDTzwDTp24i3sGjwyWsLUy63xxhI,5449
36
+ layrz_sdk/entities/operation.py,sha256=e9c46dWfNodfAhOTr_4PBP6SMzZCQVevmI0GzILxl38,5797
37
37
  layrz_sdk/entities/operation_case_payload.py,sha256=NSsZbtP_Iz1At7ok4xlVFzk40Vx_-7wBYMgYNV5Ftu8,2520
38
- layrz_sdk/entities/operation_payload.py,sha256=2V6y2qUNq6goAZtrMBrCLpc282c6njcVEyWbahIbyUA,8248
38
+ layrz_sdk/entities/operation_payload.py,sha256=JXOg3aY0lGYXFfmHSqwwYOGOkZhTsaNTwikV39GdI6g,8579
39
39
  layrz_sdk/entities/operation_type.py,sha256=NAe_suR3Zfazu5KsYsPya8AtkSaNNjh78XPBEIqMTQU,939
40
40
  layrz_sdk/entities/outbound_service.py,sha256=mDtMwTql8sHmFayP1AnGdMgegF6tsvu-xSC2ftGVNJo,663
41
41
  layrz_sdk/entities/platform.py,sha256=fJQXFwRhG_L9h2h7lm_KYqpssJgYtRbfTWPy7BqOnOE,626
@@ -56,7 +56,7 @@ layrz_sdk/entities/sound_effect.py,sha256=4dy9BOUzzYAByr-ROwONJSFBXsFyrYsgBIAU1g
56
56
  layrz_sdk/entities/static_position.py,sha256=xTbTWRPQLZqTgPQnyIMOoMHiNi42AzmVRfgDMM4m03c,365
57
57
  layrz_sdk/entities/text_alignment.py,sha256=YX2iz6Tm5Qn2iFFD86mju-wFR3bia_auRJCK_MA6TuU,408
58
58
  layrz_sdk/entities/timezone.py,sha256=VhS3o9miktQmThz22KJfatjvqzSONHy73_eBUtjI8iA,375
59
- layrz_sdk/entities/trigger.py,sha256=-WROidPSDRBNYM2ES3hXOoHSMYmO8X7FxrYZXckrSXE,3670
59
+ layrz_sdk/entities/trigger.py,sha256=99ECSQrEJDt6zCPtINqz7j1JK0AMH6gEPP0uBPHzAh8,4225
60
60
  layrz_sdk/entities/trigger_kind.py,sha256=gShJL0_Zg2C8To_5ksTXWoGiR_c5sMpNBKPzykudtg4,1689
61
61
  layrz_sdk/entities/user.py,sha256=-j15Q3nDqd1eYEtkId_Cj5bjIRJAapt6et_ny8fW6xw,248
62
62
  layrz_sdk/entities/waypoint.py,sha256=ZZMIZet5y_cspEQp8ToIkrM0f1ljnkXgnReMB09DDvU,1736
@@ -109,8 +109,8 @@ layrz_sdk/helpers/__init__.py,sha256=5iW3z2m3jrYhvTfxX-p-QTkR9X9oTKfEsbtVOg9jFFY
109
109
  layrz_sdk/helpers/color.py,sha256=dlpMafbM-4Wd9D9hMbbnZJf4ALkpie_ZmBR2Vz_YCmM,1203
110
110
  layrz_sdk/lcl/__init__.py,sha256=U967AWANkL3u_YVxMNAYlh8jkZ6hqHfStacz7yz6sOA,89
111
111
  layrz_sdk/lcl/core.py,sha256=T80A3hL7SeqRNSfl5SrPAgwIEf-enoAVv9ldwJNzqsA,24786
112
- layrz_sdk-4.0.4.dist-info/licenses/LICENSE,sha256=d5ZrU--lIPER7QByXDKcrtOTOMk1JvN_9FdYDuoWi7Y,1057
113
- layrz_sdk-4.0.4.dist-info/METADATA,sha256=XIXqzyUVMJ6OqNvjgNB3lxO9RiBhqiSTL9IoiE8Zotw,1955
114
- layrz_sdk-4.0.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
115
- layrz_sdk-4.0.4.dist-info/top_level.txt,sha256=yUTMMzfdZ0HDWQH5TaSlFM4xtwmP1fSGxmlL1dmu4l4,10
116
- layrz_sdk-4.0.4.dist-info/RECORD,,
112
+ layrz_sdk-4.0.6.dist-info/licenses/LICENSE,sha256=d5ZrU--lIPER7QByXDKcrtOTOMk1JvN_9FdYDuoWi7Y,1057
113
+ layrz_sdk-4.0.6.dist-info/METADATA,sha256=lNLySRP5ElA05NUqGI5nmpWp3OmliT3_TaX_m7-92Y0,1955
114
+ layrz_sdk-4.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
115
+ layrz_sdk-4.0.6.dist-info/top_level.txt,sha256=yUTMMzfdZ0HDWQH5TaSlFM4xtwmP1fSGxmlL1dmu4l4,10
116
+ layrz_sdk-4.0.6.dist-info/RECORD,,