glpi-python-client 0.6.8__py3-none-any.whl → 0.6.9__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.
@@ -138,7 +138,7 @@ from glpi_python_client.rsql import (
138
138
  date_window,
139
139
  )
140
140
 
141
- __version__ = "0.6.8"
141
+ __version__ = "0.6.9"
142
142
 
143
143
  __all__ = [
144
144
  "AsyncGlpiClient",
@@ -22,6 +22,9 @@ from __future__ import annotations
22
22
 
23
23
  from datetime import datetime
24
24
  from functools import cached_property
25
+ from typing import Annotated
26
+
27
+ from pydantic import BeforeValidator
25
28
 
26
29
  from glpi_python_client.models._base import GlpiModel
27
30
  from glpi_python_client.models.api_schema._common import (
@@ -41,6 +44,24 @@ from glpi_python_client.models.api_schema.enums import (
41
44
  )
42
45
 
43
46
 
47
+ def _empty_list_as_none(value: object) -> object:
48
+ """Read an empty JSON array as an absent reference.
49
+
50
+ GLPI 12 sends ``ola_ttr`` and ``ola_tto`` as ``[]`` on a ticket with no
51
+ OLA, where its own v2.3 contract, like GLPI 11, declares a nullable
52
+ ``{"id", "name"}`` object. Every SLA and OLA reference of
53
+ :class:`GetTicket` reads through this, so the same quirk on any of them
54
+ cannot fail a ticket read. Every other value is passed on unchanged.
55
+ """
56
+
57
+ if isinstance(value, list) and not value:
58
+ return None
59
+ return value
60
+
61
+
62
+ _LevelAgreementRef = Annotated[IdNameRef | None, BeforeValidator(_empty_list_as_none)]
63
+
64
+
44
65
  class _TicketTeamMember(GlpiModel):
45
66
  """One inline team-member entry of the ``Ticket.team`` array.
46
67
 
@@ -158,7 +179,9 @@ class GetTicket(GlpiModel):
158
179
  sla_level_ttr : IdNameRef | None, optional
159
180
  SLA level escalation step for time-to-resolve.
160
181
  ola_level_ttr : IdNameRef | None, optional
161
- OLA level escalation step for time-to-resolve.
182
+ OLA level escalation step for time-to-resolve. On all six SLA and
183
+ OLA references an empty array reads as :data:`None`: GLPI 12 sends
184
+ ``[]`` for ``ola_ttr`` and ``ola_tto`` on a ticket with no OLA.
162
185
  sla_waiting_duration : int | None, optional
163
186
  Total SLA waiting duration in seconds (contract field
164
187
  ``sla_waiting_duration`` — ``Total SLA waiting duration in
@@ -217,12 +240,12 @@ class GetTicket(GlpiModel):
217
240
  request_type: IdNameRef | None = None
218
241
  take_into_account_date: datetime | None = None
219
242
  take_into_account_duration: int | None = None
220
- sla_ttr: IdNameRef | None = None
221
- sla_tto: IdNameRef | None = None
222
- ola_ttr: IdNameRef | None = None
223
- ola_tto: IdNameRef | None = None
224
- sla_level_ttr: IdNameRef | None = None
225
- ola_level_ttr: IdNameRef | None = None
243
+ sla_ttr: _LevelAgreementRef = None
244
+ sla_tto: _LevelAgreementRef = None
245
+ ola_ttr: _LevelAgreementRef = None
246
+ ola_tto: _LevelAgreementRef = None
247
+ sla_level_ttr: _LevelAgreementRef = None
248
+ ola_level_ttr: _LevelAgreementRef = None
226
249
  sla_waiting_duration: int | None = None
227
250
  ola_waiting_duration: int | None = None
228
251
  ola_ttr_begin_date: datetime | None = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: glpi-python-client
3
- Version: 0.6.8
3
+ Version: 0.6.9
4
4
  Summary: A typed Python client for GLPI ITSM APIs.
5
5
  Project-URL: Homepage, https://github.com/baraline/glpi_python_client
6
6
  Project-URL: Documentation, https://glpi-python-client.readthedocs.io/en/latest/
@@ -1,4 +1,4 @@
1
- glpi_python_client/__init__.py,sha256=gW8x9fJRzEx95wmAJYbe7ST7Ix9sOIxe46mTMCzXjSg,5810
1
+ glpi_python_client/__init__.py,sha256=zfnLDx7ayOf6kDGYzqMW_JDHZj9ow26gRHWueh5anc0,5810
2
2
  glpi_python_client/_errors.py,sha256=Bc9UvlxulbdcGvzZIKXnJCTL78sW78R6EFg50P-1dpY,7151
3
3
  glpi_python_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  glpi_python_client/rsql.py,sha256=3u3lH3_-F1bvHbVzxALXTDPoHyoMATP1f4QPTar_sEU,8974
@@ -114,7 +114,7 @@ glpi_python_client/models/api_schema/assets/_computer.py,sha256=me3px9rkaN_ZataD
114
114
  glpi_python_client/models/api_schema/assets/_contract_item.py,sha256=sS9SqdI47IGFaFBa5_8koOu26wut198-N-CG1OKbl7s,3430
115
115
  glpi_python_client/models/api_schema/assistance/__init__.py,sha256=HoycYjTWQbP8_cm6li34jjREG64B1n-MNcD_G9FP1sI,714
116
116
  glpi_python_client/models/api_schema/assistance/_team.py,sha256=R9KYKuQEjm_E9FQLnI9i-6dvNs8S7AWYu996-q56wtk,2690
117
- glpi_python_client/models/api_schema/assistance/_ticket.py,sha256=huqVMxqucM11MSJtr-OjOxOYZV685qaKBF0EWhA5iUA,17294
117
+ glpi_python_client/models/api_schema/assistance/_ticket.py,sha256=pz6Q6zP1TnLGcpaE4csaE9193a7mXU4CuWE3zajYzL8,18188
118
118
  glpi_python_client/models/api_schema/assistance/timeline/__init__.py,sha256=-1-EM2mmEcEnv1nLzo4_gxQU4KukWC_5fCJt2mx7BSI,1248
119
119
  glpi_python_client/models/api_schema/assistance/timeline/_document.py,sha256=3TxYwNm5CAZRJUO0vJznZ8q3a43RBHgiLPNAJFYy8F0,3805
120
120
  glpi_python_client/models/api_schema/assistance/timeline/_followup.py,sha256=82ZiuVzkoDs-Ns4OlVGaoGITAtkw9FTEku2qE8jWFOg,7481
@@ -140,7 +140,7 @@ glpi_python_client/models/custom_schema/_ticket_context.py,sha256=jnlfgho-aDbmA9
140
140
  glpi_python_client/testing/__init__.py,sha256=iLtUyJjyv3fEhy3PN25NxNTbtqDl3SoHLbNium0Z80U,568
141
141
  glpi_python_client/testing/fixtures.py,sha256=HKt6MXHgcmLn4L98pSwp-oGlc9C--_vrABNe5G_iBeg,1286
142
142
  glpi_python_client/testing/utils.py,sha256=JyO3w2d-0kYdtC1hEZ2Tu_YjnCz8nUQ_Ck05-1EhsX4,4404
143
- glpi_python_client-0.6.8.dist-info/METADATA,sha256=NO8Su8O8dS0rA3fzg_Heai9rxsNdsPElUHsmmsW8UbY,8234
144
- glpi_python_client-0.6.8.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
145
- glpi_python_client-0.6.8.dist-info/licenses/LICENSE,sha256=nL8re-TIKkxCoL7OkSBja6EB4NsQR1HoOJgxv_MEhtc,1088
146
- glpi_python_client-0.6.8.dist-info/RECORD,,
143
+ glpi_python_client-0.6.9.dist-info/METADATA,sha256=i5VjczNW8qdGBF6DnhQzn28pG0y-KmnBtvwMUGf7Sl8,8234
144
+ glpi_python_client-0.6.9.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
145
+ glpi_python_client-0.6.9.dist-info/licenses/LICENSE,sha256=nL8re-TIKkxCoL7OkSBja6EB4NsQR1HoOJgxv_MEhtc,1088
146
+ glpi_python_client-0.6.9.dist-info/RECORD,,