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.
- samsara/__init__.py +69 -9
- samsara/addresses/client.py +7 -14
- samsara/addresses/raw_client.py +7 -11
- samsara/alerts/client.py +2 -10
- samsara/alerts/raw_client.py +180 -180
- samsara/assets/__init__.py +3 -3
- samsara/assets/client.py +14 -45
- samsara/assets/raw_client.py +156 -160
- samsara/assets/types/__init__.py +3 -3
- samsara/assets/types/{assets_list_request_type.py → list_assets_request_type.py} +1 -1
- samsara/attributes/client.py +0 -4
- samsara/beta_ap_is/client.py +137 -187
- samsara/beta_ap_is/raw_client.py +2035 -1702
- samsara/carrier_proposed_assignments/client.py +2 -10
- samsara/client.py +5 -0
- samsara/coaching/client.py +2 -22
- samsara/coaching/raw_client.py +108 -108
- samsara/contacts/client.py +2 -8
- samsara/core/__init__.py +5 -0
- samsara/core/client_wrapper.py +18 -10
- samsara/core/custom_pagination.py +152 -0
- samsara/core/http_client.py +176 -90
- samsara/core/http_sse/__init__.py +42 -0
- samsara/core/http_sse/_api.py +112 -0
- samsara/core/http_sse/_decoders.py +61 -0
- samsara/core/http_sse/_exceptions.py +7 -0
- samsara/core/http_sse/_models.py +17 -0
- samsara/core/pagination.py +14 -14
- samsara/core/pydantic_utilities.py +3 -1
- samsara/documents/client.py +2 -12
- samsara/documents/raw_client.py +180 -180
- samsara/driver_qr_codes/raw_client.py +108 -108
- samsara/driver_vehicle_assignments/client.py +0 -12
- samsara/driver_vehicle_assignments/raw_client.py +144 -144
- samsara/drivers/__init__.py +3 -3
- samsara/drivers/client.py +12 -23
- samsara/drivers/raw_client.py +48 -52
- samsara/drivers/types/__init__.py +3 -3
- samsara/drivers/types/{drivers_list_request_driver_activation_status.py → list_drivers_request_driver_activation_status.py} +1 -1
- samsara/equipment/client.py +6 -22
- samsara/errors/bad_gateway_error.py +1 -1
- samsara/errors/gateway_timeout_error.py +1 -1
- samsara/errors/internal_server_error.py +1 -1
- samsara/errors/method_not_allowed_error.py +1 -1
- samsara/errors/not_found_error.py +1 -1
- samsara/errors/not_implemented_error.py +1 -1
- samsara/errors/service_unavailable_error.py +1 -1
- samsara/errors/too_many_requests_error.py +1 -1
- samsara/errors/unauthorized_error.py +1 -1
- samsara/forms/__init__.py +9 -3
- samsara/forms/client.py +17 -10
- samsara/forms/raw_client.py +265 -254
- samsara/forms/types/__init__.py +6 -2
- samsara/forms/types/form_submissions_post_form_submission_request_body_status.py +5 -0
- samsara/fuel_and_energy/client.py +0 -30
- samsara/fuel_and_energy/raw_client.py +180 -180
- samsara/gateways/client.py +2 -6
- samsara/gateways/raw_client.py +108 -108
- samsara/hours_of_service/__init__.py +6 -3
- samsara/hours_of_service/client.py +13 -52
- samsara/hours_of_service/raw_client.py +77 -76
- samsara/hours_of_service/types/__init__.py +4 -2
- samsara/hours_of_service/types/get_hos_daily_logs_request_expand.py +5 -0
- samsara/hubs/client.py +2 -94
- samsara/hubs/raw_client.py +216 -216
- samsara/idling/client.py +0 -18
- samsara/idling/raw_client.py +36 -36
- samsara/ifta/client.py +4 -34
- samsara/ifta/raw_client.py +144 -144
- samsara/industrial/client.py +12 -56
- samsara/industrial/raw_client.py +40 -48
- samsara/issues/client.py +0 -4
- samsara/issues/raw_client.py +108 -108
- samsara/legacy_ap_is/client.py +4 -56
- samsara/legacy_ap_is/raw_client.py +108 -108
- samsara/live_sharing_links/client.py +2 -10
- samsara/live_sharing_links/raw_client.py +144 -144
- samsara/location_and_speed/client.py +2 -20
- samsara/location_and_speed/raw_client.py +36 -36
- samsara/maintenance/__init__.py +3 -3
- samsara/maintenance/client.py +15 -30
- samsara/maintenance/raw_client.py +191 -182
- samsara/maintenance/types/__init__.py +6 -2
- samsara/maintenance/types/create_dvir_request_type.py +5 -0
- samsara/media/client.py +0 -4
- samsara/media/raw_client.py +108 -108
- samsara/messages/client.py +2 -8
- samsara/plans/client.py +0 -21
- samsara/plans/raw_client.py +72 -72
- samsara/preview_ap_is/client.py +0 -140
- samsara/preview_ap_is/raw_client.py +72 -430
- samsara/route_events/client.py +2 -12
- samsara/route_events/raw_client.py +36 -36
- samsara/routes/__init__.py +30 -0
- samsara/routes/client.py +7 -35
- samsara/routes/raw_client.py +257 -256
- samsara/routes/types/__init__.py +34 -0
- samsara/routes/types/get_routes_feed_request_expand.py +5 -0
- samsara/safety/client.py +2 -10
- samsara/safety/raw_client.py +36 -36
- samsara/settings/raw_client.py +180 -180
- samsara/speeding_intervals/raw_client.py +36 -36
- samsara/tachograph_eu_only/client.py +0 -6
- samsara/tags/client.py +2 -8
- samsara/trailer_assignments/client.py +2 -18
- samsara/trailers/client.py +2 -12
- samsara/trailers/raw_client.py +180 -180
- samsara/types/__init__.py +54 -0
- samsara/types/create_routes_stop_request_object_request_body.py +7 -0
- samsara/types/driver_assignment_object_response_body.py +2 -1
- samsara/types/driver_assignment_object_response_body_assignment_type.py +5 -0
- samsara/types/driver_external_ids.py +1 -1
- samsara/types/forms_approval_config_object_response_body.py +2 -1
- samsara/types/forms_approval_config_object_response_body_type.py +5 -0
- samsara/types/fuel_level_trigger_details_object_request_body.py +2 -1
- samsara/types/fuel_level_trigger_details_object_request_body_operation.py +5 -0
- samsara/types/fuel_level_trigger_details_object_response_body.py +4 -1
- samsara/types/fuel_level_trigger_details_object_response_body_operation.py +5 -0
- samsara/types/idling_event_object_v_20251023_response_body.py +4 -3
- samsara/types/idling_event_object_v_20251023_response_body_pto_state.py +5 -0
- samsara/types/patch_issue_request_body_assigned_to_request_body.py +2 -1
- samsara/types/patch_issue_request_body_assigned_to_request_body_type.py +5 -0
- samsara/types/reading_datapoint_request_body.py +5 -4
- samsara/types/reading_datapoint_request_body_entity_type.py +5 -0
- samsara/types/reading_history_response_body.py +1 -1
- samsara/types/reading_snapshot_response_body.py +1 -1
- samsara/types/resolved_by.py +2 -1
- samsara/types/resolved_by_type.py +5 -0
- samsara/types/route_feed_object_response_body.py +2 -1
- samsara/types/route_feed_object_response_body_type.py +5 -0
- samsara/types/route_settings_request_body.py +8 -0
- samsara/types/route_settings_request_body_sequencing_method.py +7 -0
- samsara/types/route_settings_response_body.py +8 -0
- samsara/types/route_settings_response_body_sequencing_method.py +7 -0
- samsara/types/route_stop_details_object_response_body.py +2 -1
- samsara/types/route_stop_details_object_response_body_type.py +5 -0
- samsara/types/routes_stop_response_object_response_body.py +7 -0
- samsara/types/training_learner_object_response_body.py +2 -1
- samsara/types/training_learner_object_response_body_type.py +5 -0
- samsara/types/update_routes_stop_request_object_request_body.py +7 -0
- samsara/types/vehicle_assignment_object_response_body.py +4 -3
- samsara/types/vehicle_assignment_object_response_body_assignment_type.py +5 -0
- samsara/types/vehicle_external_ids.py +1 -1
- samsara/types/work_order_money_object_request_body.py +2 -1
- samsara/types/work_order_money_object_request_body_currency.py +5 -0
- samsara/types/work_order_money_object_response_body.py +2 -1
- samsara/types/work_order_money_object_response_body_currency.py +5 -0
- samsara/users/client.py +4 -16
- samsara/vehicle_locations/client.py +4 -16
- samsara/vehicles/client.py +7 -22
- samsara/vehicles/raw_client.py +43 -47
- samsara/webhooks/client.py +2 -10
- samsara/webhooks/raw_client.py +180 -180
- samsara/work_orders/client.py +4 -18
- samsara/work_orders/raw_client.py +216 -216
- {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/METADATA +2 -1
- {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/RECORD +159 -132
- {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/LICENSE +0 -0
- {samsara_api-4.2.0.dist-info → samsara_api-4.3.0.dist-info}/WHEEL +0 -0
samsara/drivers/__init__.py
CHANGED
|
@@ -8,13 +8,13 @@ from importlib import import_module
|
|
|
8
8
|
if typing.TYPE_CHECKING:
|
|
9
9
|
from .types import (
|
|
10
10
|
CreateDriverRequestLocale,
|
|
11
|
-
|
|
11
|
+
ListDriversRequestDriverActivationStatus,
|
|
12
12
|
UpdateDriverRequestDriverActivationStatus,
|
|
13
13
|
UpdateDriverRequestLocale,
|
|
14
14
|
)
|
|
15
15
|
_dynamic_imports: typing.Dict[str, str] = {
|
|
16
16
|
"CreateDriverRequestLocale": ".types",
|
|
17
|
-
"
|
|
17
|
+
"ListDriversRequestDriverActivationStatus": ".types",
|
|
18
18
|
"UpdateDriverRequestDriverActivationStatus": ".types",
|
|
19
19
|
"UpdateDriverRequestLocale": ".types",
|
|
20
20
|
}
|
|
@@ -43,7 +43,7 @@ def __dir__():
|
|
|
43
43
|
|
|
44
44
|
__all__ = [
|
|
45
45
|
"CreateDriverRequestLocale",
|
|
46
|
-
"
|
|
46
|
+
"ListDriversRequestDriverActivationStatus",
|
|
47
47
|
"UpdateDriverRequestDriverActivationStatus",
|
|
48
48
|
"UpdateDriverRequestLocale",
|
|
49
49
|
]
|
samsara/drivers/client.py
CHANGED
|
@@ -17,11 +17,12 @@ from ..types.driver_remote_signout_post_driver_remote_signout_response_body impo
|
|
|
17
17
|
DriverRemoteSignoutPostDriverRemoteSignoutResponseBody,
|
|
18
18
|
)
|
|
19
19
|
from ..types.driver_response import DriverResponse
|
|
20
|
+
from ..types.list_drivers_response import ListDriversResponse
|
|
20
21
|
from ..types.update_driver_request_hos_setting import UpdateDriverRequestHosSetting
|
|
21
22
|
from ..types.us_driver_ruleset_override import UsDriverRulesetOverride
|
|
22
23
|
from .raw_client import AsyncRawDriversClient, RawDriversClient
|
|
23
24
|
from .types.create_driver_request_locale import CreateDriverRequestLocale
|
|
24
|
-
from .types.
|
|
25
|
+
from .types.list_drivers_request_driver_activation_status import ListDriversRequestDriverActivationStatus
|
|
25
26
|
from .types.update_driver_request_driver_activation_status import UpdateDriverRequestDriverActivationStatus
|
|
26
27
|
from .types.update_driver_request_locale import UpdateDriverRequestLocale
|
|
27
28
|
|
|
@@ -47,7 +48,7 @@ class DriversClient:
|
|
|
47
48
|
def list(
|
|
48
49
|
self,
|
|
49
50
|
*,
|
|
50
|
-
driver_activation_status: typing.Optional[
|
|
51
|
+
driver_activation_status: typing.Optional[ListDriversRequestDriverActivationStatus] = None,
|
|
51
52
|
limit: typing.Optional[int] = None,
|
|
52
53
|
after: typing.Optional[str] = None,
|
|
53
54
|
parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
@@ -57,7 +58,7 @@ class DriversClient:
|
|
|
57
58
|
updated_after_time: typing.Optional[str] = None,
|
|
58
59
|
created_after_time: typing.Optional[str] = None,
|
|
59
60
|
request_options: typing.Optional[RequestOptions] = None,
|
|
60
|
-
) -> SyncPager[Driver]:
|
|
61
|
+
) -> SyncPager[Driver, ListDriversResponse]:
|
|
61
62
|
"""
|
|
62
63
|
Get all drivers in organization.
|
|
63
64
|
|
|
@@ -67,7 +68,7 @@ class DriversClient:
|
|
|
67
68
|
|
|
68
69
|
Parameters
|
|
69
70
|
----------
|
|
70
|
-
driver_activation_status : typing.Optional[
|
|
71
|
+
driver_activation_status : typing.Optional[ListDriversRequestDriverActivationStatus]
|
|
71
72
|
If value is `deactivated`, only drivers that are deactivated will appear in the response. This parameter will default to `active` if not provided (fetching only active drivers).
|
|
72
73
|
|
|
73
74
|
limit : typing.Optional[int]
|
|
@@ -99,7 +100,7 @@ class DriversClient:
|
|
|
99
100
|
|
|
100
101
|
Returns
|
|
101
102
|
-------
|
|
102
|
-
SyncPager[Driver]
|
|
103
|
+
SyncPager[Driver, ListDriversResponse]
|
|
103
104
|
List of all driver objects.
|
|
104
105
|
|
|
105
106
|
Examples
|
|
@@ -109,13 +110,7 @@ class DriversClient:
|
|
|
109
110
|
client = Samsara(
|
|
110
111
|
token="YOUR_TOKEN",
|
|
111
112
|
)
|
|
112
|
-
response = client.drivers.list(
|
|
113
|
-
driver_activation_status="active",
|
|
114
|
-
limit=1000000,
|
|
115
|
-
after="after",
|
|
116
|
-
updated_after_time="updatedAfterTime",
|
|
117
|
-
created_after_time="createdAfterTime",
|
|
118
|
-
)
|
|
113
|
+
response = client.drivers.list()
|
|
119
114
|
for item in response:
|
|
120
115
|
yield item
|
|
121
116
|
# alternatively, you can paginate page-by-page
|
|
@@ -657,7 +652,7 @@ class AsyncDriversClient:
|
|
|
657
652
|
async def list(
|
|
658
653
|
self,
|
|
659
654
|
*,
|
|
660
|
-
driver_activation_status: typing.Optional[
|
|
655
|
+
driver_activation_status: typing.Optional[ListDriversRequestDriverActivationStatus] = None,
|
|
661
656
|
limit: typing.Optional[int] = None,
|
|
662
657
|
after: typing.Optional[str] = None,
|
|
663
658
|
parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
@@ -667,7 +662,7 @@ class AsyncDriversClient:
|
|
|
667
662
|
updated_after_time: typing.Optional[str] = None,
|
|
668
663
|
created_after_time: typing.Optional[str] = None,
|
|
669
664
|
request_options: typing.Optional[RequestOptions] = None,
|
|
670
|
-
) -> AsyncPager[Driver]:
|
|
665
|
+
) -> AsyncPager[Driver, ListDriversResponse]:
|
|
671
666
|
"""
|
|
672
667
|
Get all drivers in organization.
|
|
673
668
|
|
|
@@ -677,7 +672,7 @@ class AsyncDriversClient:
|
|
|
677
672
|
|
|
678
673
|
Parameters
|
|
679
674
|
----------
|
|
680
|
-
driver_activation_status : typing.Optional[
|
|
675
|
+
driver_activation_status : typing.Optional[ListDriversRequestDriverActivationStatus]
|
|
681
676
|
If value is `deactivated`, only drivers that are deactivated will appear in the response. This parameter will default to `active` if not provided (fetching only active drivers).
|
|
682
677
|
|
|
683
678
|
limit : typing.Optional[int]
|
|
@@ -709,7 +704,7 @@ class AsyncDriversClient:
|
|
|
709
704
|
|
|
710
705
|
Returns
|
|
711
706
|
-------
|
|
712
|
-
AsyncPager[Driver]
|
|
707
|
+
AsyncPager[Driver, ListDriversResponse]
|
|
713
708
|
List of all driver objects.
|
|
714
709
|
|
|
715
710
|
Examples
|
|
@@ -724,13 +719,7 @@ class AsyncDriversClient:
|
|
|
724
719
|
|
|
725
720
|
|
|
726
721
|
async def main() -> None:
|
|
727
|
-
response = await client.drivers.list(
|
|
728
|
-
driver_activation_status="active",
|
|
729
|
-
limit=1000000,
|
|
730
|
-
after="after",
|
|
731
|
-
updated_after_time="updatedAfterTime",
|
|
732
|
-
created_after_time="createdAfterTime",
|
|
733
|
-
)
|
|
722
|
+
response = await client.drivers.list()
|
|
734
723
|
async for item in response:
|
|
735
724
|
yield item
|
|
736
725
|
|
samsara/drivers/raw_client.py
CHANGED
|
@@ -7,7 +7,7 @@ from ..core.api_error import ApiError
|
|
|
7
7
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
8
|
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
10
|
-
from ..core.pagination import AsyncPager,
|
|
10
|
+
from ..core.pagination import AsyncPager, SyncPager
|
|
11
11
|
from ..core.pydantic_utilities import parse_obj_as
|
|
12
12
|
from ..core.request_options import RequestOptions
|
|
13
13
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
@@ -36,7 +36,7 @@ from ..types.list_drivers_response import ListDriversResponse
|
|
|
36
36
|
from ..types.update_driver_request_hos_setting import UpdateDriverRequestHosSetting
|
|
37
37
|
from ..types.us_driver_ruleset_override import UsDriverRulesetOverride
|
|
38
38
|
from .types.create_driver_request_locale import CreateDriverRequestLocale
|
|
39
|
-
from .types.
|
|
39
|
+
from .types.list_drivers_request_driver_activation_status import ListDriversRequestDriverActivationStatus
|
|
40
40
|
from .types.update_driver_request_driver_activation_status import UpdateDriverRequestDriverActivationStatus
|
|
41
41
|
from .types.update_driver_request_locale import UpdateDriverRequestLocale
|
|
42
42
|
|
|
@@ -51,7 +51,7 @@ class RawDriversClient:
|
|
|
51
51
|
def list(
|
|
52
52
|
self,
|
|
53
53
|
*,
|
|
54
|
-
driver_activation_status: typing.Optional[
|
|
54
|
+
driver_activation_status: typing.Optional[ListDriversRequestDriverActivationStatus] = None,
|
|
55
55
|
limit: typing.Optional[int] = None,
|
|
56
56
|
after: typing.Optional[str] = None,
|
|
57
57
|
parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
@@ -61,7 +61,7 @@ class RawDriversClient:
|
|
|
61
61
|
updated_after_time: typing.Optional[str] = None,
|
|
62
62
|
created_after_time: typing.Optional[str] = None,
|
|
63
63
|
request_options: typing.Optional[RequestOptions] = None,
|
|
64
|
-
) -> SyncPager[Driver]:
|
|
64
|
+
) -> SyncPager[Driver, ListDriversResponse]:
|
|
65
65
|
"""
|
|
66
66
|
Get all drivers in organization.
|
|
67
67
|
|
|
@@ -71,7 +71,7 @@ class RawDriversClient:
|
|
|
71
71
|
|
|
72
72
|
Parameters
|
|
73
73
|
----------
|
|
74
|
-
driver_activation_status : typing.Optional[
|
|
74
|
+
driver_activation_status : typing.Optional[ListDriversRequestDriverActivationStatus]
|
|
75
75
|
If value is `deactivated`, only drivers that are deactivated will appear in the response. This parameter will default to `active` if not provided (fetching only active drivers).
|
|
76
76
|
|
|
77
77
|
limit : typing.Optional[int]
|
|
@@ -103,7 +103,7 @@ class RawDriversClient:
|
|
|
103
103
|
|
|
104
104
|
Returns
|
|
105
105
|
-------
|
|
106
|
-
SyncPager[Driver]
|
|
106
|
+
SyncPager[Driver, ListDriversResponse]
|
|
107
107
|
List of all driver objects.
|
|
108
108
|
"""
|
|
109
109
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -149,9 +149,7 @@ class RawDriversClient:
|
|
|
149
149
|
created_after_time=created_after_time,
|
|
150
150
|
request_options=request_options,
|
|
151
151
|
)
|
|
152
|
-
return SyncPager(
|
|
153
|
-
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
154
|
-
)
|
|
152
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
155
153
|
_response_json = _response.json()
|
|
156
154
|
except JSONDecodeError:
|
|
157
155
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -421,9 +419,9 @@ class RawDriversClient:
|
|
|
421
419
|
raise UnauthorizedError(
|
|
422
420
|
headers=dict(_response.headers),
|
|
423
421
|
body=typing.cast(
|
|
424
|
-
typing.
|
|
422
|
+
typing.Any,
|
|
425
423
|
parse_obj_as(
|
|
426
|
-
type_=typing.
|
|
424
|
+
type_=typing.Any, # type: ignore
|
|
427
425
|
object_=_response.json(),
|
|
428
426
|
),
|
|
429
427
|
),
|
|
@@ -432,9 +430,9 @@ class RawDriversClient:
|
|
|
432
430
|
raise NotFoundError(
|
|
433
431
|
headers=dict(_response.headers),
|
|
434
432
|
body=typing.cast(
|
|
435
|
-
typing.
|
|
433
|
+
typing.Any,
|
|
436
434
|
parse_obj_as(
|
|
437
|
-
type_=typing.
|
|
435
|
+
type_=typing.Any, # type: ignore
|
|
438
436
|
object_=_response.json(),
|
|
439
437
|
),
|
|
440
438
|
),
|
|
@@ -443,9 +441,9 @@ class RawDriversClient:
|
|
|
443
441
|
raise MethodNotAllowedError(
|
|
444
442
|
headers=dict(_response.headers),
|
|
445
443
|
body=typing.cast(
|
|
446
|
-
typing.
|
|
444
|
+
typing.Any,
|
|
447
445
|
parse_obj_as(
|
|
448
|
-
type_=typing.
|
|
446
|
+
type_=typing.Any, # type: ignore
|
|
449
447
|
object_=_response.json(),
|
|
450
448
|
),
|
|
451
449
|
),
|
|
@@ -454,9 +452,9 @@ class RawDriversClient:
|
|
|
454
452
|
raise TooManyRequestsError(
|
|
455
453
|
headers=dict(_response.headers),
|
|
456
454
|
body=typing.cast(
|
|
457
|
-
typing.
|
|
455
|
+
typing.Any,
|
|
458
456
|
parse_obj_as(
|
|
459
|
-
type_=typing.
|
|
457
|
+
type_=typing.Any, # type: ignore
|
|
460
458
|
object_=_response.json(),
|
|
461
459
|
),
|
|
462
460
|
),
|
|
@@ -465,9 +463,9 @@ class RawDriversClient:
|
|
|
465
463
|
raise InternalServerError(
|
|
466
464
|
headers=dict(_response.headers),
|
|
467
465
|
body=typing.cast(
|
|
468
|
-
typing.
|
|
466
|
+
typing.Any,
|
|
469
467
|
parse_obj_as(
|
|
470
|
-
type_=typing.
|
|
468
|
+
type_=typing.Any, # type: ignore
|
|
471
469
|
object_=_response.json(),
|
|
472
470
|
),
|
|
473
471
|
),
|
|
@@ -476,9 +474,9 @@ class RawDriversClient:
|
|
|
476
474
|
raise NotImplementedError(
|
|
477
475
|
headers=dict(_response.headers),
|
|
478
476
|
body=typing.cast(
|
|
479
|
-
typing.
|
|
477
|
+
typing.Any,
|
|
480
478
|
parse_obj_as(
|
|
481
|
-
type_=typing.
|
|
479
|
+
type_=typing.Any, # type: ignore
|
|
482
480
|
object_=_response.json(),
|
|
483
481
|
),
|
|
484
482
|
),
|
|
@@ -487,9 +485,9 @@ class RawDriversClient:
|
|
|
487
485
|
raise BadGatewayError(
|
|
488
486
|
headers=dict(_response.headers),
|
|
489
487
|
body=typing.cast(
|
|
490
|
-
typing.
|
|
488
|
+
typing.Any,
|
|
491
489
|
parse_obj_as(
|
|
492
|
-
type_=typing.
|
|
490
|
+
type_=typing.Any, # type: ignore
|
|
493
491
|
object_=_response.json(),
|
|
494
492
|
),
|
|
495
493
|
),
|
|
@@ -498,9 +496,9 @@ class RawDriversClient:
|
|
|
498
496
|
raise ServiceUnavailableError(
|
|
499
497
|
headers=dict(_response.headers),
|
|
500
498
|
body=typing.cast(
|
|
501
|
-
typing.
|
|
499
|
+
typing.Any,
|
|
502
500
|
parse_obj_as(
|
|
503
|
-
type_=typing.
|
|
501
|
+
type_=typing.Any, # type: ignore
|
|
504
502
|
object_=_response.json(),
|
|
505
503
|
),
|
|
506
504
|
),
|
|
@@ -509,9 +507,9 @@ class RawDriversClient:
|
|
|
509
507
|
raise GatewayTimeoutError(
|
|
510
508
|
headers=dict(_response.headers),
|
|
511
509
|
body=typing.cast(
|
|
512
|
-
typing.
|
|
510
|
+
typing.Any,
|
|
513
511
|
parse_obj_as(
|
|
514
|
-
type_=typing.
|
|
512
|
+
type_=typing.Any, # type: ignore
|
|
515
513
|
object_=_response.json(),
|
|
516
514
|
),
|
|
517
515
|
),
|
|
@@ -818,7 +816,7 @@ class AsyncRawDriversClient:
|
|
|
818
816
|
async def list(
|
|
819
817
|
self,
|
|
820
818
|
*,
|
|
821
|
-
driver_activation_status: typing.Optional[
|
|
819
|
+
driver_activation_status: typing.Optional[ListDriversRequestDriverActivationStatus] = None,
|
|
822
820
|
limit: typing.Optional[int] = None,
|
|
823
821
|
after: typing.Optional[str] = None,
|
|
824
822
|
parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
@@ -828,7 +826,7 @@ class AsyncRawDriversClient:
|
|
|
828
826
|
updated_after_time: typing.Optional[str] = None,
|
|
829
827
|
created_after_time: typing.Optional[str] = None,
|
|
830
828
|
request_options: typing.Optional[RequestOptions] = None,
|
|
831
|
-
) -> AsyncPager[Driver]:
|
|
829
|
+
) -> AsyncPager[Driver, ListDriversResponse]:
|
|
832
830
|
"""
|
|
833
831
|
Get all drivers in organization.
|
|
834
832
|
|
|
@@ -838,7 +836,7 @@ class AsyncRawDriversClient:
|
|
|
838
836
|
|
|
839
837
|
Parameters
|
|
840
838
|
----------
|
|
841
|
-
driver_activation_status : typing.Optional[
|
|
839
|
+
driver_activation_status : typing.Optional[ListDriversRequestDriverActivationStatus]
|
|
842
840
|
If value is `deactivated`, only drivers that are deactivated will appear in the response. This parameter will default to `active` if not provided (fetching only active drivers).
|
|
843
841
|
|
|
844
842
|
limit : typing.Optional[int]
|
|
@@ -870,7 +868,7 @@ class AsyncRawDriversClient:
|
|
|
870
868
|
|
|
871
869
|
Returns
|
|
872
870
|
-------
|
|
873
|
-
AsyncPager[Driver]
|
|
871
|
+
AsyncPager[Driver, ListDriversResponse]
|
|
874
872
|
List of all driver objects.
|
|
875
873
|
"""
|
|
876
874
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -919,9 +917,7 @@ class AsyncRawDriversClient:
|
|
|
919
917
|
request_options=request_options,
|
|
920
918
|
)
|
|
921
919
|
|
|
922
|
-
return AsyncPager(
|
|
923
|
-
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
924
|
-
)
|
|
920
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
925
921
|
_response_json = _response.json()
|
|
926
922
|
except JSONDecodeError:
|
|
927
923
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -1191,9 +1187,9 @@ class AsyncRawDriversClient:
|
|
|
1191
1187
|
raise UnauthorizedError(
|
|
1192
1188
|
headers=dict(_response.headers),
|
|
1193
1189
|
body=typing.cast(
|
|
1194
|
-
typing.
|
|
1190
|
+
typing.Any,
|
|
1195
1191
|
parse_obj_as(
|
|
1196
|
-
type_=typing.
|
|
1192
|
+
type_=typing.Any, # type: ignore
|
|
1197
1193
|
object_=_response.json(),
|
|
1198
1194
|
),
|
|
1199
1195
|
),
|
|
@@ -1202,9 +1198,9 @@ class AsyncRawDriversClient:
|
|
|
1202
1198
|
raise NotFoundError(
|
|
1203
1199
|
headers=dict(_response.headers),
|
|
1204
1200
|
body=typing.cast(
|
|
1205
|
-
typing.
|
|
1201
|
+
typing.Any,
|
|
1206
1202
|
parse_obj_as(
|
|
1207
|
-
type_=typing.
|
|
1203
|
+
type_=typing.Any, # type: ignore
|
|
1208
1204
|
object_=_response.json(),
|
|
1209
1205
|
),
|
|
1210
1206
|
),
|
|
@@ -1213,9 +1209,9 @@ class AsyncRawDriversClient:
|
|
|
1213
1209
|
raise MethodNotAllowedError(
|
|
1214
1210
|
headers=dict(_response.headers),
|
|
1215
1211
|
body=typing.cast(
|
|
1216
|
-
typing.
|
|
1212
|
+
typing.Any,
|
|
1217
1213
|
parse_obj_as(
|
|
1218
|
-
type_=typing.
|
|
1214
|
+
type_=typing.Any, # type: ignore
|
|
1219
1215
|
object_=_response.json(),
|
|
1220
1216
|
),
|
|
1221
1217
|
),
|
|
@@ -1224,9 +1220,9 @@ class AsyncRawDriversClient:
|
|
|
1224
1220
|
raise TooManyRequestsError(
|
|
1225
1221
|
headers=dict(_response.headers),
|
|
1226
1222
|
body=typing.cast(
|
|
1227
|
-
typing.
|
|
1223
|
+
typing.Any,
|
|
1228
1224
|
parse_obj_as(
|
|
1229
|
-
type_=typing.
|
|
1225
|
+
type_=typing.Any, # type: ignore
|
|
1230
1226
|
object_=_response.json(),
|
|
1231
1227
|
),
|
|
1232
1228
|
),
|
|
@@ -1235,9 +1231,9 @@ class AsyncRawDriversClient:
|
|
|
1235
1231
|
raise InternalServerError(
|
|
1236
1232
|
headers=dict(_response.headers),
|
|
1237
1233
|
body=typing.cast(
|
|
1238
|
-
typing.
|
|
1234
|
+
typing.Any,
|
|
1239
1235
|
parse_obj_as(
|
|
1240
|
-
type_=typing.
|
|
1236
|
+
type_=typing.Any, # type: ignore
|
|
1241
1237
|
object_=_response.json(),
|
|
1242
1238
|
),
|
|
1243
1239
|
),
|
|
@@ -1246,9 +1242,9 @@ class AsyncRawDriversClient:
|
|
|
1246
1242
|
raise NotImplementedError(
|
|
1247
1243
|
headers=dict(_response.headers),
|
|
1248
1244
|
body=typing.cast(
|
|
1249
|
-
typing.
|
|
1245
|
+
typing.Any,
|
|
1250
1246
|
parse_obj_as(
|
|
1251
|
-
type_=typing.
|
|
1247
|
+
type_=typing.Any, # type: ignore
|
|
1252
1248
|
object_=_response.json(),
|
|
1253
1249
|
),
|
|
1254
1250
|
),
|
|
@@ -1257,9 +1253,9 @@ class AsyncRawDriversClient:
|
|
|
1257
1253
|
raise BadGatewayError(
|
|
1258
1254
|
headers=dict(_response.headers),
|
|
1259
1255
|
body=typing.cast(
|
|
1260
|
-
typing.
|
|
1256
|
+
typing.Any,
|
|
1261
1257
|
parse_obj_as(
|
|
1262
|
-
type_=typing.
|
|
1258
|
+
type_=typing.Any, # type: ignore
|
|
1263
1259
|
object_=_response.json(),
|
|
1264
1260
|
),
|
|
1265
1261
|
),
|
|
@@ -1268,9 +1264,9 @@ class AsyncRawDriversClient:
|
|
|
1268
1264
|
raise ServiceUnavailableError(
|
|
1269
1265
|
headers=dict(_response.headers),
|
|
1270
1266
|
body=typing.cast(
|
|
1271
|
-
typing.
|
|
1267
|
+
typing.Any,
|
|
1272
1268
|
parse_obj_as(
|
|
1273
|
-
type_=typing.
|
|
1269
|
+
type_=typing.Any, # type: ignore
|
|
1274
1270
|
object_=_response.json(),
|
|
1275
1271
|
),
|
|
1276
1272
|
),
|
|
@@ -1279,9 +1275,9 @@ class AsyncRawDriversClient:
|
|
|
1279
1275
|
raise GatewayTimeoutError(
|
|
1280
1276
|
headers=dict(_response.headers),
|
|
1281
1277
|
body=typing.cast(
|
|
1282
|
-
typing.
|
|
1278
|
+
typing.Any,
|
|
1283
1279
|
parse_obj_as(
|
|
1284
|
-
type_=typing.
|
|
1280
|
+
type_=typing.Any, # type: ignore
|
|
1285
1281
|
object_=_response.json(),
|
|
1286
1282
|
),
|
|
1287
1283
|
),
|
|
@@ -7,12 +7,12 @@ from importlib import import_module
|
|
|
7
7
|
|
|
8
8
|
if typing.TYPE_CHECKING:
|
|
9
9
|
from .create_driver_request_locale import CreateDriverRequestLocale
|
|
10
|
-
from .
|
|
10
|
+
from .list_drivers_request_driver_activation_status import ListDriversRequestDriverActivationStatus
|
|
11
11
|
from .update_driver_request_driver_activation_status import UpdateDriverRequestDriverActivationStatus
|
|
12
12
|
from .update_driver_request_locale import UpdateDriverRequestLocale
|
|
13
13
|
_dynamic_imports: typing.Dict[str, str] = {
|
|
14
14
|
"CreateDriverRequestLocale": ".create_driver_request_locale",
|
|
15
|
-
"
|
|
15
|
+
"ListDriversRequestDriverActivationStatus": ".list_drivers_request_driver_activation_status",
|
|
16
16
|
"UpdateDriverRequestDriverActivationStatus": ".update_driver_request_driver_activation_status",
|
|
17
17
|
"UpdateDriverRequestLocale": ".update_driver_request_locale",
|
|
18
18
|
}
|
|
@@ -41,7 +41,7 @@ def __dir__():
|
|
|
41
41
|
|
|
42
42
|
__all__ = [
|
|
43
43
|
"CreateDriverRequestLocale",
|
|
44
|
-
"
|
|
44
|
+
"ListDriversRequestDriverActivationStatus",
|
|
45
45
|
"UpdateDriverRequestDriverActivationStatus",
|
|
46
46
|
"UpdateDriverRequestLocale",
|
|
47
47
|
]
|
samsara/equipment/client.py
CHANGED
|
@@ -72,10 +72,7 @@ class EquipmentClient:
|
|
|
72
72
|
client = Samsara(
|
|
73
73
|
token="YOUR_TOKEN",
|
|
74
74
|
)
|
|
75
|
-
client.equipment.list_equipment(
|
|
76
|
-
limit=1000000,
|
|
77
|
-
after="after",
|
|
78
|
-
)
|
|
75
|
+
client.equipment.list_equipment()
|
|
79
76
|
"""
|
|
80
77
|
_response = self._raw_client.list_equipment(
|
|
81
78
|
limit=limit, after=after, parent_tag_ids=parent_tag_ids, tag_ids=tag_ids, request_options=request_options
|
|
@@ -127,9 +124,7 @@ class EquipmentClient:
|
|
|
127
124
|
client = Samsara(
|
|
128
125
|
token="YOUR_TOKEN",
|
|
129
126
|
)
|
|
130
|
-
client.equipment.get_equipment_locations(
|
|
131
|
-
after="after",
|
|
132
|
-
)
|
|
127
|
+
client.equipment.get_equipment_locations()
|
|
133
128
|
"""
|
|
134
129
|
_response = self._raw_client.get_equipment_locations(
|
|
135
130
|
after=after,
|
|
@@ -191,9 +186,7 @@ class EquipmentClient:
|
|
|
191
186
|
client = Samsara(
|
|
192
187
|
token="YOUR_TOKEN",
|
|
193
188
|
)
|
|
194
|
-
client.equipment.get_equipment_locations_feed(
|
|
195
|
-
after="after",
|
|
196
|
-
)
|
|
189
|
+
client.equipment.get_equipment_locations_feed()
|
|
197
190
|
"""
|
|
198
191
|
_response = self._raw_client.get_equipment_locations_feed(
|
|
199
192
|
after=after,
|
|
@@ -258,7 +251,6 @@ class EquipmentClient:
|
|
|
258
251
|
token="YOUR_TOKEN",
|
|
259
252
|
)
|
|
260
253
|
client.equipment.get_equipment_locations_history(
|
|
261
|
-
after="after",
|
|
262
254
|
start_time="startTime",
|
|
263
255
|
end_time="endTime",
|
|
264
256
|
)
|
|
@@ -626,10 +618,7 @@ class AsyncEquipmentClient:
|
|
|
626
618
|
|
|
627
619
|
|
|
628
620
|
async def main() -> None:
|
|
629
|
-
await client.equipment.list_equipment(
|
|
630
|
-
limit=1000000,
|
|
631
|
-
after="after",
|
|
632
|
-
)
|
|
621
|
+
await client.equipment.list_equipment()
|
|
633
622
|
|
|
634
623
|
|
|
635
624
|
asyncio.run(main())
|
|
@@ -689,9 +678,7 @@ class AsyncEquipmentClient:
|
|
|
689
678
|
|
|
690
679
|
|
|
691
680
|
async def main() -> None:
|
|
692
|
-
await client.equipment.get_equipment_locations(
|
|
693
|
-
after="after",
|
|
694
|
-
)
|
|
681
|
+
await client.equipment.get_equipment_locations()
|
|
695
682
|
|
|
696
683
|
|
|
697
684
|
asyncio.run(main())
|
|
@@ -761,9 +748,7 @@ class AsyncEquipmentClient:
|
|
|
761
748
|
|
|
762
749
|
|
|
763
750
|
async def main() -> None:
|
|
764
|
-
await client.equipment.get_equipment_locations_feed(
|
|
765
|
-
after="after",
|
|
766
|
-
)
|
|
751
|
+
await client.equipment.get_equipment_locations_feed()
|
|
767
752
|
|
|
768
753
|
|
|
769
754
|
asyncio.run(main())
|
|
@@ -836,7 +821,6 @@ class AsyncEquipmentClient:
|
|
|
836
821
|
|
|
837
822
|
async def main() -> None:
|
|
838
823
|
await client.equipment.get_equipment_locations_history(
|
|
839
|
-
after="after",
|
|
840
824
|
start_time="startTime",
|
|
841
825
|
end_time="endTime",
|
|
842
826
|
)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class BadGatewayError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=502, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class GatewayTimeoutError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=504, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class InternalServerError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=500, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class MethodNotAllowedError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=405, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class NotFoundError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=404, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class NotImplementedError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=501, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class ServiceUnavailableError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=503, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class TooManyRequestsError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=429, headers=headers, body=body)
|
|
@@ -6,5 +6,5 @@ from ..core.api_error import ApiError
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class UnauthorizedError(ApiError):
|
|
9
|
-
def __init__(self, body: typing.
|
|
9
|
+
def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
10
10
|
super().__init__(status_code=401, headers=headers, body=body)
|