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
@@ -73,11 +73,7 @@ class CarrierProposedAssignmentsClient:
73
73
  client = Samsara(
74
74
  token="YOUR_TOKEN",
75
75
  )
76
- client.carrier_proposed_assignments.list_carrier_proposed_assignments(
77
- limit=1000000,
78
- after="after",
79
- active_time="activeTime",
80
- )
76
+ client.carrier_proposed_assignments.list_carrier_proposed_assignments()
81
77
  """
82
78
  _response = self._raw_client.list_carrier_proposed_assignments(
83
79
  limit=limit, after=after, driver_ids=driver_ids, active_time=active_time, request_options=request_options
@@ -256,11 +252,7 @@ class AsyncCarrierProposedAssignmentsClient:
256
252
 
257
253
 
258
254
  async def main() -> None:
259
- await client.carrier_proposed_assignments.list_carrier_proposed_assignments(
260
- limit=1000000,
261
- after="after",
262
- active_time="activeTime",
263
- )
255
+ await client.carrier_proposed_assignments.list_carrier_proposed_assignments()
264
256
 
265
257
 
266
258
  asyncio.run(main())
samsara/client.py CHANGED
@@ -6,6 +6,7 @@ import os
6
6
  import typing
7
7
 
8
8
  import httpx
9
+ from .core.api_error import ApiError
9
10
  from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10
11
  from .environment import SamsaraEnvironment
11
12
 
@@ -119,6 +120,8 @@ class Samsara:
119
120
  _defaulted_timeout = (
120
121
  timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
121
122
  )
123
+ if token is None:
124
+ raise ApiError(body="The client must be instantiated be either passing in token or setting SAMSARA_API_KEY")
122
125
  self._client_wrapper = SyncClientWrapper(
123
126
  base_url=_get_base_url(base_url=base_url, environment=environment),
124
127
  token=token,
@@ -636,6 +639,8 @@ class AsyncSamsara:
636
639
  _defaulted_timeout = (
637
640
  timeout if timeout is not None else 60 if httpx_client is None else httpx_client.timeout.read
638
641
  )
642
+ if token is None:
643
+ raise ApiError(body="The client must be instantiated be either passing in token or setting SAMSARA_API_KEY")
639
644
  self._client_wrapper = AsyncClientWrapper(
640
645
  base_url=_get_base_url(base_url=base_url, environment=environment),
641
646
  token=token,
@@ -80,10 +80,7 @@ class CoachingClient:
80
80
  client = Samsara(
81
81
  token="YOUR_TOKEN",
82
82
  )
83
- client.coaching.get_driver_coach_assignment(
84
- include_external_ids=True,
85
- after="after",
86
- )
83
+ client.coaching.get_driver_coach_assignment()
87
84
  """
88
85
  _response = self._raw_client.get_driver_coach_assignment(
89
86
  driver_ids=driver_ids,
@@ -136,7 +133,6 @@ class CoachingClient:
136
133
  )
137
134
  client.coaching.put_driver_coach_assignment(
138
135
  driver_id="driverId",
139
- coach_id="coachId",
140
136
  )
141
137
  """
142
138
  _response = self._raw_client.put_driver_coach_assignment(
@@ -211,15 +207,9 @@ class CoachingClient:
211
207
  token="YOUR_TOKEN",
212
208
  )
213
209
  client.coaching.get_coaching_sessions(
214
- include_coachable_events=True,
215
210
  start_time=datetime.datetime.fromisoformat(
216
211
  "2024-01-15 09:30:00+00:00",
217
212
  ),
218
- end_time=datetime.datetime.fromisoformat(
219
- "2024-01-15 09:30:00+00:00",
220
- ),
221
- after="after",
222
- include_external_ids=True,
223
213
  )
224
214
  """
225
215
  _response = self._raw_client.get_coaching_sessions(
@@ -304,10 +294,7 @@ class AsyncCoachingClient:
304
294
 
305
295
 
306
296
  async def main() -> None:
307
- await client.coaching.get_driver_coach_assignment(
308
- include_external_ids=True,
309
- after="after",
310
- )
297
+ await client.coaching.get_driver_coach_assignment()
311
298
 
312
299
 
313
300
  asyncio.run(main())
@@ -368,7 +355,6 @@ class AsyncCoachingClient:
368
355
  async def main() -> None:
369
356
  await client.coaching.put_driver_coach_assignment(
370
357
  driver_id="driverId",
371
- coach_id="coachId",
372
358
  )
373
359
 
374
360
 
@@ -450,15 +436,9 @@ class AsyncCoachingClient:
450
436
 
451
437
  async def main() -> None:
452
438
  await client.coaching.get_coaching_sessions(
453
- include_coachable_events=True,
454
439
  start_time=datetime.datetime.fromisoformat(
455
440
  "2024-01-15 09:30:00+00:00",
456
441
  ),
457
- end_time=datetime.datetime.fromisoformat(
458
- "2024-01-15 09:30:00+00:00",
459
- ),
460
- after="after",
461
- include_external_ids=True,
462
442
  )
463
443
 
464
444