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/beta_ap_is/client.py
CHANGED
|
@@ -10,6 +10,9 @@ from ..types.assets_inputs_get_assets_inputs_response_body import AssetsInputsGe
|
|
|
10
10
|
from ..types.detection_log_get_detections_response_body import DetectionLogGetDetectionsResponseBody
|
|
11
11
|
from ..types.devices_get_devices_response_body import DevicesGetDevicesResponseBody
|
|
12
12
|
from ..types.driver_efficiencies_response import DriverEfficienciesResponse
|
|
13
|
+
from ..types.drivers_auth_token_create_driver_auth_token_response_body import (
|
|
14
|
+
DriversAuthTokenCreateDriverAuthTokenResponseBody,
|
|
15
|
+
)
|
|
13
16
|
from ..types.engine_immobilizer_get_engine_immobilizer_states_response_body import (
|
|
14
17
|
EngineImmobilizerGetEngineImmobilizerStatesResponseBody,
|
|
15
18
|
)
|
|
@@ -310,23 +313,12 @@ class BetaApIsClient:
|
|
|
310
313
|
|
|
311
314
|
Examples
|
|
312
315
|
--------
|
|
313
|
-
import datetime
|
|
314
|
-
|
|
315
316
|
from samsara import Samsara
|
|
316
317
|
|
|
317
318
|
client = Samsara(
|
|
318
319
|
token="YOUR_TOKEN",
|
|
319
320
|
)
|
|
320
|
-
client.beta_ap_is.get_driver_efficiency(
|
|
321
|
-
driver_activation_status="active",
|
|
322
|
-
after="after",
|
|
323
|
-
start_time=datetime.datetime.fromisoformat(
|
|
324
|
-
"2024-01-15 09:30:00+00:00",
|
|
325
|
-
),
|
|
326
|
-
end_time=datetime.datetime.fromisoformat(
|
|
327
|
-
"2024-01-15 09:30:00+00:00",
|
|
328
|
-
),
|
|
329
|
-
)
|
|
321
|
+
client.beta_ap_is.get_driver_efficiency()
|
|
330
322
|
"""
|
|
331
323
|
_response = self._raw_client.get_driver_efficiency(
|
|
332
324
|
driver_activation_status=driver_activation_status,
|
|
@@ -348,7 +340,6 @@ class BetaApIsClient:
|
|
|
348
340
|
engine_hours: typing.Optional[int] = OMIT,
|
|
349
341
|
equipment_serial_number: typing.Optional[str] = OMIT,
|
|
350
342
|
external_ids: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
351
|
-
equipment_patch_equipment_request_body_id: typing.Optional[str] = OMIT,
|
|
352
343
|
name: typing.Optional[str] = OMIT,
|
|
353
344
|
notes: typing.Optional[str] = OMIT,
|
|
354
345
|
odometer_meters: typing.Optional[int] = OMIT,
|
|
@@ -384,9 +375,6 @@ class BetaApIsClient:
|
|
|
384
375
|
external_ids : typing.Optional[typing.Dict[str, str]]
|
|
385
376
|
A map of external ids
|
|
386
377
|
|
|
387
|
-
equipment_patch_equipment_request_body_id : typing.Optional[str]
|
|
388
|
-
The unique Samsara ID of the Equipment. This is automatically generated when the Equipment object is created. It cannot be changed.
|
|
389
|
-
|
|
390
378
|
name : typing.Optional[str]
|
|
391
379
|
The human-readable name of the Equipment. This is set by a fleet administrator and will appear in both Samsara’s cloud dashboard as well as the Samsara Driver mobile app. By default, this name is the serial number of the Samsara Asset Gateway. It can be set or updated through the Samsara Dashboard or through the API at any time.
|
|
392
380
|
|
|
@@ -424,7 +412,6 @@ class BetaApIsClient:
|
|
|
424
412
|
engine_hours=engine_hours,
|
|
425
413
|
equipment_serial_number=equipment_serial_number,
|
|
426
414
|
external_ids=external_ids,
|
|
427
|
-
equipment_patch_equipment_request_body_id=equipment_patch_equipment_request_body_id,
|
|
428
415
|
name=name,
|
|
429
416
|
notes=notes,
|
|
430
417
|
odometer_meters=odometer_meters,
|
|
@@ -500,11 +487,6 @@ class BetaApIsClient:
|
|
|
500
487
|
client.beta_ap_is.get_hos_eld_events(
|
|
501
488
|
start_time="startTime",
|
|
502
489
|
end_time="endTime",
|
|
503
|
-
tag_ids="tagIds",
|
|
504
|
-
parent_tag_ids="parentTagIds",
|
|
505
|
-
driver_activation_status="active",
|
|
506
|
-
after="after",
|
|
507
|
-
limit=1,
|
|
508
490
|
)
|
|
509
491
|
"""
|
|
510
492
|
_response = self._raw_client.get_hos_eld_events(
|
|
@@ -604,11 +586,6 @@ class BetaApIsClient:
|
|
|
604
586
|
)
|
|
605
587
|
client.beta_ap_is.get_trailer_stats_snapshot(
|
|
606
588
|
types="types",
|
|
607
|
-
tag_ids="tagIds",
|
|
608
|
-
parent_tag_ids="parentTagIds",
|
|
609
|
-
after="after",
|
|
610
|
-
trailer_ids="trailerIds",
|
|
611
|
-
time="time",
|
|
612
589
|
)
|
|
613
590
|
"""
|
|
614
591
|
_response = self._raw_client.get_trailer_stats_snapshot(
|
|
@@ -740,11 +717,6 @@ class BetaApIsClient:
|
|
|
740
717
|
)
|
|
741
718
|
client.beta_ap_is.get_trailer_stats_feed(
|
|
742
719
|
types="types",
|
|
743
|
-
tag_ids="tagIds",
|
|
744
|
-
parent_tag_ids="parentTagIds",
|
|
745
|
-
after="after",
|
|
746
|
-
trailer_ids="trailerIds",
|
|
747
|
-
decorations="decorations",
|
|
748
720
|
)
|
|
749
721
|
"""
|
|
750
722
|
_response = self._raw_client.get_trailer_stats_feed(
|
|
@@ -880,11 +852,6 @@ class BetaApIsClient:
|
|
|
880
852
|
start_time="startTime",
|
|
881
853
|
end_time="endTime",
|
|
882
854
|
types="types",
|
|
883
|
-
tag_ids="tagIds",
|
|
884
|
-
parent_tag_ids="parentTagIds",
|
|
885
|
-
after="after",
|
|
886
|
-
trailer_ids="trailerIds",
|
|
887
|
-
decorations="decorations",
|
|
888
855
|
)
|
|
889
856
|
"""
|
|
890
857
|
_response = self._raw_client.get_trailer_stats_history(
|
|
@@ -1019,14 +986,7 @@ class BetaApIsClient:
|
|
|
1019
986
|
client = Samsara(
|
|
1020
987
|
token="YOUR_TOKEN",
|
|
1021
988
|
)
|
|
1022
|
-
client.beta_ap_is.get_jobs(
|
|
1023
|
-
id="id",
|
|
1024
|
-
start_date="startDate",
|
|
1025
|
-
end_date="endDate",
|
|
1026
|
-
status="active",
|
|
1027
|
-
customer_name="customerName",
|
|
1028
|
-
after="after",
|
|
1029
|
-
)
|
|
989
|
+
client.beta_ap_is.get_jobs()
|
|
1030
990
|
"""
|
|
1031
991
|
_response = self._raw_client.get_jobs(
|
|
1032
992
|
id=id,
|
|
@@ -1255,13 +1215,7 @@ class BetaApIsClient:
|
|
|
1255
1215
|
token="YOUR_TOKEN",
|
|
1256
1216
|
)
|
|
1257
1217
|
client.beta_ap_is.get_detections(
|
|
1258
|
-
inbox_event=True,
|
|
1259
|
-
in_cab_alert_played=True,
|
|
1260
|
-
include_asset=True,
|
|
1261
|
-
include_driver=True,
|
|
1262
1218
|
start_time="startTime",
|
|
1263
|
-
end_time="endTime",
|
|
1264
|
-
after="after",
|
|
1265
1219
|
)
|
|
1266
1220
|
"""
|
|
1267
1221
|
_response = self._raw_client.get_detections(
|
|
@@ -1335,11 +1289,7 @@ class BetaApIsClient:
|
|
|
1335
1289
|
client = Samsara(
|
|
1336
1290
|
token="YOUR_TOKEN",
|
|
1337
1291
|
)
|
|
1338
|
-
client.beta_ap_is.get_devices(
|
|
1339
|
-
include_health=True,
|
|
1340
|
-
after="after",
|
|
1341
|
-
limit=1,
|
|
1342
|
-
)
|
|
1292
|
+
client.beta_ap_is.get_devices()
|
|
1343
1293
|
"""
|
|
1344
1294
|
_response = self._raw_client.get_devices(
|
|
1345
1295
|
models=models,
|
|
@@ -1505,6 +1455,63 @@ class BetaApIsClient:
|
|
|
1505
1455
|
)
|
|
1506
1456
|
return _response.data
|
|
1507
1457
|
|
|
1458
|
+
def create_driver_auth_token(
|
|
1459
|
+
self,
|
|
1460
|
+
*,
|
|
1461
|
+
code: str,
|
|
1462
|
+
external_id: typing.Optional[str] = OMIT,
|
|
1463
|
+
id: typing.Optional[int] = OMIT,
|
|
1464
|
+
username: typing.Optional[str] = OMIT,
|
|
1465
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1466
|
+
) -> DriversAuthTokenCreateDriverAuthTokenResponseBody:
|
|
1467
|
+
"""
|
|
1468
|
+
Creates a short-lived auth token for a driver.
|
|
1469
|
+
|
|
1470
|
+
<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>).
|
|
1471
|
+
|
|
1472
|
+
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>
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
**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.
|
|
1476
|
+
|
|
1477
|
+
Parameters
|
|
1478
|
+
----------
|
|
1479
|
+
code : str
|
|
1480
|
+
Required. Random 12+ character string, used with the auth token to help secure the client from intercepted tokens.
|
|
1481
|
+
|
|
1482
|
+
external_id : typing.Optional[str]
|
|
1483
|
+
Optional. External ID of the driver, in the format `key:value` (e.g., `payrollId:ABFS18600`). One of `id`, `externalId`, or `username` is required.
|
|
1484
|
+
|
|
1485
|
+
id : typing.Optional[int]
|
|
1486
|
+
Optional. Samsara ID of the driver. One of `id`, `externalId`, or `username` is required.
|
|
1487
|
+
|
|
1488
|
+
username : typing.Optional[str]
|
|
1489
|
+
Optional. Username of the driver. This is the login identifier configured when the driver is created. One of `id`, `externalId`, or `username` is required.
|
|
1490
|
+
|
|
1491
|
+
request_options : typing.Optional[RequestOptions]
|
|
1492
|
+
Request-specific configuration.
|
|
1493
|
+
|
|
1494
|
+
Returns
|
|
1495
|
+
-------
|
|
1496
|
+
DriversAuthTokenCreateDriverAuthTokenResponseBody
|
|
1497
|
+
OK response.
|
|
1498
|
+
|
|
1499
|
+
Examples
|
|
1500
|
+
--------
|
|
1501
|
+
from samsara import Samsara
|
|
1502
|
+
|
|
1503
|
+
client = Samsara(
|
|
1504
|
+
token="YOUR_TOKEN",
|
|
1505
|
+
)
|
|
1506
|
+
client.beta_ap_is.create_driver_auth_token(
|
|
1507
|
+
code="dp[gZc1wAigz4uGa0Hh",
|
|
1508
|
+
)
|
|
1509
|
+
"""
|
|
1510
|
+
_response = self._raw_client.create_driver_auth_token(
|
|
1511
|
+
code=code, external_id=external_id, id=id, username=username, request_options=request_options
|
|
1512
|
+
)
|
|
1513
|
+
return _response.data
|
|
1514
|
+
|
|
1508
1515
|
def get_engine_immobilizer_states(
|
|
1509
1516
|
self,
|
|
1510
1517
|
*,
|
|
@@ -1556,8 +1563,6 @@ class BetaApIsClient:
|
|
|
1556
1563
|
client.beta_ap_is.get_engine_immobilizer_states(
|
|
1557
1564
|
vehicle_ids="vehicleIds",
|
|
1558
1565
|
start_time="startTime",
|
|
1559
|
-
end_time="endTime",
|
|
1560
|
-
after="after",
|
|
1561
1566
|
)
|
|
1562
1567
|
"""
|
|
1563
1568
|
_response = self._raw_client.get_engine_immobilizer_states(
|
|
@@ -2096,12 +2101,6 @@ class BetaApIsClient:
|
|
|
2096
2101
|
start_time=datetime.datetime.fromisoformat(
|
|
2097
2102
|
"2024-01-15 09:30:00+00:00",
|
|
2098
2103
|
),
|
|
2099
|
-
end_time=datetime.datetime.fromisoformat(
|
|
2100
|
-
"2024-01-15 09:30:00+00:00",
|
|
2101
|
-
),
|
|
2102
|
-
after="after",
|
|
2103
|
-
include_deleted=True,
|
|
2104
|
-
include_external_ids=True,
|
|
2105
2104
|
)
|
|
2106
2105
|
"""
|
|
2107
2106
|
_response = self._raw_client.get_qualification_records_stream(
|
|
@@ -2202,7 +2201,6 @@ class BetaApIsClient:
|
|
|
2202
2201
|
)
|
|
2203
2202
|
client.beta_ap_is.get_qualification_types(
|
|
2204
2203
|
entity_type="worker",
|
|
2205
|
-
after="after",
|
|
2206
2204
|
)
|
|
2207
2205
|
"""
|
|
2208
2206
|
_response = self._raw_client.get_qualification_types(
|
|
@@ -2251,6 +2249,7 @@ class BetaApIsClient:
|
|
|
2251
2249
|
data=[
|
|
2252
2250
|
ReadingDatapointRequestBody(
|
|
2253
2251
|
entity_id="123451234512345",
|
|
2252
|
+
entity_type="asset",
|
|
2254
2253
|
happened_at_time="2023-10-27T10:00:00Z",
|
|
2255
2254
|
reading_id="airInletPressure",
|
|
2256
2255
|
value={"key": "value"},
|
|
@@ -2309,11 +2308,7 @@ class BetaApIsClient:
|
|
|
2309
2308
|
client = Samsara(
|
|
2310
2309
|
token="YOUR_TOKEN",
|
|
2311
2310
|
)
|
|
2312
|
-
client.beta_ap_is.list_readings_definitions(
|
|
2313
|
-
after="after",
|
|
2314
|
-
ids="ids",
|
|
2315
|
-
entity_types="entityTypes",
|
|
2316
|
-
)
|
|
2311
|
+
client.beta_ap_is.list_readings_definitions()
|
|
2317
2312
|
"""
|
|
2318
2313
|
_response = self._raw_client.list_readings_definitions(
|
|
2319
2314
|
after=after, ids=ids, entity_types=entity_types, request_options=request_options
|
|
@@ -2403,15 +2398,8 @@ class BetaApIsClient:
|
|
|
2403
2398
|
token="YOUR_TOKEN",
|
|
2404
2399
|
)
|
|
2405
2400
|
client.beta_ap_is.get_readings_history(
|
|
2406
|
-
after="after",
|
|
2407
2401
|
reading_id="readingId",
|
|
2408
|
-
entity_ids="entityIds",
|
|
2409
2402
|
entity_type="entityType",
|
|
2410
|
-
external_ids="externalIds",
|
|
2411
|
-
start_time="startTime",
|
|
2412
|
-
end_time="endTime",
|
|
2413
|
-
feed=True,
|
|
2414
|
-
include_external_ids=True,
|
|
2415
2403
|
)
|
|
2416
2404
|
"""
|
|
2417
2405
|
_response = self._raw_client.get_readings_history(
|
|
@@ -2499,13 +2487,8 @@ class BetaApIsClient:
|
|
|
2499
2487
|
token="YOUR_TOKEN",
|
|
2500
2488
|
)
|
|
2501
2489
|
client.beta_ap_is.get_readings_snapshot(
|
|
2502
|
-
after="after",
|
|
2503
2490
|
reading_ids="readingIds",
|
|
2504
|
-
entity_ids="entityIds",
|
|
2505
|
-
external_ids="externalIds",
|
|
2506
|
-
as_of_time="asOfTime",
|
|
2507
2491
|
entity_type="entityType",
|
|
2508
|
-
include_external_ids=True,
|
|
2509
2492
|
)
|
|
2510
2493
|
"""
|
|
2511
2494
|
_response = self._raw_client.get_readings_snapshot(
|
|
@@ -2657,10 +2640,6 @@ class BetaApIsClient:
|
|
|
2657
2640
|
)
|
|
2658
2641
|
client.beta_ap_is.get_safety_events_v_2_stream(
|
|
2659
2642
|
start_time="startTime",
|
|
2660
|
-
end_time="endTime",
|
|
2661
|
-
include_asset=True,
|
|
2662
|
-
include_driver=True,
|
|
2663
|
-
after="after",
|
|
2664
2643
|
)
|
|
2665
2644
|
"""
|
|
2666
2645
|
_response = self._raw_client.get_safety_events_v_2_stream(
|
|
@@ -2730,7 +2709,6 @@ class BetaApIsClient:
|
|
|
2730
2709
|
client.beta_ap_is.get_driver_safety_scores(
|
|
2731
2710
|
end_time="endTime",
|
|
2732
2711
|
start_time="startTime",
|
|
2733
|
-
after="after",
|
|
2734
2712
|
)
|
|
2735
2713
|
"""
|
|
2736
2714
|
_response = self._raw_client.get_driver_safety_scores(
|
|
@@ -2923,7 +2901,6 @@ class BetaApIsClient:
|
|
|
2923
2901
|
end_time="endTime",
|
|
2924
2902
|
start_time="startTime",
|
|
2925
2903
|
score_type="driver",
|
|
2926
|
-
after="after",
|
|
2927
2904
|
)
|
|
2928
2905
|
"""
|
|
2929
2906
|
_response = self._raw_client.get_tag_safety_scores(
|
|
@@ -2987,7 +2964,6 @@ class BetaApIsClient:
|
|
|
2987
2964
|
client.beta_ap_is.get_vehicle_safety_scores(
|
|
2988
2965
|
end_time="endTime",
|
|
2989
2966
|
start_time="startTime",
|
|
2990
|
-
after="after",
|
|
2991
2967
|
)
|
|
2992
2968
|
"""
|
|
2993
2969
|
_response = self._raw_client.get_vehicle_safety_scores(
|
|
@@ -3269,9 +3245,7 @@ class BetaApIsClient:
|
|
|
3269
3245
|
token="YOUR_TOKEN",
|
|
3270
3246
|
)
|
|
3271
3247
|
client.beta_ap_is.get_training_assignments_stream(
|
|
3272
|
-
after="after",
|
|
3273
3248
|
start_time="startTime",
|
|
3274
|
-
end_time="endTime",
|
|
3275
3249
|
)
|
|
3276
3250
|
"""
|
|
3277
3251
|
_response = self._raw_client.get_training_assignments_stream(
|
|
@@ -3334,9 +3308,7 @@ class BetaApIsClient:
|
|
|
3334
3308
|
client = Samsara(
|
|
3335
3309
|
token="YOUR_TOKEN",
|
|
3336
3310
|
)
|
|
3337
|
-
client.beta_ap_is.get_training_courses(
|
|
3338
|
-
after="after",
|
|
3339
|
-
)
|
|
3311
|
+
client.beta_ap_is.get_training_courses()
|
|
3340
3312
|
"""
|
|
3341
3313
|
_response = self._raw_client.get_training_courses(
|
|
3342
3314
|
after=after,
|
|
@@ -3638,7 +3610,6 @@ class AsyncBetaApIsClient:
|
|
|
3638
3610
|
Examples
|
|
3639
3611
|
--------
|
|
3640
3612
|
import asyncio
|
|
3641
|
-
import datetime
|
|
3642
3613
|
|
|
3643
3614
|
from samsara import AsyncSamsara
|
|
3644
3615
|
|
|
@@ -3648,16 +3619,7 @@ class AsyncBetaApIsClient:
|
|
|
3648
3619
|
|
|
3649
3620
|
|
|
3650
3621
|
async def main() -> None:
|
|
3651
|
-
await client.beta_ap_is.get_driver_efficiency(
|
|
3652
|
-
driver_activation_status="active",
|
|
3653
|
-
after="after",
|
|
3654
|
-
start_time=datetime.datetime.fromisoformat(
|
|
3655
|
-
"2024-01-15 09:30:00+00:00",
|
|
3656
|
-
),
|
|
3657
|
-
end_time=datetime.datetime.fromisoformat(
|
|
3658
|
-
"2024-01-15 09:30:00+00:00",
|
|
3659
|
-
),
|
|
3660
|
-
)
|
|
3622
|
+
await client.beta_ap_is.get_driver_efficiency()
|
|
3661
3623
|
|
|
3662
3624
|
|
|
3663
3625
|
asyncio.run(main())
|
|
@@ -3682,7 +3644,6 @@ class AsyncBetaApIsClient:
|
|
|
3682
3644
|
engine_hours: typing.Optional[int] = OMIT,
|
|
3683
3645
|
equipment_serial_number: typing.Optional[str] = OMIT,
|
|
3684
3646
|
external_ids: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
3685
|
-
equipment_patch_equipment_request_body_id: typing.Optional[str] = OMIT,
|
|
3686
3647
|
name: typing.Optional[str] = OMIT,
|
|
3687
3648
|
notes: typing.Optional[str] = OMIT,
|
|
3688
3649
|
odometer_meters: typing.Optional[int] = OMIT,
|
|
@@ -3718,9 +3679,6 @@ class AsyncBetaApIsClient:
|
|
|
3718
3679
|
external_ids : typing.Optional[typing.Dict[str, str]]
|
|
3719
3680
|
A map of external ids
|
|
3720
3681
|
|
|
3721
|
-
equipment_patch_equipment_request_body_id : typing.Optional[str]
|
|
3722
|
-
The unique Samsara ID of the Equipment. This is automatically generated when the Equipment object is created. It cannot be changed.
|
|
3723
|
-
|
|
3724
3682
|
name : typing.Optional[str]
|
|
3725
3683
|
The human-readable name of the Equipment. This is set by a fleet administrator and will appear in both Samsara’s cloud dashboard as well as the Samsara Driver mobile app. By default, this name is the serial number of the Samsara Asset Gateway. It can be set or updated through the Samsara Dashboard or through the API at any time.
|
|
3726
3684
|
|
|
@@ -3766,7 +3724,6 @@ class AsyncBetaApIsClient:
|
|
|
3766
3724
|
engine_hours=engine_hours,
|
|
3767
3725
|
equipment_serial_number=equipment_serial_number,
|
|
3768
3726
|
external_ids=external_ids,
|
|
3769
|
-
equipment_patch_equipment_request_body_id=equipment_patch_equipment_request_body_id,
|
|
3770
3727
|
name=name,
|
|
3771
3728
|
notes=notes,
|
|
3772
3729
|
odometer_meters=odometer_meters,
|
|
@@ -3847,11 +3804,6 @@ class AsyncBetaApIsClient:
|
|
|
3847
3804
|
await client.beta_ap_is.get_hos_eld_events(
|
|
3848
3805
|
start_time="startTime",
|
|
3849
3806
|
end_time="endTime",
|
|
3850
|
-
tag_ids="tagIds",
|
|
3851
|
-
parent_tag_ids="parentTagIds",
|
|
3852
|
-
driver_activation_status="active",
|
|
3853
|
-
after="after",
|
|
3854
|
-
limit=1,
|
|
3855
3807
|
)
|
|
3856
3808
|
|
|
3857
3809
|
|
|
@@ -3959,11 +3911,6 @@ class AsyncBetaApIsClient:
|
|
|
3959
3911
|
async def main() -> None:
|
|
3960
3912
|
await client.beta_ap_is.get_trailer_stats_snapshot(
|
|
3961
3913
|
types="types",
|
|
3962
|
-
tag_ids="tagIds",
|
|
3963
|
-
parent_tag_ids="parentTagIds",
|
|
3964
|
-
after="after",
|
|
3965
|
-
trailer_ids="trailerIds",
|
|
3966
|
-
time="time",
|
|
3967
3914
|
)
|
|
3968
3915
|
|
|
3969
3916
|
|
|
@@ -4103,11 +4050,6 @@ class AsyncBetaApIsClient:
|
|
|
4103
4050
|
async def main() -> None:
|
|
4104
4051
|
await client.beta_ap_is.get_trailer_stats_feed(
|
|
4105
4052
|
types="types",
|
|
4106
|
-
tag_ids="tagIds",
|
|
4107
|
-
parent_tag_ids="parentTagIds",
|
|
4108
|
-
after="after",
|
|
4109
|
-
trailer_ids="trailerIds",
|
|
4110
|
-
decorations="decorations",
|
|
4111
4053
|
)
|
|
4112
4054
|
|
|
4113
4055
|
|
|
@@ -4251,11 +4193,6 @@ class AsyncBetaApIsClient:
|
|
|
4251
4193
|
start_time="startTime",
|
|
4252
4194
|
end_time="endTime",
|
|
4253
4195
|
types="types",
|
|
4254
|
-
tag_ids="tagIds",
|
|
4255
|
-
parent_tag_ids="parentTagIds",
|
|
4256
|
-
after="after",
|
|
4257
|
-
trailer_ids="trailerIds",
|
|
4258
|
-
decorations="decorations",
|
|
4259
4196
|
)
|
|
4260
4197
|
|
|
4261
4198
|
|
|
@@ -4406,14 +4343,7 @@ class AsyncBetaApIsClient:
|
|
|
4406
4343
|
|
|
4407
4344
|
|
|
4408
4345
|
async def main() -> None:
|
|
4409
|
-
await client.beta_ap_is.get_jobs(
|
|
4410
|
-
id="id",
|
|
4411
|
-
start_date="startDate",
|
|
4412
|
-
end_date="endDate",
|
|
4413
|
-
status="active",
|
|
4414
|
-
customer_name="customerName",
|
|
4415
|
-
after="after",
|
|
4416
|
-
)
|
|
4346
|
+
await client.beta_ap_is.get_jobs()
|
|
4417
4347
|
|
|
4418
4348
|
|
|
4419
4349
|
asyncio.run(main())
|
|
@@ -4674,13 +4604,7 @@ class AsyncBetaApIsClient:
|
|
|
4674
4604
|
|
|
4675
4605
|
async def main() -> None:
|
|
4676
4606
|
await client.beta_ap_is.get_detections(
|
|
4677
|
-
inbox_event=True,
|
|
4678
|
-
in_cab_alert_played=True,
|
|
4679
|
-
include_asset=True,
|
|
4680
|
-
include_driver=True,
|
|
4681
4607
|
start_time="startTime",
|
|
4682
|
-
end_time="endTime",
|
|
4683
|
-
after="after",
|
|
4684
4608
|
)
|
|
4685
4609
|
|
|
4686
4610
|
|
|
@@ -4762,11 +4686,7 @@ class AsyncBetaApIsClient:
|
|
|
4762
4686
|
|
|
4763
4687
|
|
|
4764
4688
|
async def main() -> None:
|
|
4765
|
-
await client.beta_ap_is.get_devices(
|
|
4766
|
-
include_health=True,
|
|
4767
|
-
after="after",
|
|
4768
|
-
limit=1,
|
|
4769
|
-
)
|
|
4689
|
+
await client.beta_ap_is.get_devices()
|
|
4770
4690
|
|
|
4771
4691
|
|
|
4772
4692
|
asyncio.run(main())
|
|
@@ -4959,6 +4879,71 @@ class AsyncBetaApIsClient:
|
|
|
4959
4879
|
)
|
|
4960
4880
|
return _response.data
|
|
4961
4881
|
|
|
4882
|
+
async def create_driver_auth_token(
|
|
4883
|
+
self,
|
|
4884
|
+
*,
|
|
4885
|
+
code: str,
|
|
4886
|
+
external_id: typing.Optional[str] = OMIT,
|
|
4887
|
+
id: typing.Optional[int] = OMIT,
|
|
4888
|
+
username: typing.Optional[str] = OMIT,
|
|
4889
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
4890
|
+
) -> DriversAuthTokenCreateDriverAuthTokenResponseBody:
|
|
4891
|
+
"""
|
|
4892
|
+
Creates a short-lived auth token for a driver.
|
|
4893
|
+
|
|
4894
|
+
<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>).
|
|
4895
|
+
|
|
4896
|
+
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>
|
|
4897
|
+
|
|
4898
|
+
|
|
4899
|
+
**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.
|
|
4900
|
+
|
|
4901
|
+
Parameters
|
|
4902
|
+
----------
|
|
4903
|
+
code : str
|
|
4904
|
+
Required. Random 12+ character string, used with the auth token to help secure the client from intercepted tokens.
|
|
4905
|
+
|
|
4906
|
+
external_id : typing.Optional[str]
|
|
4907
|
+
Optional. External ID of the driver, in the format `key:value` (e.g., `payrollId:ABFS18600`). One of `id`, `externalId`, or `username` is required.
|
|
4908
|
+
|
|
4909
|
+
id : typing.Optional[int]
|
|
4910
|
+
Optional. Samsara ID of the driver. One of `id`, `externalId`, or `username` is required.
|
|
4911
|
+
|
|
4912
|
+
username : typing.Optional[str]
|
|
4913
|
+
Optional. Username of the driver. This is the login identifier configured when the driver is created. One of `id`, `externalId`, or `username` is required.
|
|
4914
|
+
|
|
4915
|
+
request_options : typing.Optional[RequestOptions]
|
|
4916
|
+
Request-specific configuration.
|
|
4917
|
+
|
|
4918
|
+
Returns
|
|
4919
|
+
-------
|
|
4920
|
+
DriversAuthTokenCreateDriverAuthTokenResponseBody
|
|
4921
|
+
OK response.
|
|
4922
|
+
|
|
4923
|
+
Examples
|
|
4924
|
+
--------
|
|
4925
|
+
import asyncio
|
|
4926
|
+
|
|
4927
|
+
from samsara import AsyncSamsara
|
|
4928
|
+
|
|
4929
|
+
client = AsyncSamsara(
|
|
4930
|
+
token="YOUR_TOKEN",
|
|
4931
|
+
)
|
|
4932
|
+
|
|
4933
|
+
|
|
4934
|
+
async def main() -> None:
|
|
4935
|
+
await client.beta_ap_is.create_driver_auth_token(
|
|
4936
|
+
code="dp[gZc1wAigz4uGa0Hh",
|
|
4937
|
+
)
|
|
4938
|
+
|
|
4939
|
+
|
|
4940
|
+
asyncio.run(main())
|
|
4941
|
+
"""
|
|
4942
|
+
_response = await self._raw_client.create_driver_auth_token(
|
|
4943
|
+
code=code, external_id=external_id, id=id, username=username, request_options=request_options
|
|
4944
|
+
)
|
|
4945
|
+
return _response.data
|
|
4946
|
+
|
|
4962
4947
|
async def get_engine_immobilizer_states(
|
|
4963
4948
|
self,
|
|
4964
4949
|
*,
|
|
@@ -5015,8 +5000,6 @@ class AsyncBetaApIsClient:
|
|
|
5015
5000
|
await client.beta_ap_is.get_engine_immobilizer_states(
|
|
5016
5001
|
vehicle_ids="vehicleIds",
|
|
5017
5002
|
start_time="startTime",
|
|
5018
|
-
end_time="endTime",
|
|
5019
|
-
after="after",
|
|
5020
5003
|
)
|
|
5021
5004
|
|
|
5022
5005
|
|
|
@@ -5628,12 +5611,6 @@ class AsyncBetaApIsClient:
|
|
|
5628
5611
|
start_time=datetime.datetime.fromisoformat(
|
|
5629
5612
|
"2024-01-15 09:30:00+00:00",
|
|
5630
5613
|
),
|
|
5631
|
-
end_time=datetime.datetime.fromisoformat(
|
|
5632
|
-
"2024-01-15 09:30:00+00:00",
|
|
5633
|
-
),
|
|
5634
|
-
after="after",
|
|
5635
|
-
include_deleted=True,
|
|
5636
|
-
include_external_ids=True,
|
|
5637
5614
|
)
|
|
5638
5615
|
|
|
5639
5616
|
|
|
@@ -5750,7 +5727,6 @@ class AsyncBetaApIsClient:
|
|
|
5750
5727
|
async def main() -> None:
|
|
5751
5728
|
await client.beta_ap_is.get_qualification_types(
|
|
5752
5729
|
entity_type="worker",
|
|
5753
|
-
after="after",
|
|
5754
5730
|
)
|
|
5755
5731
|
|
|
5756
5732
|
|
|
@@ -5807,6 +5783,7 @@ class AsyncBetaApIsClient:
|
|
|
5807
5783
|
data=[
|
|
5808
5784
|
ReadingDatapointRequestBody(
|
|
5809
5785
|
entity_id="123451234512345",
|
|
5786
|
+
entity_type="asset",
|
|
5810
5787
|
happened_at_time="2023-10-27T10:00:00Z",
|
|
5811
5788
|
reading_id="airInletPressure",
|
|
5812
5789
|
value={"key": "value"},
|
|
@@ -5873,11 +5850,7 @@ class AsyncBetaApIsClient:
|
|
|
5873
5850
|
|
|
5874
5851
|
|
|
5875
5852
|
async def main() -> None:
|
|
5876
|
-
await client.beta_ap_is.list_readings_definitions(
|
|
5877
|
-
after="after",
|
|
5878
|
-
ids="ids",
|
|
5879
|
-
entity_types="entityTypes",
|
|
5880
|
-
)
|
|
5853
|
+
await client.beta_ap_is.list_readings_definitions()
|
|
5881
5854
|
|
|
5882
5855
|
|
|
5883
5856
|
asyncio.run(main())
|
|
@@ -5975,15 +5948,8 @@ class AsyncBetaApIsClient:
|
|
|
5975
5948
|
|
|
5976
5949
|
async def main() -> None:
|
|
5977
5950
|
await client.beta_ap_is.get_readings_history(
|
|
5978
|
-
after="after",
|
|
5979
5951
|
reading_id="readingId",
|
|
5980
|
-
entity_ids="entityIds",
|
|
5981
5952
|
entity_type="entityType",
|
|
5982
|
-
external_ids="externalIds",
|
|
5983
|
-
start_time="startTime",
|
|
5984
|
-
end_time="endTime",
|
|
5985
|
-
feed=True,
|
|
5986
|
-
include_external_ids=True,
|
|
5987
5953
|
)
|
|
5988
5954
|
|
|
5989
5955
|
|
|
@@ -6079,13 +6045,8 @@ class AsyncBetaApIsClient:
|
|
|
6079
6045
|
|
|
6080
6046
|
async def main() -> None:
|
|
6081
6047
|
await client.beta_ap_is.get_readings_snapshot(
|
|
6082
|
-
after="after",
|
|
6083
6048
|
reading_ids="readingIds",
|
|
6084
|
-
entity_ids="entityIds",
|
|
6085
|
-
external_ids="externalIds",
|
|
6086
|
-
as_of_time="asOfTime",
|
|
6087
6049
|
entity_type="entityType",
|
|
6088
|
-
include_external_ids=True,
|
|
6089
6050
|
)
|
|
6090
6051
|
|
|
6091
6052
|
|
|
@@ -6253,10 +6214,6 @@ class AsyncBetaApIsClient:
|
|
|
6253
6214
|
async def main() -> None:
|
|
6254
6215
|
await client.beta_ap_is.get_safety_events_v_2_stream(
|
|
6255
6216
|
start_time="startTime",
|
|
6256
|
-
end_time="endTime",
|
|
6257
|
-
include_asset=True,
|
|
6258
|
-
include_driver=True,
|
|
6259
|
-
after="after",
|
|
6260
6217
|
)
|
|
6261
6218
|
|
|
6262
6219
|
|
|
@@ -6334,7 +6291,6 @@ class AsyncBetaApIsClient:
|
|
|
6334
6291
|
await client.beta_ap_is.get_driver_safety_scores(
|
|
6335
6292
|
end_time="endTime",
|
|
6336
6293
|
start_time="startTime",
|
|
6337
|
-
after="after",
|
|
6338
6294
|
)
|
|
6339
6295
|
|
|
6340
6296
|
|
|
@@ -6551,7 +6507,6 @@ class AsyncBetaApIsClient:
|
|
|
6551
6507
|
end_time="endTime",
|
|
6552
6508
|
start_time="startTime",
|
|
6553
6509
|
score_type="driver",
|
|
6554
|
-
after="after",
|
|
6555
6510
|
)
|
|
6556
6511
|
|
|
6557
6512
|
|
|
@@ -6623,7 +6578,6 @@ class AsyncBetaApIsClient:
|
|
|
6623
6578
|
await client.beta_ap_is.get_vehicle_safety_scores(
|
|
6624
6579
|
end_time="endTime",
|
|
6625
6580
|
start_time="startTime",
|
|
6626
|
-
after="after",
|
|
6627
6581
|
)
|
|
6628
6582
|
|
|
6629
6583
|
|
|
@@ -6945,9 +6899,7 @@ class AsyncBetaApIsClient:
|
|
|
6945
6899
|
|
|
6946
6900
|
async def main() -> None:
|
|
6947
6901
|
await client.beta_ap_is.get_training_assignments_stream(
|
|
6948
|
-
after="after",
|
|
6949
6902
|
start_time="startTime",
|
|
6950
|
-
end_time="endTime",
|
|
6951
6903
|
)
|
|
6952
6904
|
|
|
6953
6905
|
|
|
@@ -7018,9 +6970,7 @@ class AsyncBetaApIsClient:
|
|
|
7018
6970
|
|
|
7019
6971
|
|
|
7020
6972
|
async def main() -> None:
|
|
7021
|
-
await client.beta_ap_is.get_training_courses(
|
|
7022
|
-
after="after",
|
|
7023
|
-
)
|
|
6973
|
+
await client.beta_ap_is.get_training_courses()
|
|
7024
6974
|
|
|
7025
6975
|
|
|
7026
6976
|
asyncio.run(main())
|