samsara-api 4.1.1__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 (166) hide show
  1. samsara/__init__.py +84 -15
  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 +139 -189
  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 +10 -16
  67. samsara/idling/raw_client.py +46 -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 +2 -16
  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 +71 -6
  109. samsara/types/advanced_idling_get_idling_events_response_body.py +2 -2
  110. samsara/types/create_routes_stop_request_object_request_body.py +7 -0
  111. samsara/types/driver_assignment_object_response_body.py +2 -1
  112. samsara/types/driver_assignment_object_response_body_assignment_type.py +5 -0
  113. samsara/types/driver_external_ids.py +1 -1
  114. samsara/types/forms_approval_config_object_response_body.py +2 -1
  115. samsara/types/forms_approval_config_object_response_body_type.py +5 -0
  116. samsara/types/fuel_level_trigger_details_object_request_body.py +2 -1
  117. samsara/types/fuel_level_trigger_details_object_request_body_operation.py +5 -0
  118. samsara/types/fuel_level_trigger_details_object_response_body.py +4 -1
  119. samsara/types/fuel_level_trigger_details_object_response_body_operation.py +5 -0
  120. samsara/types/harsh_event_trigger_details_object_request_body_types_item.py +1 -0
  121. samsara/types/harsh_event_trigger_details_object_response_body_types_item.py +1 -0
  122. samsara/types/idling_event_address_object_response_body.py +46 -0
  123. samsara/types/{idling_event_object_response_body_address_type.py → idling_event_address_object_response_body_address_types_item.py} +1 -1
  124. samsara/types/idling_event_asset_object_response_body.py +35 -0
  125. samsara/types/{idling_event_object_response_body.py → idling_event_object_v_20251023_response_body.py} +18 -28
  126. samsara/types/idling_event_object_v_20251023_response_body_pto_state.py +5 -0
  127. samsara/types/idling_event_operator_object_response_body.py +35 -0
  128. samsara/types/patch_issue_request_body_assigned_to_request_body.py +2 -1
  129. samsara/types/patch_issue_request_body_assigned_to_request_body_type.py +5 -0
  130. samsara/types/reading_datapoint_request_body.py +5 -4
  131. samsara/types/reading_datapoint_request_body_entity_type.py +5 -0
  132. samsara/types/reading_history_response_body.py +1 -1
  133. samsara/types/reading_snapshot_response_body.py +1 -1
  134. samsara/types/resolved_by.py +2 -1
  135. samsara/types/resolved_by_type.py +5 -0
  136. samsara/types/route_feed_object_response_body.py +2 -1
  137. samsara/types/route_feed_object_response_body_type.py +5 -0
  138. samsara/types/route_settings_request_body.py +8 -0
  139. samsara/types/route_settings_request_body_sequencing_method.py +7 -0
  140. samsara/types/route_settings_response_body.py +8 -0
  141. samsara/types/route_settings_response_body_sequencing_method.py +7 -0
  142. samsara/types/route_stop_details_object_response_body.py +2 -1
  143. samsara/types/route_stop_details_object_response_body_type.py +5 -0
  144. samsara/types/routes_stop_response_object_response_body.py +7 -0
  145. samsara/types/training_learner_object_response_body.py +2 -1
  146. samsara/types/training_learner_object_response_body_type.py +5 -0
  147. samsara/types/update_routes_stop_request_object_request_body.py +7 -0
  148. samsara/types/vehicle_assignment_object_response_body.py +4 -3
  149. samsara/types/vehicle_assignment_object_response_body_assignment_type.py +5 -0
  150. samsara/types/vehicle_external_ids.py +1 -1
  151. samsara/types/work_order_money_object_request_body.py +2 -1
  152. samsara/types/work_order_money_object_request_body_currency.py +5 -0
  153. samsara/types/work_order_money_object_response_body.py +2 -1
  154. samsara/types/work_order_money_object_response_body_currency.py +5 -0
  155. samsara/users/client.py +4 -16
  156. samsara/vehicle_locations/client.py +4 -16
  157. samsara/vehicles/client.py +7 -22
  158. samsara/vehicles/raw_client.py +43 -47
  159. samsara/webhooks/client.py +2 -10
  160. samsara/webhooks/raw_client.py +180 -180
  161. samsara/work_orders/client.py +4 -18
  162. samsara/work_orders/raw_client.py +216 -216
  163. {samsara_api-4.1.1.dist-info → samsara_api-4.3.0.dist-info}/METADATA +2 -1
  164. {samsara_api-4.1.1.dist-info → samsara_api-4.3.0.dist-info}/RECORD +166 -136
  165. {samsara_api-4.1.1.dist-info → samsara_api-4.3.0.dist-info}/LICENSE +0 -0
  166. {samsara_api-4.1.1.dist-info → samsara_api-4.3.0.dist-info}/WHEEL +0 -0
@@ -9,16 +9,16 @@ if typing.TYPE_CHECKING:
9
9
  from .types import (
10
10
  AssetsCreateAssetRequestBodyRegulationMode,
11
11
  AssetsCreateAssetRequestBodyType,
12
- AssetsListRequestType,
13
12
  AssetsUpdateAssetRequestBodyRegulationMode,
14
13
  AssetsUpdateAssetRequestBodyType,
14
+ ListAssetsRequestType,
15
15
  )
16
16
  _dynamic_imports: typing.Dict[str, str] = {
17
17
  "AssetsCreateAssetRequestBodyRegulationMode": ".types",
18
18
  "AssetsCreateAssetRequestBodyType": ".types",
19
- "AssetsListRequestType": ".types",
20
19
  "AssetsUpdateAssetRequestBodyRegulationMode": ".types",
21
20
  "AssetsUpdateAssetRequestBodyType": ".types",
21
+ "ListAssetsRequestType": ".types",
22
22
  }
23
23
 
24
24
 
@@ -46,7 +46,7 @@ def __dir__():
46
46
  __all__ = [
47
47
  "AssetsCreateAssetRequestBodyRegulationMode",
48
48
  "AssetsCreateAssetRequestBodyType",
49
- "AssetsListRequestType",
50
49
  "AssetsUpdateAssetRequestBodyRegulationMode",
51
50
  "AssetsUpdateAssetRequestBodyType",
51
+ "ListAssetsRequestType",
52
52
  ]
samsara/assets/client.py CHANGED
@@ -7,6 +7,7 @@ from ..core.pagination import AsyncPager, SyncPager
7
7
  from ..core.request_options import RequestOptions
8
8
  from ..types.asset_response_body import AssetResponseBody
9
9
  from ..types.assets_create_asset_response_body import AssetsCreateAssetResponseBody
10
+ from ..types.assets_list_assets_response_body import AssetsListAssetsResponseBody
10
11
  from ..types.assets_update_asset_response_body import AssetsUpdateAssetResponseBody
11
12
  from ..types.inline_response_2002 import InlineResponse2002
12
13
  from ..types.inline_response_2003 import InlineResponse2003
@@ -15,9 +16,9 @@ from ..types.v_1_asset_reefer_response import V1AssetReeferResponse
15
16
  from .raw_client import AsyncRawAssetsClient, RawAssetsClient
16
17
  from .types.assets_create_asset_request_body_regulation_mode import AssetsCreateAssetRequestBodyRegulationMode
17
18
  from .types.assets_create_asset_request_body_type import AssetsCreateAssetRequestBodyType
18
- from .types.assets_list_request_type import AssetsListRequestType
19
19
  from .types.assets_update_asset_request_body_regulation_mode import AssetsUpdateAssetRequestBodyRegulationMode
20
20
  from .types.assets_update_asset_request_body_type import AssetsUpdateAssetRequestBodyType
21
+ from .types.list_assets_request_type import ListAssetsRequestType
21
22
 
22
23
  # this is used as the default value for optional parameters
23
24
  OMIT = typing.cast(typing.Any, ...)
@@ -41,7 +42,7 @@ class AssetsClient:
41
42
  def list(
42
43
  self,
43
44
  *,
44
- type: typing.Optional[AssetsListRequestType] = None,
45
+ type: typing.Optional[ListAssetsRequestType] = None,
45
46
  after: typing.Optional[str] = None,
46
47
  updated_after_time: typing.Optional[str] = None,
47
48
  include_external_ids: typing.Optional[bool] = None,
@@ -52,7 +53,7 @@ class AssetsClient:
52
53
  attribute_value_ids: typing.Optional[str] = None,
53
54
  attributes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
54
55
  request_options: typing.Optional[RequestOptions] = None,
55
- ) -> SyncPager[AssetResponseBody]:
56
+ ) -> SyncPager[AssetResponseBody, AssetsListAssetsResponseBody]:
56
57
  """
57
58
  List all assets. Up to 300 assets will be returned per page.
58
59
 
@@ -65,7 +66,7 @@ class AssetsClient:
65
66
 
66
67
  Parameters
67
68
  ----------
68
- type : typing.Optional[AssetsListRequestType]
69
+ type : typing.Optional[ListAssetsRequestType]
69
70
  The operational context in which the asset interacts with the Samsara system. Examples: Vehicle (eg: truck, bus...), Trailer (eg: dry van, reefer, flatbed...), Powered Equipment (eg: dozer, crane...), Unpowered Equipment (eg: container, dumpster...), or Uncategorized. Valid values: `uncategorized`, `trailer`, `equipment`, `unpowered`, `vehicle`
70
71
 
71
72
  after : typing.Optional[str]
@@ -100,7 +101,7 @@ class AssetsClient:
100
101
 
101
102
  Returns
102
103
  -------
103
- SyncPager[AssetResponseBody]
104
+ SyncPager[AssetResponseBody, AssetsListAssetsResponseBody]
104
105
  OK response.
105
106
 
106
107
  Examples
@@ -110,16 +111,7 @@ class AssetsClient:
110
111
  client = Samsara(
111
112
  token="YOUR_TOKEN",
112
113
  )
113
- response = client.assets.list(
114
- type="uncategorized",
115
- after="after",
116
- updated_after_time="updatedAfterTime",
117
- include_external_ids=True,
118
- include_tags=True,
119
- tag_ids="tagIds",
120
- parent_tag_ids="parentTagIds",
121
- attribute_value_ids="attributeValueIds",
122
- )
114
+ response = client.assets.list()
123
115
  for item in response:
124
116
  yield item
125
117
  # alternatively, you can paginate page-by-page
@@ -430,11 +422,7 @@ class AssetsClient:
430
422
  client = Samsara(
431
423
  token="YOUR_TOKEN",
432
424
  )
433
- client.assets.v_1_get_all_asset_current_locations(
434
- starting_after="startingAfter",
435
- ending_before="endingBefore",
436
- limit=1000000,
437
- )
425
+ client.assets.v_1_get_all_asset_current_locations()
438
426
  """
439
427
  _response = self._raw_client.v_1_get_all_asset_current_locations(
440
428
  starting_after=starting_after, ending_before=ending_before, limit=limit, request_options=request_options
@@ -500,9 +488,6 @@ class AssetsClient:
500
488
  client.assets.v_1_get_assets_reefers(
501
489
  start_ms=1000000,
502
490
  end_ms=1000000,
503
- starting_after="startingAfter",
504
- ending_before="endingBefore",
505
- limit=1000000,
506
491
  )
507
492
  """
508
493
  _response = self._raw_client.v_1_get_assets_reefers(
@@ -696,7 +681,7 @@ class AsyncAssetsClient:
696
681
  async def list(
697
682
  self,
698
683
  *,
699
- type: typing.Optional[AssetsListRequestType] = None,
684
+ type: typing.Optional[ListAssetsRequestType] = None,
700
685
  after: typing.Optional[str] = None,
701
686
  updated_after_time: typing.Optional[str] = None,
702
687
  include_external_ids: typing.Optional[bool] = None,
@@ -707,7 +692,7 @@ class AsyncAssetsClient:
707
692
  attribute_value_ids: typing.Optional[str] = None,
708
693
  attributes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
709
694
  request_options: typing.Optional[RequestOptions] = None,
710
- ) -> AsyncPager[AssetResponseBody]:
695
+ ) -> AsyncPager[AssetResponseBody, AssetsListAssetsResponseBody]:
711
696
  """
712
697
  List all assets. Up to 300 assets will be returned per page.
713
698
 
@@ -720,7 +705,7 @@ class AsyncAssetsClient:
720
705
 
721
706
  Parameters
722
707
  ----------
723
- type : typing.Optional[AssetsListRequestType]
708
+ type : typing.Optional[ListAssetsRequestType]
724
709
  The operational context in which the asset interacts with the Samsara system. Examples: Vehicle (eg: truck, bus...), Trailer (eg: dry van, reefer, flatbed...), Powered Equipment (eg: dozer, crane...), Unpowered Equipment (eg: container, dumpster...), or Uncategorized. Valid values: `uncategorized`, `trailer`, `equipment`, `unpowered`, `vehicle`
725
710
 
726
711
  after : typing.Optional[str]
@@ -755,7 +740,7 @@ class AsyncAssetsClient:
755
740
 
756
741
  Returns
757
742
  -------
758
- AsyncPager[AssetResponseBody]
743
+ AsyncPager[AssetResponseBody, AssetsListAssetsResponseBody]
759
744
  OK response.
760
745
 
761
746
  Examples
@@ -770,16 +755,7 @@ class AsyncAssetsClient:
770
755
 
771
756
 
772
757
  async def main() -> None:
773
- response = await client.assets.list(
774
- type="uncategorized",
775
- after="after",
776
- updated_after_time="updatedAfterTime",
777
- include_external_ids=True,
778
- include_tags=True,
779
- tag_ids="tagIds",
780
- parent_tag_ids="parentTagIds",
781
- attribute_value_ids="attributeValueIds",
782
- )
758
+ response = await client.assets.list()
783
759
  async for item in response:
784
760
  yield item
785
761
 
@@ -1123,11 +1099,7 @@ class AsyncAssetsClient:
1123
1099
 
1124
1100
 
1125
1101
  async def main() -> None:
1126
- await client.assets.v_1_get_all_asset_current_locations(
1127
- starting_after="startingAfter",
1128
- ending_before="endingBefore",
1129
- limit=1000000,
1130
- )
1102
+ await client.assets.v_1_get_all_asset_current_locations()
1131
1103
 
1132
1104
 
1133
1105
  asyncio.run(main())
@@ -1201,9 +1173,6 @@ class AsyncAssetsClient:
1201
1173
  await client.assets.v_1_get_assets_reefers(
1202
1174
  start_ms=1000000,
1203
1175
  end_ms=1000000,
1204
- starting_after="startingAfter",
1205
- ending_before="endingBefore",
1206
- limit=1000000,
1207
1176
  )
1208
1177
 
1209
1178