samsara-api 0.0.1__py3-none-any.whl → 0.0.3__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/work_order_item_object_request_body.py +1 -1
- samsara/types/work_order_item_object_request_body_type.py +10 -1
- samsara/types/work_order_item_object_response_body.py +1 -1
- samsara/types/work_order_item_object_response_body_type.py +10 -1
- 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.1.dist-info → samsara_api-0.0.3.dist-info}/METADATA +25 -18
- {samsara_api-0.0.1.dist-info → samsara_api-0.0.3.dist-info}/RECORD +332 -197
- 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/{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.3.dist-info}/LICENSE +0 -0
- {samsara_api-0.0.1.dist-info → samsara_api-0.0.3.dist-info}/WHEEL +0 -0
|
@@ -5,7 +5,7 @@ from json.decoder import JSONDecodeError
|
|
|
5
5
|
|
|
6
6
|
from ...core.api_error import ApiError
|
|
7
7
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
-
from ...core.
|
|
8
|
+
from ...core.pagination import AsyncPager, BaseHttpResponse, SyncPager
|
|
9
9
|
from ...core.pydantic_utilities import parse_obj_as
|
|
10
10
|
from ...core.request_options import RequestOptions
|
|
11
11
|
from ...errors.bad_gateway_error import BadGatewayError
|
|
@@ -20,6 +20,7 @@ from ...errors.unauthorized_error import UnauthorizedError
|
|
|
20
20
|
from ...types.location_and_speed_get_location_and_speed_response_body import (
|
|
21
21
|
LocationAndSpeedGetLocationAndSpeedResponseBody,
|
|
22
22
|
)
|
|
23
|
+
from ...types.location_and_speed_response_response_body import LocationAndSpeedResponseResponseBody
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class RawLocationAndSpeedClient:
|
|
@@ -39,7 +40,7 @@ class RawLocationAndSpeedClient:
|
|
|
39
40
|
include_geofence_lookup: typing.Optional[bool] = None,
|
|
40
41
|
include_external_ids: typing.Optional[bool] = None,
|
|
41
42
|
request_options: typing.Optional[RequestOptions] = None,
|
|
42
|
-
) ->
|
|
43
|
+
) -> SyncPager[LocationAndSpeedResponseResponseBody]:
|
|
43
44
|
"""
|
|
44
45
|
This endpoint will return asset locations and speed data that has been collected for your organization 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 the time-series data by device.
|
|
45
46
|
|
|
@@ -84,7 +85,7 @@ class RawLocationAndSpeedClient:
|
|
|
84
85
|
|
|
85
86
|
Returns
|
|
86
87
|
-------
|
|
87
|
-
|
|
88
|
+
SyncPager[LocationAndSpeedResponseResponseBody]
|
|
88
89
|
OK response.
|
|
89
90
|
"""
|
|
90
91
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -105,14 +106,34 @@ class RawLocationAndSpeedClient:
|
|
|
105
106
|
)
|
|
106
107
|
try:
|
|
107
108
|
if 200 <= _response.status_code < 300:
|
|
108
|
-
|
|
109
|
+
_parsed_response = typing.cast(
|
|
109
110
|
LocationAndSpeedGetLocationAndSpeedResponseBody,
|
|
110
111
|
parse_obj_as(
|
|
111
112
|
type_=LocationAndSpeedGetLocationAndSpeedResponseBody, # type: ignore
|
|
112
113
|
object_=_response.json(),
|
|
113
114
|
),
|
|
114
115
|
)
|
|
115
|
-
|
|
116
|
+
_items = _parsed_response.data
|
|
117
|
+
_has_next = False
|
|
118
|
+
_get_next = None
|
|
119
|
+
if _parsed_response.pagination is not None:
|
|
120
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
121
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
122
|
+
_get_next = lambda: self.stream(
|
|
123
|
+
after=_parsed_next,
|
|
124
|
+
limit=limit,
|
|
125
|
+
start_time=start_time,
|
|
126
|
+
end_time=end_time,
|
|
127
|
+
ids=ids,
|
|
128
|
+
include_speed=include_speed,
|
|
129
|
+
include_reverse_geo=include_reverse_geo,
|
|
130
|
+
include_geofence_lookup=include_geofence_lookup,
|
|
131
|
+
include_external_ids=include_external_ids,
|
|
132
|
+
request_options=request_options,
|
|
133
|
+
)
|
|
134
|
+
return SyncPager(
|
|
135
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
136
|
+
)
|
|
116
137
|
if _response.status_code == 401:
|
|
117
138
|
raise UnauthorizedError(
|
|
118
139
|
headers=dict(_response.headers),
|
|
@@ -235,7 +256,7 @@ class AsyncRawLocationAndSpeedClient:
|
|
|
235
256
|
include_geofence_lookup: typing.Optional[bool] = None,
|
|
236
257
|
include_external_ids: typing.Optional[bool] = None,
|
|
237
258
|
request_options: typing.Optional[RequestOptions] = None,
|
|
238
|
-
) ->
|
|
259
|
+
) -> AsyncPager[LocationAndSpeedResponseResponseBody]:
|
|
239
260
|
"""
|
|
240
261
|
This endpoint will return asset locations and speed data that has been collected for your organization 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 the time-series data by device.
|
|
241
262
|
|
|
@@ -280,7 +301,7 @@ class AsyncRawLocationAndSpeedClient:
|
|
|
280
301
|
|
|
281
302
|
Returns
|
|
282
303
|
-------
|
|
283
|
-
|
|
304
|
+
AsyncPager[LocationAndSpeedResponseResponseBody]
|
|
284
305
|
OK response.
|
|
285
306
|
"""
|
|
286
307
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -301,14 +322,37 @@ class AsyncRawLocationAndSpeedClient:
|
|
|
301
322
|
)
|
|
302
323
|
try:
|
|
303
324
|
if 200 <= _response.status_code < 300:
|
|
304
|
-
|
|
325
|
+
_parsed_response = typing.cast(
|
|
305
326
|
LocationAndSpeedGetLocationAndSpeedResponseBody,
|
|
306
327
|
parse_obj_as(
|
|
307
328
|
type_=LocationAndSpeedGetLocationAndSpeedResponseBody, # type: ignore
|
|
308
329
|
object_=_response.json(),
|
|
309
330
|
),
|
|
310
331
|
)
|
|
311
|
-
|
|
332
|
+
_items = _parsed_response.data
|
|
333
|
+
_has_next = False
|
|
334
|
+
_get_next = None
|
|
335
|
+
if _parsed_response.pagination is not None:
|
|
336
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
337
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
338
|
+
|
|
339
|
+
async def _get_next():
|
|
340
|
+
return await self.stream(
|
|
341
|
+
after=_parsed_next,
|
|
342
|
+
limit=limit,
|
|
343
|
+
start_time=start_time,
|
|
344
|
+
end_time=end_time,
|
|
345
|
+
ids=ids,
|
|
346
|
+
include_speed=include_speed,
|
|
347
|
+
include_reverse_geo=include_reverse_geo,
|
|
348
|
+
include_geofence_lookup=include_geofence_lookup,
|
|
349
|
+
include_external_ids=include_external_ids,
|
|
350
|
+
request_options=request_options,
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
return AsyncPager(
|
|
354
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
355
|
+
)
|
|
312
356
|
if _response.status_code == 401:
|
|
313
357
|
raise UnauthorizedError(
|
|
314
358
|
headers=dict(_response.headers),
|
samsara/assets/raw_client.py
CHANGED
|
@@ -6,6 +6,7 @@ from json.decoder import JSONDecodeError
|
|
|
6
6
|
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
|
+
from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager
|
|
9
10
|
from ..core.pydantic_utilities import parse_obj_as
|
|
10
11
|
from ..core.request_options import RequestOptions
|
|
11
12
|
from ..errors.bad_gateway_error import BadGatewayError
|
|
@@ -17,6 +18,7 @@ from ..errors.not_implemented_error import NotImplementedError
|
|
|
17
18
|
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
18
19
|
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
19
20
|
from ..errors.unauthorized_error import UnauthorizedError
|
|
21
|
+
from ..types.asset_response_body import AssetResponseBody
|
|
20
22
|
from ..types.assets_create_asset_response_body import AssetsCreateAssetResponseBody
|
|
21
23
|
from ..types.assets_list_assets_response_body import AssetsListAssetsResponseBody
|
|
22
24
|
from ..types.assets_update_asset_response_body import AssetsUpdateAssetResponseBody
|
|
@@ -47,7 +49,7 @@ class RawAssetsClient:
|
|
|
47
49
|
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
48
50
|
attribute_value_ids: typing.Optional[str] = None,
|
|
49
51
|
request_options: typing.Optional[RequestOptions] = None,
|
|
50
|
-
) ->
|
|
52
|
+
) -> SyncPager[AssetResponseBody]:
|
|
51
53
|
"""
|
|
52
54
|
List all assets. Up to 300 assets will be returned per page.
|
|
53
55
|
|
|
@@ -92,7 +94,7 @@ class RawAssetsClient:
|
|
|
92
94
|
|
|
93
95
|
Returns
|
|
94
96
|
-------
|
|
95
|
-
|
|
97
|
+
SyncPager[AssetResponseBody]
|
|
96
98
|
OK response.
|
|
97
99
|
"""
|
|
98
100
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -113,14 +115,34 @@ class RawAssetsClient:
|
|
|
113
115
|
)
|
|
114
116
|
try:
|
|
115
117
|
if 200 <= _response.status_code < 300:
|
|
116
|
-
|
|
118
|
+
_parsed_response = typing.cast(
|
|
117
119
|
AssetsListAssetsResponseBody,
|
|
118
120
|
parse_obj_as(
|
|
119
121
|
type_=AssetsListAssetsResponseBody, # type: ignore
|
|
120
122
|
object_=_response.json(),
|
|
121
123
|
),
|
|
122
124
|
)
|
|
123
|
-
|
|
125
|
+
_items = _parsed_response.data
|
|
126
|
+
_has_next = False
|
|
127
|
+
_get_next = None
|
|
128
|
+
if _parsed_response.pagination is not None:
|
|
129
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
130
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
131
|
+
_get_next = lambda: self.list(
|
|
132
|
+
type=type,
|
|
133
|
+
after=_parsed_next,
|
|
134
|
+
updated_after_time=updated_after_time,
|
|
135
|
+
include_external_ids=include_external_ids,
|
|
136
|
+
include_tags=include_tags,
|
|
137
|
+
tag_ids=tag_ids,
|
|
138
|
+
parent_tag_ids=parent_tag_ids,
|
|
139
|
+
ids=ids,
|
|
140
|
+
attribute_value_ids=attribute_value_ids,
|
|
141
|
+
request_options=request_options,
|
|
142
|
+
)
|
|
143
|
+
return SyncPager(
|
|
144
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
145
|
+
)
|
|
124
146
|
if _response.status_code == 401:
|
|
125
147
|
raise UnauthorizedError(
|
|
126
148
|
headers=dict(_response.headers),
|
|
@@ -798,7 +820,7 @@ class AsyncRawAssetsClient:
|
|
|
798
820
|
ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
799
821
|
attribute_value_ids: typing.Optional[str] = None,
|
|
800
822
|
request_options: typing.Optional[RequestOptions] = None,
|
|
801
|
-
) ->
|
|
823
|
+
) -> AsyncPager[AssetResponseBody]:
|
|
802
824
|
"""
|
|
803
825
|
List all assets. Up to 300 assets will be returned per page.
|
|
804
826
|
|
|
@@ -843,7 +865,7 @@ class AsyncRawAssetsClient:
|
|
|
843
865
|
|
|
844
866
|
Returns
|
|
845
867
|
-------
|
|
846
|
-
|
|
868
|
+
AsyncPager[AssetResponseBody]
|
|
847
869
|
OK response.
|
|
848
870
|
"""
|
|
849
871
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -864,14 +886,37 @@ class AsyncRawAssetsClient:
|
|
|
864
886
|
)
|
|
865
887
|
try:
|
|
866
888
|
if 200 <= _response.status_code < 300:
|
|
867
|
-
|
|
889
|
+
_parsed_response = typing.cast(
|
|
868
890
|
AssetsListAssetsResponseBody,
|
|
869
891
|
parse_obj_as(
|
|
870
892
|
type_=AssetsListAssetsResponseBody, # type: ignore
|
|
871
893
|
object_=_response.json(),
|
|
872
894
|
),
|
|
873
895
|
)
|
|
874
|
-
|
|
896
|
+
_items = _parsed_response.data
|
|
897
|
+
_has_next = False
|
|
898
|
+
_get_next = None
|
|
899
|
+
if _parsed_response.pagination is not None:
|
|
900
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
901
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
902
|
+
|
|
903
|
+
async def _get_next():
|
|
904
|
+
return await self.list(
|
|
905
|
+
type=type,
|
|
906
|
+
after=_parsed_next,
|
|
907
|
+
updated_after_time=updated_after_time,
|
|
908
|
+
include_external_ids=include_external_ids,
|
|
909
|
+
include_tags=include_tags,
|
|
910
|
+
tag_ids=tag_ids,
|
|
911
|
+
parent_tag_ids=parent_tag_ids,
|
|
912
|
+
ids=ids,
|
|
913
|
+
attribute_value_ids=attribute_value_ids,
|
|
914
|
+
request_options=request_options,
|
|
915
|
+
)
|
|
916
|
+
|
|
917
|
+
return AsyncPager(
|
|
918
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
919
|
+
)
|
|
875
920
|
if _response.status_code == 401:
|
|
876
921
|
raise UnauthorizedError(
|
|
877
922
|
headers=dict(_response.headers),
|
samsara/attributes/client.py
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
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
|
|
8
|
+
from ..types.attribute import Attribute
|
|
7
9
|
from ..types.attribute_expanded_response import AttributeExpandedResponse
|
|
8
10
|
from ..types.create_attribute_request_entities import CreateAttributeRequestEntities
|
|
9
|
-
from ..types.get_attributes_by_entity_type_response import GetAttributesByEntityTypeResponse
|
|
10
11
|
from .raw_client import AsyncRawAttributesClient, RawAttributesClient
|
|
11
12
|
from .types.attributes_delete_request_entity_type import AttributesDeleteRequestEntityType
|
|
12
13
|
from .types.attributes_get_request_entity_type import AttributesGetRequestEntityType
|
|
@@ -44,7 +45,7 @@ class AttributesClient:
|
|
|
44
45
|
limit: typing.Optional[int] = None,
|
|
45
46
|
after: typing.Optional[str] = None,
|
|
46
47
|
request_options: typing.Optional[RequestOptions] = None,
|
|
47
|
-
) ->
|
|
48
|
+
) -> SyncPager[Attribute]:
|
|
48
49
|
"""
|
|
49
50
|
Fetch all attributes in an organization associated with either drivers or assets.
|
|
50
51
|
|
|
@@ -68,7 +69,7 @@ class AttributesClient:
|
|
|
68
69
|
|
|
69
70
|
Returns
|
|
70
71
|
-------
|
|
71
|
-
|
|
72
|
+
SyncPager[Attribute]
|
|
72
73
|
All attributes in an organization for an entity type
|
|
73
74
|
|
|
74
75
|
Examples
|
|
@@ -78,14 +79,16 @@ class AttributesClient:
|
|
|
78
79
|
client = Samsara(
|
|
79
80
|
token="YOUR_TOKEN",
|
|
80
81
|
)
|
|
81
|
-
client.attributes.list(
|
|
82
|
+
response = client.attributes.list(
|
|
82
83
|
entity_type="driver",
|
|
83
84
|
)
|
|
85
|
+
for item in response:
|
|
86
|
+
yield item
|
|
87
|
+
# alternatively, you can paginate page-by-page
|
|
88
|
+
for page in response.iter_pages():
|
|
89
|
+
yield page
|
|
84
90
|
"""
|
|
85
|
-
|
|
86
|
-
entity_type=entity_type, limit=limit, after=after, request_options=request_options
|
|
87
|
-
)
|
|
88
|
-
return _response.data
|
|
91
|
+
return self._raw_client.list(entity_type=entity_type, limit=limit, after=after, request_options=request_options)
|
|
89
92
|
|
|
90
93
|
def create(
|
|
91
94
|
self,
|
|
@@ -355,7 +358,7 @@ class AsyncAttributesClient:
|
|
|
355
358
|
limit: typing.Optional[int] = None,
|
|
356
359
|
after: typing.Optional[str] = None,
|
|
357
360
|
request_options: typing.Optional[RequestOptions] = None,
|
|
358
|
-
) ->
|
|
361
|
+
) -> AsyncPager[Attribute]:
|
|
359
362
|
"""
|
|
360
363
|
Fetch all attributes in an organization associated with either drivers or assets.
|
|
361
364
|
|
|
@@ -379,7 +382,7 @@ class AsyncAttributesClient:
|
|
|
379
382
|
|
|
380
383
|
Returns
|
|
381
384
|
-------
|
|
382
|
-
|
|
385
|
+
AsyncPager[Attribute]
|
|
383
386
|
All attributes in an organization for an entity type
|
|
384
387
|
|
|
385
388
|
Examples
|
|
@@ -394,17 +397,22 @@ class AsyncAttributesClient:
|
|
|
394
397
|
|
|
395
398
|
|
|
396
399
|
async def main() -> None:
|
|
397
|
-
await client.attributes.list(
|
|
400
|
+
response = await client.attributes.list(
|
|
398
401
|
entity_type="driver",
|
|
399
402
|
)
|
|
403
|
+
async for item in response:
|
|
404
|
+
yield item
|
|
405
|
+
|
|
406
|
+
# alternatively, you can paginate page-by-page
|
|
407
|
+
async for page in response.iter_pages():
|
|
408
|
+
yield page
|
|
400
409
|
|
|
401
410
|
|
|
402
411
|
asyncio.run(main())
|
|
403
412
|
"""
|
|
404
|
-
|
|
413
|
+
return await self._raw_client.list(
|
|
405
414
|
entity_type=entity_type, limit=limit, after=after, request_options=request_options
|
|
406
415
|
)
|
|
407
|
-
return _response.data
|
|
408
416
|
|
|
409
417
|
async def create(
|
|
410
418
|
self,
|
samsara/attributes/raw_client.py
CHANGED
|
@@ -7,9 +7,11 @@ 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, BaseHttpResponse, SyncPager
|
|
10
11
|
from ..core.pydantic_utilities import parse_obj_as
|
|
11
12
|
from ..core.request_options import RequestOptions
|
|
12
13
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
14
|
+
from ..types.attribute import Attribute
|
|
13
15
|
from ..types.attribute_expanded_response import AttributeExpandedResponse
|
|
14
16
|
from ..types.create_attribute_request_entities import CreateAttributeRequestEntities
|
|
15
17
|
from ..types.get_attributes_by_entity_type_response import GetAttributesByEntityTypeResponse
|
|
@@ -38,7 +40,7 @@ class RawAttributesClient:
|
|
|
38
40
|
limit: typing.Optional[int] = None,
|
|
39
41
|
after: typing.Optional[str] = None,
|
|
40
42
|
request_options: typing.Optional[RequestOptions] = None,
|
|
41
|
-
) ->
|
|
43
|
+
) -> SyncPager[Attribute]:
|
|
42
44
|
"""
|
|
43
45
|
Fetch all attributes in an organization associated with either drivers or assets.
|
|
44
46
|
|
|
@@ -62,7 +64,7 @@ class RawAttributesClient:
|
|
|
62
64
|
|
|
63
65
|
Returns
|
|
64
66
|
-------
|
|
65
|
-
|
|
67
|
+
SyncPager[Attribute]
|
|
66
68
|
All attributes in an organization for an entity type
|
|
67
69
|
"""
|
|
68
70
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -77,14 +79,28 @@ class RawAttributesClient:
|
|
|
77
79
|
)
|
|
78
80
|
try:
|
|
79
81
|
if 200 <= _response.status_code < 300:
|
|
80
|
-
|
|
82
|
+
_parsed_response = typing.cast(
|
|
81
83
|
GetAttributesByEntityTypeResponse,
|
|
82
84
|
parse_obj_as(
|
|
83
85
|
type_=GetAttributesByEntityTypeResponse, # type: ignore
|
|
84
86
|
object_=_response.json(),
|
|
85
87
|
),
|
|
86
88
|
)
|
|
87
|
-
|
|
89
|
+
_items = _parsed_response.data
|
|
90
|
+
_has_next = False
|
|
91
|
+
_get_next = None
|
|
92
|
+
if _parsed_response.pagination is not None:
|
|
93
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
94
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
95
|
+
_get_next = lambda: self.list(
|
|
96
|
+
entity_type=entity_type,
|
|
97
|
+
limit=limit,
|
|
98
|
+
after=_parsed_next,
|
|
99
|
+
request_options=request_options,
|
|
100
|
+
)
|
|
101
|
+
return SyncPager(
|
|
102
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
103
|
+
)
|
|
88
104
|
_response_json = _response.json()
|
|
89
105
|
except JSONDecodeError:
|
|
90
106
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -384,7 +400,7 @@ class AsyncRawAttributesClient:
|
|
|
384
400
|
limit: typing.Optional[int] = None,
|
|
385
401
|
after: typing.Optional[str] = None,
|
|
386
402
|
request_options: typing.Optional[RequestOptions] = None,
|
|
387
|
-
) ->
|
|
403
|
+
) -> AsyncPager[Attribute]:
|
|
388
404
|
"""
|
|
389
405
|
Fetch all attributes in an organization associated with either drivers or assets.
|
|
390
406
|
|
|
@@ -408,7 +424,7 @@ class AsyncRawAttributesClient:
|
|
|
408
424
|
|
|
409
425
|
Returns
|
|
410
426
|
-------
|
|
411
|
-
|
|
427
|
+
AsyncPager[Attribute]
|
|
412
428
|
All attributes in an organization for an entity type
|
|
413
429
|
"""
|
|
414
430
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -423,14 +439,31 @@ class AsyncRawAttributesClient:
|
|
|
423
439
|
)
|
|
424
440
|
try:
|
|
425
441
|
if 200 <= _response.status_code < 300:
|
|
426
|
-
|
|
442
|
+
_parsed_response = typing.cast(
|
|
427
443
|
GetAttributesByEntityTypeResponse,
|
|
428
444
|
parse_obj_as(
|
|
429
445
|
type_=GetAttributesByEntityTypeResponse, # type: ignore
|
|
430
446
|
object_=_response.json(),
|
|
431
447
|
),
|
|
432
448
|
)
|
|
433
|
-
|
|
449
|
+
_items = _parsed_response.data
|
|
450
|
+
_has_next = False
|
|
451
|
+
_get_next = None
|
|
452
|
+
if _parsed_response.pagination is not None:
|
|
453
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
454
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
455
|
+
|
|
456
|
+
async def _get_next():
|
|
457
|
+
return await self.list(
|
|
458
|
+
entity_type=entity_type,
|
|
459
|
+
limit=limit,
|
|
460
|
+
after=_parsed_next,
|
|
461
|
+
request_options=request_options,
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
return AsyncPager(
|
|
465
|
+
has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
|
|
466
|
+
)
|
|
434
467
|
_response_json = _response.json()
|
|
435
468
|
except JSONDecodeError:
|
|
436
469
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
samsara/cameras/media/client.py
CHANGED
|
@@ -75,7 +75,7 @@ class MediaClient:
|
|
|
75
75
|
An optional list of desired media types for which to return captured media. If empty, media for all available media types will be returned. Possible options include: image, videoHighRes.
|
|
76
76
|
|
|
77
77
|
trigger_reasons : typing.Optional[typing.Union[MediaListRequestTriggerReasonsItem, typing.Sequence[MediaListRequestTriggerReasonsItem]]]
|
|
78
|
-
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
78
|
+
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, rfidEvent, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
79
79
|
|
|
80
80
|
available_after_time : typing.Optional[str]
|
|
81
81
|
An optional timestamp in RFC 3339 format that can act as a cursor to track which media has previously been retrieved; only media whose availableAtTime comes after this parameter will be returned. Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00
|
|
@@ -181,7 +181,7 @@ class AsyncMediaClient:
|
|
|
181
181
|
An optional list of desired media types for which to return captured media. If empty, media for all available media types will be returned. Possible options include: image, videoHighRes.
|
|
182
182
|
|
|
183
183
|
trigger_reasons : typing.Optional[typing.Union[MediaListRequestTriggerReasonsItem, typing.Sequence[MediaListRequestTriggerReasonsItem]]]
|
|
184
|
-
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
184
|
+
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, rfidEvent, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
185
185
|
|
|
186
186
|
available_after_time : typing.Optional[str]
|
|
187
187
|
An optional timestamp in RFC 3339 format that can act as a cursor to track which media has previously been retrieved; only media whose availableAtTime comes after this parameter will be returned. Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00
|
|
@@ -74,7 +74,7 @@ class RawMediaClient:
|
|
|
74
74
|
An optional list of desired media types for which to return captured media. If empty, media for all available media types will be returned. Possible options include: image, videoHighRes.
|
|
75
75
|
|
|
76
76
|
trigger_reasons : typing.Optional[typing.Union[MediaListRequestTriggerReasonsItem, typing.Sequence[MediaListRequestTriggerReasonsItem]]]
|
|
77
|
-
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
77
|
+
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, rfidEvent, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
78
78
|
|
|
79
79
|
available_after_time : typing.Optional[str]
|
|
80
80
|
An optional timestamp in RFC 3339 format that can act as a cursor to track which media has previously been retrieved; only media whose availableAtTime comes after this parameter will be returned. Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00
|
|
@@ -271,7 +271,7 @@ class AsyncRawMediaClient:
|
|
|
271
271
|
An optional list of desired media types for which to return captured media. If empty, media for all available media types will be returned. Possible options include: image, videoHighRes.
|
|
272
272
|
|
|
273
273
|
trigger_reasons : typing.Optional[typing.Union[MediaListRequestTriggerReasonsItem, typing.Sequence[MediaListRequestTriggerReasonsItem]]]
|
|
274
|
-
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
274
|
+
An optional list of desired trigger reasons for which to return captured media. If empty, media for all available trigger reasons will be returned. Possible options include: api, panicButton, periodicStill, rfidEvent, safetyEvent, tripEndStill, tripStartStill, videoRetrieval. videoRetrieval represents media captured for a dashboard video retrieval request.
|
|
275
275
|
|
|
276
276
|
available_after_time : typing.Optional[str]
|
|
277
277
|
An optional timestamp in RFC 3339 format that can act as a cursor to track which media has previously been retrieved; only media whose availableAtTime comes after this parameter will be returned. Examples: 2019-06-13T19:08:25Z, 2019-06-13T19:08:25.455Z, OR 2015-09-15T14:00:12-04:00
|
|
@@ -127,12 +127,7 @@ class RetrievalClient:
|
|
|
127
127
|
)
|
|
128
128
|
client.cameras.media.retrieval.create(
|
|
129
129
|
end_time="2019-06-13T19:08:55Z",
|
|
130
|
-
inputs=[
|
|
131
|
-
"dashcamRoadFacing",
|
|
132
|
-
"dashcamRoadFacing",
|
|
133
|
-
"dashcamRoadFacing",
|
|
134
|
-
"dashcamRoadFacing",
|
|
135
|
-
],
|
|
130
|
+
inputs=["dashcamRoadFacing", "dashcamRoadFacing"],
|
|
136
131
|
media_type="image",
|
|
137
132
|
start_time="2019-06-13T19:08:25Z",
|
|
138
133
|
vehicle_id="1234",
|
|
@@ -271,12 +266,7 @@ class AsyncRetrievalClient:
|
|
|
271
266
|
async def main() -> None:
|
|
272
267
|
await client.cameras.media.retrieval.create(
|
|
273
268
|
end_time="2019-06-13T19:08:55Z",
|
|
274
|
-
inputs=[
|
|
275
|
-
"dashcamRoadFacing",
|
|
276
|
-
"dashcamRoadFacing",
|
|
277
|
-
"dashcamRoadFacing",
|
|
278
|
-
"dashcamRoadFacing",
|
|
279
|
-
],
|
|
269
|
+
inputs=["dashcamRoadFacing", "dashcamRoadFacing"],
|
|
280
270
|
media_type="image",
|
|
281
271
|
start_time="2019-06-13T19:08:25Z",
|
|
282
272
|
vehicle_id="1234",
|
|
@@ -4,7 +4,14 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
MediaListRequestTriggerReasonsItem = typing.Union[
|
|
6
6
|
typing.Literal[
|
|
7
|
-
"api",
|
|
7
|
+
"api",
|
|
8
|
+
"panicButton",
|
|
9
|
+
"periodicStill",
|
|
10
|
+
"rfidEvent",
|
|
11
|
+
"safetyEvent",
|
|
12
|
+
"tripEndStill",
|
|
13
|
+
"tripStartStill",
|
|
14
|
+
"videoRetrieval",
|
|
8
15
|
],
|
|
9
16
|
typing.Any,
|
|
10
17
|
]
|
|
@@ -3,9 +3,10 @@
|
|
|
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
|
|
8
|
+
from ..types.carrier_proposed_assignment import CarrierProposedAssignment
|
|
7
9
|
from ..types.carrier_proposed_assignment_response import CarrierProposedAssignmentResponse
|
|
8
|
-
from ..types.list_carrier_proposed_assignment_response import ListCarrierProposedAssignmentResponse
|
|
9
10
|
from .raw_client import AsyncRawCarrierProposedAssignmentsClient, RawCarrierProposedAssignmentsClient
|
|
10
11
|
|
|
11
12
|
# this is used as the default value for optional parameters
|
|
@@ -35,7 +36,7 @@ class CarrierProposedAssignmentsClient:
|
|
|
35
36
|
driver_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
36
37
|
active_time: typing.Optional[str] = None,
|
|
37
38
|
request_options: typing.Optional[RequestOptions] = None,
|
|
38
|
-
) ->
|
|
39
|
+
) -> SyncPager[CarrierProposedAssignment]:
|
|
39
40
|
"""
|
|
40
41
|
Show the assignments created by the POST fleet/carrier-proposed-assignments. This endpoint will only show the assignments that are active for drivers and currently visible to them in the driver app. Once a proposed assignment has been accepted, the endpoint will not return any data.
|
|
41
42
|
|
|
@@ -62,7 +63,7 @@ class CarrierProposedAssignmentsClient:
|
|
|
62
63
|
|
|
63
64
|
Returns
|
|
64
65
|
-------
|
|
65
|
-
|
|
66
|
+
SyncPager[CarrierProposedAssignment]
|
|
66
67
|
Returns the assignments that drivers would see in the future, if any.
|
|
67
68
|
|
|
68
69
|
Examples
|
|
@@ -72,12 +73,16 @@ class CarrierProposedAssignmentsClient:
|
|
|
72
73
|
client = Samsara(
|
|
73
74
|
token="YOUR_TOKEN",
|
|
74
75
|
)
|
|
75
|
-
client.carrier_proposed_assignments.list()
|
|
76
|
+
response = client.carrier_proposed_assignments.list()
|
|
77
|
+
for item in response:
|
|
78
|
+
yield item
|
|
79
|
+
# alternatively, you can paginate page-by-page
|
|
80
|
+
for page in response.iter_pages():
|
|
81
|
+
yield page
|
|
76
82
|
"""
|
|
77
|
-
|
|
83
|
+
return self._raw_client.list(
|
|
78
84
|
limit=limit, after=after, driver_ids=driver_ids, active_time=active_time, request_options=request_options
|
|
79
85
|
)
|
|
80
|
-
return _response.data
|
|
81
86
|
|
|
82
87
|
def create(
|
|
83
88
|
self,
|
|
@@ -209,7 +214,7 @@ class AsyncCarrierProposedAssignmentsClient:
|
|
|
209
214
|
driver_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
|
|
210
215
|
active_time: typing.Optional[str] = None,
|
|
211
216
|
request_options: typing.Optional[RequestOptions] = None,
|
|
212
|
-
) ->
|
|
217
|
+
) -> AsyncPager[CarrierProposedAssignment]:
|
|
213
218
|
"""
|
|
214
219
|
Show the assignments created by the POST fleet/carrier-proposed-assignments. This endpoint will only show the assignments that are active for drivers and currently visible to them in the driver app. Once a proposed assignment has been accepted, the endpoint will not return any data.
|
|
215
220
|
|
|
@@ -236,7 +241,7 @@ class AsyncCarrierProposedAssignmentsClient:
|
|
|
236
241
|
|
|
237
242
|
Returns
|
|
238
243
|
-------
|
|
239
|
-
|
|
244
|
+
AsyncPager[CarrierProposedAssignment]
|
|
240
245
|
Returns the assignments that drivers would see in the future, if any.
|
|
241
246
|
|
|
242
247
|
Examples
|
|
@@ -251,15 +256,20 @@ class AsyncCarrierProposedAssignmentsClient:
|
|
|
251
256
|
|
|
252
257
|
|
|
253
258
|
async def main() -> None:
|
|
254
|
-
await client.carrier_proposed_assignments.list()
|
|
259
|
+
response = await client.carrier_proposed_assignments.list()
|
|
260
|
+
async for item in response:
|
|
261
|
+
yield item
|
|
262
|
+
|
|
263
|
+
# alternatively, you can paginate page-by-page
|
|
264
|
+
async for page in response.iter_pages():
|
|
265
|
+
yield page
|
|
255
266
|
|
|
256
267
|
|
|
257
268
|
asyncio.run(main())
|
|
258
269
|
"""
|
|
259
|
-
|
|
270
|
+
return await self._raw_client.list(
|
|
260
271
|
limit=limit, after=after, driver_ids=driver_ids, active_time=active_time, request_options=request_options
|
|
261
272
|
)
|
|
262
|
-
return _response.data
|
|
263
273
|
|
|
264
274
|
async def create(
|
|
265
275
|
self,
|