samsara-api 0.0.1__py3-none-any.whl → 0.0.2__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 +298 -38
- samsara/alerts/configurations/client.py +25 -11
- samsara/alerts/configurations/raw_client.py +47 -8
- samsara/alerts/incidents/client.py +21 -11
- samsara/alerts/incidents/raw_client.py +43 -9
- samsara/assets/client.py +21 -11
- samsara/assets/location_and_speed/client.py +21 -13
- samsara/assets/location_and_speed/raw_client.py +53 -9
- samsara/assets/raw_client.py +53 -8
- samsara/attributes/client.py +21 -13
- samsara/attributes/raw_client.py +41 -8
- samsara/cameras/media/client.py +2 -2
- samsara/cameras/media/raw_client.py +2 -2
- samsara/cameras/media/retrieval/client.py +2 -12
- samsara/cameras/media/types/media_list_request_trigger_reasons_item.py +8 -1
- samsara/carrier_proposed_assignments/client.py +21 -11
- samsara/carrier_proposed_assignments/raw_client.py +43 -8
- samsara/client.py +15 -6
- samsara/coaching/driver_coach_assignments/client.py +22 -12
- samsara/coaching/driver_coach_assignments/raw_client.py +45 -8
- samsara/coaching/sessions/client.py +21 -13
- samsara/coaching/sessions/raw_client.py +51 -9
- samsara/contacts/client.py +21 -11
- samsara/contacts/raw_client.py +39 -8
- samsara/core/client_wrapper.py +2 -2
- samsara/defect_types/client.py +21 -11
- samsara/defect_types/raw_client.py +41 -9
- samsara/defects/client.py +124 -9
- samsara/defects/raw_client.py +356 -6
- samsara/devices/client.py +21 -11
- samsara/devices/raw_client.py +45 -9
- samsara/document_types/client.py +21 -11
- samsara/document_types/raw_client.py +37 -9
- samsara/documents/client.py +21 -11
- samsara/documents/raw_client.py +45 -8
- samsara/driver_trailer_assignments/client.py +23 -13
- samsara/driver_trailer_assignments/raw_client.py +43 -8
- samsara/drivers/__init__.py +1 -3
- samsara/drivers/client.py +21 -21
- samsara/drivers/raw_client.py +51 -8
- samsara/dvirs/client.py +124 -9
- samsara/dvirs/raw_client.py +356 -6
- samsara/equipment/__init__.py +2 -2
- samsara/equipment/client.py +23 -21
- samsara/equipment/locations/client.py +62 -34
- samsara/equipment/locations/raw_client.py +132 -27
- samsara/equipment/raw_client.py +45 -18
- samsara/equipment/stats/__init__.py +2 -2
- samsara/equipment/stats/client.py +81 -53
- samsara/equipment/stats/raw_client.py +157 -46
- samsara/equipment/stats/types/__init__.py +2 -2
- samsara/equipment/stats/types/{stats_get_request_types_item.py → stats_list_request_types_item.py} +1 -1
- samsara/form_submissions/client.py +46 -54
- samsara/form_submissions/pdf_exports/client.py +14 -22
- samsara/form_submissions/pdf_exports/raw_client.py +10 -18
- samsara/form_submissions/raw_client.py +74 -47
- samsara/forms/client.py +138 -0
- samsara/{beta → forms}/raw_client.py +37 -62
- samsara/function.py +99 -0
- samsara/gateways/client.py +21 -11
- samsara/gateways/raw_client.py +39 -8
- samsara/hos/__init__.py +3 -0
- samsara/hos/client.py +218 -11
- samsara/hos/raw_client.py +485 -8
- samsara/hos/types/__init__.py +7 -0
- samsara/hos/types/hos_daily_logs_request_driver_activation_status.py +5 -0
- samsara/idling/__init__.py +7 -0
- samsara/idling/client.py +287 -0
- samsara/idling/raw_client.py +521 -0
- samsara/idling/types/__init__.py +7 -0
- samsara/idling/types/idling_list_request_pto_state.py +5 -0
- samsara/inputs/client.py +21 -11
- samsara/inputs/raw_client.py +51 -9
- samsara/issues/client.py +27 -29
- samsara/issues/raw_client.py +53 -26
- samsara/live_shares/client.py +21 -13
- samsara/live_shares/raw_client.py +43 -8
- samsara/maintenance/service_tasks/client.py +21 -11
- samsara/maintenance/service_tasks/raw_client.py +41 -8
- samsara/maintenance/work_orders/client.py +40 -22
- samsara/maintenance/work_orders/raw_client.py +84 -16
- samsara/readings/client.py +524 -0
- samsara/readings/raw_client.py +1214 -0
- samsara/reports/drivers/fuel_energy/client.py +6 -6
- samsara/reports/drivers/fuel_energy/raw_client.py +2 -2
- samsara/reports/ifta/__init__.py +4 -4
- samsara/reports/ifta/vehicle/__init__.py +2 -2
- samsara/reports/ifta/vehicle/client.py +21 -21
- samsara/reports/ifta/vehicle/raw_client.py +17 -17
- samsara/reports/ifta/vehicle/types/__init__.py +4 -4
- samsara/reports/ifta/vehicle/types/{vehicle_get_request_fuel_type.py → vehicle_list_request_fuel_type.py} +1 -1
- samsara/reports/ifta/vehicle/types/{vehicle_get_request_month.py → vehicle_list_request_month.py} +1 -1
- samsara/reports/ifta/vehicle/types/vehicle_list_request_quarter.py +5 -0
- samsara/reports/vehicles/__init__.py +2 -2
- samsara/reports/vehicles/fuel_energy/__init__.py +2 -2
- samsara/reports/vehicles/fuel_energy/client.py +11 -11
- samsara/reports/vehicles/fuel_energy/raw_client.py +7 -7
- samsara/reports/vehicles/fuel_energy/types/__init__.py +2 -2
- samsara/reports/vehicles/fuel_energy/types/fuel_energy_list_request_energy_type.py +5 -0
- samsara/reports/vehicles/idling/client.py +27 -15
- samsara/reports/vehicles/idling/raw_client.py +59 -11
- samsara/routes/client.py +21 -11
- samsara/routes/raw_client.py +43 -8
- samsara/safety_events/audit_logs/client.py +21 -13
- samsara/safety_events/audit_logs/raw_client.py +39 -9
- samsara/safety_events/client.py +21 -11
- samsara/safety_events/raw_client.py +47 -9
- samsara/speeding_intervals/client.py +25 -17
- samsara/speeding_intervals/raw_client.py +55 -13
- samsara/tachograph/__init__.py +7 -0
- samsara/tachograph/client.py +44 -0
- samsara/{drivers/tachograph_files → tachograph/driver}/client.py +162 -15
- samsara/{drivers/tachograph_files → tachograph/driver}/raw_client.py +153 -4
- samsara/tachograph/raw_client.py +13 -0
- samsara/{vehicles/tachograph_files → tachograph/vehicles}/client.py +15 -15
- samsara/{vehicles/tachograph_files → tachograph/vehicles}/raw_client.py +4 -4
- samsara/tags/client.py +21 -11
- samsara/tags/raw_client.py +39 -8
- samsara/trailers/client.py +21 -11
- samsara/trailers/raw_client.py +43 -8
- samsara/training_courses/client.py +21 -11
- samsara/training_courses/raw_client.py +43 -9
- samsara/trips/client.py +21 -11
- samsara/trips/raw_client.py +49 -9
- samsara/types/__init__.py +406 -50
- samsara/types/advanced_idling_get_idling_events_bad_gateway_error_response_body.py +33 -0
- samsara/types/advanced_idling_get_idling_events_gateway_timeout_error_response_body.py +33 -0
- samsara/types/{hos_daily_logs_update_shipping_docs_internal_server_error_response_body.py → advanced_idling_get_idling_events_internal_server_error_response_body.py} +1 -1
- samsara/types/advanced_idling_get_idling_events_method_not_allowed_error_response_body.py +33 -0
- samsara/types/{hos_daily_logs_update_shipping_docs_not_found_error_response_body.py → advanced_idling_get_idling_events_not_found_error_response_body.py} +1 -1
- samsara/types/{hos_daily_logs_update_shipping_docs_not_implemented_error_response_body.py → advanced_idling_get_idling_events_not_implemented_error_response_body.py} +1 -1
- samsara/types/advanced_idling_get_idling_events_response_body.py +26 -0
- samsara/types/{hos_daily_logs_update_shipping_docs_service_unavailable_error_response_body.py → advanced_idling_get_idling_events_service_unavailable_error_response_body.py} +1 -1
- samsara/types/{hos_daily_logs_update_shipping_docs_gateway_timeout_error_response_body.py → advanced_idling_get_idling_events_too_many_requests_error_response_body.py} +2 -2
- samsara/types/advanced_idling_get_idling_events_unauthorized_error_response_body.py +33 -0
- samsara/types/alert_object_asset_response_body.py +63 -0
- samsara/types/{assets_create_asset_response_body_type.py → alert_object_asset_response_body_type.py} +1 -1
- samsara/types/assets_create_asset_response_body.py +2 -87
- samsara/types/assets_update_asset_response_body.py +2 -87
- samsara/types/continuous_reading_alert_threshold_response_body.py +49 -0
- samsara/types/continuous_reading_alert_threshold_response_body_operation.py +7 -0
- samsara/types/continuous_reading_alert_threshold_response_body_unit.py +62 -0
- samsara/types/device_response_response_body.py +1 -1
- samsara/types/device_response_response_body_model.py +1 -0
- samsara/types/dvir_defect_get_defect_bad_gateway_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_gateway_timeout_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_internal_server_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_method_not_allowed_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_not_found_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_not_implemented_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_response_body.py +91 -0
- samsara/types/dvir_defect_get_defect_service_unavailable_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_too_many_requests_error_response_body.py +33 -0
- samsara/types/dvir_defect_get_defect_unauthorized_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_bad_gateway_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_gateway_timeout_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_internal_server_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_method_not_allowed_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_not_found_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_not_implemented_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_response_body.py +99 -0
- samsara/types/dvir_get_dvir_response_body_safety_status.py +5 -0
- samsara/types/dvir_get_dvir_response_body_type.py +5 -0
- samsara/types/dvir_get_dvir_service_unavailable_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_too_many_requests_error_response_body.py +33 -0
- samsara/types/dvir_get_dvir_unauthorized_error_response_body.py +33 -0
- samsara/types/enum_reading_alert_threshold_response_body.py +31 -0
- samsara/types/enum_value_response_body.py +31 -0
- samsara/types/equipment_gateway_engine_seconds.py +1 -1
- samsara/types/equipment_gateway_j_1939_engine_seconds.py +1 -1
- samsara/types/equipment_obd_engine_seconds.py +1 -1
- samsara/types/event_location_response_body.py +31 -0
- samsara/types/form_submission_request_field_input_object_request_body.py +7 -1
- samsara/types/form_submission_request_field_input_object_request_body_type.py +3 -1
- samsara/types/{hos_daily_logs_update_shipping_docs_response_body.py → form_submission_request_geofence_object_request_body.py} +9 -3
- samsara/types/form_submission_request_geofence_value_object_request_body.py +24 -0
- samsara/types/form_submission_response_object_response_body.py +8 -0
- samsara/types/{form_template_reference_object_request_body.py → form_template_request_object_request_body.py} +6 -4
- samsara/types/form_template_response_object_response_body.py +74 -0
- samsara/types/form_template_section_object_response_body.py +47 -0
- samsara/types/form_templates_get_form_templates_bad_gateway_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_gateway_timeout_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_internal_server_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_method_not_allowed_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_not_found_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_not_implemented_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_response_body.py +26 -0
- samsara/types/form_templates_get_form_templates_service_unavailable_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_too_many_requests_error_response_body.py +33 -0
- samsara/types/form_templates_get_form_templates_unauthorized_error_response_body.py +33 -0
- samsara/types/forms_action_object_response_body.py +43 -0
- samsara/types/forms_action_object_response_body_type.py +7 -0
- samsara/types/forms_approval_config_object_response_body.py +32 -0
- samsara/types/forms_asset_object_response_body.py +8 -1
- samsara/types/forms_check_boxes_value_object_response_body.py +7 -0
- samsara/types/forms_condition_object_response_body.py +36 -0
- samsara/types/forms_condition_object_response_body_type.py +7 -0
- samsara/types/forms_conditional_action_object_response_body.py +30 -0
- samsara/types/forms_field_definition_object_response_body.py +143 -0
- samsara/types/forms_field_definition_object_response_body_allowed_asset_types_item.py +7 -0
- samsara/types/forms_field_definition_object_response_body_allowed_date_time_value_type.py +7 -0
- samsara/types/forms_field_definition_object_response_body_type.py +22 -0
- samsara/types/forms_field_input_object_response_body.py +7 -4
- samsara/types/forms_field_input_object_response_body_type.py +20 -0
- samsara/types/forms_geofence_object_response_body.py +53 -0
- samsara/types/forms_geofence_object_response_body_entry_type.py +5 -0
- samsara/types/forms_geofence_value_object_response_body.py +24 -0
- samsara/types/forms_multiple_choice_value_object_response_body.py +8 -1
- samsara/types/forms_product_submission_approval_details_object_response_body.py +26 -0
- samsara/types/forms_select_option_object_response_body.py +47 -0
- samsara/types/forms_single_approval_config_object_response_body.py +33 -0
- samsara/types/forms_table_cell_object_response_body.py +3 -4
- samsara/types/forms_table_cell_object_response_body_type.py +8 -0
- samsara/types/forms_table_column_object_response_body.py +3 -4
- samsara/types/forms_table_column_object_response_body_type.py +8 -0
- samsara/types/forms_table_field_definition_object_response_body.py +91 -0
- samsara/types/forms_table_field_definition_object_response_body_allowed_date_time_value_type.py +7 -0
- samsara/types/forms_table_field_definition_object_response_body_type.py +8 -0
- samsara/types/fuel_cost_object_response_body.py +32 -0
- samsara/types/fuel_cost_object_response_body_currency.py +5 -0
- samsara/types/fuel_volume_response_body.py +28 -0
- samsara/types/fuel_volume_response_body_unit.py +5 -0
- samsara/types/gaseous_fuel_cost_object_response_body.py +32 -0
- samsara/types/gaseous_fuel_cost_object_response_body_currency.py +7 -0
- samsara/types/gateway_details_response_response_body.py +14 -0
- samsara/types/harsh_event_trigger_details_object_request_body_types_item.py +1 -0
- samsara/types/harsh_event_trigger_details_object_response_body_types_item.py +1 -0
- samsara/types/idling_event_object_response_body.py +101 -0
- samsara/types/idling_event_object_response_body_address_type.py +17 -0
- samsara/types/inline_response_2005.py +24 -0
- samsara/types/inline_response_2006.py +24 -0
- samsara/types/reading_definition_response_body.py +59 -0
- samsara/types/reading_history_response_body.py +47 -0
- samsara/types/reading_snapshot_response_body.py +52 -0
- samsara/types/reading_trigger_continuous_value_object_request_body.py +51 -0
- samsara/types/reading_trigger_continuous_value_object_request_body_operation.py +7 -0
- samsara/types/reading_trigger_continuous_value_object_request_body_unit.py +62 -0
- samsara/types/reading_trigger_continuous_value_object_response_body.py +51 -0
- samsara/types/reading_trigger_continuous_value_object_response_body_operation.py +7 -0
- samsara/types/reading_trigger_continuous_value_object_response_body_unit.py +62 -0
- samsara/types/reading_trigger_details_object_request_body.py +48 -0
- samsara/types/reading_trigger_details_object_response_body.py +48 -0
- samsara/types/reading_trigger_details_response_body.py +38 -0
- samsara/types/reading_trigger_enum_value_object_request_body.py +31 -0
- samsara/types/reading_trigger_enum_value_object_response_body.py +31 -0
- samsara/types/reading_type_response_body.py +34 -0
- samsara/types/reading_type_response_body_data_type.py +5 -0
- samsara/types/readings_get_readings_history_bad_gateway_error_response_body.py +33 -0
- samsara/types/{hos_daily_logs_update_shipping_docs_bad_gateway_error_response_body.py → readings_get_readings_history_gateway_timeout_error_response_body.py} +2 -2
- samsara/types/readings_get_readings_history_internal_server_error_response_body.py +33 -0
- samsara/types/readings_get_readings_history_method_not_allowed_error_response_body.py +33 -0
- samsara/types/readings_get_readings_history_not_found_error_response_body.py +33 -0
- samsara/types/readings_get_readings_history_not_implemented_error_response_body.py +33 -0
- samsara/types/readings_get_readings_history_response_body.py +26 -0
- samsara/types/readings_get_readings_history_service_unavailable_error_response_body.py +33 -0
- samsara/types/readings_get_readings_history_too_many_requests_error_response_body.py +33 -0
- samsara/types/readings_get_readings_history_unauthorized_error_response_body.py +33 -0
- samsara/types/readings_get_readings_snapshot_bad_gateway_error_response_body.py +33 -0
- samsara/types/readings_get_readings_snapshot_gateway_timeout_error_response_body.py +33 -0
- samsara/types/readings_get_readings_snapshot_internal_server_error_response_body.py +33 -0
- samsara/types/readings_get_readings_snapshot_method_not_allowed_error_response_body.py +33 -0
- samsara/types/readings_get_readings_snapshot_not_found_error_response_body.py +33 -0
- samsara/types/readings_get_readings_snapshot_not_implemented_error_response_body.py +33 -0
- samsara/types/readings_get_readings_snapshot_response_body.py +26 -0
- samsara/types/readings_get_readings_snapshot_service_unavailable_error_response_body.py +33 -0
- samsara/types/{hos_daily_logs_update_shipping_docs_unauthorized_error_response_body.py → readings_get_readings_snapshot_too_many_requests_error_response_body.py} +2 -2
- samsara/types/readings_get_readings_snapshot_unauthorized_error_response_body.py +33 -0
- samsara/types/readings_list_readings_definitions_bad_gateway_error_response_body.py +33 -0
- samsara/types/{hos_daily_logs_update_shipping_docs_too_many_requests_error_response_body.py → readings_list_readings_definitions_gateway_timeout_error_response_body.py} +2 -2
- samsara/types/readings_list_readings_definitions_internal_server_error_response_body.py +33 -0
- samsara/types/readings_list_readings_definitions_method_not_allowed_error_response_body.py +33 -0
- samsara/types/readings_list_readings_definitions_not_found_error_response_body.py +33 -0
- samsara/types/readings_list_readings_definitions_not_implemented_error_response_body.py +33 -0
- samsara/types/readings_list_readings_definitions_response_body.py +26 -0
- samsara/types/readings_list_readings_definitions_service_unavailable_error_response_body.py +33 -0
- samsara/types/{hos_daily_logs_update_shipping_docs_method_not_allowed_error_response_body.py → readings_list_readings_definitions_too_many_requests_error_response_body.py} +2 -2
- samsara/types/readings_list_readings_definitions_unauthorized_error_response_body.py +33 -0
- samsara/types/safety_score_configuration_settings_object_response_body.py +7 -0
- samsara/types/single_approval_requirements_object_response_body.py +28 -0
- samsara/types/sudden_fuel_level_drop_response_body.py +33 -0
- samsara/types/sudden_fuel_level_rise_response_body.py +33 -0
- samsara/types/trigger_params_object_request_body.py +2 -0
- samsara/types/trigger_params_object_response_body.py +2 -0
- samsara/types/unit_response_body.py +39 -0
- samsara/types/unit_response_body_base_unit.py +62 -0
- samsara/types/unit_response_body_measurement_type.py +28 -0
- samsara/types/uploaded_media_object_response_body.py +1 -1
- samsara/types/uploaded_media_object_response_body_trigger_reason.py +8 -1
- samsara/types/v_1_message.py +29 -0
- samsara/types/v_1_message_response.py +41 -0
- samsara/types/v_1_message_sender.py +27 -0
- samsara/types/v_1_messages.py +7 -0
- samsara/types/v_1_messages_response.py +7 -0
- samsara/types/webhook_response_response_body_event_types_item.py +1 -0
- samsara/types/webhooks_get_webhook_response_body_event_types_item.py +1 -0
- samsara/types/webhooks_patch_webhook_response_body_event_types_item.py +1 -0
- samsara/types/webhooks_post_webhooks_response_body_event_types_item.py +1 -0
- samsara/types/workflow_geofence_event_response_object_response_body.py +6 -0
- samsara/types/workflow_incident_details_object_response_body.py +2 -0
- samsara/types/workflow_trigger_object_request_body.py +1 -0
- samsara/types/workflow_trigger_object_response_body.py +1 -0
- samsara/user_roles/client.py +21 -11
- samsara/user_roles/raw_client.py +39 -9
- samsara/users/client.py +21 -11
- samsara/users/raw_client.py +39 -8
- samsara/v_1_messages/__init__.py +4 -0
- samsara/v_1_messages/client.py +258 -0
- samsara/v_1_messages/raw_client.py +273 -0
- samsara/vehicles/__init__.py +1 -2
- samsara/vehicles/client.py +31 -16
- samsara/vehicles/immobilizer/client.py +21 -13
- samsara/vehicles/immobilizer/raw_client.py +43 -9
- samsara/vehicles/locations/client.py +60 -32
- samsara/vehicles/locations/raw_client.py +132 -25
- samsara/vehicles/raw_client.py +61 -8
- samsara/vehicles/stats/client.py +66 -38
- samsara/vehicles/stats/raw_client.py +148 -31
- samsara/webhooks/client.py +21 -11
- samsara/webhooks/raw_client.py +41 -8
- samsara/webhooks/types/webhooks_post_webhooks_request_body_event_types_item.py +1 -0
- samsara_api-0.0.2.dist-info/METADATA +29 -0
- {samsara_api-0.0.1.dist-info → samsara_api-0.0.2.dist-info}/RECORD +328 -193
- samsara/beta/client.py +0 -161
- samsara/drivers/tachograph_activity/client.py +0 -186
- samsara/drivers/tachograph_activity/raw_client.py +0 -169
- samsara/hours_of_service/__init__.py +0 -7
- samsara/hours_of_service/client.py +0 -229
- samsara/hours_of_service/raw_client.py +0 -425
- samsara/hours_of_service/types/__init__.py +0 -9
- samsara/hours_of_service/types/hours_of_service_get_daily_logs_request_driver_activation_status.py +0 -7
- samsara/reports/ifta/vehicle/types/vehicle_get_request_quarter.py +0 -5
- samsara/reports/vehicles/fuel_energy/types/fuel_energy_get_request_energy_type.py +0 -5
- samsara/types/assets_create_asset_response_body_regulation_mode.py +0 -7
- samsara/types/assets_update_asset_response_body_regulation_mode.py +0 -7
- samsara/types/assets_update_asset_response_body_type.py +0 -7
- samsara/types/patch_shipping_docs_response_body_response_body.py +0 -93
- samsara_api-0.0.1.dist-info/METADATA +0 -214
- /samsara/{beta → forms}/__init__.py +0 -0
- /samsara/{drivers/tachograph_activity → readings}/__init__.py +0 -0
- /samsara/{drivers/tachograph_files → tachograph/driver}/__init__.py +0 -0
- /samsara/{vehicles/tachograph_files → tachograph/vehicles}/__init__.py +0 -0
- {samsara_api-0.0.1.dist-info → samsara_api-0.0.2.dist-info}/LICENSE +0 -0
- {samsara_api-0.0.1.dist-info → samsara_api-0.0.2.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager
|
|
9
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
10
|
+
from ..core.request_options import RequestOptions
|
|
11
|
+
from ..errors.bad_gateway_error import BadGatewayError
|
|
12
|
+
from ..errors.gateway_timeout_error import GatewayTimeoutError
|
|
13
|
+
from ..errors.internal_server_error import InternalServerError
|
|
14
|
+
from ..errors.method_not_allowed_error import MethodNotAllowedError
|
|
15
|
+
from ..errors.not_found_error import NotFoundError
|
|
16
|
+
from ..errors.not_implemented_error import NotImplementedError
|
|
17
|
+
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
18
|
+
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
19
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
20
|
+
from ..types.advanced_idling_get_idling_events_response_body import AdvancedIdlingGetIdlingEventsResponseBody
|
|
21
|
+
from ..types.idling_event_object_response_body import IdlingEventObjectResponseBody
|
|
22
|
+
from .types.idling_list_request_pto_state import IdlingListRequestPtoState
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RawIdlingClient:
|
|
26
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
27
|
+
self._client_wrapper = client_wrapper
|
|
28
|
+
|
|
29
|
+
def list(
|
|
30
|
+
self,
|
|
31
|
+
*,
|
|
32
|
+
start_time: str,
|
|
33
|
+
end_time: str,
|
|
34
|
+
asset_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
35
|
+
operator_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
36
|
+
pto_state: typing.Optional[IdlingListRequestPtoState] = None,
|
|
37
|
+
min_air_temperature_millicelsius: typing.Optional[int] = None,
|
|
38
|
+
max_air_temperature_millicelsius: typing.Optional[int] = None,
|
|
39
|
+
exclude_events_with_unknown_air_temperature: typing.Optional[bool] = None,
|
|
40
|
+
min_duration_milliseconds: typing.Optional[int] = None,
|
|
41
|
+
max_duration_milliseconds: typing.Optional[int] = None,
|
|
42
|
+
tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
43
|
+
parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
44
|
+
after: typing.Optional[str] = None,
|
|
45
|
+
limit: typing.Optional[int] = None,
|
|
46
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
47
|
+
) -> SyncPager[IdlingEventObjectResponseBody]:
|
|
48
|
+
"""
|
|
49
|
+
Get idling events for the requested time duration.
|
|
50
|
+
|
|
51
|
+
**Note:** The data from this endpoint comes from the new Advanced Idling Report, which provides additional data fields for each idling event such as air temperature, geofence, PTO state and minimum idle time. This endpoint will initially include data from August 1, 2024. Approx. two weeks later, this will be further back dated to January 1, 2024. If you require additional historical data, you can access it via the [vehicle idling reports API](https://developers.samsara.com/reference/getvehicleidlingreports).
|
|
52
|
+
|
|
53
|
+
<b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
54
|
+
|
|
55
|
+
To use this endpoint, select **Read Idling** under the Fuel & Energy 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>
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
**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.
|
|
59
|
+
|
|
60
|
+
Parameters
|
|
61
|
+
----------
|
|
62
|
+
start_time : str
|
|
63
|
+
The start of the time range for filtering idling events in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-11T19:00:00Z, 2015-09-12T14:00:00-04:00). Returns events that begin at or after this timestamp.
|
|
64
|
+
|
|
65
|
+
end_time : str
|
|
66
|
+
The end of the time range for filtering idling events in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:00:00Z, 2015-09-15T14:00:00-04:00). Returns events that begin before this timestamp.
|
|
67
|
+
|
|
68
|
+
asset_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
69
|
+
A filter on the data based on this comma-separated list of asset IDs. Asset IDs only include vehicle IDs at this time.
|
|
70
|
+
|
|
71
|
+
operator_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
72
|
+
A filter on the data based on this comma-separated list of operator IDs. Operator IDs only include driver IDs at this time.
|
|
73
|
+
|
|
74
|
+
pto_state : typing.Optional[IdlingListRequestPtoState]
|
|
75
|
+
A filter on the data on this PTO (Power Take-Off) state. If no specific state is provided, data including any state will be included. Valid values: `active`, `inactive`
|
|
76
|
+
|
|
77
|
+
min_air_temperature_millicelsius : typing.Optional[int]
|
|
78
|
+
A filter on the data based on the minimum value of air temperature in millicelsius. The acceptable range for this value is between -20,000 and 50,000 millicelsius.
|
|
79
|
+
|
|
80
|
+
max_air_temperature_millicelsius : typing.Optional[int]
|
|
81
|
+
A filter on the data based on the maximum value of air temperature in millicelsius. The acceptable range for this value is between -20,000 and 50,000 millicelsius.
|
|
82
|
+
|
|
83
|
+
exclude_events_with_unknown_air_temperature : typing.Optional[bool]
|
|
84
|
+
A filter on the data based on unknown air temperature value.
|
|
85
|
+
|
|
86
|
+
min_duration_milliseconds : typing.Optional[int]
|
|
87
|
+
A filter on the data based on the minimum value of Idling duration in milliseconds. The acceptable range for this value is between 2 minutes and 24 hours.
|
|
88
|
+
|
|
89
|
+
max_duration_milliseconds : typing.Optional[int]
|
|
90
|
+
A filter on the data based on the maximum value of Idling duration in milliseconds. The acceptable range for this value is between 2 minutes and 24 hours.
|
|
91
|
+
|
|
92
|
+
tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
93
|
+
A filter on the data based on this comma-separated list of tag IDs. Tag IDs only include vehicle IDs at this time.
|
|
94
|
+
|
|
95
|
+
parent_tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
96
|
+
A filter on the data based on this comma-separated list of parent tag IDs. Parent tag IDs only include vehicle IDs at this time.
|
|
97
|
+
|
|
98
|
+
after : typing.Optional[str]
|
|
99
|
+
If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
|
|
100
|
+
|
|
101
|
+
limit : typing.Optional[int]
|
|
102
|
+
The limit for how many objects will be in the response. Default and max for this value is 200 objects.
|
|
103
|
+
|
|
104
|
+
request_options : typing.Optional[RequestOptions]
|
|
105
|
+
Request-specific configuration.
|
|
106
|
+
|
|
107
|
+
Returns
|
|
108
|
+
-------
|
|
109
|
+
SyncPager[IdlingEventObjectResponseBody]
|
|
110
|
+
OK response.
|
|
111
|
+
"""
|
|
112
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
113
|
+
"idling/events",
|
|
114
|
+
method="GET",
|
|
115
|
+
params={
|
|
116
|
+
"startTime": start_time,
|
|
117
|
+
"endTime": end_time,
|
|
118
|
+
"assetIds": asset_ids,
|
|
119
|
+
"operatorIds": operator_ids,
|
|
120
|
+
"ptoState": pto_state,
|
|
121
|
+
"minAirTemperatureMillicelsius": min_air_temperature_millicelsius,
|
|
122
|
+
"maxAirTemperatureMillicelsius": max_air_temperature_millicelsius,
|
|
123
|
+
"excludeEventsWithUnknownAirTemperature": exclude_events_with_unknown_air_temperature,
|
|
124
|
+
"minDurationMilliseconds": min_duration_milliseconds,
|
|
125
|
+
"maxDurationMilliseconds": max_duration_milliseconds,
|
|
126
|
+
"tagIds": tag_ids,
|
|
127
|
+
"parentTagIds": parent_tag_ids,
|
|
128
|
+
"after": after,
|
|
129
|
+
"limit": limit,
|
|
130
|
+
},
|
|
131
|
+
request_options=request_options,
|
|
132
|
+
)
|
|
133
|
+
try:
|
|
134
|
+
if 200 <= _response.status_code < 300:
|
|
135
|
+
_parsed_response = typing.cast(
|
|
136
|
+
AdvancedIdlingGetIdlingEventsResponseBody,
|
|
137
|
+
parse_obj_as(
|
|
138
|
+
type_=AdvancedIdlingGetIdlingEventsResponseBody, # type: ignore
|
|
139
|
+
object_=_response.json(),
|
|
140
|
+
),
|
|
141
|
+
)
|
|
142
|
+
_items = _parsed_response.data
|
|
143
|
+
_has_next = False
|
|
144
|
+
_get_next = None
|
|
145
|
+
if _parsed_response.pagination is not None:
|
|
146
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
147
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
148
|
+
_get_next = lambda: self.list(
|
|
149
|
+
start_time=start_time,
|
|
150
|
+
end_time=end_time,
|
|
151
|
+
asset_ids=asset_ids,
|
|
152
|
+
operator_ids=operator_ids,
|
|
153
|
+
pto_state=pto_state,
|
|
154
|
+
min_air_temperature_millicelsius=min_air_temperature_millicelsius,
|
|
155
|
+
max_air_temperature_millicelsius=max_air_temperature_millicelsius,
|
|
156
|
+
exclude_events_with_unknown_air_temperature=exclude_events_with_unknown_air_temperature,
|
|
157
|
+
min_duration_milliseconds=min_duration_milliseconds,
|
|
158
|
+
max_duration_milliseconds=max_duration_milliseconds,
|
|
159
|
+
tag_ids=tag_ids,
|
|
160
|
+
parent_tag_ids=parent_tag_ids,
|
|
161
|
+
after=_parsed_next,
|
|
162
|
+
limit=limit,
|
|
163
|
+
request_options=request_options,
|
|
164
|
+
)
|
|
165
|
+
return SyncPager(
|
|
166
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
167
|
+
)
|
|
168
|
+
if _response.status_code == 401:
|
|
169
|
+
raise UnauthorizedError(
|
|
170
|
+
headers=dict(_response.headers),
|
|
171
|
+
body=typing.cast(
|
|
172
|
+
typing.Optional[typing.Any],
|
|
173
|
+
parse_obj_as(
|
|
174
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
175
|
+
object_=_response.json(),
|
|
176
|
+
),
|
|
177
|
+
),
|
|
178
|
+
)
|
|
179
|
+
if _response.status_code == 404:
|
|
180
|
+
raise NotFoundError(
|
|
181
|
+
headers=dict(_response.headers),
|
|
182
|
+
body=typing.cast(
|
|
183
|
+
typing.Optional[typing.Any],
|
|
184
|
+
parse_obj_as(
|
|
185
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
186
|
+
object_=_response.json(),
|
|
187
|
+
),
|
|
188
|
+
),
|
|
189
|
+
)
|
|
190
|
+
if _response.status_code == 405:
|
|
191
|
+
raise MethodNotAllowedError(
|
|
192
|
+
headers=dict(_response.headers),
|
|
193
|
+
body=typing.cast(
|
|
194
|
+
typing.Optional[typing.Any],
|
|
195
|
+
parse_obj_as(
|
|
196
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
197
|
+
object_=_response.json(),
|
|
198
|
+
),
|
|
199
|
+
),
|
|
200
|
+
)
|
|
201
|
+
if _response.status_code == 429:
|
|
202
|
+
raise TooManyRequestsError(
|
|
203
|
+
headers=dict(_response.headers),
|
|
204
|
+
body=typing.cast(
|
|
205
|
+
typing.Optional[typing.Any],
|
|
206
|
+
parse_obj_as(
|
|
207
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
208
|
+
object_=_response.json(),
|
|
209
|
+
),
|
|
210
|
+
),
|
|
211
|
+
)
|
|
212
|
+
if _response.status_code == 500:
|
|
213
|
+
raise InternalServerError(
|
|
214
|
+
headers=dict(_response.headers),
|
|
215
|
+
body=typing.cast(
|
|
216
|
+
typing.Optional[typing.Any],
|
|
217
|
+
parse_obj_as(
|
|
218
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
219
|
+
object_=_response.json(),
|
|
220
|
+
),
|
|
221
|
+
),
|
|
222
|
+
)
|
|
223
|
+
if _response.status_code == 501:
|
|
224
|
+
raise NotImplementedError(
|
|
225
|
+
headers=dict(_response.headers),
|
|
226
|
+
body=typing.cast(
|
|
227
|
+
typing.Optional[typing.Any],
|
|
228
|
+
parse_obj_as(
|
|
229
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
230
|
+
object_=_response.json(),
|
|
231
|
+
),
|
|
232
|
+
),
|
|
233
|
+
)
|
|
234
|
+
if _response.status_code == 502:
|
|
235
|
+
raise BadGatewayError(
|
|
236
|
+
headers=dict(_response.headers),
|
|
237
|
+
body=typing.cast(
|
|
238
|
+
typing.Optional[typing.Any],
|
|
239
|
+
parse_obj_as(
|
|
240
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
241
|
+
object_=_response.json(),
|
|
242
|
+
),
|
|
243
|
+
),
|
|
244
|
+
)
|
|
245
|
+
if _response.status_code == 503:
|
|
246
|
+
raise ServiceUnavailableError(
|
|
247
|
+
headers=dict(_response.headers),
|
|
248
|
+
body=typing.cast(
|
|
249
|
+
typing.Optional[typing.Any],
|
|
250
|
+
parse_obj_as(
|
|
251
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
252
|
+
object_=_response.json(),
|
|
253
|
+
),
|
|
254
|
+
),
|
|
255
|
+
)
|
|
256
|
+
if _response.status_code == 504:
|
|
257
|
+
raise GatewayTimeoutError(
|
|
258
|
+
headers=dict(_response.headers),
|
|
259
|
+
body=typing.cast(
|
|
260
|
+
typing.Optional[typing.Any],
|
|
261
|
+
parse_obj_as(
|
|
262
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
263
|
+
object_=_response.json(),
|
|
264
|
+
),
|
|
265
|
+
),
|
|
266
|
+
)
|
|
267
|
+
_response_json = _response.json()
|
|
268
|
+
except JSONDecodeError:
|
|
269
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
270
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class AsyncRawIdlingClient:
|
|
274
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
275
|
+
self._client_wrapper = client_wrapper
|
|
276
|
+
|
|
277
|
+
async def list(
|
|
278
|
+
self,
|
|
279
|
+
*,
|
|
280
|
+
start_time: str,
|
|
281
|
+
end_time: str,
|
|
282
|
+
asset_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
283
|
+
operator_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
284
|
+
pto_state: typing.Optional[IdlingListRequestPtoState] = None,
|
|
285
|
+
min_air_temperature_millicelsius: typing.Optional[int] = None,
|
|
286
|
+
max_air_temperature_millicelsius: typing.Optional[int] = None,
|
|
287
|
+
exclude_events_with_unknown_air_temperature: typing.Optional[bool] = None,
|
|
288
|
+
min_duration_milliseconds: typing.Optional[int] = None,
|
|
289
|
+
max_duration_milliseconds: typing.Optional[int] = None,
|
|
290
|
+
tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
291
|
+
parent_tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
292
|
+
after: typing.Optional[str] = None,
|
|
293
|
+
limit: typing.Optional[int] = None,
|
|
294
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
295
|
+
) -> AsyncPager[IdlingEventObjectResponseBody]:
|
|
296
|
+
"""
|
|
297
|
+
Get idling events for the requested time duration.
|
|
298
|
+
|
|
299
|
+
**Note:** The data from this endpoint comes from the new Advanced Idling Report, which provides additional data fields for each idling event such as air temperature, geofence, PTO state and minimum idle time. This endpoint will initially include data from August 1, 2024. Approx. two weeks later, this will be further back dated to January 1, 2024. If you require additional historical data, you can access it via the [vehicle idling reports API](https://developers.samsara.com/reference/getvehicleidlingreports).
|
|
300
|
+
|
|
301
|
+
<b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).
|
|
302
|
+
|
|
303
|
+
To use this endpoint, select **Read Idling** under the Fuel & Energy 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>
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
**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.
|
|
307
|
+
|
|
308
|
+
Parameters
|
|
309
|
+
----------
|
|
310
|
+
start_time : str
|
|
311
|
+
The start of the time range for filtering idling events in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-11T19:00:00Z, 2015-09-12T14:00:00-04:00). Returns events that begin at or after this timestamp.
|
|
312
|
+
|
|
313
|
+
end_time : str
|
|
314
|
+
The end of the time range for filtering idling events in RFC 3339 format. Millisecond precision and timezones are supported. (Examples: 2019-06-13T19:00:00Z, 2015-09-15T14:00:00-04:00). Returns events that begin before this timestamp.
|
|
315
|
+
|
|
316
|
+
asset_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
317
|
+
A filter on the data based on this comma-separated list of asset IDs. Asset IDs only include vehicle IDs at this time.
|
|
318
|
+
|
|
319
|
+
operator_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
320
|
+
A filter on the data based on this comma-separated list of operator IDs. Operator IDs only include driver IDs at this time.
|
|
321
|
+
|
|
322
|
+
pto_state : typing.Optional[IdlingListRequestPtoState]
|
|
323
|
+
A filter on the data on this PTO (Power Take-Off) state. If no specific state is provided, data including any state will be included. Valid values: `active`, `inactive`
|
|
324
|
+
|
|
325
|
+
min_air_temperature_millicelsius : typing.Optional[int]
|
|
326
|
+
A filter on the data based on the minimum value of air temperature in millicelsius. The acceptable range for this value is between -20,000 and 50,000 millicelsius.
|
|
327
|
+
|
|
328
|
+
max_air_temperature_millicelsius : typing.Optional[int]
|
|
329
|
+
A filter on the data based on the maximum value of air temperature in millicelsius. The acceptable range for this value is between -20,000 and 50,000 millicelsius.
|
|
330
|
+
|
|
331
|
+
exclude_events_with_unknown_air_temperature : typing.Optional[bool]
|
|
332
|
+
A filter on the data based on unknown air temperature value.
|
|
333
|
+
|
|
334
|
+
min_duration_milliseconds : typing.Optional[int]
|
|
335
|
+
A filter on the data based on the minimum value of Idling duration in milliseconds. The acceptable range for this value is between 2 minutes and 24 hours.
|
|
336
|
+
|
|
337
|
+
max_duration_milliseconds : typing.Optional[int]
|
|
338
|
+
A filter on the data based on the maximum value of Idling duration in milliseconds. The acceptable range for this value is between 2 minutes and 24 hours.
|
|
339
|
+
|
|
340
|
+
tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
341
|
+
A filter on the data based on this comma-separated list of tag IDs. Tag IDs only include vehicle IDs at this time.
|
|
342
|
+
|
|
343
|
+
parent_tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]]
|
|
344
|
+
A filter on the data based on this comma-separated list of parent tag IDs. Parent tag IDs only include vehicle IDs at this time.
|
|
345
|
+
|
|
346
|
+
after : typing.Optional[str]
|
|
347
|
+
If specified, this should be the endCursor value from the previous page of results. When present, this request will return the next page of results that occur immediately after the previous page of results.
|
|
348
|
+
|
|
349
|
+
limit : typing.Optional[int]
|
|
350
|
+
The limit for how many objects will be in the response. Default and max for this value is 200 objects.
|
|
351
|
+
|
|
352
|
+
request_options : typing.Optional[RequestOptions]
|
|
353
|
+
Request-specific configuration.
|
|
354
|
+
|
|
355
|
+
Returns
|
|
356
|
+
-------
|
|
357
|
+
AsyncPager[IdlingEventObjectResponseBody]
|
|
358
|
+
OK response.
|
|
359
|
+
"""
|
|
360
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
361
|
+
"idling/events",
|
|
362
|
+
method="GET",
|
|
363
|
+
params={
|
|
364
|
+
"startTime": start_time,
|
|
365
|
+
"endTime": end_time,
|
|
366
|
+
"assetIds": asset_ids,
|
|
367
|
+
"operatorIds": operator_ids,
|
|
368
|
+
"ptoState": pto_state,
|
|
369
|
+
"minAirTemperatureMillicelsius": min_air_temperature_millicelsius,
|
|
370
|
+
"maxAirTemperatureMillicelsius": max_air_temperature_millicelsius,
|
|
371
|
+
"excludeEventsWithUnknownAirTemperature": exclude_events_with_unknown_air_temperature,
|
|
372
|
+
"minDurationMilliseconds": min_duration_milliseconds,
|
|
373
|
+
"maxDurationMilliseconds": max_duration_milliseconds,
|
|
374
|
+
"tagIds": tag_ids,
|
|
375
|
+
"parentTagIds": parent_tag_ids,
|
|
376
|
+
"after": after,
|
|
377
|
+
"limit": limit,
|
|
378
|
+
},
|
|
379
|
+
request_options=request_options,
|
|
380
|
+
)
|
|
381
|
+
try:
|
|
382
|
+
if 200 <= _response.status_code < 300:
|
|
383
|
+
_parsed_response = typing.cast(
|
|
384
|
+
AdvancedIdlingGetIdlingEventsResponseBody,
|
|
385
|
+
parse_obj_as(
|
|
386
|
+
type_=AdvancedIdlingGetIdlingEventsResponseBody, # type: ignore
|
|
387
|
+
object_=_response.json(),
|
|
388
|
+
),
|
|
389
|
+
)
|
|
390
|
+
_items = _parsed_response.data
|
|
391
|
+
_has_next = False
|
|
392
|
+
_get_next = None
|
|
393
|
+
if _parsed_response.pagination is not None:
|
|
394
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
395
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
396
|
+
|
|
397
|
+
async def _get_next():
|
|
398
|
+
return await self.list(
|
|
399
|
+
start_time=start_time,
|
|
400
|
+
end_time=end_time,
|
|
401
|
+
asset_ids=asset_ids,
|
|
402
|
+
operator_ids=operator_ids,
|
|
403
|
+
pto_state=pto_state,
|
|
404
|
+
min_air_temperature_millicelsius=min_air_temperature_millicelsius,
|
|
405
|
+
max_air_temperature_millicelsius=max_air_temperature_millicelsius,
|
|
406
|
+
exclude_events_with_unknown_air_temperature=exclude_events_with_unknown_air_temperature,
|
|
407
|
+
min_duration_milliseconds=min_duration_milliseconds,
|
|
408
|
+
max_duration_milliseconds=max_duration_milliseconds,
|
|
409
|
+
tag_ids=tag_ids,
|
|
410
|
+
parent_tag_ids=parent_tag_ids,
|
|
411
|
+
after=_parsed_next,
|
|
412
|
+
limit=limit,
|
|
413
|
+
request_options=request_options,
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
return AsyncPager(
|
|
417
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
418
|
+
)
|
|
419
|
+
if _response.status_code == 401:
|
|
420
|
+
raise UnauthorizedError(
|
|
421
|
+
headers=dict(_response.headers),
|
|
422
|
+
body=typing.cast(
|
|
423
|
+
typing.Optional[typing.Any],
|
|
424
|
+
parse_obj_as(
|
|
425
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
426
|
+
object_=_response.json(),
|
|
427
|
+
),
|
|
428
|
+
),
|
|
429
|
+
)
|
|
430
|
+
if _response.status_code == 404:
|
|
431
|
+
raise NotFoundError(
|
|
432
|
+
headers=dict(_response.headers),
|
|
433
|
+
body=typing.cast(
|
|
434
|
+
typing.Optional[typing.Any],
|
|
435
|
+
parse_obj_as(
|
|
436
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
437
|
+
object_=_response.json(),
|
|
438
|
+
),
|
|
439
|
+
),
|
|
440
|
+
)
|
|
441
|
+
if _response.status_code == 405:
|
|
442
|
+
raise MethodNotAllowedError(
|
|
443
|
+
headers=dict(_response.headers),
|
|
444
|
+
body=typing.cast(
|
|
445
|
+
typing.Optional[typing.Any],
|
|
446
|
+
parse_obj_as(
|
|
447
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
448
|
+
object_=_response.json(),
|
|
449
|
+
),
|
|
450
|
+
),
|
|
451
|
+
)
|
|
452
|
+
if _response.status_code == 429:
|
|
453
|
+
raise TooManyRequestsError(
|
|
454
|
+
headers=dict(_response.headers),
|
|
455
|
+
body=typing.cast(
|
|
456
|
+
typing.Optional[typing.Any],
|
|
457
|
+
parse_obj_as(
|
|
458
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
459
|
+
object_=_response.json(),
|
|
460
|
+
),
|
|
461
|
+
),
|
|
462
|
+
)
|
|
463
|
+
if _response.status_code == 500:
|
|
464
|
+
raise InternalServerError(
|
|
465
|
+
headers=dict(_response.headers),
|
|
466
|
+
body=typing.cast(
|
|
467
|
+
typing.Optional[typing.Any],
|
|
468
|
+
parse_obj_as(
|
|
469
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
470
|
+
object_=_response.json(),
|
|
471
|
+
),
|
|
472
|
+
),
|
|
473
|
+
)
|
|
474
|
+
if _response.status_code == 501:
|
|
475
|
+
raise NotImplementedError(
|
|
476
|
+
headers=dict(_response.headers),
|
|
477
|
+
body=typing.cast(
|
|
478
|
+
typing.Optional[typing.Any],
|
|
479
|
+
parse_obj_as(
|
|
480
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
481
|
+
object_=_response.json(),
|
|
482
|
+
),
|
|
483
|
+
),
|
|
484
|
+
)
|
|
485
|
+
if _response.status_code == 502:
|
|
486
|
+
raise BadGatewayError(
|
|
487
|
+
headers=dict(_response.headers),
|
|
488
|
+
body=typing.cast(
|
|
489
|
+
typing.Optional[typing.Any],
|
|
490
|
+
parse_obj_as(
|
|
491
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
492
|
+
object_=_response.json(),
|
|
493
|
+
),
|
|
494
|
+
),
|
|
495
|
+
)
|
|
496
|
+
if _response.status_code == 503:
|
|
497
|
+
raise ServiceUnavailableError(
|
|
498
|
+
headers=dict(_response.headers),
|
|
499
|
+
body=typing.cast(
|
|
500
|
+
typing.Optional[typing.Any],
|
|
501
|
+
parse_obj_as(
|
|
502
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
503
|
+
object_=_response.json(),
|
|
504
|
+
),
|
|
505
|
+
),
|
|
506
|
+
)
|
|
507
|
+
if _response.status_code == 504:
|
|
508
|
+
raise GatewayTimeoutError(
|
|
509
|
+
headers=dict(_response.headers),
|
|
510
|
+
body=typing.cast(
|
|
511
|
+
typing.Optional[typing.Any],
|
|
512
|
+
parse_obj_as(
|
|
513
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
514
|
+
object_=_response.json(),
|
|
515
|
+
),
|
|
516
|
+
),
|
|
517
|
+
)
|
|
518
|
+
_response_json = _response.json()
|
|
519
|
+
except JSONDecodeError:
|
|
520
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
521
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
samsara/inputs/client.py
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.pagination import AsyncPager, SyncPager
|
|
6
7
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..types.
|
|
8
|
+
from ..types.assets_inputs_response_response_body import AssetsInputsResponseResponseBody
|
|
8
9
|
from .raw_client import AsyncRawInputsClient, RawInputsClient
|
|
9
10
|
from .types.inputs_stream_request_type import InputsStreamRequestType
|
|
10
11
|
|
|
@@ -36,7 +37,7 @@ class InputsClient:
|
|
|
36
37
|
include_tags: typing.Optional[bool] = None,
|
|
37
38
|
include_attributes: typing.Optional[bool] = None,
|
|
38
39
|
request_options: typing.Optional[RequestOptions] = None,
|
|
39
|
-
) ->
|
|
40
|
+
) -> SyncPager[AssetsInputsResponseResponseBody]:
|
|
40
41
|
"""
|
|
41
42
|
This endpoint will return data collected from the inputs of your organization's assets based on the time parameters passed in. Results are paginated. If you include an endTime, the endpoint will return data up until that point. If you don’t include an endTime, you can continue to poll the API real-time with the pagination cursor that gets returned on every call. The endpoint will only return data up until the endTime that has been processed by the server at the time of the original request. You will need to request the same [startTime, endTime) range again to receive data for assets processed after the original request time. This endpoint sorts data by time ascending.
|
|
42
43
|
|
|
@@ -78,7 +79,7 @@ class InputsClient:
|
|
|
78
79
|
|
|
79
80
|
Returns
|
|
80
81
|
-------
|
|
81
|
-
|
|
82
|
+
SyncPager[AssetsInputsResponseResponseBody]
|
|
82
83
|
OK response.
|
|
83
84
|
|
|
84
85
|
Examples
|
|
@@ -88,12 +89,17 @@ class InputsClient:
|
|
|
88
89
|
client = Samsara(
|
|
89
90
|
token="YOUR_TOKEN",
|
|
90
91
|
)
|
|
91
|
-
client.inputs.stream(
|
|
92
|
+
response = client.inputs.stream(
|
|
92
93
|
type="auxInput1",
|
|
93
94
|
start_time="startTime",
|
|
94
95
|
)
|
|
96
|
+
for item in response:
|
|
97
|
+
yield item
|
|
98
|
+
# alternatively, you can paginate page-by-page
|
|
99
|
+
for page in response.iter_pages():
|
|
100
|
+
yield page
|
|
95
101
|
"""
|
|
96
|
-
|
|
102
|
+
return self._raw_client.stream(
|
|
97
103
|
type=type,
|
|
98
104
|
start_time=start_time,
|
|
99
105
|
ids=ids,
|
|
@@ -104,7 +110,6 @@ class InputsClient:
|
|
|
104
110
|
include_attributes=include_attributes,
|
|
105
111
|
request_options=request_options,
|
|
106
112
|
)
|
|
107
|
-
return _response.data
|
|
108
113
|
|
|
109
114
|
|
|
110
115
|
class AsyncInputsClient:
|
|
@@ -134,7 +139,7 @@ class AsyncInputsClient:
|
|
|
134
139
|
include_tags: typing.Optional[bool] = None,
|
|
135
140
|
include_attributes: typing.Optional[bool] = None,
|
|
136
141
|
request_options: typing.Optional[RequestOptions] = None,
|
|
137
|
-
) ->
|
|
142
|
+
) -> AsyncPager[AssetsInputsResponseResponseBody]:
|
|
138
143
|
"""
|
|
139
144
|
This endpoint will return data collected from the inputs of your organization's assets based on the time parameters passed in. Results are paginated. If you include an endTime, the endpoint will return data up until that point. If you don’t include an endTime, you can continue to poll the API real-time with the pagination cursor that gets returned on every call. The endpoint will only return data up until the endTime that has been processed by the server at the time of the original request. You will need to request the same [startTime, endTime) range again to receive data for assets processed after the original request time. This endpoint sorts data by time ascending.
|
|
140
145
|
|
|
@@ -176,7 +181,7 @@ class AsyncInputsClient:
|
|
|
176
181
|
|
|
177
182
|
Returns
|
|
178
183
|
-------
|
|
179
|
-
|
|
184
|
+
AsyncPager[AssetsInputsResponseResponseBody]
|
|
180
185
|
OK response.
|
|
181
186
|
|
|
182
187
|
Examples
|
|
@@ -191,15 +196,21 @@ class AsyncInputsClient:
|
|
|
191
196
|
|
|
192
197
|
|
|
193
198
|
async def main() -> None:
|
|
194
|
-
await client.inputs.stream(
|
|
199
|
+
response = await client.inputs.stream(
|
|
195
200
|
type="auxInput1",
|
|
196
201
|
start_time="startTime",
|
|
197
202
|
)
|
|
203
|
+
async for item in response:
|
|
204
|
+
yield item
|
|
205
|
+
|
|
206
|
+
# alternatively, you can paginate page-by-page
|
|
207
|
+
async for page in response.iter_pages():
|
|
208
|
+
yield page
|
|
198
209
|
|
|
199
210
|
|
|
200
211
|
asyncio.run(main())
|
|
201
212
|
"""
|
|
202
|
-
|
|
213
|
+
return await self._raw_client.stream(
|
|
203
214
|
type=type,
|
|
204
215
|
start_time=start_time,
|
|
205
216
|
ids=ids,
|
|
@@ -210,4 +221,3 @@ class AsyncInputsClient:
|
|
|
210
221
|
include_attributes=include_attributes,
|
|
211
222
|
request_options=request_options,
|
|
212
223
|
)
|
|
213
|
-
return _response.data
|