samsara-api 4.2.0__py3-none-any.whl → 4.3.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 (159) hide show
  1. samsara/__init__.py +69 -9
  2. samsara/addresses/client.py +7 -14
  3. samsara/addresses/raw_client.py +7 -11
  4. samsara/alerts/client.py +2 -10
  5. samsara/alerts/raw_client.py +180 -180
  6. samsara/assets/__init__.py +3 -3
  7. samsara/assets/client.py +14 -45
  8. samsara/assets/raw_client.py +156 -160
  9. samsara/assets/types/__init__.py +3 -3
  10. samsara/assets/types/{assets_list_request_type.py → list_assets_request_type.py} +1 -1
  11. samsara/attributes/client.py +0 -4
  12. samsara/beta_ap_is/client.py +137 -187
  13. samsara/beta_ap_is/raw_client.py +2035 -1702
  14. samsara/carrier_proposed_assignments/client.py +2 -10
  15. samsara/client.py +5 -0
  16. samsara/coaching/client.py +2 -22
  17. samsara/coaching/raw_client.py +108 -108
  18. samsara/contacts/client.py +2 -8
  19. samsara/core/__init__.py +5 -0
  20. samsara/core/client_wrapper.py +18 -10
  21. samsara/core/custom_pagination.py +152 -0
  22. samsara/core/http_client.py +176 -90
  23. samsara/core/http_sse/__init__.py +42 -0
  24. samsara/core/http_sse/_api.py +112 -0
  25. samsara/core/http_sse/_decoders.py +61 -0
  26. samsara/core/http_sse/_exceptions.py +7 -0
  27. samsara/core/http_sse/_models.py +17 -0
  28. samsara/core/pagination.py +14 -14
  29. samsara/core/pydantic_utilities.py +3 -1
  30. samsara/documents/client.py +2 -12
  31. samsara/documents/raw_client.py +180 -180
  32. samsara/driver_qr_codes/raw_client.py +108 -108
  33. samsara/driver_vehicle_assignments/client.py +0 -12
  34. samsara/driver_vehicle_assignments/raw_client.py +144 -144
  35. samsara/drivers/__init__.py +3 -3
  36. samsara/drivers/client.py +12 -23
  37. samsara/drivers/raw_client.py +48 -52
  38. samsara/drivers/types/__init__.py +3 -3
  39. samsara/drivers/types/{drivers_list_request_driver_activation_status.py → list_drivers_request_driver_activation_status.py} +1 -1
  40. samsara/equipment/client.py +6 -22
  41. samsara/errors/bad_gateway_error.py +1 -1
  42. samsara/errors/gateway_timeout_error.py +1 -1
  43. samsara/errors/internal_server_error.py +1 -1
  44. samsara/errors/method_not_allowed_error.py +1 -1
  45. samsara/errors/not_found_error.py +1 -1
  46. samsara/errors/not_implemented_error.py +1 -1
  47. samsara/errors/service_unavailable_error.py +1 -1
  48. samsara/errors/too_many_requests_error.py +1 -1
  49. samsara/errors/unauthorized_error.py +1 -1
  50. samsara/forms/__init__.py +9 -3
  51. samsara/forms/client.py +17 -10
  52. samsara/forms/raw_client.py +265 -254
  53. samsara/forms/types/__init__.py +6 -2
  54. samsara/forms/types/form_submissions_post_form_submission_request_body_status.py +5 -0
  55. samsara/fuel_and_energy/client.py +0 -30
  56. samsara/fuel_and_energy/raw_client.py +180 -180
  57. samsara/gateways/client.py +2 -6
  58. samsara/gateways/raw_client.py +108 -108
  59. samsara/hours_of_service/__init__.py +6 -3
  60. samsara/hours_of_service/client.py +13 -52
  61. samsara/hours_of_service/raw_client.py +77 -76
  62. samsara/hours_of_service/types/__init__.py +4 -2
  63. samsara/hours_of_service/types/get_hos_daily_logs_request_expand.py +5 -0
  64. samsara/hubs/client.py +2 -94
  65. samsara/hubs/raw_client.py +216 -216
  66. samsara/idling/client.py +0 -18
  67. samsara/idling/raw_client.py +36 -36
  68. samsara/ifta/client.py +4 -34
  69. samsara/ifta/raw_client.py +144 -144
  70. samsara/industrial/client.py +12 -56
  71. samsara/industrial/raw_client.py +40 -48
  72. samsara/issues/client.py +0 -4
  73. samsara/issues/raw_client.py +108 -108
  74. samsara/legacy_ap_is/client.py +4 -56
  75. samsara/legacy_ap_is/raw_client.py +108 -108
  76. samsara/live_sharing_links/client.py +2 -10
  77. samsara/live_sharing_links/raw_client.py +144 -144
  78. samsara/location_and_speed/client.py +2 -20
  79. samsara/location_and_speed/raw_client.py +36 -36
  80. samsara/maintenance/__init__.py +3 -3
  81. samsara/maintenance/client.py +15 -30
  82. samsara/maintenance/raw_client.py +191 -182
  83. samsara/maintenance/types/__init__.py +6 -2
  84. samsara/maintenance/types/create_dvir_request_type.py +5 -0
  85. samsara/media/client.py +0 -4
  86. samsara/media/raw_client.py +108 -108
  87. samsara/messages/client.py +2 -8
  88. samsara/plans/client.py +0 -21
  89. samsara/plans/raw_client.py +72 -72
  90. samsara/preview_ap_is/client.py +0 -140
  91. samsara/preview_ap_is/raw_client.py +72 -430
  92. samsara/route_events/client.py +2 -12
  93. samsara/route_events/raw_client.py +36 -36
  94. samsara/routes/__init__.py +30 -0
  95. samsara/routes/client.py +7 -35
  96. samsara/routes/raw_client.py +257 -256
  97. samsara/routes/types/__init__.py +34 -0
  98. samsara/routes/types/get_routes_feed_request_expand.py +5 -0
  99. samsara/safety/client.py +2 -10
  100. samsara/safety/raw_client.py +36 -36
  101. samsara/settings/raw_client.py +180 -180
  102. samsara/speeding_intervals/raw_client.py +36 -36
  103. samsara/tachograph_eu_only/client.py +0 -6
  104. samsara/tags/client.py +2 -8
  105. samsara/trailer_assignments/client.py +2 -18
  106. samsara/trailers/client.py +2 -12
  107. samsara/trailers/raw_client.py +180 -180
  108. samsara/types/__init__.py +54 -0
  109. samsara/types/create_routes_stop_request_object_request_body.py +7 -0
  110. samsara/types/driver_assignment_object_response_body.py +2 -1
  111. samsara/types/driver_assignment_object_response_body_assignment_type.py +5 -0
  112. samsara/types/driver_external_ids.py +1 -1
  113. samsara/types/forms_approval_config_object_response_body.py +2 -1
  114. samsara/types/forms_approval_config_object_response_body_type.py +5 -0
  115. samsara/types/fuel_level_trigger_details_object_request_body.py +2 -1
  116. samsara/types/fuel_level_trigger_details_object_request_body_operation.py +5 -0
  117. samsara/types/fuel_level_trigger_details_object_response_body.py +4 -1
  118. samsara/types/fuel_level_trigger_details_object_response_body_operation.py +5 -0
  119. samsara/types/idling_event_object_v_20251023_response_body.py +4 -3
  120. samsara/types/idling_event_object_v_20251023_response_body_pto_state.py +5 -0
  121. samsara/types/patch_issue_request_body_assigned_to_request_body.py +2 -1
  122. samsara/types/patch_issue_request_body_assigned_to_request_body_type.py +5 -0
  123. samsara/types/reading_datapoint_request_body.py +5 -4
  124. samsara/types/reading_datapoint_request_body_entity_type.py +5 -0
  125. samsara/types/reading_history_response_body.py +1 -1
  126. samsara/types/reading_snapshot_response_body.py +1 -1
  127. samsara/types/resolved_by.py +2 -1
  128. samsara/types/resolved_by_type.py +5 -0
  129. samsara/types/route_feed_object_response_body.py +2 -1
  130. samsara/types/route_feed_object_response_body_type.py +5 -0
  131. samsara/types/route_settings_request_body.py +8 -0
  132. samsara/types/route_settings_request_body_sequencing_method.py +7 -0
  133. samsara/types/route_settings_response_body.py +8 -0
  134. samsara/types/route_settings_response_body_sequencing_method.py +7 -0
  135. samsara/types/route_stop_details_object_response_body.py +2 -1
  136. samsara/types/route_stop_details_object_response_body_type.py +5 -0
  137. samsara/types/routes_stop_response_object_response_body.py +7 -0
  138. samsara/types/training_learner_object_response_body.py +2 -1
  139. samsara/types/training_learner_object_response_body_type.py +5 -0
  140. samsara/types/update_routes_stop_request_object_request_body.py +7 -0
  141. samsara/types/vehicle_assignment_object_response_body.py +4 -3
  142. samsara/types/vehicle_assignment_object_response_body_assignment_type.py +5 -0
  143. samsara/types/vehicle_external_ids.py +1 -1
  144. samsara/types/work_order_money_object_request_body.py +2 -1
  145. samsara/types/work_order_money_object_request_body_currency.py +5 -0
  146. samsara/types/work_order_money_object_response_body.py +2 -1
  147. samsara/types/work_order_money_object_response_body_currency.py +5 -0
  148. samsara/users/client.py +4 -16
  149. samsara/vehicle_locations/client.py +4 -16
  150. samsara/vehicles/client.py +7 -22
  151. samsara/vehicles/raw_client.py +43 -47
  152. samsara/webhooks/client.py +2 -10
  153. samsara/webhooks/raw_client.py +180 -180
  154. samsara/work_orders/client.py +4 -18
  155. samsara/work_orders/raw_client.py +216 -216
  156. {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/METADATA +2 -1
  157. {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/RECORD +159 -132
  158. {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/LICENSE +0 -0
  159. {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/WHEEL +0 -0
@@ -18,194 +18,12 @@ from ..errors.not_implemented_error import NotImplementedError
18
18
  from ..errors.service_unavailable_error import ServiceUnavailableError
19
19
  from ..errors.too_many_requests_error import TooManyRequestsError
20
20
  from ..errors.unauthorized_error import UnauthorizedError
21
- from ..types.drivers_auth_token_create_driver_auth_token_response_body import (
22
- DriversAuthTokenCreateDriverAuthTokenResponseBody,
23
- )
24
-
25
- # this is used as the default value for optional parameters
26
- OMIT = typing.cast(typing.Any, ...)
27
21
 
28
22
 
29
23
  class RawPreviewApIsClient:
30
24
  def __init__(self, *, client_wrapper: SyncClientWrapper):
31
25
  self._client_wrapper = client_wrapper
32
26
 
33
- def create_driver_auth_token(
34
- self,
35
- *,
36
- code: str,
37
- external_id: typing.Optional[str] = OMIT,
38
- id: typing.Optional[int] = OMIT,
39
- username: typing.Optional[str] = OMIT,
40
- request_options: typing.Optional[RequestOptions] = None,
41
- ) -> HttpResponse[DriversAuthTokenCreateDriverAuthTokenResponseBody]:
42
- """
43
- Creates a short-lived auth token for a driver.
44
-
45
- <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
46
-
47
- To use this endpoint, select **Write Driver Auth Token** under the Closed Beta 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>
48
-
49
- Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications
50
-
51
- - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
52
-
53
- - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
54
-
55
-
56
- **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.
57
-
58
- Parameters
59
- ----------
60
- code : str
61
- Required. Random 12+ character string, used with the auth token to help secure the client from intercepted tokens.
62
-
63
- external_id : typing.Optional[str]
64
- Optional. External ID of the driver, in the format `key:value` (e.g., `payrollId:ABFS18600`). One of `id`, `externalId`, or `username` is required.
65
-
66
- id : typing.Optional[int]
67
- Optional. Samsara ID of the driver. One of `id`, `externalId`, or `username` is required.
68
-
69
- username : typing.Optional[str]
70
- Optional. Username of the driver. This is the login identifier configured when the driver is created. One of `id`, `externalId`, or `username` is required.
71
-
72
- request_options : typing.Optional[RequestOptions]
73
- Request-specific configuration.
74
-
75
- Returns
76
- -------
77
- HttpResponse[DriversAuthTokenCreateDriverAuthTokenResponseBody]
78
- OK response.
79
- """
80
- _response = self._client_wrapper.httpx_client.request(
81
- "preview/fleet/drivers/create-auth-token",
82
- method="POST",
83
- json={
84
- "code": code,
85
- "externalId": external_id,
86
- "id": id,
87
- "username": username,
88
- },
89
- headers={
90
- "content-type": "application/json",
91
- },
92
- request_options=request_options,
93
- omit=OMIT,
94
- )
95
- try:
96
- if 200 <= _response.status_code < 300:
97
- _data = typing.cast(
98
- DriversAuthTokenCreateDriverAuthTokenResponseBody,
99
- parse_obj_as(
100
- type_=DriversAuthTokenCreateDriverAuthTokenResponseBody, # type: ignore
101
- object_=_response.json(),
102
- ),
103
- )
104
- return HttpResponse(response=_response, data=_data)
105
- if _response.status_code == 401:
106
- raise UnauthorizedError(
107
- headers=dict(_response.headers),
108
- body=typing.cast(
109
- typing.Optional[typing.Any],
110
- parse_obj_as(
111
- type_=typing.Optional[typing.Any], # type: ignore
112
- object_=_response.json(),
113
- ),
114
- ),
115
- )
116
- if _response.status_code == 404:
117
- raise NotFoundError(
118
- headers=dict(_response.headers),
119
- body=typing.cast(
120
- typing.Optional[typing.Any],
121
- parse_obj_as(
122
- type_=typing.Optional[typing.Any], # type: ignore
123
- object_=_response.json(),
124
- ),
125
- ),
126
- )
127
- if _response.status_code == 405:
128
- raise MethodNotAllowedError(
129
- headers=dict(_response.headers),
130
- body=typing.cast(
131
- typing.Optional[typing.Any],
132
- parse_obj_as(
133
- type_=typing.Optional[typing.Any], # type: ignore
134
- object_=_response.json(),
135
- ),
136
- ),
137
- )
138
- if _response.status_code == 429:
139
- raise TooManyRequestsError(
140
- headers=dict(_response.headers),
141
- body=typing.cast(
142
- typing.Optional[typing.Any],
143
- parse_obj_as(
144
- type_=typing.Optional[typing.Any], # type: ignore
145
- object_=_response.json(),
146
- ),
147
- ),
148
- )
149
- if _response.status_code == 500:
150
- raise InternalServerError(
151
- headers=dict(_response.headers),
152
- body=typing.cast(
153
- typing.Optional[typing.Any],
154
- parse_obj_as(
155
- type_=typing.Optional[typing.Any], # type: ignore
156
- object_=_response.json(),
157
- ),
158
- ),
159
- )
160
- if _response.status_code == 501:
161
- raise NotImplementedError(
162
- headers=dict(_response.headers),
163
- body=typing.cast(
164
- typing.Optional[typing.Any],
165
- parse_obj_as(
166
- type_=typing.Optional[typing.Any], # type: ignore
167
- object_=_response.json(),
168
- ),
169
- ),
170
- )
171
- if _response.status_code == 502:
172
- raise BadGatewayError(
173
- headers=dict(_response.headers),
174
- body=typing.cast(
175
- typing.Optional[typing.Any],
176
- parse_obj_as(
177
- type_=typing.Optional[typing.Any], # type: ignore
178
- object_=_response.json(),
179
- ),
180
- ),
181
- )
182
- if _response.status_code == 503:
183
- raise ServiceUnavailableError(
184
- headers=dict(_response.headers),
185
- body=typing.cast(
186
- typing.Optional[typing.Any],
187
- parse_obj_as(
188
- type_=typing.Optional[typing.Any], # type: ignore
189
- object_=_response.json(),
190
- ),
191
- ),
192
- )
193
- if _response.status_code == 504:
194
- raise GatewayTimeoutError(
195
- headers=dict(_response.headers),
196
- body=typing.cast(
197
- typing.Optional[typing.Any],
198
- parse_obj_as(
199
- type_=typing.Optional[typing.Any], # type: ignore
200
- object_=_response.json(),
201
- ),
202
- ),
203
- )
204
- _response_json = _response.json()
205
- except JSONDecodeError:
206
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
207
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
208
-
209
27
  def lock_vehicle(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
210
28
  """
211
29
  Lock a vehicle. This requires a vehicle gateway with locking capabilities.
@@ -247,9 +65,9 @@ class RawPreviewApIsClient:
247
65
  raise UnauthorizedError(
248
66
  headers=dict(_response.headers),
249
67
  body=typing.cast(
250
- typing.Optional[typing.Any],
68
+ typing.Any,
251
69
  parse_obj_as(
252
- type_=typing.Optional[typing.Any], # type: ignore
70
+ type_=typing.Any, # type: ignore
253
71
  object_=_response.json(),
254
72
  ),
255
73
  ),
@@ -258,9 +76,9 @@ class RawPreviewApIsClient:
258
76
  raise NotFoundError(
259
77
  headers=dict(_response.headers),
260
78
  body=typing.cast(
261
- typing.Optional[typing.Any],
79
+ typing.Any,
262
80
  parse_obj_as(
263
- type_=typing.Optional[typing.Any], # type: ignore
81
+ type_=typing.Any, # type: ignore
264
82
  object_=_response.json(),
265
83
  ),
266
84
  ),
@@ -269,9 +87,9 @@ class RawPreviewApIsClient:
269
87
  raise MethodNotAllowedError(
270
88
  headers=dict(_response.headers),
271
89
  body=typing.cast(
272
- typing.Optional[typing.Any],
90
+ typing.Any,
273
91
  parse_obj_as(
274
- type_=typing.Optional[typing.Any], # type: ignore
92
+ type_=typing.Any, # type: ignore
275
93
  object_=_response.json(),
276
94
  ),
277
95
  ),
@@ -280,9 +98,9 @@ class RawPreviewApIsClient:
280
98
  raise TooManyRequestsError(
281
99
  headers=dict(_response.headers),
282
100
  body=typing.cast(
283
- typing.Optional[typing.Any],
101
+ typing.Any,
284
102
  parse_obj_as(
285
- type_=typing.Optional[typing.Any], # type: ignore
103
+ type_=typing.Any, # type: ignore
286
104
  object_=_response.json(),
287
105
  ),
288
106
  ),
@@ -291,9 +109,9 @@ class RawPreviewApIsClient:
291
109
  raise InternalServerError(
292
110
  headers=dict(_response.headers),
293
111
  body=typing.cast(
294
- typing.Optional[typing.Any],
112
+ typing.Any,
295
113
  parse_obj_as(
296
- type_=typing.Optional[typing.Any], # type: ignore
114
+ type_=typing.Any, # type: ignore
297
115
  object_=_response.json(),
298
116
  ),
299
117
  ),
@@ -302,9 +120,9 @@ class RawPreviewApIsClient:
302
120
  raise NotImplementedError(
303
121
  headers=dict(_response.headers),
304
122
  body=typing.cast(
305
- typing.Optional[typing.Any],
123
+ typing.Any,
306
124
  parse_obj_as(
307
- type_=typing.Optional[typing.Any], # type: ignore
125
+ type_=typing.Any, # type: ignore
308
126
  object_=_response.json(),
309
127
  ),
310
128
  ),
@@ -313,9 +131,9 @@ class RawPreviewApIsClient:
313
131
  raise BadGatewayError(
314
132
  headers=dict(_response.headers),
315
133
  body=typing.cast(
316
- typing.Optional[typing.Any],
134
+ typing.Any,
317
135
  parse_obj_as(
318
- type_=typing.Optional[typing.Any], # type: ignore
136
+ type_=typing.Any, # type: ignore
319
137
  object_=_response.json(),
320
138
  ),
321
139
  ),
@@ -324,9 +142,9 @@ class RawPreviewApIsClient:
324
142
  raise ServiceUnavailableError(
325
143
  headers=dict(_response.headers),
326
144
  body=typing.cast(
327
- typing.Optional[typing.Any],
145
+ typing.Any,
328
146
  parse_obj_as(
329
- type_=typing.Optional[typing.Any], # type: ignore
147
+ type_=typing.Any, # type: ignore
330
148
  object_=_response.json(),
331
149
  ),
332
150
  ),
@@ -335,9 +153,9 @@ class RawPreviewApIsClient:
335
153
  raise GatewayTimeoutError(
336
154
  headers=dict(_response.headers),
337
155
  body=typing.cast(
338
- typing.Optional[typing.Any],
156
+ typing.Any,
339
157
  parse_obj_as(
340
- type_=typing.Optional[typing.Any], # type: ignore
158
+ type_=typing.Any, # type: ignore
341
159
  object_=_response.json(),
342
160
  ),
343
161
  ),
@@ -388,9 +206,9 @@ class RawPreviewApIsClient:
388
206
  raise UnauthorizedError(
389
207
  headers=dict(_response.headers),
390
208
  body=typing.cast(
391
- typing.Optional[typing.Any],
209
+ typing.Any,
392
210
  parse_obj_as(
393
- type_=typing.Optional[typing.Any], # type: ignore
211
+ type_=typing.Any, # type: ignore
394
212
  object_=_response.json(),
395
213
  ),
396
214
  ),
@@ -399,9 +217,9 @@ class RawPreviewApIsClient:
399
217
  raise NotFoundError(
400
218
  headers=dict(_response.headers),
401
219
  body=typing.cast(
402
- typing.Optional[typing.Any],
220
+ typing.Any,
403
221
  parse_obj_as(
404
- type_=typing.Optional[typing.Any], # type: ignore
222
+ type_=typing.Any, # type: ignore
405
223
  object_=_response.json(),
406
224
  ),
407
225
  ),
@@ -410,9 +228,9 @@ class RawPreviewApIsClient:
410
228
  raise MethodNotAllowedError(
411
229
  headers=dict(_response.headers),
412
230
  body=typing.cast(
413
- typing.Optional[typing.Any],
231
+ typing.Any,
414
232
  parse_obj_as(
415
- type_=typing.Optional[typing.Any], # type: ignore
233
+ type_=typing.Any, # type: ignore
416
234
  object_=_response.json(),
417
235
  ),
418
236
  ),
@@ -421,9 +239,9 @@ class RawPreviewApIsClient:
421
239
  raise TooManyRequestsError(
422
240
  headers=dict(_response.headers),
423
241
  body=typing.cast(
424
- typing.Optional[typing.Any],
242
+ typing.Any,
425
243
  parse_obj_as(
426
- type_=typing.Optional[typing.Any], # type: ignore
244
+ type_=typing.Any, # type: ignore
427
245
  object_=_response.json(),
428
246
  ),
429
247
  ),
@@ -432,9 +250,9 @@ class RawPreviewApIsClient:
432
250
  raise InternalServerError(
433
251
  headers=dict(_response.headers),
434
252
  body=typing.cast(
435
- typing.Optional[typing.Any],
253
+ typing.Any,
436
254
  parse_obj_as(
437
- type_=typing.Optional[typing.Any], # type: ignore
255
+ type_=typing.Any, # type: ignore
438
256
  object_=_response.json(),
439
257
  ),
440
258
  ),
@@ -443,9 +261,9 @@ class RawPreviewApIsClient:
443
261
  raise NotImplementedError(
444
262
  headers=dict(_response.headers),
445
263
  body=typing.cast(
446
- typing.Optional[typing.Any],
264
+ typing.Any,
447
265
  parse_obj_as(
448
- type_=typing.Optional[typing.Any], # type: ignore
266
+ type_=typing.Any, # type: ignore
449
267
  object_=_response.json(),
450
268
  ),
451
269
  ),
@@ -454,9 +272,9 @@ class RawPreviewApIsClient:
454
272
  raise BadGatewayError(
455
273
  headers=dict(_response.headers),
456
274
  body=typing.cast(
457
- typing.Optional[typing.Any],
275
+ typing.Any,
458
276
  parse_obj_as(
459
- type_=typing.Optional[typing.Any], # type: ignore
277
+ type_=typing.Any, # type: ignore
460
278
  object_=_response.json(),
461
279
  ),
462
280
  ),
@@ -465,9 +283,9 @@ class RawPreviewApIsClient:
465
283
  raise ServiceUnavailableError(
466
284
  headers=dict(_response.headers),
467
285
  body=typing.cast(
468
- typing.Optional[typing.Any],
286
+ typing.Any,
469
287
  parse_obj_as(
470
- type_=typing.Optional[typing.Any], # type: ignore
288
+ type_=typing.Any, # type: ignore
471
289
  object_=_response.json(),
472
290
  ),
473
291
  ),
@@ -476,9 +294,9 @@ class RawPreviewApIsClient:
476
294
  raise GatewayTimeoutError(
477
295
  headers=dict(_response.headers),
478
296
  body=typing.cast(
479
- typing.Optional[typing.Any],
297
+ typing.Any,
480
298
  parse_obj_as(
481
- type_=typing.Optional[typing.Any], # type: ignore
299
+ type_=typing.Any, # type: ignore
482
300
  object_=_response.json(),
483
301
  ),
484
302
  ),
@@ -493,182 +311,6 @@ class AsyncRawPreviewApIsClient:
493
311
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
494
312
  self._client_wrapper = client_wrapper
495
313
 
496
- async def create_driver_auth_token(
497
- self,
498
- *,
499
- code: str,
500
- external_id: typing.Optional[str] = OMIT,
501
- id: typing.Optional[int] = OMIT,
502
- username: typing.Optional[str] = OMIT,
503
- request_options: typing.Optional[RequestOptions] = None,
504
- ) -> AsyncHttpResponse[DriversAuthTokenCreateDriverAuthTokenResponseBody]:
505
- """
506
- Creates a short-lived auth token for a driver.
507
-
508
- <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
509
-
510
- To use this endpoint, select **Write Driver Auth Token** under the Closed Beta 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>
511
-
512
- Endpoints in this section are in Preview. These APIs are not functional and are instead for soliciting feedback from our API users on the intended design of this API. Additionally, it is not guaranteed that we will be releasing an endpoint included in this section to production. This means that developers should **NOT** rely on these APIs to build business critical applications
513
-
514
- - Samsara may change the structure of a preview API's interface without versioning or any notice to API users.
515
-
516
- - When an endpoint becomes generally available, it will be announced in the API [changelog](https://developers.samsara.com/changelog).
517
-
518
-
519
- **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.
520
-
521
- Parameters
522
- ----------
523
- code : str
524
- Required. Random 12+ character string, used with the auth token to help secure the client from intercepted tokens.
525
-
526
- external_id : typing.Optional[str]
527
- Optional. External ID of the driver, in the format `key:value` (e.g., `payrollId:ABFS18600`). One of `id`, `externalId`, or `username` is required.
528
-
529
- id : typing.Optional[int]
530
- Optional. Samsara ID of the driver. One of `id`, `externalId`, or `username` is required.
531
-
532
- username : typing.Optional[str]
533
- Optional. Username of the driver. This is the login identifier configured when the driver is created. One of `id`, `externalId`, or `username` is required.
534
-
535
- request_options : typing.Optional[RequestOptions]
536
- Request-specific configuration.
537
-
538
- Returns
539
- -------
540
- AsyncHttpResponse[DriversAuthTokenCreateDriverAuthTokenResponseBody]
541
- OK response.
542
- """
543
- _response = await self._client_wrapper.httpx_client.request(
544
- "preview/fleet/drivers/create-auth-token",
545
- method="POST",
546
- json={
547
- "code": code,
548
- "externalId": external_id,
549
- "id": id,
550
- "username": username,
551
- },
552
- headers={
553
- "content-type": "application/json",
554
- },
555
- request_options=request_options,
556
- omit=OMIT,
557
- )
558
- try:
559
- if 200 <= _response.status_code < 300:
560
- _data = typing.cast(
561
- DriversAuthTokenCreateDriverAuthTokenResponseBody,
562
- parse_obj_as(
563
- type_=DriversAuthTokenCreateDriverAuthTokenResponseBody, # type: ignore
564
- object_=_response.json(),
565
- ),
566
- )
567
- return AsyncHttpResponse(response=_response, data=_data)
568
- if _response.status_code == 401:
569
- raise UnauthorizedError(
570
- headers=dict(_response.headers),
571
- body=typing.cast(
572
- typing.Optional[typing.Any],
573
- parse_obj_as(
574
- type_=typing.Optional[typing.Any], # type: ignore
575
- object_=_response.json(),
576
- ),
577
- ),
578
- )
579
- if _response.status_code == 404:
580
- raise NotFoundError(
581
- headers=dict(_response.headers),
582
- body=typing.cast(
583
- typing.Optional[typing.Any],
584
- parse_obj_as(
585
- type_=typing.Optional[typing.Any], # type: ignore
586
- object_=_response.json(),
587
- ),
588
- ),
589
- )
590
- if _response.status_code == 405:
591
- raise MethodNotAllowedError(
592
- headers=dict(_response.headers),
593
- body=typing.cast(
594
- typing.Optional[typing.Any],
595
- parse_obj_as(
596
- type_=typing.Optional[typing.Any], # type: ignore
597
- object_=_response.json(),
598
- ),
599
- ),
600
- )
601
- if _response.status_code == 429:
602
- raise TooManyRequestsError(
603
- headers=dict(_response.headers),
604
- body=typing.cast(
605
- typing.Optional[typing.Any],
606
- parse_obj_as(
607
- type_=typing.Optional[typing.Any], # type: ignore
608
- object_=_response.json(),
609
- ),
610
- ),
611
- )
612
- if _response.status_code == 500:
613
- raise InternalServerError(
614
- headers=dict(_response.headers),
615
- body=typing.cast(
616
- typing.Optional[typing.Any],
617
- parse_obj_as(
618
- type_=typing.Optional[typing.Any], # type: ignore
619
- object_=_response.json(),
620
- ),
621
- ),
622
- )
623
- if _response.status_code == 501:
624
- raise NotImplementedError(
625
- headers=dict(_response.headers),
626
- body=typing.cast(
627
- typing.Optional[typing.Any],
628
- parse_obj_as(
629
- type_=typing.Optional[typing.Any], # type: ignore
630
- object_=_response.json(),
631
- ),
632
- ),
633
- )
634
- if _response.status_code == 502:
635
- raise BadGatewayError(
636
- headers=dict(_response.headers),
637
- body=typing.cast(
638
- typing.Optional[typing.Any],
639
- parse_obj_as(
640
- type_=typing.Optional[typing.Any], # type: ignore
641
- object_=_response.json(),
642
- ),
643
- ),
644
- )
645
- if _response.status_code == 503:
646
- raise ServiceUnavailableError(
647
- headers=dict(_response.headers),
648
- body=typing.cast(
649
- typing.Optional[typing.Any],
650
- parse_obj_as(
651
- type_=typing.Optional[typing.Any], # type: ignore
652
- object_=_response.json(),
653
- ),
654
- ),
655
- )
656
- if _response.status_code == 504:
657
- raise GatewayTimeoutError(
658
- headers=dict(_response.headers),
659
- body=typing.cast(
660
- typing.Optional[typing.Any],
661
- parse_obj_as(
662
- type_=typing.Optional[typing.Any], # type: ignore
663
- object_=_response.json(),
664
- ),
665
- ),
666
- )
667
- _response_json = _response.json()
668
- except JSONDecodeError:
669
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
670
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
671
-
672
314
  async def lock_vehicle(
673
315
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
674
316
  ) -> AsyncHttpResponse[None]:
@@ -712,9 +354,9 @@ class AsyncRawPreviewApIsClient:
712
354
  raise UnauthorizedError(
713
355
  headers=dict(_response.headers),
714
356
  body=typing.cast(
715
- typing.Optional[typing.Any],
357
+ typing.Any,
716
358
  parse_obj_as(
717
- type_=typing.Optional[typing.Any], # type: ignore
359
+ type_=typing.Any, # type: ignore
718
360
  object_=_response.json(),
719
361
  ),
720
362
  ),
@@ -723,9 +365,9 @@ class AsyncRawPreviewApIsClient:
723
365
  raise NotFoundError(
724
366
  headers=dict(_response.headers),
725
367
  body=typing.cast(
726
- typing.Optional[typing.Any],
368
+ typing.Any,
727
369
  parse_obj_as(
728
- type_=typing.Optional[typing.Any], # type: ignore
370
+ type_=typing.Any, # type: ignore
729
371
  object_=_response.json(),
730
372
  ),
731
373
  ),
@@ -734,9 +376,9 @@ class AsyncRawPreviewApIsClient:
734
376
  raise MethodNotAllowedError(
735
377
  headers=dict(_response.headers),
736
378
  body=typing.cast(
737
- typing.Optional[typing.Any],
379
+ typing.Any,
738
380
  parse_obj_as(
739
- type_=typing.Optional[typing.Any], # type: ignore
381
+ type_=typing.Any, # type: ignore
740
382
  object_=_response.json(),
741
383
  ),
742
384
  ),
@@ -745,9 +387,9 @@ class AsyncRawPreviewApIsClient:
745
387
  raise TooManyRequestsError(
746
388
  headers=dict(_response.headers),
747
389
  body=typing.cast(
748
- typing.Optional[typing.Any],
390
+ typing.Any,
749
391
  parse_obj_as(
750
- type_=typing.Optional[typing.Any], # type: ignore
392
+ type_=typing.Any, # type: ignore
751
393
  object_=_response.json(),
752
394
  ),
753
395
  ),
@@ -756,9 +398,9 @@ class AsyncRawPreviewApIsClient:
756
398
  raise InternalServerError(
757
399
  headers=dict(_response.headers),
758
400
  body=typing.cast(
759
- typing.Optional[typing.Any],
401
+ typing.Any,
760
402
  parse_obj_as(
761
- type_=typing.Optional[typing.Any], # type: ignore
403
+ type_=typing.Any, # type: ignore
762
404
  object_=_response.json(),
763
405
  ),
764
406
  ),
@@ -767,9 +409,9 @@ class AsyncRawPreviewApIsClient:
767
409
  raise NotImplementedError(
768
410
  headers=dict(_response.headers),
769
411
  body=typing.cast(
770
- typing.Optional[typing.Any],
412
+ typing.Any,
771
413
  parse_obj_as(
772
- type_=typing.Optional[typing.Any], # type: ignore
414
+ type_=typing.Any, # type: ignore
773
415
  object_=_response.json(),
774
416
  ),
775
417
  ),
@@ -778,9 +420,9 @@ class AsyncRawPreviewApIsClient:
778
420
  raise BadGatewayError(
779
421
  headers=dict(_response.headers),
780
422
  body=typing.cast(
781
- typing.Optional[typing.Any],
423
+ typing.Any,
782
424
  parse_obj_as(
783
- type_=typing.Optional[typing.Any], # type: ignore
425
+ type_=typing.Any, # type: ignore
784
426
  object_=_response.json(),
785
427
  ),
786
428
  ),
@@ -789,9 +431,9 @@ class AsyncRawPreviewApIsClient:
789
431
  raise ServiceUnavailableError(
790
432
  headers=dict(_response.headers),
791
433
  body=typing.cast(
792
- typing.Optional[typing.Any],
434
+ typing.Any,
793
435
  parse_obj_as(
794
- type_=typing.Optional[typing.Any], # type: ignore
436
+ type_=typing.Any, # type: ignore
795
437
  object_=_response.json(),
796
438
  ),
797
439
  ),
@@ -800,9 +442,9 @@ class AsyncRawPreviewApIsClient:
800
442
  raise GatewayTimeoutError(
801
443
  headers=dict(_response.headers),
802
444
  body=typing.cast(
803
- typing.Optional[typing.Any],
445
+ typing.Any,
804
446
  parse_obj_as(
805
- type_=typing.Optional[typing.Any], # type: ignore
447
+ type_=typing.Any, # type: ignore
806
448
  object_=_response.json(),
807
449
  ),
808
450
  ),
@@ -855,9 +497,9 @@ class AsyncRawPreviewApIsClient:
855
497
  raise UnauthorizedError(
856
498
  headers=dict(_response.headers),
857
499
  body=typing.cast(
858
- typing.Optional[typing.Any],
500
+ typing.Any,
859
501
  parse_obj_as(
860
- type_=typing.Optional[typing.Any], # type: ignore
502
+ type_=typing.Any, # type: ignore
861
503
  object_=_response.json(),
862
504
  ),
863
505
  ),
@@ -866,9 +508,9 @@ class AsyncRawPreviewApIsClient:
866
508
  raise NotFoundError(
867
509
  headers=dict(_response.headers),
868
510
  body=typing.cast(
869
- typing.Optional[typing.Any],
511
+ typing.Any,
870
512
  parse_obj_as(
871
- type_=typing.Optional[typing.Any], # type: ignore
513
+ type_=typing.Any, # type: ignore
872
514
  object_=_response.json(),
873
515
  ),
874
516
  ),
@@ -877,9 +519,9 @@ class AsyncRawPreviewApIsClient:
877
519
  raise MethodNotAllowedError(
878
520
  headers=dict(_response.headers),
879
521
  body=typing.cast(
880
- typing.Optional[typing.Any],
522
+ typing.Any,
881
523
  parse_obj_as(
882
- type_=typing.Optional[typing.Any], # type: ignore
524
+ type_=typing.Any, # type: ignore
883
525
  object_=_response.json(),
884
526
  ),
885
527
  ),
@@ -888,9 +530,9 @@ class AsyncRawPreviewApIsClient:
888
530
  raise TooManyRequestsError(
889
531
  headers=dict(_response.headers),
890
532
  body=typing.cast(
891
- typing.Optional[typing.Any],
533
+ typing.Any,
892
534
  parse_obj_as(
893
- type_=typing.Optional[typing.Any], # type: ignore
535
+ type_=typing.Any, # type: ignore
894
536
  object_=_response.json(),
895
537
  ),
896
538
  ),
@@ -899,9 +541,9 @@ class AsyncRawPreviewApIsClient:
899
541
  raise InternalServerError(
900
542
  headers=dict(_response.headers),
901
543
  body=typing.cast(
902
- typing.Optional[typing.Any],
544
+ typing.Any,
903
545
  parse_obj_as(
904
- type_=typing.Optional[typing.Any], # type: ignore
546
+ type_=typing.Any, # type: ignore
905
547
  object_=_response.json(),
906
548
  ),
907
549
  ),
@@ -910,9 +552,9 @@ class AsyncRawPreviewApIsClient:
910
552
  raise NotImplementedError(
911
553
  headers=dict(_response.headers),
912
554
  body=typing.cast(
913
- typing.Optional[typing.Any],
555
+ typing.Any,
914
556
  parse_obj_as(
915
- type_=typing.Optional[typing.Any], # type: ignore
557
+ type_=typing.Any, # type: ignore
916
558
  object_=_response.json(),
917
559
  ),
918
560
  ),
@@ -921,9 +563,9 @@ class AsyncRawPreviewApIsClient:
921
563
  raise BadGatewayError(
922
564
  headers=dict(_response.headers),
923
565
  body=typing.cast(
924
- typing.Optional[typing.Any],
566
+ typing.Any,
925
567
  parse_obj_as(
926
- type_=typing.Optional[typing.Any], # type: ignore
568
+ type_=typing.Any, # type: ignore
927
569
  object_=_response.json(),
928
570
  ),
929
571
  ),
@@ -932,9 +574,9 @@ class AsyncRawPreviewApIsClient:
932
574
  raise ServiceUnavailableError(
933
575
  headers=dict(_response.headers),
934
576
  body=typing.cast(
935
- typing.Optional[typing.Any],
577
+ typing.Any,
936
578
  parse_obj_as(
937
- type_=typing.Optional[typing.Any], # type: ignore
579
+ type_=typing.Any, # type: ignore
938
580
  object_=_response.json(),
939
581
  ),
940
582
  ),
@@ -943,9 +585,9 @@ class AsyncRawPreviewApIsClient:
943
585
  raise GatewayTimeoutError(
944
586
  headers=dict(_response.headers),
945
587
  body=typing.cast(
946
- typing.Optional[typing.Any],
588
+ typing.Any,
947
589
  parse_obj_as(
948
- type_=typing.Optional[typing.Any], # type: ignore
590
+ type_=typing.Any, # type: ignore
949
591
  object_=_response.json(),
950
592
  ),
951
593
  ),