samsara-api 5.3.1__py3-none-any.whl → 5.4.0__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.
Files changed (28) hide show
  1. samsara/__init__.py +6 -0
  2. samsara/alerts/client.py +4 -0
  3. samsara/alerts/raw_client.py +4 -0
  4. samsara/beta_ap_is/client.py +0 -630
  5. samsara/beta_ap_is/raw_client.py +1496 -3144
  6. samsara/client.py +38 -0
  7. samsara/core/client_wrapper.py +2 -2
  8. samsara/media/client.py +4 -4
  9. samsara/media/raw_client.py +4 -4
  10. samsara/training_assignments/__init__.py +4 -0
  11. samsara/training_assignments/client.py +528 -0
  12. samsara/training_assignments/raw_client.py +1330 -0
  13. samsara/training_courses/__init__.py +4 -0
  14. samsara/training_courses/client.py +168 -0
  15. samsara/training_courses/raw_client.py +364 -0
  16. samsara/types/harsh_event_trigger_details_object_request_body_types_item.py +1 -0
  17. samsara/types/harsh_event_trigger_details_object_response_body_types_item.py +1 -0
  18. samsara/types/webhook_response_response_body_event_types_item.py +1 -0
  19. samsara/types/webhooks_get_webhook_response_body_event_types_item.py +1 -0
  20. samsara/types/webhooks_patch_webhook_response_body_event_types_item.py +1 -0
  21. samsara/types/webhooks_post_webhooks_response_body_event_types_item.py +1 -0
  22. samsara/types/workflow_trigger_object_request_body.py +2 -4
  23. samsara/types/workflow_trigger_object_response_body.py +2 -4
  24. samsara/webhooks/types/webhooks_post_webhooks_request_body_event_types_item.py +1 -0
  25. {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/METADATA +1 -1
  26. {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/RECORD +28 -22
  27. {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/LICENSE +0 -0
  28. {samsara_api-5.3.1.dist-info → samsara_api-5.4.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
@@ -0,0 +1,168 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.training_courses_get_training_courses_response_body import TrainingCoursesGetTrainingCoursesResponseBody
8
+ from .raw_client import AsyncRawTrainingCoursesClient, RawTrainingCoursesClient
9
+
10
+
11
+ class TrainingCoursesClient:
12
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
13
+ self._raw_client = RawTrainingCoursesClient(client_wrapper=client_wrapper)
14
+
15
+ @property
16
+ def with_raw_response(self) -> RawTrainingCoursesClient:
17
+ """
18
+ Retrieves a raw implementation of this client that returns raw responses.
19
+
20
+ Returns
21
+ -------
22
+ RawTrainingCoursesClient
23
+ """
24
+ return self._raw_client
25
+
26
+ def get_training_courses(
27
+ self,
28
+ *,
29
+ after: typing.Optional[str] = None,
30
+ course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
31
+ category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
32
+ status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
33
+ request_options: typing.Optional[RequestOptions] = None,
34
+ ) -> TrainingCoursesGetTrainingCoursesResponseBody:
35
+ """
36
+ Returns all training courses data. Results are paginated.
37
+ Courses in the ‘draft’ status are excluded from the data returned by this endpoint.
38
+
39
+ <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
40
+
41
+ To use this endpoint, select **Read Training Courses** under the Training Courses category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
42
+
43
+
44
+ **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
45
+
46
+ Parameters
47
+ ----------
48
+ after : typing.Optional[str]
49
+ If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
50
+
51
+ course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
52
+ Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
53
+
54
+ category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
55
+ Optional string of comma separated course category IDs. If courseCategoryId is present, training courses for the specified course category(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
56
+
57
+ status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
58
+ Optional string of comma separated values. If status is present, training courses with the specified status(s) will be returned. Valid values: “published”, “deleted”, “archived”. Defaults to returning all courses.
59
+
60
+ request_options : typing.Optional[RequestOptions]
61
+ Request-specific configuration.
62
+
63
+ Returns
64
+ -------
65
+ TrainingCoursesGetTrainingCoursesResponseBody
66
+ OK response.
67
+
68
+ Examples
69
+ --------
70
+ from samsara import Samsara
71
+
72
+ client = Samsara(
73
+ token="YOUR_TOKEN",
74
+ )
75
+ client.training_courses.get_training_courses()
76
+ """
77
+ _response = self._raw_client.get_training_courses(
78
+ after=after,
79
+ course_ids=course_ids,
80
+ category_ids=category_ids,
81
+ status=status,
82
+ request_options=request_options,
83
+ )
84
+ return _response.data
85
+
86
+
87
+ class AsyncTrainingCoursesClient:
88
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
89
+ self._raw_client = AsyncRawTrainingCoursesClient(client_wrapper=client_wrapper)
90
+
91
+ @property
92
+ def with_raw_response(self) -> AsyncRawTrainingCoursesClient:
93
+ """
94
+ Retrieves a raw implementation of this client that returns raw responses.
95
+
96
+ Returns
97
+ -------
98
+ AsyncRawTrainingCoursesClient
99
+ """
100
+ return self._raw_client
101
+
102
+ async def get_training_courses(
103
+ self,
104
+ *,
105
+ after: typing.Optional[str] = None,
106
+ course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
107
+ category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
108
+ status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
109
+ request_options: typing.Optional[RequestOptions] = None,
110
+ ) -> TrainingCoursesGetTrainingCoursesResponseBody:
111
+ """
112
+ Returns all training courses data. Results are paginated.
113
+ Courses in the ‘draft’ status are excluded from the data returned by this endpoint.
114
+
115
+ <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
116
+
117
+ To use this endpoint, select **Read Training Courses** under the Training Courses category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
118
+
119
+
120
+ **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
121
+
122
+ Parameters
123
+ ----------
124
+ after : typing.Optional[str]
125
+ If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
126
+
127
+ course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
128
+ Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
129
+
130
+ category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
131
+ Optional string of comma separated course category IDs. If courseCategoryId is present, training courses for the specified course category(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
132
+
133
+ status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
134
+ Optional string of comma separated values. If status is present, training courses with the specified status(s) will be returned. Valid values: “published”, “deleted”, “archived”. Defaults to returning all courses.
135
+
136
+ request_options : typing.Optional[RequestOptions]
137
+ Request-specific configuration.
138
+
139
+ Returns
140
+ -------
141
+ TrainingCoursesGetTrainingCoursesResponseBody
142
+ OK response.
143
+
144
+ Examples
145
+ --------
146
+ import asyncio
147
+
148
+ from samsara import AsyncSamsara
149
+
150
+ client = AsyncSamsara(
151
+ token="YOUR_TOKEN",
152
+ )
153
+
154
+
155
+ async def main() -> None:
156
+ await client.training_courses.get_training_courses()
157
+
158
+
159
+ asyncio.run(main())
160
+ """
161
+ _response = await self._raw_client.get_training_courses(
162
+ after=after,
163
+ course_ids=course_ids,
164
+ category_ids=category_ids,
165
+ status=status,
166
+ request_options=request_options,
167
+ )
168
+ return _response.data
@@ -0,0 +1,364 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.pydantic_utilities import parse_obj_as
10
+ from ..core.request_options import RequestOptions
11
+ from ..errors.bad_gateway_error import BadGatewayError
12
+ from ..errors.gateway_timeout_error import GatewayTimeoutError
13
+ from ..errors.internal_server_error import InternalServerError
14
+ from ..errors.method_not_allowed_error import MethodNotAllowedError
15
+ from ..errors.not_found_error import NotFoundError
16
+ from ..errors.not_implemented_error import NotImplementedError
17
+ from ..errors.service_unavailable_error import ServiceUnavailableError
18
+ from ..errors.too_many_requests_error import TooManyRequestsError
19
+ from ..errors.unauthorized_error import UnauthorizedError
20
+ from ..types.training_courses_get_training_courses_response_body import TrainingCoursesGetTrainingCoursesResponseBody
21
+
22
+
23
+ class RawTrainingCoursesClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._client_wrapper = client_wrapper
26
+
27
+ def get_training_courses(
28
+ self,
29
+ *,
30
+ after: typing.Optional[str] = None,
31
+ course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
32
+ category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
33
+ status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
34
+ request_options: typing.Optional[RequestOptions] = None,
35
+ ) -> HttpResponse[TrainingCoursesGetTrainingCoursesResponseBody]:
36
+ """
37
+ Returns all training courses data. Results are paginated.
38
+ Courses in the ‘draft’ status are excluded from the data returned by this endpoint.
39
+
40
+ <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
41
+
42
+ To use this endpoint, select **Read Training Courses** under the Training Courses category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
43
+
44
+
45
+ **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
46
+
47
+ Parameters
48
+ ----------
49
+ after : typing.Optional[str]
50
+ If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
51
+
52
+ course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
53
+ Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
54
+
55
+ category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
56
+ Optional string of comma separated course category IDs. If courseCategoryId is present, training courses for the specified course category(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
57
+
58
+ status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
59
+ Optional string of comma separated values. If status is present, training courses with the specified status(s) will be returned. Valid values: “published”, “deleted”, “archived”. Defaults to returning all courses.
60
+
61
+ request_options : typing.Optional[RequestOptions]
62
+ Request-specific configuration.
63
+
64
+ Returns
65
+ -------
66
+ HttpResponse[TrainingCoursesGetTrainingCoursesResponseBody]
67
+ OK response.
68
+ """
69
+ _response = self._client_wrapper.httpx_client.request(
70
+ "training-courses",
71
+ method="GET",
72
+ params={
73
+ "after": after,
74
+ "courseIds": course_ids,
75
+ "categoryIds": category_ids,
76
+ "status": status,
77
+ },
78
+ request_options=request_options,
79
+ )
80
+ try:
81
+ if 200 <= _response.status_code < 300:
82
+ _data = typing.cast(
83
+ TrainingCoursesGetTrainingCoursesResponseBody,
84
+ parse_obj_as(
85
+ type_=TrainingCoursesGetTrainingCoursesResponseBody, # type: ignore
86
+ object_=_response.json(),
87
+ ),
88
+ )
89
+ return HttpResponse(response=_response, data=_data)
90
+ if _response.status_code == 401:
91
+ raise UnauthorizedError(
92
+ headers=dict(_response.headers),
93
+ body=typing.cast(
94
+ typing.Any,
95
+ parse_obj_as(
96
+ type_=typing.Any, # type: ignore
97
+ object_=_response.json(),
98
+ ),
99
+ ),
100
+ )
101
+ if _response.status_code == 404:
102
+ raise NotFoundError(
103
+ headers=dict(_response.headers),
104
+ body=typing.cast(
105
+ typing.Any,
106
+ parse_obj_as(
107
+ type_=typing.Any, # type: ignore
108
+ object_=_response.json(),
109
+ ),
110
+ ),
111
+ )
112
+ if _response.status_code == 405:
113
+ raise MethodNotAllowedError(
114
+ headers=dict(_response.headers),
115
+ body=typing.cast(
116
+ typing.Any,
117
+ parse_obj_as(
118
+ type_=typing.Any, # type: ignore
119
+ object_=_response.json(),
120
+ ),
121
+ ),
122
+ )
123
+ if _response.status_code == 429:
124
+ raise TooManyRequestsError(
125
+ headers=dict(_response.headers),
126
+ body=typing.cast(
127
+ typing.Any,
128
+ parse_obj_as(
129
+ type_=typing.Any, # type: ignore
130
+ object_=_response.json(),
131
+ ),
132
+ ),
133
+ )
134
+ if _response.status_code == 500:
135
+ raise InternalServerError(
136
+ headers=dict(_response.headers),
137
+ body=typing.cast(
138
+ typing.Any,
139
+ parse_obj_as(
140
+ type_=typing.Any, # type: ignore
141
+ object_=_response.json(),
142
+ ),
143
+ ),
144
+ )
145
+ if _response.status_code == 501:
146
+ raise NotImplementedError(
147
+ headers=dict(_response.headers),
148
+ body=typing.cast(
149
+ typing.Any,
150
+ parse_obj_as(
151
+ type_=typing.Any, # type: ignore
152
+ object_=_response.json(),
153
+ ),
154
+ ),
155
+ )
156
+ if _response.status_code == 502:
157
+ raise BadGatewayError(
158
+ headers=dict(_response.headers),
159
+ body=typing.cast(
160
+ typing.Any,
161
+ parse_obj_as(
162
+ type_=typing.Any, # type: ignore
163
+ object_=_response.json(),
164
+ ),
165
+ ),
166
+ )
167
+ if _response.status_code == 503:
168
+ raise ServiceUnavailableError(
169
+ headers=dict(_response.headers),
170
+ body=typing.cast(
171
+ typing.Any,
172
+ parse_obj_as(
173
+ type_=typing.Any, # type: ignore
174
+ object_=_response.json(),
175
+ ),
176
+ ),
177
+ )
178
+ if _response.status_code == 504:
179
+ raise GatewayTimeoutError(
180
+ headers=dict(_response.headers),
181
+ body=typing.cast(
182
+ typing.Any,
183
+ parse_obj_as(
184
+ type_=typing.Any, # type: ignore
185
+ object_=_response.json(),
186
+ ),
187
+ ),
188
+ )
189
+ _response_json = _response.json()
190
+ except JSONDecodeError:
191
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
192
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
193
+
194
+
195
+ class AsyncRawTrainingCoursesClient:
196
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
197
+ self._client_wrapper = client_wrapper
198
+
199
+ async def get_training_courses(
200
+ self,
201
+ *,
202
+ after: typing.Optional[str] = None,
203
+ course_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
204
+ category_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
205
+ status: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
206
+ request_options: typing.Optional[RequestOptions] = None,
207
+ ) -> AsyncHttpResponse[TrainingCoursesGetTrainingCoursesResponseBody]:
208
+ """
209
+ Returns all training courses data. Results are paginated.
210
+ Courses in the ‘draft’ status are excluded from the data returned by this endpoint.
211
+
212
+ <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
213
+
214
+ To use this endpoint, select **Read Training Courses** under the Training Courses category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
215
+
216
+
217
+ **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.
218
+
219
+ Parameters
220
+ ----------
221
+ after : typing.Optional[str]
222
+ If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
223
+
224
+ course_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
225
+ Optional string of comma separated course IDs. If course ID is present, training assignments for the specified course ID(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `courseIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
226
+
227
+ category_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
228
+ Optional string of comma separated course category IDs. If courseCategoryId is present, training courses for the specified course category(s) will be returned. Max value for this value is 100 objects. Defaults to returning all courses. Example: `categoryIds=a4db8702-79d5-4396-a717-e301d52ecc11,c6490f6a-d84e-49b5-b0ad-b6baae304075`
229
+
230
+ status : typing.Optional[typing.Union[str, typing.Sequence[str]]]
231
+ Optional string of comma separated values. If status is present, training courses with the specified status(s) will be returned. Valid values: “published”, “deleted”, “archived”. Defaults to returning all courses.
232
+
233
+ request_options : typing.Optional[RequestOptions]
234
+ Request-specific configuration.
235
+
236
+ Returns
237
+ -------
238
+ AsyncHttpResponse[TrainingCoursesGetTrainingCoursesResponseBody]
239
+ OK response.
240
+ """
241
+ _response = await self._client_wrapper.httpx_client.request(
242
+ "training-courses",
243
+ method="GET",
244
+ params={
245
+ "after": after,
246
+ "courseIds": course_ids,
247
+ "categoryIds": category_ids,
248
+ "status": status,
249
+ },
250
+ request_options=request_options,
251
+ )
252
+ try:
253
+ if 200 <= _response.status_code < 300:
254
+ _data = typing.cast(
255
+ TrainingCoursesGetTrainingCoursesResponseBody,
256
+ parse_obj_as(
257
+ type_=TrainingCoursesGetTrainingCoursesResponseBody, # type: ignore
258
+ object_=_response.json(),
259
+ ),
260
+ )
261
+ return AsyncHttpResponse(response=_response, data=_data)
262
+ if _response.status_code == 401:
263
+ raise UnauthorizedError(
264
+ headers=dict(_response.headers),
265
+ body=typing.cast(
266
+ typing.Any,
267
+ parse_obj_as(
268
+ type_=typing.Any, # type: ignore
269
+ object_=_response.json(),
270
+ ),
271
+ ),
272
+ )
273
+ if _response.status_code == 404:
274
+ raise NotFoundError(
275
+ headers=dict(_response.headers),
276
+ body=typing.cast(
277
+ typing.Any,
278
+ parse_obj_as(
279
+ type_=typing.Any, # type: ignore
280
+ object_=_response.json(),
281
+ ),
282
+ ),
283
+ )
284
+ if _response.status_code == 405:
285
+ raise MethodNotAllowedError(
286
+ headers=dict(_response.headers),
287
+ body=typing.cast(
288
+ typing.Any,
289
+ parse_obj_as(
290
+ type_=typing.Any, # type: ignore
291
+ object_=_response.json(),
292
+ ),
293
+ ),
294
+ )
295
+ if _response.status_code == 429:
296
+ raise TooManyRequestsError(
297
+ headers=dict(_response.headers),
298
+ body=typing.cast(
299
+ typing.Any,
300
+ parse_obj_as(
301
+ type_=typing.Any, # type: ignore
302
+ object_=_response.json(),
303
+ ),
304
+ ),
305
+ )
306
+ if _response.status_code == 500:
307
+ raise InternalServerError(
308
+ headers=dict(_response.headers),
309
+ body=typing.cast(
310
+ typing.Any,
311
+ parse_obj_as(
312
+ type_=typing.Any, # type: ignore
313
+ object_=_response.json(),
314
+ ),
315
+ ),
316
+ )
317
+ if _response.status_code == 501:
318
+ raise NotImplementedError(
319
+ headers=dict(_response.headers),
320
+ body=typing.cast(
321
+ typing.Any,
322
+ parse_obj_as(
323
+ type_=typing.Any, # type: ignore
324
+ object_=_response.json(),
325
+ ),
326
+ ),
327
+ )
328
+ if _response.status_code == 502:
329
+ raise BadGatewayError(
330
+ headers=dict(_response.headers),
331
+ body=typing.cast(
332
+ typing.Any,
333
+ parse_obj_as(
334
+ type_=typing.Any, # type: ignore
335
+ object_=_response.json(),
336
+ ),
337
+ ),
338
+ )
339
+ if _response.status_code == 503:
340
+ raise ServiceUnavailableError(
341
+ headers=dict(_response.headers),
342
+ body=typing.cast(
343
+ typing.Any,
344
+ parse_obj_as(
345
+ type_=typing.Any, # type: ignore
346
+ object_=_response.json(),
347
+ ),
348
+ ),
349
+ )
350
+ if _response.status_code == 504:
351
+ raise GatewayTimeoutError(
352
+ headers=dict(_response.headers),
353
+ body=typing.cast(
354
+ typing.Any,
355
+ parse_obj_as(
356
+ type_=typing.Any, # type: ignore
357
+ object_=_response.json(),
358
+ ),
359
+ ),
360
+ )
361
+ _response_json = _response.json()
362
+ except JSONDecodeError:
363
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
364
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -28,6 +28,7 @@ HarshEventTriggerDetailsObjectRequestBodyTypesItem = typing.Union[
28
28
  "haPolicyDetector",
29
29
  "haRearCollisionWarning",
30
30
  "haRedLightViolation",
31
+ "haReversing",
31
32
  "haRolledStopSign",
32
33
  "haRollover",
33
34
  "haRolloverProtectionBrakeControlActivated",
@@ -28,6 +28,7 @@ HarshEventTriggerDetailsObjectResponseBodyTypesItem = typing.Union[
28
28
  "haPolicyDetector",
29
29
  "haRearCollisionWarning",
30
30
  "haRedLightViolation",
31
+ "haReversing",
31
32
  "haRolledStopSign",
32
33
  "haRollover",
33
34
  "haRolloverProtectionBrakeControlActivated",
@@ -21,6 +21,7 @@ WebhookResponseResponseBodyEventTypesItem = typing.Union[
21
21
  "GeofenceEntry",
22
22
  "GeofenceExit",
23
23
  "IssueCreated",
24
+ "MissingDvirPastDue",
24
25
  "PredictiveMaintenanceAlert",
25
26
  "RouteStopArrival",
26
27
  "RouteStopDeparture",
@@ -21,6 +21,7 @@ WebhooksGetWebhookResponseBodyEventTypesItem = typing.Union[
21
21
  "GeofenceEntry",
22
22
  "GeofenceExit",
23
23
  "IssueCreated",
24
+ "MissingDvirPastDue",
24
25
  "PredictiveMaintenanceAlert",
25
26
  "RouteStopArrival",
26
27
  "RouteStopDeparture",
@@ -21,6 +21,7 @@ WebhooksPatchWebhookResponseBodyEventTypesItem = typing.Union[
21
21
  "GeofenceEntry",
22
22
  "GeofenceExit",
23
23
  "IssueCreated",
24
+ "MissingDvirPastDue",
24
25
  "PredictiveMaintenanceAlert",
25
26
  "RouteStopArrival",
26
27
  "RouteStopDeparture",
@@ -21,6 +21,7 @@ WebhooksPostWebhooksResponseBodyEventTypesItem = typing.Union[
21
21
  "GeofenceEntry",
22
22
  "GeofenceExit",
23
23
  "IssueCreated",
24
+ "MissingDvirPastDue",
24
25
  "PredictiveMaintenanceAlert",
25
26
  "RouteStopArrival",
26
27
  "RouteStopDeparture",
@@ -65,11 +65,9 @@ class WorkflowTriggerObjectRequestBody(UniversalBaseModel):
65
65
  Geofence Entry = 5016
66
66
  Geofence Exit = 5017
67
67
  Route Stop ETA Alert = 5018
68
- Scheduled Date And Time = 8001
69
-
70
- The following trigger types are in Preview:
71
- A safety event occurred = 5033
68
+ A safety event occurred with a driver assigned = 5033
72
69
  A safety event occurred = 5039
70
+ Scheduled Date And Time = 8001
73
71
  """
74
72
 
75
73
  if IS_PYDANTIC_V2:
@@ -65,11 +65,9 @@ class WorkflowTriggerObjectResponseBody(UniversalBaseModel):
65
65
  Geofence Entry = 5016
66
66
  Geofence Exit = 5017
67
67
  Route Stop ETA Alert = 5018
68
- Scheduled Date And Time = 8001
69
-
70
- The following trigger types are in Preview:
71
- A safety event occurred = 5033
68
+ A safety event occurred with a driver assigned = 5033
72
69
  A safety event occurred = 5039
70
+ Scheduled Date And Time = 8001
73
71
  """
74
72
 
75
73
  if IS_PYDANTIC_V2:
@@ -21,6 +21,7 @@ WebhooksPostWebhooksRequestBodyEventTypesItem = typing.Union[
21
21
  "GeofenceEntry",
22
22
  "GeofenceExit",
23
23
  "IssueCreated",
24
+ "MissingDvirPastDue",
24
25
  "PredictiveMaintenanceAlert",
25
26
  "RouteStopArrival",
26
27
  "RouteStopDeparture",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: samsara-api
3
- Version: 5.3.1
3
+ Version: 5.4.0
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.8,<4.0