tesla-api-sdk 1.0.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.
- tesla_api_sdk-1.0.0.dist-info/METADATA +145 -0
- tesla_api_sdk-1.0.0.dist-info/RECORD +119 -0
- tesla_api_sdk-1.0.0.dist-info/WHEEL +5 -0
- tesla_api_sdk-1.0.0.dist-info/licenses/LICENSE +28 -0
- tesla_api_sdk-1.0.0.dist-info/top_level.txt +1 -0
- teslafleetmanagementapi/__init__.py +13 -0
- teslafleetmanagementapi/api_helper.py +19 -0
- teslafleetmanagementapi/configuration.py +270 -0
- teslafleetmanagementapi/controllers/__init__.py +11 -0
- teslafleetmanagementapi/controllers/base_controller.py +70 -0
- teslafleetmanagementapi/controllers/charging_controller.py +140 -0
- teslafleetmanagementapi/controllers/energy_controller.py +572 -0
- teslafleetmanagementapi/controllers/oauth_authorization_controller.py +165 -0
- teslafleetmanagementapi/controllers/partner_controller.py +181 -0
- teslafleetmanagementapi/controllers/user_controller.py +158 -0
- teslafleetmanagementapi/controllers/vehicles_controller.py +832 -0
- teslafleetmanagementapi/exceptions/__init__.py +6 -0
- teslafleetmanagementapi/exceptions/api_exception.py +36 -0
- teslafleetmanagementapi/exceptions/oauth_provider_exception.py +75 -0
- teslafleetmanagementapi/http/__init__.py +11 -0
- teslafleetmanagementapi/http/api_response.py +67 -0
- teslafleetmanagementapi/http/auth/__init__.py +6 -0
- teslafleetmanagementapi/http/auth/bearer_auth.py +103 -0
- teslafleetmanagementapi/http/auth/oauth_2.py +311 -0
- teslafleetmanagementapi/http/http_call_back.py +20 -0
- teslafleetmanagementapi/http/http_client_provider.py +23 -0
- teslafleetmanagementapi/http/http_method_enum.py +25 -0
- teslafleetmanagementapi/http/http_request.py +55 -0
- teslafleetmanagementapi/http/http_response.py +45 -0
- teslafleetmanagementapi/http/proxy_settings.py +50 -0
- teslafleetmanagementapi/logging/__init__.py +6 -0
- teslafleetmanagementapi/logging/configuration/__init__.py +5 -0
- teslafleetmanagementapi/logging/configuration/api_logging_configuration.py +398 -0
- teslafleetmanagementapi/logging/sdk_logger.py +28 -0
- teslafleetmanagementapi/models/__init__.py +85 -0
- teslafleetmanagementapi/models/api_1_dx_vehicles_options_response.py +110 -0
- teslafleetmanagementapi/models/api_1_dx_warranty_details_response.py +110 -0
- teslafleetmanagementapi/models/api_1_vehicles_mobile_enabled_response.py +109 -0
- teslafleetmanagementapi/models/api_1_vehicles_nearby_charging_sites_response.py +109 -0
- teslafleetmanagementapi/models/api_1_vehicles_response.py +162 -0
- teslafleetmanagementapi/models/api_1_vehicles_response_get_vehicle.py +109 -0
- teslafleetmanagementapi/models/api_1_vehicles_wake_up_response.py +109 -0
- teslafleetmanagementapi/models/backup_request.py +92 -0
- teslafleetmanagementapi/models/backup_response.py +95 -0
- teslafleetmanagementapi/models/calendar_history_response.py +96 -0
- teslafleetmanagementapi/models/charge_duration.py +92 -0
- teslafleetmanagementapi/models/charge_history.py +125 -0
- teslafleetmanagementapi/models/charge_history_response.py +96 -0
- teslafleetmanagementapi/models/charge_start_time.py +92 -0
- teslafleetmanagementapi/models/charging_dimension.py +128 -0
- teslafleetmanagementapi/models/charging_fee.py +641 -0
- teslafleetmanagementapi/models/charging_history_data.py +98 -0
- teslafleetmanagementapi/models/charging_history_item.py +336 -0
- teslafleetmanagementapi/models/charging_history_response.py +96 -0
- teslafleetmanagementapi/models/charging_invoice.py +151 -0
- teslafleetmanagementapi/models/charging_location.py +293 -0
- teslafleetmanagementapi/models/charging_period.py +136 -0
- teslafleetmanagementapi/models/charging_session.py +355 -0
- teslafleetmanagementapi/models/charging_sessions_data.py +182 -0
- teslafleetmanagementapi/models/charging_sessions_response.py +96 -0
- teslafleetmanagementapi/models/default_real_mode.py +45 -0
- teslafleetmanagementapi/models/driver.py +289 -0
- teslafleetmanagementapi/models/drivers_response.py +135 -0
- teslafleetmanagementapi/models/enterprise_payer_request.py +141 -0
- teslafleetmanagementapi/models/event.py +107 -0
- teslafleetmanagementapi/models/fleet_status_request.py +105 -0
- teslafleetmanagementapi/models/fleet_telemetry_error.py +118 -0
- teslafleetmanagementapi/models/fleet_telemetry_errors_response.py +96 -0
- teslafleetmanagementapi/models/fleet_telemetry_jws_request.py +128 -0
- teslafleetmanagementapi/models/generic_update_response.py +95 -0
- teslafleetmanagementapi/models/kind.py +45 -0
- teslafleetmanagementapi/models/kind_get_wall_connector_charging_history.py +42 -0
- teslafleetmanagementapi/models/live_status_response.py +96 -0
- teslafleetmanagementapi/models/location.py +128 -0
- teslafleetmanagementapi/models/location_1.py +128 -0
- teslafleetmanagementapi/models/me_response.py +95 -0
- teslafleetmanagementapi/models/mobile_enabled.py +128 -0
- teslafleetmanagementapi/models/oauth_provider_error.py +67 -0
- teslafleetmanagementapi/models/oauth_token.py +115 -0
- teslafleetmanagementapi/models/off_grid_vehicle_charging_reserve_request.py +95 -0
- teslafleetmanagementapi/models/operation_request.py +93 -0
- teslafleetmanagementapi/models/orders_response.py +111 -0
- teslafleetmanagementapi/models/pagination.py +225 -0
- teslafleetmanagementapi/models/price_component.py +151 -0
- teslafleetmanagementapi/models/products_response.py +128 -0
- teslafleetmanagementapi/models/public_key_response.py +96 -0
- teslafleetmanagementapi/models/region_response.py +96 -0
- teslafleetmanagementapi/models/register_partner_request.py +92 -0
- teslafleetmanagementapi/models/register_partner_response.py +96 -0
- teslafleetmanagementapi/models/response.py +105 -0
- teslafleetmanagementapi/models/response_1.py +92 -0
- teslafleetmanagementapi/models/response_2.py +95 -0
- teslafleetmanagementapi/models/response_3.py +164 -0
- teslafleetmanagementapi/models/response_api_1_dx_vehicles_options_response.py +112 -0
- teslafleetmanagementapi/models/response_api_1_dx_warranty_details_response.py +169 -0
- teslafleetmanagementapi/models/response_calendar_history_response.py +110 -0
- teslafleetmanagementapi/models/response_charge_history_response.py +98 -0
- teslafleetmanagementapi/models/response_fleet_telemetry_errors_response.py +98 -0
- teslafleetmanagementapi/models/response_live_status_response.py +310 -0
- teslafleetmanagementapi/models/response_me_response.py +131 -0
- teslafleetmanagementapi/models/response_orders_response.py +209 -0
- teslafleetmanagementapi/models/response_public_key_response.py +92 -0
- teslafleetmanagementapi/models/response_region_response.py +105 -0
- teslafleetmanagementapi/models/response_register_partner_response.py +331 -0
- teslafleetmanagementapi/models/signaling.py +118 -0
- teslafleetmanagementapi/models/simple_ok_response.py +105 -0
- teslafleetmanagementapi/models/site_info_response.py +105 -0
- teslafleetmanagementapi/models/storm_mode_request.py +92 -0
- teslafleetmanagementapi/models/tariff_element.py +136 -0
- teslafleetmanagementapi/models/tariffs.py +136 -0
- teslafleetmanagementapi/models/time_of_use_settings_request.py +95 -0
- teslafleetmanagementapi/models/total_cost.py +151 -0
- teslafleetmanagementapi/models/tou_settings.py +105 -0
- teslafleetmanagementapi/models/vehicle_base.py +266 -0
- teslafleetmanagementapi/models/vehicle_option.py +178 -0
- teslafleetmanagementapi/models/warranty_item.py +249 -0
- teslafleetmanagementapi/teslafleetmanagementapi_client.py +128 -0
- teslafleetmanagementapi/utilities/__init__.py +6 -0
- teslafleetmanagementapi/utilities/file_wrapper.py +45 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""teslafleetmanagementapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
8
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
9
|
+
from apimatic_core.types.parameter import Parameter
|
|
10
|
+
|
|
11
|
+
from teslafleetmanagementapi.api_helper import (
|
|
12
|
+
APIHelper,
|
|
13
|
+
)
|
|
14
|
+
from teslafleetmanagementapi.configuration import (
|
|
15
|
+
Server,
|
|
16
|
+
)
|
|
17
|
+
from teslafleetmanagementapi.controllers.base_controller import (
|
|
18
|
+
BaseController,
|
|
19
|
+
)
|
|
20
|
+
from teslafleetmanagementapi.exceptions.oauth_provider_exception import (
|
|
21
|
+
OauthProviderException,
|
|
22
|
+
)
|
|
23
|
+
from teslafleetmanagementapi.http.http_method_enum import (
|
|
24
|
+
HttpMethodEnum,
|
|
25
|
+
)
|
|
26
|
+
from teslafleetmanagementapi.models.oauth_token import (
|
|
27
|
+
OauthToken,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class OauthAuthorizationController(BaseController):
|
|
32
|
+
"""A Controller to access Endpoints in the teslafleetmanagementapi API."""
|
|
33
|
+
|
|
34
|
+
def __init__(self, config):
|
|
35
|
+
"""Initialize OauthAuthorizationController object."""
|
|
36
|
+
super(OauthAuthorizationController, self).__init__(config)
|
|
37
|
+
|
|
38
|
+
def request_token_oauth_2(self,
|
|
39
|
+
authorization,
|
|
40
|
+
code,
|
|
41
|
+
redirect_uri,
|
|
42
|
+
_optional_form_parameters=None):
|
|
43
|
+
"""Perform a POST request to /token.
|
|
44
|
+
|
|
45
|
+
Create a new OAuth 2 token.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
authorization (str): Authorization header in Basic auth format
|
|
49
|
+
code (str): Authorization Code
|
|
50
|
+
redirect_uri (str): Redirect Uri
|
|
51
|
+
_optional_form_parameters (Array, optional): Additional optional form
|
|
52
|
+
parameters are supported by this endpoint
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
ApiResponse: An object with the response value as well as other useful
|
|
56
|
+
information such as status codes and headers.
|
|
57
|
+
|
|
58
|
+
Raises:
|
|
59
|
+
ApiException: When an error occurs while fetching the data from the
|
|
60
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
61
|
+
message, and the HTTP body that was received in the request.
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
return super().new_api_call_builder.request(
|
|
65
|
+
RequestBuilder().server(Server.AUTH_SERVER)
|
|
66
|
+
.path("/token")
|
|
67
|
+
.http_method(HttpMethodEnum.POST)
|
|
68
|
+
.form_param(Parameter()
|
|
69
|
+
.key("grant_type")
|
|
70
|
+
.value("authorization_code"))
|
|
71
|
+
.header_param(Parameter()
|
|
72
|
+
.key("Authorization")
|
|
73
|
+
.value(authorization)
|
|
74
|
+
.is_required(True))
|
|
75
|
+
.form_param(Parameter()
|
|
76
|
+
.key("code")
|
|
77
|
+
.value(code)
|
|
78
|
+
.is_required(True))
|
|
79
|
+
.form_param(Parameter()
|
|
80
|
+
.key("redirect_uri")
|
|
81
|
+
.value(redirect_uri)
|
|
82
|
+
.is_required(True))
|
|
83
|
+
.header_param(Parameter()
|
|
84
|
+
.key("content-type")
|
|
85
|
+
.value("application/x-www-form-urlencoded"))
|
|
86
|
+
.header_param(Parameter()
|
|
87
|
+
.key("accept")
|
|
88
|
+
.value("application/json"))
|
|
89
|
+
.additional_form_params(_optional_form_parameters),
|
|
90
|
+
).response(
|
|
91
|
+
ResponseHandler()
|
|
92
|
+
.deserializer(APIHelper.json_deserialize)
|
|
93
|
+
.deserialize_into(OauthToken.from_dictionary)
|
|
94
|
+
.is_api_response(True)
|
|
95
|
+
.local_error("400",
|
|
96
|
+
"OAuth 2 provider returned an error.",
|
|
97
|
+
OauthProviderException)
|
|
98
|
+
.local_error("401",
|
|
99
|
+
"OAuth 2 provider says client authentication failed.",
|
|
100
|
+
OauthProviderException),
|
|
101
|
+
).execute()
|
|
102
|
+
|
|
103
|
+
def refresh_token_oauth_2(self,
|
|
104
|
+
authorization,
|
|
105
|
+
refresh_token,
|
|
106
|
+
scope=None,
|
|
107
|
+
_optional_form_parameters=None):
|
|
108
|
+
"""Perform a POST request to /token.
|
|
109
|
+
|
|
110
|
+
Obtain a new access token using a refresh token
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
authorization (str): Authorization header in Basic auth format
|
|
114
|
+
refresh_token (str): Refresh token
|
|
115
|
+
scope (str, optional): Requested scopes as a space-delimited list.
|
|
116
|
+
_optional_form_parameters (Array, optional): Additional optional form
|
|
117
|
+
parameters are supported by this endpoint
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
ApiResponse: An object with the response value as well as other useful
|
|
121
|
+
information such as status codes and headers.
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
ApiException: When an error occurs while fetching the data from the
|
|
125
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
126
|
+
message, and the HTTP body that was received in the request.
|
|
127
|
+
|
|
128
|
+
"""
|
|
129
|
+
return super().new_api_call_builder.request(
|
|
130
|
+
RequestBuilder().server(Server.AUTH_SERVER)
|
|
131
|
+
.path("/token")
|
|
132
|
+
.http_method(HttpMethodEnum.POST)
|
|
133
|
+
.form_param(Parameter()
|
|
134
|
+
.key("grant_type")
|
|
135
|
+
.value("refresh_token"))
|
|
136
|
+
.header_param(Parameter()
|
|
137
|
+
.key("Authorization")
|
|
138
|
+
.value(authorization)
|
|
139
|
+
.is_required(True))
|
|
140
|
+
.form_param(Parameter()
|
|
141
|
+
.key("refresh_token")
|
|
142
|
+
.value(refresh_token)
|
|
143
|
+
.is_required(True))
|
|
144
|
+
.form_param(Parameter()
|
|
145
|
+
.key("scope")
|
|
146
|
+
.value(scope))
|
|
147
|
+
.header_param(Parameter()
|
|
148
|
+
.key("content-type")
|
|
149
|
+
.value("application/x-www-form-urlencoded"))
|
|
150
|
+
.header_param(Parameter()
|
|
151
|
+
.key("accept")
|
|
152
|
+
.value("application/json"))
|
|
153
|
+
.additional_form_params(_optional_form_parameters),
|
|
154
|
+
).response(
|
|
155
|
+
ResponseHandler()
|
|
156
|
+
.deserializer(APIHelper.json_deserialize)
|
|
157
|
+
.deserialize_into(OauthToken.from_dictionary)
|
|
158
|
+
.is_api_response(True)
|
|
159
|
+
.local_error("400",
|
|
160
|
+
"OAuth 2 provider returned an error.",
|
|
161
|
+
OauthProviderException)
|
|
162
|
+
.local_error("401",
|
|
163
|
+
"OAuth 2 provider says client authentication failed.",
|
|
164
|
+
OauthProviderException),
|
|
165
|
+
).execute()
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""teslafleetmanagementapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.authentication.multiple.single_auth import (
|
|
8
|
+
Single,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
11
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
12
|
+
from apimatic_core.types.parameter import Parameter
|
|
13
|
+
|
|
14
|
+
from teslafleetmanagementapi.api_helper import (
|
|
15
|
+
APIHelper,
|
|
16
|
+
)
|
|
17
|
+
from teslafleetmanagementapi.configuration import (
|
|
18
|
+
Server,
|
|
19
|
+
)
|
|
20
|
+
from teslafleetmanagementapi.controllers.base_controller import (
|
|
21
|
+
BaseController,
|
|
22
|
+
)
|
|
23
|
+
from teslafleetmanagementapi.http.http_method_enum import (
|
|
24
|
+
HttpMethodEnum,
|
|
25
|
+
)
|
|
26
|
+
from teslafleetmanagementapi.models.backup_response import (
|
|
27
|
+
BackupResponse,
|
|
28
|
+
)
|
|
29
|
+
from teslafleetmanagementapi.models.fleet_telemetry_errors_response import (
|
|
30
|
+
FleetTelemetryErrorsResponse,
|
|
31
|
+
)
|
|
32
|
+
from teslafleetmanagementapi.models.public_key_response import (
|
|
33
|
+
PublicKeyResponse,
|
|
34
|
+
)
|
|
35
|
+
from teslafleetmanagementapi.models.register_partner_response import (
|
|
36
|
+
RegisterPartnerResponse,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class PartnerController(BaseController):
|
|
41
|
+
"""A Controller to access Endpoints in the teslafleetmanagementapi API."""
|
|
42
|
+
|
|
43
|
+
def __init__(self, config):
|
|
44
|
+
"""Initialize PartnerController object."""
|
|
45
|
+
super(PartnerController, self).__init__(config)
|
|
46
|
+
|
|
47
|
+
def get_vins_with_fleet_telemetry_errors(self):
|
|
48
|
+
"""Perform a GET request to
|
|
49
|
+
/api/1/partner_accounts/fleet_telemetry_error_vins.
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
ApiResponse: An object with the response value as well as other useful
|
|
53
|
+
information such as status codes and headers. List of VINs with
|
|
54
|
+
telemetry errors
|
|
55
|
+
|
|
56
|
+
Raises:
|
|
57
|
+
ApiException: When an error occurs while fetching the data from the
|
|
58
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
59
|
+
message, and the HTTP body that was received in the request.
|
|
60
|
+
|
|
61
|
+
"""
|
|
62
|
+
return super().new_api_call_builder.request(
|
|
63
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
64
|
+
.path("/api/1/partner_accounts/fleet_telemetry_error_vins")
|
|
65
|
+
.http_method(HttpMethodEnum.GET)
|
|
66
|
+
.header_param(Parameter()
|
|
67
|
+
.key("accept")
|
|
68
|
+
.value("application/json"))
|
|
69
|
+
.auth(Single("bearerAuth")),
|
|
70
|
+
).response(
|
|
71
|
+
ResponseHandler()
|
|
72
|
+
.deserializer(APIHelper.json_deserialize)
|
|
73
|
+
.deserialize_into(BackupResponse.from_dictionary)
|
|
74
|
+
.is_api_response(True),
|
|
75
|
+
).execute()
|
|
76
|
+
|
|
77
|
+
def get_recent_fleet_telemetry_errors(self):
|
|
78
|
+
"""Perform a GET request to
|
|
79
|
+
/api/1/partner_accounts/fleet_telemetry_errors.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
ApiResponse: An object with the response value as well as other useful
|
|
83
|
+
information such as status codes and headers. Fleet telemetry errors
|
|
84
|
+
retrieved
|
|
85
|
+
|
|
86
|
+
Raises:
|
|
87
|
+
ApiException: When an error occurs while fetching the data from the
|
|
88
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
89
|
+
message, and the HTTP body that was received in the request.
|
|
90
|
+
|
|
91
|
+
"""
|
|
92
|
+
return super().new_api_call_builder.request(
|
|
93
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
94
|
+
.path("/api/1/partner_accounts/fleet_telemetry_errors")
|
|
95
|
+
.http_method(HttpMethodEnum.GET)
|
|
96
|
+
.header_param(Parameter()
|
|
97
|
+
.key("accept")
|
|
98
|
+
.value("application/json"))
|
|
99
|
+
.auth(Single("bearerAuth")),
|
|
100
|
+
).response(
|
|
101
|
+
ResponseHandler()
|
|
102
|
+
.deserializer(APIHelper.json_deserialize)
|
|
103
|
+
.deserialize_into(FleetTelemetryErrorsResponse.from_dictionary)
|
|
104
|
+
.is_api_response(True),
|
|
105
|
+
).execute()
|
|
106
|
+
|
|
107
|
+
def get_public_key_for_a_domain(self,
|
|
108
|
+
domain):
|
|
109
|
+
"""Perform a GET request to /api/1/partner_accounts/public_key.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
domain (str): The request query parameter.
|
|
113
|
+
|
|
114
|
+
Returns:
|
|
115
|
+
ApiResponse: An object with the response value as well as other useful
|
|
116
|
+
information such as status codes and headers. Public key retrieved
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
ApiException: When an error occurs while fetching the data from the
|
|
120
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
121
|
+
message, and the HTTP body that was received in the request.
|
|
122
|
+
|
|
123
|
+
"""
|
|
124
|
+
return super().new_api_call_builder.request(
|
|
125
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
126
|
+
.path("/api/1/partner_accounts/public_key")
|
|
127
|
+
.http_method(HttpMethodEnum.GET)
|
|
128
|
+
.query_param(Parameter()
|
|
129
|
+
.key("domain")
|
|
130
|
+
.value(domain)
|
|
131
|
+
.is_required(True))
|
|
132
|
+
.header_param(Parameter()
|
|
133
|
+
.key("accept")
|
|
134
|
+
.value("application/json"))
|
|
135
|
+
.auth(Single("bearerAuth")),
|
|
136
|
+
).response(
|
|
137
|
+
ResponseHandler()
|
|
138
|
+
.deserializer(APIHelper.json_deserialize)
|
|
139
|
+
.deserialize_into(PublicKeyResponse.from_dictionary)
|
|
140
|
+
.is_api_response(True),
|
|
141
|
+
).execute()
|
|
142
|
+
|
|
143
|
+
def register_a_partner_account(self,
|
|
144
|
+
body):
|
|
145
|
+
"""Perform a POST request to /api/1/partner_accounts.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
body (RegisterPartnerRequest): The request body parameter.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
ApiResponse: An object with the response value as well as other useful
|
|
152
|
+
information such as status codes and headers. Partner account
|
|
153
|
+
registered
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
ApiException: When an error occurs while fetching the data from the
|
|
157
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
158
|
+
message, and the HTTP body that was received in the request.
|
|
159
|
+
|
|
160
|
+
"""
|
|
161
|
+
return super().new_api_call_builder.request(
|
|
162
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
163
|
+
.path("/api/1/partner_accounts")
|
|
164
|
+
.http_method(HttpMethodEnum.POST)
|
|
165
|
+
.header_param(Parameter()
|
|
166
|
+
.key("Content-Type")
|
|
167
|
+
.value("application/json"))
|
|
168
|
+
.body_param(Parameter()
|
|
169
|
+
.value(body)
|
|
170
|
+
.is_required(True))
|
|
171
|
+
.header_param(Parameter()
|
|
172
|
+
.key("accept")
|
|
173
|
+
.value("application/json"))
|
|
174
|
+
.body_serializer(APIHelper.json_serialize)
|
|
175
|
+
.auth(Single("bearerAuth")),
|
|
176
|
+
).response(
|
|
177
|
+
ResponseHandler()
|
|
178
|
+
.deserializer(APIHelper.json_deserialize)
|
|
179
|
+
.deserialize_into(RegisterPartnerResponse.from_dictionary)
|
|
180
|
+
.is_api_response(True),
|
|
181
|
+
).execute()
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""teslafleetmanagementapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: D410, E501, E101, D206
|
|
7
|
+
from apimatic_core.authentication.multiple.single_auth import (
|
|
8
|
+
Single,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.request_builder import RequestBuilder
|
|
11
|
+
from apimatic_core.response_handler import ResponseHandler
|
|
12
|
+
from apimatic_core.types.parameter import Parameter
|
|
13
|
+
|
|
14
|
+
from teslafleetmanagementapi.api_helper import (
|
|
15
|
+
APIHelper,
|
|
16
|
+
)
|
|
17
|
+
from teslafleetmanagementapi.configuration import (
|
|
18
|
+
Server,
|
|
19
|
+
)
|
|
20
|
+
from teslafleetmanagementapi.controllers.base_controller import (
|
|
21
|
+
BaseController,
|
|
22
|
+
)
|
|
23
|
+
from teslafleetmanagementapi.http.http_method_enum import (
|
|
24
|
+
HttpMethodEnum,
|
|
25
|
+
)
|
|
26
|
+
from teslafleetmanagementapi.models.backup_response import (
|
|
27
|
+
BackupResponse,
|
|
28
|
+
)
|
|
29
|
+
from teslafleetmanagementapi.models.me_response import (
|
|
30
|
+
MeResponse,
|
|
31
|
+
)
|
|
32
|
+
from teslafleetmanagementapi.models.orders_response import (
|
|
33
|
+
OrdersResponse,
|
|
34
|
+
)
|
|
35
|
+
from teslafleetmanagementapi.models.region_response import (
|
|
36
|
+
RegionResponse,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class UserController(BaseController):
|
|
41
|
+
"""A Controller to access Endpoints in the teslafleetmanagementapi API."""
|
|
42
|
+
|
|
43
|
+
def __init__(self, config):
|
|
44
|
+
"""Initialize UserController object."""
|
|
45
|
+
super(UserController, self).__init__(config)
|
|
46
|
+
|
|
47
|
+
def get_custom_feature_flags_for_a_user(self):
|
|
48
|
+
"""Perform a GET request to /api/1/users/feature_config.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
ApiResponse: An object with the response value as well as other useful
|
|
52
|
+
information such as status codes and headers. Feature flags retrieved
|
|
53
|
+
|
|
54
|
+
Raises:
|
|
55
|
+
ApiException: When an error occurs while fetching the data from the
|
|
56
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
57
|
+
message, and the HTTP body that was received in the request.
|
|
58
|
+
|
|
59
|
+
"""
|
|
60
|
+
return super().new_api_call_builder.request(
|
|
61
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
62
|
+
.path("/api/1/users/feature_config")
|
|
63
|
+
.http_method(HttpMethodEnum.GET)
|
|
64
|
+
.header_param(Parameter()
|
|
65
|
+
.key("accept")
|
|
66
|
+
.value("application/json"))
|
|
67
|
+
.auth(Single("bearerAuth")),
|
|
68
|
+
).response(
|
|
69
|
+
ResponseHandler()
|
|
70
|
+
.deserializer(APIHelper.json_deserialize)
|
|
71
|
+
.deserialize_into(BackupResponse.from_dictionary)
|
|
72
|
+
.is_api_response(True),
|
|
73
|
+
).execute()
|
|
74
|
+
|
|
75
|
+
def get_summary_of_a_user_s_account(self):
|
|
76
|
+
"""Perform a GET request to /api/1/users/me.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
ApiResponse: An object with the response value as well as other useful
|
|
80
|
+
information such as status codes and headers. User account retrieved
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
ApiException: When an error occurs while fetching the data from the
|
|
84
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
85
|
+
message, and the HTTP body that was received in the request.
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
return super().new_api_call_builder.request(
|
|
89
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
90
|
+
.path("/api/1/users/me")
|
|
91
|
+
.http_method(HttpMethodEnum.GET)
|
|
92
|
+
.header_param(Parameter()
|
|
93
|
+
.key("accept")
|
|
94
|
+
.value("application/json"))
|
|
95
|
+
.auth(Single("bearerAuth")),
|
|
96
|
+
).response(
|
|
97
|
+
ResponseHandler()
|
|
98
|
+
.deserializer(APIHelper.json_deserialize)
|
|
99
|
+
.deserialize_into(MeResponse.from_dictionary)
|
|
100
|
+
.is_api_response(True),
|
|
101
|
+
).execute()
|
|
102
|
+
|
|
103
|
+
def get_active_orders_for_a_user(self):
|
|
104
|
+
"""Perform a GET request to /api/1/users/orders.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
ApiResponse: An object with the response value as well as other useful
|
|
108
|
+
information such as status codes and headers. User orders retrieved
|
|
109
|
+
|
|
110
|
+
Raises:
|
|
111
|
+
ApiException: When an error occurs while fetching the data from the
|
|
112
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
113
|
+
message, and the HTTP body that was received in the request.
|
|
114
|
+
|
|
115
|
+
"""
|
|
116
|
+
return super().new_api_call_builder.request(
|
|
117
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
118
|
+
.path("/api/1/users/orders")
|
|
119
|
+
.http_method(HttpMethodEnum.GET)
|
|
120
|
+
.header_param(Parameter()
|
|
121
|
+
.key("accept")
|
|
122
|
+
.value("application/json"))
|
|
123
|
+
.auth(Single("bearerAuth")),
|
|
124
|
+
).response(
|
|
125
|
+
ResponseHandler()
|
|
126
|
+
.deserializer(APIHelper.json_deserialize)
|
|
127
|
+
.deserialize_into(OrdersResponse.from_dictionary)
|
|
128
|
+
.is_api_response(True),
|
|
129
|
+
).execute()
|
|
130
|
+
|
|
131
|
+
def get_user_s_region_and_fleet_api_base_url(self):
|
|
132
|
+
"""Perform a GET request to /api/1/users/region.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
ApiResponse: An object with the response value as well as other useful
|
|
136
|
+
information such as status codes and headers. Region information
|
|
137
|
+
retrieved
|
|
138
|
+
|
|
139
|
+
Raises:
|
|
140
|
+
ApiException: When an error occurs while fetching the data from the
|
|
141
|
+
remote API. This exception includes the HTTP Response code, an error
|
|
142
|
+
message, and the HTTP body that was received in the request.
|
|
143
|
+
|
|
144
|
+
"""
|
|
145
|
+
return super().new_api_call_builder.request(
|
|
146
|
+
RequestBuilder().server(Server.DEFAULT)
|
|
147
|
+
.path("/api/1/users/region")
|
|
148
|
+
.http_method(HttpMethodEnum.GET)
|
|
149
|
+
.header_param(Parameter()
|
|
150
|
+
.key("accept")
|
|
151
|
+
.value("application/json"))
|
|
152
|
+
.auth(Single("bearerAuth")),
|
|
153
|
+
).response(
|
|
154
|
+
ResponseHandler()
|
|
155
|
+
.deserializer(APIHelper.json_deserialize)
|
|
156
|
+
.deserialize_into(RegionResponse.from_dictionary)
|
|
157
|
+
.is_api_response(True),
|
|
158
|
+
).execute()
|