evcloud 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- evcloud/__init__.py +802 -0
- evcloud/_default_clients.py +30 -0
- evcloud/client.py +200 -0
- evcloud/core/__init__.py +67 -0
- evcloud/core/api_error.py +23 -0
- evcloud/core/client_wrapper.py +108 -0
- evcloud/core/datetime_utils.py +70 -0
- evcloud/core/file.py +67 -0
- evcloud/core/force_multipart.py +18 -0
- evcloud/core/http_client.py +840 -0
- evcloud/core/http_response.py +59 -0
- evcloud/core/http_sse/__init__.py +9 -0
- evcloud/core/http_sse/_api.py +112 -0
- evcloud/core/http_sse/_decoders.py +61 -0
- evcloud/core/http_sse/_exceptions.py +7 -0
- evcloud/core/http_sse/_models.py +17 -0
- evcloud/core/jsonable_encoder.py +120 -0
- evcloud/core/logging.py +107 -0
- evcloud/core/pagination.py +82 -0
- evcloud/core/parse_error.py +36 -0
- evcloud/core/pydantic_utilities.py +634 -0
- evcloud/core/query_encoder.py +58 -0
- evcloud/core/remove_none_from_dict.py +11 -0
- evcloud/core/request_options.py +35 -0
- evcloud/core/serialization.py +276 -0
- evcloud/cpo/__init__.py +31 -0
- evcloud/cpo/cdrs/__init__.py +4 -0
- evcloud/cpo/cdrs/client.py +311 -0
- evcloud/cpo/cdrs/raw_client.py +592 -0
- evcloud/cpo/charge_points/__init__.py +7 -0
- evcloud/cpo/charge_points/client.py +1436 -0
- evcloud/cpo/charge_points/raw_client.py +2809 -0
- evcloud/cpo/charge_points/types/__init__.py +7 -0
- evcloud/cpo/charge_points/types/list_charge_points_request_ocpp_version.py +5 -0
- evcloud/cpo/client.py +62 -0
- evcloud/cpo/connectors/__init__.py +4 -0
- evcloud/cpo/connectors/client.py +698 -0
- evcloud/cpo/connectors/raw_client.py +1457 -0
- evcloud/cpo/evses/__init__.py +4 -0
- evcloud/cpo/evses/client.py +691 -0
- evcloud/cpo/evses/raw_client.py +1457 -0
- evcloud/cpo/health/__init__.py +4 -0
- evcloud/cpo/health/client.py +100 -0
- evcloud/cpo/health/raw_client.py +192 -0
- evcloud/cpo/locations/__init__.py +4 -0
- evcloud/cpo/locations/client.py +1021 -0
- evcloud/cpo/locations/raw_client.py +1887 -0
- evcloud/cpo/raw_client.py +13 -0
- evcloud/cpo/sessions/__init__.py +7 -0
- evcloud/cpo/sessions/client.py +430 -0
- evcloud/cpo/sessions/raw_client.py +889 -0
- evcloud/cpo/sessions/types/__init__.py +8 -0
- evcloud/cpo/sessions/types/list_sessions_request_billing_state.py +5 -0
- evcloud/cpo/sessions/types/list_sessions_request_status.py +7 -0
- evcloud/cpo/tariffs/__init__.py +17 -0
- evcloud/cpo/tariffs/client.py +1232 -0
- evcloud/cpo/tariffs/raw_client.py +2526 -0
- evcloud/cpo/tariffs/types/__init__.py +15 -0
- evcloud/cpo/tariffs/types/list_tariffs_request_type.py +7 -0
- evcloud/cpo/tariffs/types/tariff_create_ocpi_version.py +5 -0
- evcloud/cpo/tariffs/types/tariff_create_preauthorize_amount.py +5 -0
- evcloud/cpo/tariffs/types/tariff_patch_preauthorize_amount.py +5 -0
- evcloud/emsp/__init__.py +55 -0
- evcloud/emsp/cdrs/__init__.py +4 -0
- evcloud/emsp/cdrs/client.py +300 -0
- evcloud/emsp/cdrs/raw_client.py +610 -0
- evcloud/emsp/chargers/__init__.py +7 -0
- evcloud/emsp/chargers/client.py +167 -0
- evcloud/emsp/chargers/raw_client.py +331 -0
- evcloud/emsp/chargers/types/__init__.py +11 -0
- evcloud/emsp/chargers/types/resolve_chargers_response.py +53 -0
- evcloud/emsp/client.py +77 -0
- evcloud/emsp/commands/__init__.py +7 -0
- evcloud/emsp/commands/client.py +516 -0
- evcloud/emsp/commands/raw_client.py +979 -0
- evcloud/emsp/commands/types/__init__.py +7 -0
- evcloud/emsp/commands/types/send_commands_request_command.py +7 -0
- evcloud/emsp/emp_identities/__init__.py +4 -0
- evcloud/emsp/emp_identities/client.py +548 -0
- evcloud/emsp/emp_identities/raw_client.py +1277 -0
- evcloud/emsp/evses/__init__.py +4 -0
- evcloud/emsp/evses/client.py +154 -0
- evcloud/emsp/evses/raw_client.py +288 -0
- evcloud/emsp/health/__init__.py +4 -0
- evcloud/emsp/health/client.py +100 -0
- evcloud/emsp/health/raw_client.py +192 -0
- evcloud/emsp/locations/__init__.py +4 -0
- evcloud/emsp/locations/client.py +1386 -0
- evcloud/emsp/locations/raw_client.py +2903 -0
- evcloud/emsp/networks/__init__.py +7 -0
- evcloud/emsp/networks/client.py +1615 -0
- evcloud/emsp/networks/raw_client.py +3725 -0
- evcloud/emsp/networks/types/__init__.py +9 -0
- evcloud/emsp/networks/types/list_networks_request_network_type.py +5 -0
- evcloud/emsp/networks/types/list_rules_networks_request_validity.py +5 -0
- evcloud/emsp/networks/types/network_rule_create_request_rule_type.py +5 -0
- evcloud/emsp/raw_client.py +13 -0
- evcloud/emsp/sessions/__init__.py +4 -0
- evcloud/emsp/sessions/client.py +300 -0
- evcloud/emsp/sessions/raw_client.py +610 -0
- evcloud/emsp/tariffs/__init__.py +7 -0
- evcloud/emsp/tariffs/client.py +421 -0
- evcloud/emsp/tariffs/raw_client.py +883 -0
- evcloud/emsp/tariffs/types/__init__.py +8 -0
- evcloud/emsp/tariffs/types/estimate_request_kwh.py +5 -0
- evcloud/emsp/tariffs/types/estimate_request_minutes.py +5 -0
- evcloud/emsp/tenant/__init__.py +4 -0
- evcloud/emsp/tenant/client.py +328 -0
- evcloud/emsp/tenant/raw_client.py +869 -0
- evcloud/emsp/token_groups/__init__.py +7 -0
- evcloud/emsp/token_groups/client.py +1256 -0
- evcloud/emsp/token_groups/raw_client.py +3288 -0
- evcloud/emsp/token_groups/types/__init__.py +7 -0
- evcloud/emsp/token_groups/types/remove_token_token_groups_request_type.py +5 -0
- evcloud/emsp/tokens/__init__.py +7 -0
- evcloud/emsp/tokens/client.py +1298 -0
- evcloud/emsp/tokens/raw_client.py +2947 -0
- evcloud/emsp/tokens/types/__init__.py +10 -0
- evcloud/emsp/tokens/types/list_tokens_request_status.py +7 -0
- evcloud/emsp/tokens/types/list_tokens_request_type.py +5 -0
- evcloud/emsp/tokens/types/token_update_default_profile_type.py +5 -0
- evcloud/emsp/tokens/types/token_update_whitelist.py +5 -0
- evcloud/energy/__init__.py +8 -0
- evcloud/energy/client.py +47 -0
- evcloud/energy/control_requests/__init__.py +7 -0
- evcloud/energy/control_requests/client.py +399 -0
- evcloud/energy/control_requests/raw_client.py +835 -0
- evcloud/energy/control_requests/types/__init__.py +7 -0
- evcloud/energy/control_requests/types/list_control_requests_request_result.py +15 -0
- evcloud/energy/health/__init__.py +4 -0
- evcloud/energy/health/client.py +100 -0
- evcloud/energy/health/raw_client.py +192 -0
- evcloud/energy/power_measurements/__init__.py +4 -0
- evcloud/energy/power_measurements/client.py +254 -0
- evcloud/energy/power_measurements/raw_client.py +527 -0
- evcloud/energy/raw_client.py +13 -0
- evcloud/environment.py +7 -0
- evcloud/errors/__init__.py +25 -0
- evcloud/errors/bad_gateway_error.py +11 -0
- evcloud/errors/bad_request_error.py +11 -0
- evcloud/errors/conflict_error.py +11 -0
- evcloud/errors/forbidden_error.py +11 -0
- evcloud/errors/gateway_timeout_error.py +11 -0
- evcloud/errors/not_found_error.py +11 -0
- evcloud/errors/too_many_requests_error.py +11 -0
- evcloud/errors/unauthorized_error.py +11 -0
- evcloud/errors/unprocessable_entity_error.py +11 -0
- evcloud/health/__init__.py +4 -0
- evcloud/health/client.py +99 -0
- evcloud/health/raw_client.py +100 -0
- evcloud/ocpi/__init__.py +123 -0
- evcloud/ocpi/client.py +56 -0
- evcloud/ocpi/cpo_data/__init__.py +31 -0
- evcloud/ocpi/cpo_data/client.py +1553 -0
- evcloud/ocpi/cpo_data/raw_client.py +3119 -0
- evcloud/ocpi/cpo_data/types/__init__.py +29 -0
- evcloud/ocpi/cpo_data/types/cancel_reservation_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/create_cdr_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/delete_tariff_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/send_active_charging_profile_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_connector_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_evse_status_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_location_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/update_session_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/upsert_location_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/upsert_session_cpo_data_request_version.py +5 -0
- evcloud/ocpi/cpo_data/types/upsert_tariff_cpo_data_request_version.py +5 -0
- evcloud/ocpi/credentials/__init__.py +31 -0
- evcloud/ocpi/credentials/client.py +750 -0
- evcloud/ocpi/credentials/raw_client.py +1537 -0
- evcloud/ocpi/credentials/types/__init__.py +29 -0
- evcloud/ocpi/credentials/types/partner_versions_pull_request_partner_token_encoding.py +5 -0
- evcloud/ocpi/credentials/types/pull_versions_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/pull_versions_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/rotate_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/rotate_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/start_handshake_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/start_handshake_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/status_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/status_credentials_request_version.py +5 -0
- evcloud/ocpi/credentials/types/unregister_credentials_request_role.py +5 -0
- evcloud/ocpi/credentials/types/unregister_credentials_request_version.py +5 -0
- evcloud/ocpi/emsp/__init__.py +27 -0
- evcloud/ocpi/emsp/client.py +1142 -0
- evcloud/ocpi/emsp/raw_client.py +2209 -0
- evcloud/ocpi/emsp/types/__init__.py +25 -0
- evcloud/ocpi/emsp/types/charging_preferences_request_profile_type.py +5 -0
- evcloud/ocpi/emsp/types/clear_charging_profile_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/get_active_charging_profile_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/send_command_emsp_request_command.py +7 -0
- evcloud/ocpi/emsp/types/send_command_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/set_charging_preferences_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/set_charging_profile_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/update_token_emsp_request_version.py +5 -0
- evcloud/ocpi/emsp/types/upsert_token_emsp_request_version.py +5 -0
- evcloud/ocpi/invites/__init__.py +19 -0
- evcloud/ocpi/invites/client.py +385 -0
- evcloud/ocpi/invites/raw_client.py +887 -0
- evcloud/ocpi/invites/types/__init__.py +17 -0
- evcloud/ocpi/invites/types/partner_invite_create_request_gateway_role.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_create_request_role.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_create_request_version.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_update_request_gateway_role.py +5 -0
- evcloud/ocpi/invites/types/partner_invite_update_request_version.py +5 -0
- evcloud/ocpi/partners/__init__.py +7 -0
- evcloud/ocpi/partners/client.py +581 -0
- evcloud/ocpi/partners/raw_client.py +1340 -0
- evcloud/ocpi/partners/types/__init__.py +8 -0
- evcloud/ocpi/partners/types/partner_register_request_ocpi_version.py +5 -0
- evcloud/ocpi/partners/types/partner_update_request_ocpi_version.py +5 -0
- evcloud/ocpi/raw_client.py +13 -0
- evcloud/ocpi/sync/__init__.py +33 -0
- evcloud/ocpi/sync/client.py +1701 -0
- evcloud/ocpi/sync/raw_client.py +3685 -0
- evcloud/ocpi/sync/types/__init__.py +31 -0
- evcloud/ocpi/sync/types/pull_cdrs_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_hub_client_info_as_cpo_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_hub_client_info_as_emsp_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_locations_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_sessions_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_tariffs_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/pull_tokens_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_cdr_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_location_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_session_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_tariff_sync_request_version.py +5 -0
- evcloud/ocpi/sync/types/push_token_sync_request_version.py +5 -0
- evcloud/py.typed +0 -0
- evcloud/types/__init__.py +759 -0
- evcloud/types/access_mode.py +5 -0
- evcloud/types/asset_connector.py +26 -0
- evcloud/types/asset_updated_event.py +29 -0
- evcloud/types/availability_page.py +26 -0
- evcloud/types/batch_response.py +26 -0
- evcloud/types/batch_response_missing_item.py +7 -0
- evcloud/types/cdr_event.py +41 -0
- evcloud/types/cdr_out.py +75 -0
- evcloud/types/cdr_out_auth_method.py +7 -0
- evcloud/types/cdr_out_auth_method_zero.py +5 -0
- evcloud/types/cdr_out_origin.py +7 -0
- evcloud/types/cdr_out_origin_zero.py +5 -0
- evcloud/types/cdr_page.py +27 -0
- evcloud/types/cdr_write_response.py +26 -0
- evcloud/types/charge_point_created_out.py +74 -0
- evcloud/types/charge_point_created_out_access_mode.py +7 -0
- evcloud/types/charge_point_created_out_access_mode_zero.py +5 -0
- evcloud/types/charge_point_created_out_pricing.py +7 -0
- evcloud/types/charge_point_created_out_pricing_zero.py +5 -0
- evcloud/types/charge_point_created_out_site_type.py +7 -0
- evcloud/types/charge_point_created_out_site_type_zero.py +5 -0
- evcloud/types/charge_point_out.py +73 -0
- evcloud/types/charge_point_out_access_mode.py +7 -0
- evcloud/types/charge_point_out_access_mode_zero.py +5 -0
- evcloud/types/charge_point_out_pricing.py +7 -0
- evcloud/types/charge_point_out_pricing_zero.py +5 -0
- evcloud/types/charge_point_out_site_type.py +7 -0
- evcloud/types/charge_point_out_site_type_zero.py +5 -0
- evcloud/types/charge_point_page.py +27 -0
- evcloud/types/charging_preferences_response.py +28 -0
- evcloud/types/charging_preferences_response_result.py +10 -0
- evcloud/types/charging_profile.py +30 -0
- evcloud/types/charging_profile_charging_rate_unit.py +5 -0
- evcloud/types/charging_profile_period.py +31 -0
- evcloud/types/charging_profile_response.py +32 -0
- evcloud/types/cluster_page.py +26 -0
- evcloud/types/command_accepted.py +30 -0
- evcloud/types/command_accepted_route.py +53 -0
- evcloud/types/command_accepted_route_own.py +28 -0
- evcloud/types/command_accepted_route_own_ocpi_version.py +7 -0
- evcloud/types/command_accepted_route_own_ocpi_version_zero.py +5 -0
- evcloud/types/command_accepted_route_roaming.py +30 -0
- evcloud/types/command_accepted_route_roaming_ocpi_version.py +7 -0
- evcloud/types/command_accepted_route_roaming_ocpi_version_zero.py +5 -0
- evcloud/types/command_accepted_status.py +7 -0
- evcloud/types/command_accepted_status_zero.py +20 -0
- evcloud/types/command_page.py +26 -0
- evcloud/types/command_record.py +40 -0
- evcloud/types/command_record_command.py +7 -0
- evcloud/types/command_record_command_zero.py +7 -0
- evcloud/types/command_record_route.py +53 -0
- evcloud/types/command_record_route_own.py +28 -0
- evcloud/types/command_record_route_own_ocpi_version.py +7 -0
- evcloud/types/command_record_route_own_ocpi_version_zero.py +5 -0
- evcloud/types/command_record_route_roaming.py +30 -0
- evcloud/types/command_record_route_roaming_ocpi_version.py +7 -0
- evcloud/types/command_record_route_roaming_ocpi_version_zero.py +5 -0
- evcloud/types/command_record_status.py +7 -0
- evcloud/types/command_record_status_zero.py +20 -0
- evcloud/types/command_response_out.py +26 -0
- evcloud/types/command_response_out_result.py +7 -0
- evcloud/types/command_response_out_result_zero.py +7 -0
- evcloud/types/command_result_event.py +39 -0
- evcloud/types/command_result_event_module.py +5 -0
- evcloud/types/command_result_event_protocol.py +5 -0
- evcloud/types/command_result_event_status.py +5 -0
- evcloud/types/command_send_response.py +31 -0
- evcloud/types/command_token.py +36 -0
- evcloud/types/connector_format.py +5 -0
- evcloud/types/connector_page.py +27 -0
- evcloud/types/connector_status_event.py +29 -0
- evcloud/types/connector_write_response.py +27 -0
- evcloud/types/control_action.py +5 -0
- evcloud/types/control_request_page.py +27 -0
- evcloud/types/control_request_response.py +38 -0
- evcloud/types/control_request_response_action.py +7 -0
- evcloud/types/control_request_response_action_zero.py +7 -0
- evcloud/types/control_request_response_result.py +7 -0
- evcloud/types/control_request_response_result_zero.py +15 -0
- evcloud/types/control_request_response_unit.py +7 -0
- evcloud/types/control_request_response_unit_zero.py +5 -0
- evcloud/types/control_response_event.py +38 -0
- evcloud/types/control_response_event_action.py +5 -0
- evcloud/types/control_response_event_result.py +15 -0
- evcloud/types/control_response_event_unit.py +5 -0
- evcloud/types/cpo_connector_out.py +58 -0
- evcloud/types/cpo_connector_out_format.py +7 -0
- evcloud/types/cpo_connector_out_format_zero.py +5 -0
- evcloud/types/cpo_connector_out_ocpi_status.py +7 -0
- evcloud/types/cpo_connector_out_ocpi_status_zero.py +10 -0
- evcloud/types/cpo_connector_out_power_type.py +7 -0
- evcloud/types/cpo_connector_out_power_type_zero.py +7 -0
- evcloud/types/cpo_evse_out.py +61 -0
- evcloud/types/cpo_evse_out_origin.py +7 -0
- evcloud/types/cpo_evse_out_origin_zero.py +5 -0
- evcloud/types/cpo_evse_out_status.py +7 -0
- evcloud/types/cpo_evse_out_status_zero.py +10 -0
- evcloud/types/credentials_handshake_request.py +44 -0
- evcloud/types/credentials_handshake_request_partner_token_encoding.py +5 -0
- evcloud/types/credentials_handshake_response.py +32 -0
- evcloud/types/credentials_handshake_response_action.py +7 -0
- evcloud/types/credentials_handshake_response_version.py +5 -0
- evcloud/types/deliver_event_response.py +23 -0
- evcloud/types/delivery_drift_event.py +30 -0
- evcloud/types/display_text.py +24 -0
- evcloud/types/effective_cpo.py +27 -0
- evcloud/types/effective_cpo_source.py +7 -0
- evcloud/types/effective_cpo_source_zero.py +5 -0
- evcloud/types/effective_view_response.py +29 -0
- evcloud/types/emp_identity_out.py +35 -0
- evcloud/types/emp_identity_out_status.py +7 -0
- evcloud/types/emp_identity_out_status_zero.py +5 -0
- evcloud/types/emp_identity_page.py +26 -0
- evcloud/types/emsp_cdr_out.py +41 -0
- evcloud/types/emsp_cdr_out_source.py +7 -0
- evcloud/types/emsp_cdr_out_source_zero.py +5 -0
- evcloud/types/emsp_cdr_page.py +26 -0
- evcloud/types/emsp_connector_out.py +30 -0
- evcloud/types/emsp_evse_out.py +32 -0
- evcloud/types/emsp_gateway_schema_commands_location_key.py +25 -0
- evcloud/types/emsp_gateway_schema_location_lookup_location_key.py +25 -0
- evcloud/types/emsp_gateway_schema_locations_location_out.py +47 -0
- evcloud/types/emsp_gateway_schema_locations_location_page.py +26 -0
- evcloud/types/emsp_gateway_schema_networks_location_out.py +37 -0
- evcloud/types/emsp_gateway_schema_networks_location_page.py +26 -0
- evcloud/types/emsp_session_out.py +41 -0
- evcloud/types/emsp_session_out_source.py +7 -0
- evcloud/types/emsp_session_out_source_zero.py +5 -0
- evcloud/types/emsp_session_page.py +26 -0
- evcloud/types/emsp_tariff_page.py +26 -0
- evcloud/types/energy_contract.py +24 -0
- evcloud/types/estimate_line.py +27 -0
- evcloud/types/estimate_line_type.py +7 -0
- evcloud/types/estimate_line_type_zero.py +5 -0
- evcloud/types/estimate_response.py +30 -0
- evcloud/types/event_type_list.py +24 -0
- evcloud/types/event_type_response.py +27 -0
- evcloud/types/event_type_response_type.py +7 -0
- evcloud/types/event_type_response_type_zero.py +27 -0
- evcloud/types/event_type_version.py +24 -0
- evcloud/types/evse_connector_status.py +26 -0
- evcloud/types/evse_page.py +27 -0
- evcloud/types/evse_parking.py +25 -0
- evcloud/types/evse_parking_evse_position.py +7 -0
- evcloud/types/evse_parking_evse_position_zero.py +5 -0
- evcloud/types/evse_status_event.py +31 -0
- evcloud/types/evse_status_out.py +32 -0
- evcloud/types/evse_status_write_response.py +28 -0
- evcloud/types/facility_count.py +24 -0
- evcloud/types/facility_page.py +26 -0
- evcloud/types/health_ok.py +24 -0
- evcloud/types/health_ok_status.py +7 -0
- evcloud/types/health_ok_status_zero.py +5 -0
- evcloud/types/http_error_response.py +29 -0
- evcloud/types/http_validation_error.py +24 -0
- evcloud/types/limit_unit.py +5 -0
- evcloud/types/location_availability.py +28 -0
- evcloud/types/location_availability_status.py +7 -0
- evcloud/types/location_availability_status_zero.py +7 -0
- evcloud/types/location_base.py +53 -0
- evcloud/types/location_base_parking_type.py +7 -0
- evcloud/types/location_base_parking_type_zero.py +8 -0
- evcloud/types/location_cluster.py +26 -0
- evcloud/types/location_detail.py +51 -0
- evcloud/types/location_key_input.py +25 -0
- evcloud/types/location_list.py +24 -0
- evcloud/types/location_out.py +79 -0
- evcloud/types/location_out_access_mode.py +7 -0
- evcloud/types/location_out_access_mode_zero.py +5 -0
- evcloud/types/location_out_ocpi_version.py +7 -0
- evcloud/types/location_out_ocpi_version_zero.py +5 -0
- evcloud/types/location_out_origin.py +7 -0
- evcloud/types/location_out_origin_zero.py +5 -0
- evcloud/types/location_out_parking_type.py +7 -0
- evcloud/types/location_out_parking_type_zero.py +8 -0
- evcloud/types/location_out_role.py +7 -0
- evcloud/types/location_out_role_zero.py +5 -0
- evcloud/types/location_out_site_type.py +7 -0
- evcloud/types/location_out_site_type_zero.py +5 -0
- evcloud/types/location_page.py +27 -0
- evcloud/types/location_summary.py +43 -0
- evcloud/types/location_updated_event.py +30 -0
- evcloud/types/location_write_response.py +26 -0
- evcloud/types/map_cluster.py +28 -0
- evcloud/types/map_page.py +29 -0
- evcloud/types/network_consumer.py +25 -0
- evcloud/types/network_consumer_page.py +26 -0
- evcloud/types/network_detail_response.py +49 -0
- evcloud/types/network_detail_response_network_type.py +7 -0
- evcloud/types/network_detail_response_network_type_zero.py +5 -0
- evcloud/types/network_detail_response_publish_state.py +7 -0
- evcloud/types/network_detail_response_publish_state_zero.py +7 -0
- evcloud/types/network_page.py +26 -0
- evcloud/types/network_priority_order.py +23 -0
- evcloud/types/network_response.py +46 -0
- evcloud/types/network_response_network_type.py +7 -0
- evcloud/types/network_response_network_type_zero.py +5 -0
- evcloud/types/network_response_publish_state.py +7 -0
- evcloud/types/network_response_publish_state_zero.py +5 -0
- evcloud/types/network_rule_page.py +26 -0
- evcloud/types/network_rule_response.py +33 -0
- evcloud/types/network_rule_response_rule_type.py +7 -0
- evcloud/types/network_rule_response_rule_type_zero.py +5 -0
- evcloud/types/ocpi_business_details.py +26 -0
- evcloud/types/ocpi_business_details_input.py +26 -0
- evcloud/types/ocpi_cdr_dimension.py +24 -0
- evcloud/types/ocpi_cdr_location.py +30 -0
- evcloud/types/ocpi_cdr_token.py +30 -0
- evcloud/types/ocpi_charging_period.py +27 -0
- evcloud/types/ocpi_display_text.py +24 -0
- evcloud/types/ocpi_energy_mix.py +29 -0
- evcloud/types/ocpi_energy_mix_input.py +29 -0
- evcloud/types/ocpi_energy_source.py +24 -0
- evcloud/types/ocpi_energy_source_input.py +24 -0
- evcloud/types/ocpi_environmental_impact.py +24 -0
- evcloud/types/ocpi_evse_parking.py +24 -0
- evcloud/types/ocpi_exceptional_period.py +25 -0
- evcloud/types/ocpi_geo_location.py +24 -0
- evcloud/types/ocpi_geo_location_in.py +24 -0
- evcloud/types/ocpi_image.py +28 -0
- evcloud/types/ocpi_image_input.py +28 -0
- evcloud/types/ocpi_opening_times.py +28 -0
- evcloud/types/ocpi_opening_times_input.py +28 -0
- evcloud/types/ocpi_parking_place.py +44 -0
- evcloud/types/ocpi_parking_place_input.py +44 -0
- evcloud/types/ocpi_price_component_input.py +28 -0
- evcloud/types/ocpi_price_component_input_price.py +5 -0
- evcloud/types/ocpi_price_component_input_vat.py +5 -0
- evcloud/types/ocpi_price_component_output.py +26 -0
- evcloud/types/ocpi_price_input.py +26 -0
- evcloud/types/ocpi_price_input_excl_vat.py +5 -0
- evcloud/types/ocpi_price_input_incl_vat.py +5 -0
- evcloud/types/ocpi_price_output.py +24 -0
- evcloud/types/ocpi_publish_token.py +27 -0
- evcloud/types/ocpi_regular_hours.py +25 -0
- evcloud/types/ocpi_regular_hours_input.py +25 -0
- evcloud/types/ocpi_related_location.py +26 -0
- evcloud/types/ocpi_signed_data.py +28 -0
- evcloud/types/ocpi_signed_value.py +25 -0
- evcloud/types/ocpi_status_schedule.py +26 -0
- evcloud/types/ocpi_tariff_element_input.py +26 -0
- evcloud/types/ocpi_tariff_element_output.py +26 -0
- evcloud/types/ocpi_tariff_restrictions_input.py +33 -0
- evcloud/types/ocpi_tariff_restrictions_input_max_kwh.py +5 -0
- evcloud/types/ocpi_tariff_restrictions_input_min_kwh.py +5 -0
- evcloud/types/ocpi_tariff_restrictions_output.py +31 -0
- evcloud/types/ocpi_tariff_snapshot.py +26 -0
- evcloud/types/ocpp_version.py +5 -0
- evcloud/types/page_info.py +24 -0
- evcloud/types/parking.py +45 -0
- evcloud/types/parking_direction.py +7 -0
- evcloud/types/parking_direction_zero.py +5 -0
- evcloud/types/parking_type.py +8 -0
- evcloud/types/parking_vehicle_types_item.py +7 -0
- evcloud/types/parking_vehicle_types_item_zero.py +18 -0
- evcloud/types/partner_invite_response.py +47 -0
- evcloud/types/partner_invite_response_action.py +5 -0
- evcloud/types/partner_invite_response_role.py +5 -0
- evcloud/types/partner_invite_response_version.py +5 -0
- evcloud/types/partner_invite_revoke_response.py +31 -0
- evcloud/types/partner_invite_revoke_response_role.py +5 -0
- evcloud/types/partner_response.py +41 -0
- evcloud/types/partner_response_ocpi_version.py +5 -0
- evcloud/types/partner_token_updated_event.py +35 -0
- evcloud/types/partner_versions_pull_response.py +29 -0
- evcloud/types/partner_versions_pull_response_code.py +8 -0
- evcloud/types/partner_versions_pull_response_version.py +5 -0
- evcloud/types/power_measurement.py +30 -0
- evcloud/types/power_measurement_event.py +30 -0
- evcloud/types/power_measurement_list.py +24 -0
- evcloud/types/power_type.py +5 -0
- evcloud/types/price_component.py +26 -0
- evcloud/types/price_limit.py +24 -0
- evcloud/types/pricing_mode.py +5 -0
- evcloud/types/queue_health.py +34 -0
- evcloud/types/reservation_cancel_response.py +25 -0
- evcloud/types/resolve_chargers_response_own.py +28 -0
- evcloud/types/resolve_chargers_response_own_ocpi_version.py +7 -0
- evcloud/types/resolve_chargers_response_own_ocpi_version_zero.py +5 -0
- evcloud/types/resolve_chargers_response_roaming.py +30 -0
- evcloud/types/resolve_chargers_response_roaming_ocpi_version.py +7 -0
- evcloud/types/resolve_chargers_response_roaming_ocpi_version_zero.py +5 -0
- evcloud/types/session_event.py +39 -0
- evcloud/types/session_out.py +60 -0
- evcloud/types/session_out_auth_method.py +7 -0
- evcloud/types/session_out_auth_method_zero.py +5 -0
- evcloud/types/session_out_billing_state.py +7 -0
- evcloud/types/session_out_billing_state_zero.py +5 -0
- evcloud/types/session_out_origin.py +7 -0
- evcloud/types/session_out_origin_zero.py +5 -0
- evcloud/types/session_out_status.py +7 -0
- evcloud/types/session_out_status_zero.py +7 -0
- evcloud/types/session_page.py +27 -0
- evcloud/types/session_write_response.py +27 -0
- evcloud/types/sharing_slot.py +25 -0
- evcloud/types/sharing_slot_input.py +25 -0
- evcloud/types/site_type.py +5 -0
- evcloud/types/sync_patch_request.py +26 -0
- evcloud/types/sync_pull_response.py +31 -0
- evcloud/types/sync_push_response.py +31 -0
- evcloud/types/sync_push_response_status.py +5 -0
- evcloud/types/tariff.py +42 -0
- evcloud/types/tariff_assignment_out.py +32 -0
- evcloud/types/tariff_assignment_page.py +27 -0
- evcloud/types/tariff_delete_response.py +26 -0
- evcloud/types/tariff_display.py +27 -0
- evcloud/types/tariff_element.py +26 -0
- evcloud/types/tariff_out.py +57 -0
- evcloud/types/tariff_out_origin.py +7 -0
- evcloud/types/tariff_out_origin_zero.py +5 -0
- evcloud/types/tariff_out_tax_included.py +7 -0
- evcloud/types/tariff_out_tax_included_zero.py +5 -0
- evcloud/types/tariff_out_type.py +7 -0
- evcloud/types/tariff_out_type_zero.py +7 -0
- evcloud/types/tariff_page.py +27 -0
- evcloud/types/tariff_restrictions.py +36 -0
- evcloud/types/tariff_summary.py +29 -0
- evcloud/types/tariff_tax_included.py +7 -0
- evcloud/types/tariff_tax_included_zero.py +5 -0
- evcloud/types/tariff_type.py +7 -0
- evcloud/types/tariff_updated_event.py +29 -0
- evcloud/types/tariff_write_response.py +26 -0
- evcloud/types/tax_included.py +5 -0
- evcloud/types/tenant_profile_out.py +31 -0
- evcloud/types/token_bulk_out.py +26 -0
- evcloud/types/token_create.py +46 -0
- evcloud/types/token_create_default_profile_type.py +5 -0
- evcloud/types/token_create_ocpi_version.py +5 -0
- evcloud/types/token_create_type.py +5 -0
- evcloud/types/token_create_whitelist.py +5 -0
- evcloud/types/token_event_data.py +47 -0
- evcloud/types/token_event_data_status.py +7 -0
- evcloud/types/token_event_data_type.py +5 -0
- evcloud/types/token_event_data_whitelist.py +5 -0
- evcloud/types/token_event_out.py +32 -0
- evcloud/types/token_event_out_event.py +7 -0
- evcloud/types/token_event_out_event_zero.py +7 -0
- evcloud/types/token_event_page.py +26 -0
- evcloud/types/token_failure_item.py +24 -0
- evcloud/types/token_group_action_out.py +27 -0
- evcloud/types/token_group_failure.py +24 -0
- evcloud/types/token_group_member_out.py +26 -0
- evcloud/types/token_group_network_out.py +35 -0
- evcloud/types/token_group_network_page.py +26 -0
- evcloud/types/token_group_out.py +31 -0
- evcloud/types/token_group_page.py +26 -0
- evcloud/types/token_out.py +55 -0
- evcloud/types/token_out_status.py +7 -0
- evcloud/types/token_out_status_zero.py +7 -0
- evcloud/types/token_out_type.py +7 -0
- evcloud/types/token_out_type_zero.py +5 -0
- evcloud/types/token_out_whitelist.py +7 -0
- evcloud/types/token_out_whitelist_zero.py +5 -0
- evcloud/types/token_page.py +26 -0
- evcloud/types/token_reason.py +23 -0
- evcloud/types/token_ref.py +26 -0
- evcloud/types/token_ref_ocpi_version.py +5 -0
- evcloud/types/token_write_response.py +28 -0
- evcloud/types/validation_error.py +28 -0
- evcloud/types/validation_error_loc_item.py +5 -0
- evcloud/types/webhook_delivery_page.py +27 -0
- evcloud/types/webhook_delivery_response.py +35 -0
- evcloud/types/webhook_page.py +27 -0
- evcloud/types/webhook_response.py +42 -0
- evcloud/types/webhook_response_event.py +7 -0
- evcloud/types/webhook_response_event_zero.py +27 -0
- evcloud/types/webhook_response_status.py +7 -0
- evcloud/types/webhook_response_status_zero.py +5 -0
- evcloud/types/webhook_test_result.py +25 -0
- evcloud/types/webhook_with_secret_response.py +43 -0
- evcloud/types/webhook_with_secret_response_event.py +7 -0
- evcloud/types/webhook_with_secret_response_event_zero.py +27 -0
- evcloud/types/webhook_with_secret_response_status.py +7 -0
- evcloud/types/webhook_with_secret_response_status_zero.py +5 -0
- evcloud/version.py +3 -0
- evcloud/webhooks/__init__.py +28 -0
- evcloud/webhooks/client.py +53 -0
- evcloud/webhooks/deliveries/__init__.py +4 -0
- evcloud/webhooks/deliveries/client.py +141 -0
- evcloud/webhooks/deliveries/raw_client.py +268 -0
- evcloud/webhooks/endpoints/__init__.py +17 -0
- evcloud/webhooks/endpoints/client.py +642 -0
- evcloud/webhooks/endpoints/raw_client.py +1521 -0
- evcloud/webhooks/endpoints/types/__init__.py +15 -0
- evcloud/webhooks/endpoints/types/list_endpoints_request_event_types_item.py +27 -0
- evcloud/webhooks/endpoints/types/webhook_create_request_api_version.py +5 -0
- evcloud/webhooks/endpoints/types/webhook_create_request_event.py +27 -0
- evcloud/webhooks/endpoints/types/webhook_update_request_status.py +5 -0
- evcloud/webhooks/event_types/__init__.py +7 -0
- evcloud/webhooks/event_types/client.py +176 -0
- evcloud/webhooks/event_types/raw_client.py +418 -0
- evcloud/webhooks/event_types/types/__init__.py +7 -0
- evcloud/webhooks/event_types/types/get_event_types_request_type.py +27 -0
- evcloud/webhooks/events/__init__.py +7 -0
- evcloud/webhooks/events/client.py +207 -0
- evcloud/webhooks/events/raw_client.py +355 -0
- evcloud/webhooks/events/types/__init__.py +8 -0
- evcloud/webhooks/events/types/deliver_event_request_data.py +33 -0
- evcloud/webhooks/events/types/deliver_event_request_event.py +27 -0
- evcloud/webhooks/health/__init__.py +4 -0
- evcloud/webhooks/health/client.py +161 -0
- evcloud/webhooks/health/raw_client.py +380 -0
- evcloud/webhooks/raw_client.py +13 -0
- evcloud-0.1.0.dist-info/METADATA +257 -0
- evcloud-0.1.0.dist-info/RECORD +635 -0
- evcloud-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,979 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from ...core.api_error import ApiError
|
|
8
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
10
|
+
from ...core.jsonable_encoder import encode_path_param
|
|
11
|
+
from ...core.pagination import AsyncPager, SyncPager
|
|
12
|
+
from ...core.parse_error import ParsingError
|
|
13
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
14
|
+
from ...core.request_options import RequestOptions
|
|
15
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
16
|
+
from ...errors.bad_gateway_error import BadGatewayError
|
|
17
|
+
from ...errors.bad_request_error import BadRequestError
|
|
18
|
+
from ...errors.conflict_error import ConflictError
|
|
19
|
+
from ...errors.gateway_timeout_error import GatewayTimeoutError
|
|
20
|
+
from ...errors.not_found_error import NotFoundError
|
|
21
|
+
from ...errors.too_many_requests_error import TooManyRequestsError
|
|
22
|
+
from ...errors.unauthorized_error import UnauthorizedError
|
|
23
|
+
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
24
|
+
from ...types.command_accepted import CommandAccepted
|
|
25
|
+
from ...types.command_page import CommandPage
|
|
26
|
+
from ...types.command_record import CommandRecord
|
|
27
|
+
from ...types.command_token import CommandToken
|
|
28
|
+
from ...types.http_error_response import HttpErrorResponse
|
|
29
|
+
from ...types.http_validation_error import HttpValidationError
|
|
30
|
+
from .types.send_commands_request_command import SendCommandsRequestCommand
|
|
31
|
+
from pydantic import ValidationError
|
|
32
|
+
|
|
33
|
+
# this is used as the default value for optional parameters
|
|
34
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class RawCommandsClient:
|
|
38
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
39
|
+
self._client_wrapper = client_wrapper
|
|
40
|
+
|
|
41
|
+
def send(
|
|
42
|
+
self,
|
|
43
|
+
authorization_reference: str,
|
|
44
|
+
command: SendCommandsRequestCommand,
|
|
45
|
+
*,
|
|
46
|
+
tracking_id: typing.Optional[str] = None,
|
|
47
|
+
idempotency_key: typing.Optional[str] = None,
|
|
48
|
+
ocpi_country_code: typing.Optional[str] = None,
|
|
49
|
+
ocpi_party_id: typing.Optional[str] = None,
|
|
50
|
+
request_id: typing.Optional[str] = None,
|
|
51
|
+
correlation_id: typing.Optional[str] = None,
|
|
52
|
+
command_callback_url: typing.Optional[str] = None,
|
|
53
|
+
session_callback_url: typing.Optional[str] = None,
|
|
54
|
+
cdr_callback_url: typing.Optional[str] = None,
|
|
55
|
+
token: typing.Optional[CommandToken] = OMIT,
|
|
56
|
+
location_id: typing.Optional[str] = OMIT,
|
|
57
|
+
evse_uid: typing.Optional[str] = OMIT,
|
|
58
|
+
connector_id: typing.Optional[str] = OMIT,
|
|
59
|
+
session_id: typing.Optional[str] = OMIT,
|
|
60
|
+
reservation_id: typing.Optional[str] = OMIT,
|
|
61
|
+
expiry_date: typing.Optional[dt.datetime] = OMIT,
|
|
62
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
63
|
+
) -> HttpResponse[CommandAccepted]:
|
|
64
|
+
"""
|
|
65
|
+
Starts, stops, unlocks or reserves. ``response`` is the immediate answer; the final result arrives on ``X-Command-Callback-Url`` and on ``GET /emsp/commands/{tracking_id}``. ``X-Tracking-Id`` (or ``Idempotency-Key``) makes the call safe to retry: the same id returns the first outcome without sending again.
|
|
66
|
+
|
|
67
|
+
emsp-gateway decides whether the charger is yours (sent over OCPP) or a roaming CPO's (sent over OCPI in the partner's version); ``route`` says which. Session and CDR updates for this authorization go to the session and CDR callback URLs.
|
|
68
|
+
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
authorization_reference : str
|
|
72
|
+
Your id for this authorization (OCPI CiString(36), no '/'). Sessions and CDRs carry it.
|
|
73
|
+
|
|
74
|
+
command : SendCommandsRequestCommand
|
|
75
|
+
The OCPI command.
|
|
76
|
+
|
|
77
|
+
tracking_id : typing.Optional[str]
|
|
78
|
+
Idempotency key and command id (≤36 printable ASCII). Generated when absent.
|
|
79
|
+
|
|
80
|
+
idempotency_key : typing.Optional[str]
|
|
81
|
+
Same as X-Tracking-Id; send one of the two.
|
|
82
|
+
|
|
83
|
+
ocpi_country_code : typing.Optional[str]
|
|
84
|
+
CPO country code, when location_id alone is ambiguous.
|
|
85
|
+
|
|
86
|
+
ocpi_party_id : typing.Optional[str]
|
|
87
|
+
CPO party id, when location_id alone is ambiguous.
|
|
88
|
+
|
|
89
|
+
request_id : typing.Optional[str]
|
|
90
|
+
Your request id; echoed on every callback.
|
|
91
|
+
|
|
92
|
+
correlation_id : typing.Optional[str]
|
|
93
|
+
Your correlation id; echoed on every callback.
|
|
94
|
+
|
|
95
|
+
command_callback_url : typing.Optional[str]
|
|
96
|
+
HTTPS URL that gets a POST with the final command result.
|
|
97
|
+
|
|
98
|
+
session_callback_url : typing.Optional[str]
|
|
99
|
+
HTTPS URL that gets a PUT with every session update.
|
|
100
|
+
|
|
101
|
+
cdr_callback_url : typing.Optional[str]
|
|
102
|
+
HTTPS URL that gets a POST per CDR.
|
|
103
|
+
|
|
104
|
+
token : typing.Optional[CommandToken]
|
|
105
|
+
START_SESSION and RESERVE_NOW: the driver's token.
|
|
106
|
+
|
|
107
|
+
location_id : typing.Optional[str]
|
|
108
|
+
OCPI location id of the charger.
|
|
109
|
+
|
|
110
|
+
evse_uid : typing.Optional[str]
|
|
111
|
+
OCPI EVSE uid.
|
|
112
|
+
|
|
113
|
+
connector_id : typing.Optional[str]
|
|
114
|
+
OCPI connector id.
|
|
115
|
+
|
|
116
|
+
session_id : typing.Optional[str]
|
|
117
|
+
STOP_SESSION: the OCPI session id to stop.
|
|
118
|
+
|
|
119
|
+
reservation_id : typing.Optional[str]
|
|
120
|
+
RESERVE_NOW and CANCEL_RESERVATION: your reservation id.
|
|
121
|
+
|
|
122
|
+
expiry_date : typing.Optional[dt.datetime]
|
|
123
|
+
RESERVE_NOW: when the reservation ends.
|
|
124
|
+
|
|
125
|
+
request_options : typing.Optional[RequestOptions]
|
|
126
|
+
Request-specific configuration.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
HttpResponse[CommandAccepted]
|
|
131
|
+
The route and the immediate answer; ``status`` is ``PENDING`` until the final result.
|
|
132
|
+
"""
|
|
133
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
134
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
135
|
+
)
|
|
136
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
137
|
+
f"emsp/commands/{encode_path_param(authorization_reference)}/{encode_path_param(command)}",
|
|
138
|
+
method="POST",
|
|
139
|
+
json={
|
|
140
|
+
"token": convert_and_respect_annotation_metadata(
|
|
141
|
+
object_=token, annotation=typing.Optional[CommandToken], direction="write"
|
|
142
|
+
),
|
|
143
|
+
"location_id": location_id,
|
|
144
|
+
"evse_uid": evse_uid,
|
|
145
|
+
"connector_id": connector_id,
|
|
146
|
+
"session_id": session_id,
|
|
147
|
+
"reservation_id": reservation_id,
|
|
148
|
+
"expiry_date": expiry_date,
|
|
149
|
+
},
|
|
150
|
+
headers={
|
|
151
|
+
"content-type": "application/json",
|
|
152
|
+
"X-Tracking-Id": str(tracking_id) if tracking_id is not None else None,
|
|
153
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
154
|
+
"X-Ocpi-Country-Code": str(ocpi_country_code) if ocpi_country_code is not None else None,
|
|
155
|
+
"X-Ocpi-Party-Id": str(ocpi_party_id) if ocpi_party_id is not None else None,
|
|
156
|
+
"X-Request-Id": str(request_id) if request_id is not None else None,
|
|
157
|
+
"X-Correlation-Id": str(correlation_id) if correlation_id is not None else None,
|
|
158
|
+
"X-Command-Callback-Url": str(command_callback_url) if command_callback_url is not None else None,
|
|
159
|
+
"X-Session-Callback-Url": str(session_callback_url) if session_callback_url is not None else None,
|
|
160
|
+
"X-Cdr-Callback-Url": str(cdr_callback_url) if cdr_callback_url is not None else None,
|
|
161
|
+
},
|
|
162
|
+
request_options=_request_options_with_retries_disabled,
|
|
163
|
+
omit=OMIT,
|
|
164
|
+
)
|
|
165
|
+
try:
|
|
166
|
+
if 200 <= _response.status_code < 300:
|
|
167
|
+
_data = typing.cast(
|
|
168
|
+
CommandAccepted,
|
|
169
|
+
parse_obj_as(
|
|
170
|
+
type_=CommandAccepted, # type: ignore
|
|
171
|
+
object_=_response.json(),
|
|
172
|
+
),
|
|
173
|
+
)
|
|
174
|
+
return HttpResponse(response=_response, data=_data)
|
|
175
|
+
if _response.status_code == 400:
|
|
176
|
+
raise BadRequestError(
|
|
177
|
+
headers=dict(_response.headers),
|
|
178
|
+
body=typing.cast(
|
|
179
|
+
HttpErrorResponse,
|
|
180
|
+
parse_obj_as(
|
|
181
|
+
type_=HttpErrorResponse, # type: ignore
|
|
182
|
+
object_=_response.json(),
|
|
183
|
+
),
|
|
184
|
+
),
|
|
185
|
+
)
|
|
186
|
+
if _response.status_code == 401:
|
|
187
|
+
raise UnauthorizedError(
|
|
188
|
+
headers=dict(_response.headers),
|
|
189
|
+
body=typing.cast(
|
|
190
|
+
HttpErrorResponse,
|
|
191
|
+
parse_obj_as(
|
|
192
|
+
type_=HttpErrorResponse, # type: ignore
|
|
193
|
+
object_=_response.json(),
|
|
194
|
+
),
|
|
195
|
+
),
|
|
196
|
+
)
|
|
197
|
+
if _response.status_code == 404:
|
|
198
|
+
raise NotFoundError(
|
|
199
|
+
headers=dict(_response.headers),
|
|
200
|
+
body=typing.cast(
|
|
201
|
+
HttpErrorResponse,
|
|
202
|
+
parse_obj_as(
|
|
203
|
+
type_=HttpErrorResponse, # type: ignore
|
|
204
|
+
object_=_response.json(),
|
|
205
|
+
),
|
|
206
|
+
),
|
|
207
|
+
)
|
|
208
|
+
if _response.status_code == 409:
|
|
209
|
+
raise ConflictError(
|
|
210
|
+
headers=dict(_response.headers),
|
|
211
|
+
body=typing.cast(
|
|
212
|
+
HttpErrorResponse,
|
|
213
|
+
parse_obj_as(
|
|
214
|
+
type_=HttpErrorResponse, # type: ignore
|
|
215
|
+
object_=_response.json(),
|
|
216
|
+
),
|
|
217
|
+
),
|
|
218
|
+
)
|
|
219
|
+
if _response.status_code == 422:
|
|
220
|
+
raise UnprocessableEntityError(
|
|
221
|
+
headers=dict(_response.headers),
|
|
222
|
+
body=typing.cast(
|
|
223
|
+
HttpValidationError,
|
|
224
|
+
parse_obj_as(
|
|
225
|
+
type_=HttpValidationError, # type: ignore
|
|
226
|
+
object_=_response.json(),
|
|
227
|
+
),
|
|
228
|
+
),
|
|
229
|
+
)
|
|
230
|
+
if _response.status_code == 429:
|
|
231
|
+
raise TooManyRequestsError(
|
|
232
|
+
headers=dict(_response.headers),
|
|
233
|
+
body=typing.cast(
|
|
234
|
+
HttpErrorResponse,
|
|
235
|
+
parse_obj_as(
|
|
236
|
+
type_=HttpErrorResponse, # type: ignore
|
|
237
|
+
object_=_response.json(),
|
|
238
|
+
),
|
|
239
|
+
),
|
|
240
|
+
)
|
|
241
|
+
if _response.status_code == 502:
|
|
242
|
+
raise BadGatewayError(
|
|
243
|
+
headers=dict(_response.headers),
|
|
244
|
+
body=typing.cast(
|
|
245
|
+
HttpErrorResponse,
|
|
246
|
+
parse_obj_as(
|
|
247
|
+
type_=HttpErrorResponse, # type: ignore
|
|
248
|
+
object_=_response.json(),
|
|
249
|
+
),
|
|
250
|
+
),
|
|
251
|
+
)
|
|
252
|
+
if _response.status_code == 504:
|
|
253
|
+
raise GatewayTimeoutError(
|
|
254
|
+
headers=dict(_response.headers),
|
|
255
|
+
body=typing.cast(
|
|
256
|
+
HttpErrorResponse,
|
|
257
|
+
parse_obj_as(
|
|
258
|
+
type_=HttpErrorResponse, # type: ignore
|
|
259
|
+
object_=_response.json(),
|
|
260
|
+
),
|
|
261
|
+
),
|
|
262
|
+
)
|
|
263
|
+
_response_json = _response.json()
|
|
264
|
+
except JSONDecodeError:
|
|
265
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
266
|
+
except ValidationError as e:
|
|
267
|
+
raise ParsingError(
|
|
268
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
269
|
+
)
|
|
270
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
271
|
+
|
|
272
|
+
def list(
|
|
273
|
+
self,
|
|
274
|
+
*,
|
|
275
|
+
authorization_reference: typing.Optional[str] = None,
|
|
276
|
+
after: typing.Optional[str] = None,
|
|
277
|
+
limit: typing.Optional[int] = None,
|
|
278
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
279
|
+
) -> SyncPager[CommandRecord, CommandPage]:
|
|
280
|
+
"""
|
|
281
|
+
Commands you sent, oldest first, optionally for one authorization.
|
|
282
|
+
|
|
283
|
+
Parameters
|
|
284
|
+
----------
|
|
285
|
+
authorization_reference : typing.Optional[str]
|
|
286
|
+
Only this authorization (the reference you sent the command with).
|
|
287
|
+
|
|
288
|
+
after : typing.Optional[str]
|
|
289
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
290
|
+
|
|
291
|
+
limit : typing.Optional[int]
|
|
292
|
+
Maximum rows per page (default 50, max 200).
|
|
293
|
+
|
|
294
|
+
request_options : typing.Optional[RequestOptions]
|
|
295
|
+
Request-specific configuration.
|
|
296
|
+
|
|
297
|
+
Returns
|
|
298
|
+
-------
|
|
299
|
+
SyncPager[CommandRecord, CommandPage]
|
|
300
|
+
One page of commands, oldest first.
|
|
301
|
+
"""
|
|
302
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
303
|
+
"emsp/commands",
|
|
304
|
+
method="GET",
|
|
305
|
+
params={
|
|
306
|
+
"authorization_reference": authorization_reference,
|
|
307
|
+
"after": after,
|
|
308
|
+
"limit": limit,
|
|
309
|
+
},
|
|
310
|
+
request_options=request_options,
|
|
311
|
+
)
|
|
312
|
+
try:
|
|
313
|
+
if 200 <= _response.status_code < 300:
|
|
314
|
+
_parsed_response = typing.cast(
|
|
315
|
+
CommandPage,
|
|
316
|
+
parse_obj_as(
|
|
317
|
+
type_=CommandPage, # type: ignore
|
|
318
|
+
object_=_response.json(),
|
|
319
|
+
),
|
|
320
|
+
)
|
|
321
|
+
_items = _parsed_response.data
|
|
322
|
+
_has_next = False
|
|
323
|
+
_get_next = None
|
|
324
|
+
if _parsed_response.pagination is not None:
|
|
325
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
326
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
327
|
+
_get_next = lambda: self.list(
|
|
328
|
+
authorization_reference=authorization_reference,
|
|
329
|
+
after=_parsed_next,
|
|
330
|
+
limit=limit,
|
|
331
|
+
request_options=request_options,
|
|
332
|
+
)
|
|
333
|
+
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
334
|
+
if _response.status_code == 401:
|
|
335
|
+
raise UnauthorizedError(
|
|
336
|
+
headers=dict(_response.headers),
|
|
337
|
+
body=typing.cast(
|
|
338
|
+
HttpErrorResponse,
|
|
339
|
+
parse_obj_as(
|
|
340
|
+
type_=HttpErrorResponse, # type: ignore
|
|
341
|
+
object_=_response.json(),
|
|
342
|
+
),
|
|
343
|
+
),
|
|
344
|
+
)
|
|
345
|
+
if _response.status_code == 422:
|
|
346
|
+
raise UnprocessableEntityError(
|
|
347
|
+
headers=dict(_response.headers),
|
|
348
|
+
body=typing.cast(
|
|
349
|
+
HttpValidationError,
|
|
350
|
+
parse_obj_as(
|
|
351
|
+
type_=HttpValidationError, # type: ignore
|
|
352
|
+
object_=_response.json(),
|
|
353
|
+
),
|
|
354
|
+
),
|
|
355
|
+
)
|
|
356
|
+
if _response.status_code == 429:
|
|
357
|
+
raise TooManyRequestsError(
|
|
358
|
+
headers=dict(_response.headers),
|
|
359
|
+
body=typing.cast(
|
|
360
|
+
HttpErrorResponse,
|
|
361
|
+
parse_obj_as(
|
|
362
|
+
type_=HttpErrorResponse, # type: ignore
|
|
363
|
+
object_=_response.json(),
|
|
364
|
+
),
|
|
365
|
+
),
|
|
366
|
+
)
|
|
367
|
+
if _response.status_code == 502:
|
|
368
|
+
raise BadGatewayError(
|
|
369
|
+
headers=dict(_response.headers),
|
|
370
|
+
body=typing.cast(
|
|
371
|
+
HttpErrorResponse,
|
|
372
|
+
parse_obj_as(
|
|
373
|
+
type_=HttpErrorResponse, # type: ignore
|
|
374
|
+
object_=_response.json(),
|
|
375
|
+
),
|
|
376
|
+
),
|
|
377
|
+
)
|
|
378
|
+
if _response.status_code == 504:
|
|
379
|
+
raise GatewayTimeoutError(
|
|
380
|
+
headers=dict(_response.headers),
|
|
381
|
+
body=typing.cast(
|
|
382
|
+
HttpErrorResponse,
|
|
383
|
+
parse_obj_as(
|
|
384
|
+
type_=HttpErrorResponse, # type: ignore
|
|
385
|
+
object_=_response.json(),
|
|
386
|
+
),
|
|
387
|
+
),
|
|
388
|
+
)
|
|
389
|
+
_response_json = _response.json()
|
|
390
|
+
except JSONDecodeError:
|
|
391
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
392
|
+
except ValidationError as e:
|
|
393
|
+
raise ParsingError(
|
|
394
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
395
|
+
)
|
|
396
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
397
|
+
|
|
398
|
+
def get(
|
|
399
|
+
self, tracking_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
400
|
+
) -> HttpResponse[CommandRecord]:
|
|
401
|
+
"""
|
|
402
|
+
Route, status, the immediate response and the final result of one command. A roaming command still ``PENDING`` is refreshed from the partner's CommandResult first, so polling this finishes it.
|
|
403
|
+
|
|
404
|
+
Parameters
|
|
405
|
+
----------
|
|
406
|
+
tracking_id : str
|
|
407
|
+
``tracking_id`` returned by ``POST /emsp/commands/...``.
|
|
408
|
+
|
|
409
|
+
request_options : typing.Optional[RequestOptions]
|
|
410
|
+
Request-specific configuration.
|
|
411
|
+
|
|
412
|
+
Returns
|
|
413
|
+
-------
|
|
414
|
+
HttpResponse[CommandRecord]
|
|
415
|
+
The command with its route, response and final result.
|
|
416
|
+
"""
|
|
417
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
418
|
+
f"emsp/commands/{encode_path_param(tracking_id)}",
|
|
419
|
+
method="GET",
|
|
420
|
+
request_options=request_options,
|
|
421
|
+
)
|
|
422
|
+
try:
|
|
423
|
+
if 200 <= _response.status_code < 300:
|
|
424
|
+
_data = typing.cast(
|
|
425
|
+
CommandRecord,
|
|
426
|
+
parse_obj_as(
|
|
427
|
+
type_=CommandRecord, # type: ignore
|
|
428
|
+
object_=_response.json(),
|
|
429
|
+
),
|
|
430
|
+
)
|
|
431
|
+
return HttpResponse(response=_response, data=_data)
|
|
432
|
+
if _response.status_code == 401:
|
|
433
|
+
raise UnauthorizedError(
|
|
434
|
+
headers=dict(_response.headers),
|
|
435
|
+
body=typing.cast(
|
|
436
|
+
HttpErrorResponse,
|
|
437
|
+
parse_obj_as(
|
|
438
|
+
type_=HttpErrorResponse, # type: ignore
|
|
439
|
+
object_=_response.json(),
|
|
440
|
+
),
|
|
441
|
+
),
|
|
442
|
+
)
|
|
443
|
+
if _response.status_code == 404:
|
|
444
|
+
raise NotFoundError(
|
|
445
|
+
headers=dict(_response.headers),
|
|
446
|
+
body=typing.cast(
|
|
447
|
+
HttpErrorResponse,
|
|
448
|
+
parse_obj_as(
|
|
449
|
+
type_=HttpErrorResponse, # type: ignore
|
|
450
|
+
object_=_response.json(),
|
|
451
|
+
),
|
|
452
|
+
),
|
|
453
|
+
)
|
|
454
|
+
if _response.status_code == 422:
|
|
455
|
+
raise UnprocessableEntityError(
|
|
456
|
+
headers=dict(_response.headers),
|
|
457
|
+
body=typing.cast(
|
|
458
|
+
HttpValidationError,
|
|
459
|
+
parse_obj_as(
|
|
460
|
+
type_=HttpValidationError, # type: ignore
|
|
461
|
+
object_=_response.json(),
|
|
462
|
+
),
|
|
463
|
+
),
|
|
464
|
+
)
|
|
465
|
+
if _response.status_code == 429:
|
|
466
|
+
raise TooManyRequestsError(
|
|
467
|
+
headers=dict(_response.headers),
|
|
468
|
+
body=typing.cast(
|
|
469
|
+
HttpErrorResponse,
|
|
470
|
+
parse_obj_as(
|
|
471
|
+
type_=HttpErrorResponse, # type: ignore
|
|
472
|
+
object_=_response.json(),
|
|
473
|
+
),
|
|
474
|
+
),
|
|
475
|
+
)
|
|
476
|
+
if _response.status_code == 502:
|
|
477
|
+
raise BadGatewayError(
|
|
478
|
+
headers=dict(_response.headers),
|
|
479
|
+
body=typing.cast(
|
|
480
|
+
HttpErrorResponse,
|
|
481
|
+
parse_obj_as(
|
|
482
|
+
type_=HttpErrorResponse, # type: ignore
|
|
483
|
+
object_=_response.json(),
|
|
484
|
+
),
|
|
485
|
+
),
|
|
486
|
+
)
|
|
487
|
+
if _response.status_code == 504:
|
|
488
|
+
raise GatewayTimeoutError(
|
|
489
|
+
headers=dict(_response.headers),
|
|
490
|
+
body=typing.cast(
|
|
491
|
+
HttpErrorResponse,
|
|
492
|
+
parse_obj_as(
|
|
493
|
+
type_=HttpErrorResponse, # type: ignore
|
|
494
|
+
object_=_response.json(),
|
|
495
|
+
),
|
|
496
|
+
),
|
|
497
|
+
)
|
|
498
|
+
_response_json = _response.json()
|
|
499
|
+
except JSONDecodeError:
|
|
500
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
501
|
+
except ValidationError as e:
|
|
502
|
+
raise ParsingError(
|
|
503
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
504
|
+
)
|
|
505
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
class AsyncRawCommandsClient:
|
|
509
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
510
|
+
self._client_wrapper = client_wrapper
|
|
511
|
+
|
|
512
|
+
async def send(
|
|
513
|
+
self,
|
|
514
|
+
authorization_reference: str,
|
|
515
|
+
command: SendCommandsRequestCommand,
|
|
516
|
+
*,
|
|
517
|
+
tracking_id: typing.Optional[str] = None,
|
|
518
|
+
idempotency_key: typing.Optional[str] = None,
|
|
519
|
+
ocpi_country_code: typing.Optional[str] = None,
|
|
520
|
+
ocpi_party_id: typing.Optional[str] = None,
|
|
521
|
+
request_id: typing.Optional[str] = None,
|
|
522
|
+
correlation_id: typing.Optional[str] = None,
|
|
523
|
+
command_callback_url: typing.Optional[str] = None,
|
|
524
|
+
session_callback_url: typing.Optional[str] = None,
|
|
525
|
+
cdr_callback_url: typing.Optional[str] = None,
|
|
526
|
+
token: typing.Optional[CommandToken] = OMIT,
|
|
527
|
+
location_id: typing.Optional[str] = OMIT,
|
|
528
|
+
evse_uid: typing.Optional[str] = OMIT,
|
|
529
|
+
connector_id: typing.Optional[str] = OMIT,
|
|
530
|
+
session_id: typing.Optional[str] = OMIT,
|
|
531
|
+
reservation_id: typing.Optional[str] = OMIT,
|
|
532
|
+
expiry_date: typing.Optional[dt.datetime] = OMIT,
|
|
533
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
534
|
+
) -> AsyncHttpResponse[CommandAccepted]:
|
|
535
|
+
"""
|
|
536
|
+
Starts, stops, unlocks or reserves. ``response`` is the immediate answer; the final result arrives on ``X-Command-Callback-Url`` and on ``GET /emsp/commands/{tracking_id}``. ``X-Tracking-Id`` (or ``Idempotency-Key``) makes the call safe to retry: the same id returns the first outcome without sending again.
|
|
537
|
+
|
|
538
|
+
emsp-gateway decides whether the charger is yours (sent over OCPP) or a roaming CPO's (sent over OCPI in the partner's version); ``route`` says which. Session and CDR updates for this authorization go to the session and CDR callback URLs.
|
|
539
|
+
|
|
540
|
+
Parameters
|
|
541
|
+
----------
|
|
542
|
+
authorization_reference : str
|
|
543
|
+
Your id for this authorization (OCPI CiString(36), no '/'). Sessions and CDRs carry it.
|
|
544
|
+
|
|
545
|
+
command : SendCommandsRequestCommand
|
|
546
|
+
The OCPI command.
|
|
547
|
+
|
|
548
|
+
tracking_id : typing.Optional[str]
|
|
549
|
+
Idempotency key and command id (≤36 printable ASCII). Generated when absent.
|
|
550
|
+
|
|
551
|
+
idempotency_key : typing.Optional[str]
|
|
552
|
+
Same as X-Tracking-Id; send one of the two.
|
|
553
|
+
|
|
554
|
+
ocpi_country_code : typing.Optional[str]
|
|
555
|
+
CPO country code, when location_id alone is ambiguous.
|
|
556
|
+
|
|
557
|
+
ocpi_party_id : typing.Optional[str]
|
|
558
|
+
CPO party id, when location_id alone is ambiguous.
|
|
559
|
+
|
|
560
|
+
request_id : typing.Optional[str]
|
|
561
|
+
Your request id; echoed on every callback.
|
|
562
|
+
|
|
563
|
+
correlation_id : typing.Optional[str]
|
|
564
|
+
Your correlation id; echoed on every callback.
|
|
565
|
+
|
|
566
|
+
command_callback_url : typing.Optional[str]
|
|
567
|
+
HTTPS URL that gets a POST with the final command result.
|
|
568
|
+
|
|
569
|
+
session_callback_url : typing.Optional[str]
|
|
570
|
+
HTTPS URL that gets a PUT with every session update.
|
|
571
|
+
|
|
572
|
+
cdr_callback_url : typing.Optional[str]
|
|
573
|
+
HTTPS URL that gets a POST per CDR.
|
|
574
|
+
|
|
575
|
+
token : typing.Optional[CommandToken]
|
|
576
|
+
START_SESSION and RESERVE_NOW: the driver's token.
|
|
577
|
+
|
|
578
|
+
location_id : typing.Optional[str]
|
|
579
|
+
OCPI location id of the charger.
|
|
580
|
+
|
|
581
|
+
evse_uid : typing.Optional[str]
|
|
582
|
+
OCPI EVSE uid.
|
|
583
|
+
|
|
584
|
+
connector_id : typing.Optional[str]
|
|
585
|
+
OCPI connector id.
|
|
586
|
+
|
|
587
|
+
session_id : typing.Optional[str]
|
|
588
|
+
STOP_SESSION: the OCPI session id to stop.
|
|
589
|
+
|
|
590
|
+
reservation_id : typing.Optional[str]
|
|
591
|
+
RESERVE_NOW and CANCEL_RESERVATION: your reservation id.
|
|
592
|
+
|
|
593
|
+
expiry_date : typing.Optional[dt.datetime]
|
|
594
|
+
RESERVE_NOW: when the reservation ends.
|
|
595
|
+
|
|
596
|
+
request_options : typing.Optional[RequestOptions]
|
|
597
|
+
Request-specific configuration.
|
|
598
|
+
|
|
599
|
+
Returns
|
|
600
|
+
-------
|
|
601
|
+
AsyncHttpResponse[CommandAccepted]
|
|
602
|
+
The route and the immediate answer; ``status`` is ``PENDING`` until the final result.
|
|
603
|
+
"""
|
|
604
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
605
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
606
|
+
)
|
|
607
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
608
|
+
f"emsp/commands/{encode_path_param(authorization_reference)}/{encode_path_param(command)}",
|
|
609
|
+
method="POST",
|
|
610
|
+
json={
|
|
611
|
+
"token": convert_and_respect_annotation_metadata(
|
|
612
|
+
object_=token, annotation=typing.Optional[CommandToken], direction="write"
|
|
613
|
+
),
|
|
614
|
+
"location_id": location_id,
|
|
615
|
+
"evse_uid": evse_uid,
|
|
616
|
+
"connector_id": connector_id,
|
|
617
|
+
"session_id": session_id,
|
|
618
|
+
"reservation_id": reservation_id,
|
|
619
|
+
"expiry_date": expiry_date,
|
|
620
|
+
},
|
|
621
|
+
headers={
|
|
622
|
+
"content-type": "application/json",
|
|
623
|
+
"X-Tracking-Id": str(tracking_id) if tracking_id is not None else None,
|
|
624
|
+
"Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
|
|
625
|
+
"X-Ocpi-Country-Code": str(ocpi_country_code) if ocpi_country_code is not None else None,
|
|
626
|
+
"X-Ocpi-Party-Id": str(ocpi_party_id) if ocpi_party_id is not None else None,
|
|
627
|
+
"X-Request-Id": str(request_id) if request_id is not None else None,
|
|
628
|
+
"X-Correlation-Id": str(correlation_id) if correlation_id is not None else None,
|
|
629
|
+
"X-Command-Callback-Url": str(command_callback_url) if command_callback_url is not None else None,
|
|
630
|
+
"X-Session-Callback-Url": str(session_callback_url) if session_callback_url is not None else None,
|
|
631
|
+
"X-Cdr-Callback-Url": str(cdr_callback_url) if cdr_callback_url is not None else None,
|
|
632
|
+
},
|
|
633
|
+
request_options=_request_options_with_retries_disabled,
|
|
634
|
+
omit=OMIT,
|
|
635
|
+
)
|
|
636
|
+
try:
|
|
637
|
+
if 200 <= _response.status_code < 300:
|
|
638
|
+
_data = typing.cast(
|
|
639
|
+
CommandAccepted,
|
|
640
|
+
parse_obj_as(
|
|
641
|
+
type_=CommandAccepted, # type: ignore
|
|
642
|
+
object_=_response.json(),
|
|
643
|
+
),
|
|
644
|
+
)
|
|
645
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
646
|
+
if _response.status_code == 400:
|
|
647
|
+
raise BadRequestError(
|
|
648
|
+
headers=dict(_response.headers),
|
|
649
|
+
body=typing.cast(
|
|
650
|
+
HttpErrorResponse,
|
|
651
|
+
parse_obj_as(
|
|
652
|
+
type_=HttpErrorResponse, # type: ignore
|
|
653
|
+
object_=_response.json(),
|
|
654
|
+
),
|
|
655
|
+
),
|
|
656
|
+
)
|
|
657
|
+
if _response.status_code == 401:
|
|
658
|
+
raise UnauthorizedError(
|
|
659
|
+
headers=dict(_response.headers),
|
|
660
|
+
body=typing.cast(
|
|
661
|
+
HttpErrorResponse,
|
|
662
|
+
parse_obj_as(
|
|
663
|
+
type_=HttpErrorResponse, # type: ignore
|
|
664
|
+
object_=_response.json(),
|
|
665
|
+
),
|
|
666
|
+
),
|
|
667
|
+
)
|
|
668
|
+
if _response.status_code == 404:
|
|
669
|
+
raise NotFoundError(
|
|
670
|
+
headers=dict(_response.headers),
|
|
671
|
+
body=typing.cast(
|
|
672
|
+
HttpErrorResponse,
|
|
673
|
+
parse_obj_as(
|
|
674
|
+
type_=HttpErrorResponse, # type: ignore
|
|
675
|
+
object_=_response.json(),
|
|
676
|
+
),
|
|
677
|
+
),
|
|
678
|
+
)
|
|
679
|
+
if _response.status_code == 409:
|
|
680
|
+
raise ConflictError(
|
|
681
|
+
headers=dict(_response.headers),
|
|
682
|
+
body=typing.cast(
|
|
683
|
+
HttpErrorResponse,
|
|
684
|
+
parse_obj_as(
|
|
685
|
+
type_=HttpErrorResponse, # type: ignore
|
|
686
|
+
object_=_response.json(),
|
|
687
|
+
),
|
|
688
|
+
),
|
|
689
|
+
)
|
|
690
|
+
if _response.status_code == 422:
|
|
691
|
+
raise UnprocessableEntityError(
|
|
692
|
+
headers=dict(_response.headers),
|
|
693
|
+
body=typing.cast(
|
|
694
|
+
HttpValidationError,
|
|
695
|
+
parse_obj_as(
|
|
696
|
+
type_=HttpValidationError, # type: ignore
|
|
697
|
+
object_=_response.json(),
|
|
698
|
+
),
|
|
699
|
+
),
|
|
700
|
+
)
|
|
701
|
+
if _response.status_code == 429:
|
|
702
|
+
raise TooManyRequestsError(
|
|
703
|
+
headers=dict(_response.headers),
|
|
704
|
+
body=typing.cast(
|
|
705
|
+
HttpErrorResponse,
|
|
706
|
+
parse_obj_as(
|
|
707
|
+
type_=HttpErrorResponse, # type: ignore
|
|
708
|
+
object_=_response.json(),
|
|
709
|
+
),
|
|
710
|
+
),
|
|
711
|
+
)
|
|
712
|
+
if _response.status_code == 502:
|
|
713
|
+
raise BadGatewayError(
|
|
714
|
+
headers=dict(_response.headers),
|
|
715
|
+
body=typing.cast(
|
|
716
|
+
HttpErrorResponse,
|
|
717
|
+
parse_obj_as(
|
|
718
|
+
type_=HttpErrorResponse, # type: ignore
|
|
719
|
+
object_=_response.json(),
|
|
720
|
+
),
|
|
721
|
+
),
|
|
722
|
+
)
|
|
723
|
+
if _response.status_code == 504:
|
|
724
|
+
raise GatewayTimeoutError(
|
|
725
|
+
headers=dict(_response.headers),
|
|
726
|
+
body=typing.cast(
|
|
727
|
+
HttpErrorResponse,
|
|
728
|
+
parse_obj_as(
|
|
729
|
+
type_=HttpErrorResponse, # type: ignore
|
|
730
|
+
object_=_response.json(),
|
|
731
|
+
),
|
|
732
|
+
),
|
|
733
|
+
)
|
|
734
|
+
_response_json = _response.json()
|
|
735
|
+
except JSONDecodeError:
|
|
736
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
737
|
+
except ValidationError as e:
|
|
738
|
+
raise ParsingError(
|
|
739
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
740
|
+
)
|
|
741
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
742
|
+
|
|
743
|
+
async def list(
|
|
744
|
+
self,
|
|
745
|
+
*,
|
|
746
|
+
authorization_reference: typing.Optional[str] = None,
|
|
747
|
+
after: typing.Optional[str] = None,
|
|
748
|
+
limit: typing.Optional[int] = None,
|
|
749
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
750
|
+
) -> AsyncPager[CommandRecord, CommandPage]:
|
|
751
|
+
"""
|
|
752
|
+
Commands you sent, oldest first, optionally for one authorization.
|
|
753
|
+
|
|
754
|
+
Parameters
|
|
755
|
+
----------
|
|
756
|
+
authorization_reference : typing.Optional[str]
|
|
757
|
+
Only this authorization (the reference you sent the command with).
|
|
758
|
+
|
|
759
|
+
after : typing.Optional[str]
|
|
760
|
+
Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
|
|
761
|
+
|
|
762
|
+
limit : typing.Optional[int]
|
|
763
|
+
Maximum rows per page (default 50, max 200).
|
|
764
|
+
|
|
765
|
+
request_options : typing.Optional[RequestOptions]
|
|
766
|
+
Request-specific configuration.
|
|
767
|
+
|
|
768
|
+
Returns
|
|
769
|
+
-------
|
|
770
|
+
AsyncPager[CommandRecord, CommandPage]
|
|
771
|
+
One page of commands, oldest first.
|
|
772
|
+
"""
|
|
773
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
774
|
+
"emsp/commands",
|
|
775
|
+
method="GET",
|
|
776
|
+
params={
|
|
777
|
+
"authorization_reference": authorization_reference,
|
|
778
|
+
"after": after,
|
|
779
|
+
"limit": limit,
|
|
780
|
+
},
|
|
781
|
+
request_options=request_options,
|
|
782
|
+
)
|
|
783
|
+
try:
|
|
784
|
+
if 200 <= _response.status_code < 300:
|
|
785
|
+
_parsed_response = typing.cast(
|
|
786
|
+
CommandPage,
|
|
787
|
+
parse_obj_as(
|
|
788
|
+
type_=CommandPage, # type: ignore
|
|
789
|
+
object_=_response.json(),
|
|
790
|
+
),
|
|
791
|
+
)
|
|
792
|
+
_items = _parsed_response.data
|
|
793
|
+
_has_next = False
|
|
794
|
+
_get_next = None
|
|
795
|
+
if _parsed_response.pagination is not None:
|
|
796
|
+
_parsed_next = _parsed_response.pagination.end_cursor
|
|
797
|
+
_has_next = _parsed_next is not None and _parsed_next != ""
|
|
798
|
+
|
|
799
|
+
async def _get_next():
|
|
800
|
+
return await self.list(
|
|
801
|
+
authorization_reference=authorization_reference,
|
|
802
|
+
after=_parsed_next,
|
|
803
|
+
limit=limit,
|
|
804
|
+
request_options=request_options,
|
|
805
|
+
)
|
|
806
|
+
|
|
807
|
+
return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
|
|
808
|
+
if _response.status_code == 401:
|
|
809
|
+
raise UnauthorizedError(
|
|
810
|
+
headers=dict(_response.headers),
|
|
811
|
+
body=typing.cast(
|
|
812
|
+
HttpErrorResponse,
|
|
813
|
+
parse_obj_as(
|
|
814
|
+
type_=HttpErrorResponse, # type: ignore
|
|
815
|
+
object_=_response.json(),
|
|
816
|
+
),
|
|
817
|
+
),
|
|
818
|
+
)
|
|
819
|
+
if _response.status_code == 422:
|
|
820
|
+
raise UnprocessableEntityError(
|
|
821
|
+
headers=dict(_response.headers),
|
|
822
|
+
body=typing.cast(
|
|
823
|
+
HttpValidationError,
|
|
824
|
+
parse_obj_as(
|
|
825
|
+
type_=HttpValidationError, # type: ignore
|
|
826
|
+
object_=_response.json(),
|
|
827
|
+
),
|
|
828
|
+
),
|
|
829
|
+
)
|
|
830
|
+
if _response.status_code == 429:
|
|
831
|
+
raise TooManyRequestsError(
|
|
832
|
+
headers=dict(_response.headers),
|
|
833
|
+
body=typing.cast(
|
|
834
|
+
HttpErrorResponse,
|
|
835
|
+
parse_obj_as(
|
|
836
|
+
type_=HttpErrorResponse, # type: ignore
|
|
837
|
+
object_=_response.json(),
|
|
838
|
+
),
|
|
839
|
+
),
|
|
840
|
+
)
|
|
841
|
+
if _response.status_code == 502:
|
|
842
|
+
raise BadGatewayError(
|
|
843
|
+
headers=dict(_response.headers),
|
|
844
|
+
body=typing.cast(
|
|
845
|
+
HttpErrorResponse,
|
|
846
|
+
parse_obj_as(
|
|
847
|
+
type_=HttpErrorResponse, # type: ignore
|
|
848
|
+
object_=_response.json(),
|
|
849
|
+
),
|
|
850
|
+
),
|
|
851
|
+
)
|
|
852
|
+
if _response.status_code == 504:
|
|
853
|
+
raise GatewayTimeoutError(
|
|
854
|
+
headers=dict(_response.headers),
|
|
855
|
+
body=typing.cast(
|
|
856
|
+
HttpErrorResponse,
|
|
857
|
+
parse_obj_as(
|
|
858
|
+
type_=HttpErrorResponse, # type: ignore
|
|
859
|
+
object_=_response.json(),
|
|
860
|
+
),
|
|
861
|
+
),
|
|
862
|
+
)
|
|
863
|
+
_response_json = _response.json()
|
|
864
|
+
except JSONDecodeError:
|
|
865
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
866
|
+
except ValidationError as e:
|
|
867
|
+
raise ParsingError(
|
|
868
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
869
|
+
)
|
|
870
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
871
|
+
|
|
872
|
+
async def get(
|
|
873
|
+
self, tracking_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
874
|
+
) -> AsyncHttpResponse[CommandRecord]:
|
|
875
|
+
"""
|
|
876
|
+
Route, status, the immediate response and the final result of one command. A roaming command still ``PENDING`` is refreshed from the partner's CommandResult first, so polling this finishes it.
|
|
877
|
+
|
|
878
|
+
Parameters
|
|
879
|
+
----------
|
|
880
|
+
tracking_id : str
|
|
881
|
+
``tracking_id`` returned by ``POST /emsp/commands/...``.
|
|
882
|
+
|
|
883
|
+
request_options : typing.Optional[RequestOptions]
|
|
884
|
+
Request-specific configuration.
|
|
885
|
+
|
|
886
|
+
Returns
|
|
887
|
+
-------
|
|
888
|
+
AsyncHttpResponse[CommandRecord]
|
|
889
|
+
The command with its route, response and final result.
|
|
890
|
+
"""
|
|
891
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
892
|
+
f"emsp/commands/{encode_path_param(tracking_id)}",
|
|
893
|
+
method="GET",
|
|
894
|
+
request_options=request_options,
|
|
895
|
+
)
|
|
896
|
+
try:
|
|
897
|
+
if 200 <= _response.status_code < 300:
|
|
898
|
+
_data = typing.cast(
|
|
899
|
+
CommandRecord,
|
|
900
|
+
parse_obj_as(
|
|
901
|
+
type_=CommandRecord, # type: ignore
|
|
902
|
+
object_=_response.json(),
|
|
903
|
+
),
|
|
904
|
+
)
|
|
905
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
906
|
+
if _response.status_code == 401:
|
|
907
|
+
raise UnauthorizedError(
|
|
908
|
+
headers=dict(_response.headers),
|
|
909
|
+
body=typing.cast(
|
|
910
|
+
HttpErrorResponse,
|
|
911
|
+
parse_obj_as(
|
|
912
|
+
type_=HttpErrorResponse, # type: ignore
|
|
913
|
+
object_=_response.json(),
|
|
914
|
+
),
|
|
915
|
+
),
|
|
916
|
+
)
|
|
917
|
+
if _response.status_code == 404:
|
|
918
|
+
raise NotFoundError(
|
|
919
|
+
headers=dict(_response.headers),
|
|
920
|
+
body=typing.cast(
|
|
921
|
+
HttpErrorResponse,
|
|
922
|
+
parse_obj_as(
|
|
923
|
+
type_=HttpErrorResponse, # type: ignore
|
|
924
|
+
object_=_response.json(),
|
|
925
|
+
),
|
|
926
|
+
),
|
|
927
|
+
)
|
|
928
|
+
if _response.status_code == 422:
|
|
929
|
+
raise UnprocessableEntityError(
|
|
930
|
+
headers=dict(_response.headers),
|
|
931
|
+
body=typing.cast(
|
|
932
|
+
HttpValidationError,
|
|
933
|
+
parse_obj_as(
|
|
934
|
+
type_=HttpValidationError, # type: ignore
|
|
935
|
+
object_=_response.json(),
|
|
936
|
+
),
|
|
937
|
+
),
|
|
938
|
+
)
|
|
939
|
+
if _response.status_code == 429:
|
|
940
|
+
raise TooManyRequestsError(
|
|
941
|
+
headers=dict(_response.headers),
|
|
942
|
+
body=typing.cast(
|
|
943
|
+
HttpErrorResponse,
|
|
944
|
+
parse_obj_as(
|
|
945
|
+
type_=HttpErrorResponse, # type: ignore
|
|
946
|
+
object_=_response.json(),
|
|
947
|
+
),
|
|
948
|
+
),
|
|
949
|
+
)
|
|
950
|
+
if _response.status_code == 502:
|
|
951
|
+
raise BadGatewayError(
|
|
952
|
+
headers=dict(_response.headers),
|
|
953
|
+
body=typing.cast(
|
|
954
|
+
HttpErrorResponse,
|
|
955
|
+
parse_obj_as(
|
|
956
|
+
type_=HttpErrorResponse, # type: ignore
|
|
957
|
+
object_=_response.json(),
|
|
958
|
+
),
|
|
959
|
+
),
|
|
960
|
+
)
|
|
961
|
+
if _response.status_code == 504:
|
|
962
|
+
raise GatewayTimeoutError(
|
|
963
|
+
headers=dict(_response.headers),
|
|
964
|
+
body=typing.cast(
|
|
965
|
+
HttpErrorResponse,
|
|
966
|
+
parse_obj_as(
|
|
967
|
+
type_=HttpErrorResponse, # type: ignore
|
|
968
|
+
object_=_response.json(),
|
|
969
|
+
),
|
|
970
|
+
),
|
|
971
|
+
)
|
|
972
|
+
_response_json = _response.json()
|
|
973
|
+
except JSONDecodeError:
|
|
974
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
975
|
+
except ValidationError as e:
|
|
976
|
+
raise ParsingError(
|
|
977
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
978
|
+
)
|
|
979
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|