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,249 @@
|
|
|
1
|
+
"""teslafleetmanagementapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from teslafleetmanagementapi.api_helper import (
|
|
8
|
+
APIHelper,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class WarrantyItem(object):
|
|
13
|
+
"""Implementation of the 'WarrantyItem' model.
|
|
14
|
+
|
|
15
|
+
Attributes:
|
|
16
|
+
warranty_type (str): The model property of type str.
|
|
17
|
+
warranty_display_name (str): The model property of type str.
|
|
18
|
+
expiration_date (datetime): The model property of type datetime.
|
|
19
|
+
expiration_odometer (int): The model property of type int.
|
|
20
|
+
odometer_unit (str): The model property of type str.
|
|
21
|
+
warranty_expired_on (str): The model property of type str.
|
|
22
|
+
coverage_age_in_years (int): The model property of type int.
|
|
23
|
+
additional_properties (Dict[str, Any]): The additional properties for the
|
|
24
|
+
model.
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
# Create a mapping from Model property names to API property names
|
|
29
|
+
_names = {
|
|
30
|
+
"warranty_type": "warrantyType",
|
|
31
|
+
"warranty_display_name": "warrantyDisplayName",
|
|
32
|
+
"expiration_date": "expirationDate",
|
|
33
|
+
"expiration_odometer": "expirationOdometer",
|
|
34
|
+
"odometer_unit": "odometerUnit",
|
|
35
|
+
"warranty_expired_on": "warrantyExpiredOn",
|
|
36
|
+
"coverage_age_in_years": "coverageAgeInYears",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_optionals = [
|
|
40
|
+
"warranty_type",
|
|
41
|
+
"warranty_display_name",
|
|
42
|
+
"expiration_date",
|
|
43
|
+
"expiration_odometer",
|
|
44
|
+
"odometer_unit",
|
|
45
|
+
"warranty_expired_on",
|
|
46
|
+
"coverage_age_in_years",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
_nullables = [
|
|
50
|
+
"warranty_expired_on",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
def __init__(
|
|
54
|
+
self,
|
|
55
|
+
warranty_type=APIHelper.SKIP,
|
|
56
|
+
warranty_display_name=APIHelper.SKIP,
|
|
57
|
+
expiration_date=APIHelper.SKIP,
|
|
58
|
+
expiration_odometer=APIHelper.SKIP,
|
|
59
|
+
odometer_unit=APIHelper.SKIP,
|
|
60
|
+
warranty_expired_on=APIHelper.SKIP,
|
|
61
|
+
coverage_age_in_years=APIHelper.SKIP,
|
|
62
|
+
additional_properties=None):
|
|
63
|
+
"""Initialize a WarrantyItem instance."""
|
|
64
|
+
# Initialize members of the class
|
|
65
|
+
if warranty_type is not APIHelper.SKIP:
|
|
66
|
+
self.warranty_type = warranty_type
|
|
67
|
+
if warranty_display_name is not APIHelper.SKIP:
|
|
68
|
+
self.warranty_display_name = warranty_display_name
|
|
69
|
+
if expiration_date is not APIHelper.SKIP:
|
|
70
|
+
self.expiration_date =\
|
|
71
|
+
APIHelper.apply_datetime_converter(
|
|
72
|
+
expiration_date, APIHelper.RFC3339DateTime)\
|
|
73
|
+
if expiration_date else None
|
|
74
|
+
if expiration_odometer is not APIHelper.SKIP:
|
|
75
|
+
self.expiration_odometer = expiration_odometer
|
|
76
|
+
if odometer_unit is not APIHelper.SKIP:
|
|
77
|
+
self.odometer_unit = odometer_unit
|
|
78
|
+
if warranty_expired_on is not APIHelper.SKIP:
|
|
79
|
+
self.warranty_expired_on = warranty_expired_on
|
|
80
|
+
if coverage_age_in_years is not APIHelper.SKIP:
|
|
81
|
+
self.coverage_age_in_years = coverage_age_in_years
|
|
82
|
+
|
|
83
|
+
# Add additional model properties to the instance
|
|
84
|
+
if additional_properties is None:
|
|
85
|
+
additional_properties = {}
|
|
86
|
+
self.additional_properties = additional_properties
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dictionary(cls,
|
|
90
|
+
dictionary):
|
|
91
|
+
"""Create an instance of this model from a dictionary
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
dictionary (dictionary): A dictionary representation of the object
|
|
95
|
+
as obtained from the deserialization of the server's response. The
|
|
96
|
+
keys MUST match property names in the API description.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
object: An instance of this structure class.
|
|
100
|
+
|
|
101
|
+
"""
|
|
102
|
+
if not isinstance(dictionary, dict) or dictionary is None:
|
|
103
|
+
return None
|
|
104
|
+
|
|
105
|
+
# Extract variables from the dictionary
|
|
106
|
+
warranty_type =\
|
|
107
|
+
dictionary.get("warrantyType")\
|
|
108
|
+
if dictionary.get("warrantyType")\
|
|
109
|
+
else APIHelper.SKIP
|
|
110
|
+
warranty_display_name =\
|
|
111
|
+
dictionary.get("warrantyDisplayName")\
|
|
112
|
+
if dictionary.get("warrantyDisplayName")\
|
|
113
|
+
else APIHelper.SKIP
|
|
114
|
+
expiration_date = APIHelper.RFC3339DateTime.from_value(
|
|
115
|
+
dictionary.get("expirationDate")).datetime\
|
|
116
|
+
if dictionary.get("expirationDate") else APIHelper.SKIP
|
|
117
|
+
expiration_odometer =\
|
|
118
|
+
dictionary.get("expirationOdometer")\
|
|
119
|
+
if dictionary.get("expirationOdometer")\
|
|
120
|
+
else APIHelper.SKIP
|
|
121
|
+
odometer_unit =\
|
|
122
|
+
dictionary.get("odometerUnit")\
|
|
123
|
+
if dictionary.get("odometerUnit")\
|
|
124
|
+
else APIHelper.SKIP
|
|
125
|
+
warranty_expired_on =\
|
|
126
|
+
dictionary.get("warrantyExpiredOn")\
|
|
127
|
+
if "warrantyExpiredOn" in dictionary.keys()\
|
|
128
|
+
else APIHelper.SKIP
|
|
129
|
+
coverage_age_in_years =\
|
|
130
|
+
dictionary.get("coverageAgeInYears")\
|
|
131
|
+
if dictionary.get("coverageAgeInYears")\
|
|
132
|
+
else APIHelper.SKIP
|
|
133
|
+
|
|
134
|
+
additional_properties = APIHelper.get_additional_properties(
|
|
135
|
+
dictionary={k: v for k, v in dictionary.items()
|
|
136
|
+
if k not in cls._names.values()},
|
|
137
|
+
unboxing_function=lambda value: value)
|
|
138
|
+
|
|
139
|
+
# Return an object of this model
|
|
140
|
+
return cls(warranty_type,
|
|
141
|
+
warranty_display_name,
|
|
142
|
+
expiration_date,
|
|
143
|
+
expiration_odometer,
|
|
144
|
+
odometer_unit,
|
|
145
|
+
warranty_expired_on,
|
|
146
|
+
coverage_age_in_years,
|
|
147
|
+
additional_properties)
|
|
148
|
+
|
|
149
|
+
def __repr__(self):
|
|
150
|
+
"""Return a unambiguous string representation."""
|
|
151
|
+
_warranty_type=(
|
|
152
|
+
self.warranty_type
|
|
153
|
+
if hasattr(self, "warranty_type")
|
|
154
|
+
else None
|
|
155
|
+
)
|
|
156
|
+
_warranty_display_name=(
|
|
157
|
+
self.warranty_display_name
|
|
158
|
+
if hasattr(self, "warranty_display_name")
|
|
159
|
+
else None
|
|
160
|
+
)
|
|
161
|
+
_expiration_date=(
|
|
162
|
+
self.expiration_date
|
|
163
|
+
if hasattr(self, "expiration_date")
|
|
164
|
+
else None
|
|
165
|
+
)
|
|
166
|
+
_expiration_odometer=(
|
|
167
|
+
self.expiration_odometer
|
|
168
|
+
if hasattr(self, "expiration_odometer")
|
|
169
|
+
else None
|
|
170
|
+
)
|
|
171
|
+
_odometer_unit=(
|
|
172
|
+
self.odometer_unit
|
|
173
|
+
if hasattr(self, "odometer_unit")
|
|
174
|
+
else None
|
|
175
|
+
)
|
|
176
|
+
_warranty_expired_on=(
|
|
177
|
+
self.warranty_expired_on
|
|
178
|
+
if hasattr(self, "warranty_expired_on")
|
|
179
|
+
else None
|
|
180
|
+
)
|
|
181
|
+
_coverage_age_in_years=(
|
|
182
|
+
self.coverage_age_in_years
|
|
183
|
+
if hasattr(self, "coverage_age_in_years")
|
|
184
|
+
else None
|
|
185
|
+
)
|
|
186
|
+
_additional_properties=self.additional_properties
|
|
187
|
+
return (
|
|
188
|
+
f"{self.__class__.__name__}("
|
|
189
|
+
f"warranty_type={_warranty_type!r}, "
|
|
190
|
+
f"warranty_display_name={_warranty_display_name!r}, "
|
|
191
|
+
f"expiration_date={_expiration_date!r}, "
|
|
192
|
+
f"expiration_odometer={_expiration_odometer!r}, "
|
|
193
|
+
f"odometer_unit={_odometer_unit!r}, "
|
|
194
|
+
f"warranty_expired_on={_warranty_expired_on!r}, "
|
|
195
|
+
f"coverage_age_in_years={_coverage_age_in_years!r}, "
|
|
196
|
+
f"additional_properties={_additional_properties!r}, "
|
|
197
|
+
f")"
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
def __str__(self):
|
|
201
|
+
"""Return a human-readable string representation."""
|
|
202
|
+
_warranty_type=(
|
|
203
|
+
self.warranty_type
|
|
204
|
+
if hasattr(self, "warranty_type")
|
|
205
|
+
else None
|
|
206
|
+
)
|
|
207
|
+
_warranty_display_name=(
|
|
208
|
+
self.warranty_display_name
|
|
209
|
+
if hasattr(self, "warranty_display_name")
|
|
210
|
+
else None
|
|
211
|
+
)
|
|
212
|
+
_expiration_date=(
|
|
213
|
+
self.expiration_date
|
|
214
|
+
if hasattr(self, "expiration_date")
|
|
215
|
+
else None
|
|
216
|
+
)
|
|
217
|
+
_expiration_odometer=(
|
|
218
|
+
self.expiration_odometer
|
|
219
|
+
if hasattr(self, "expiration_odometer")
|
|
220
|
+
else None
|
|
221
|
+
)
|
|
222
|
+
_odometer_unit=(
|
|
223
|
+
self.odometer_unit
|
|
224
|
+
if hasattr(self, "odometer_unit")
|
|
225
|
+
else None
|
|
226
|
+
)
|
|
227
|
+
_warranty_expired_on=(
|
|
228
|
+
self.warranty_expired_on
|
|
229
|
+
if hasattr(self, "warranty_expired_on")
|
|
230
|
+
else None
|
|
231
|
+
)
|
|
232
|
+
_coverage_age_in_years=(
|
|
233
|
+
self.coverage_age_in_years
|
|
234
|
+
if hasattr(self, "coverage_age_in_years")
|
|
235
|
+
else None
|
|
236
|
+
)
|
|
237
|
+
_additional_properties=self.additional_properties
|
|
238
|
+
return (
|
|
239
|
+
f"{self.__class__.__name__}("
|
|
240
|
+
f"warranty_type={_warranty_type!s}, "
|
|
241
|
+
f"warranty_display_name={_warranty_display_name!s}, "
|
|
242
|
+
f"expiration_date={_expiration_date!s}, "
|
|
243
|
+
f"expiration_odometer={_expiration_odometer!s}, "
|
|
244
|
+
f"odometer_unit={_odometer_unit!s}, "
|
|
245
|
+
f"warranty_expired_on={_warranty_expired_on!s}, "
|
|
246
|
+
f"coverage_age_in_years={_coverage_age_in_years!s}, "
|
|
247
|
+
f"additional_properties={_additional_properties!s}, "
|
|
248
|
+
f")"
|
|
249
|
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"""teslafleetmanagementapi.
|
|
2
|
+
|
|
3
|
+
This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from apimatic_core.configurations.global_configuration import (
|
|
8
|
+
GlobalConfiguration,
|
|
9
|
+
)
|
|
10
|
+
from apimatic_core.decorators.lazy_property import (
|
|
11
|
+
LazyProperty,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from teslafleetmanagementapi.configuration import (
|
|
15
|
+
Configuration,
|
|
16
|
+
Environment,
|
|
17
|
+
)
|
|
18
|
+
from teslafleetmanagementapi.controllers.base_controller import (
|
|
19
|
+
BaseController,
|
|
20
|
+
)
|
|
21
|
+
from teslafleetmanagementapi.controllers.charging_controller import (
|
|
22
|
+
ChargingController,
|
|
23
|
+
)
|
|
24
|
+
from teslafleetmanagementapi.controllers.energy_controller import (
|
|
25
|
+
EnergyController,
|
|
26
|
+
)
|
|
27
|
+
from teslafleetmanagementapi.controllers.oauth_authorization_controller import (
|
|
28
|
+
OauthAuthorizationController,
|
|
29
|
+
)
|
|
30
|
+
from teslafleetmanagementapi.controllers.partner_controller import (
|
|
31
|
+
PartnerController,
|
|
32
|
+
)
|
|
33
|
+
from teslafleetmanagementapi.controllers.user_controller import (
|
|
34
|
+
UserController,
|
|
35
|
+
)
|
|
36
|
+
from teslafleetmanagementapi.controllers.vehicles_controller import (
|
|
37
|
+
VehiclesController,
|
|
38
|
+
)
|
|
39
|
+
from teslafleetmanagementapi.http.auth.bearer_auth import (
|
|
40
|
+
BearerAuth,
|
|
41
|
+
)
|
|
42
|
+
from teslafleetmanagementapi.http.auth.oauth_2 import (
|
|
43
|
+
Oauth2,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class TeslafleetmanagementapiClient(object):
|
|
48
|
+
"""Client that provide access to the TeslafleetmanagementapiClient APIs."""
|
|
49
|
+
|
|
50
|
+
@LazyProperty
|
|
51
|
+
def charging(self):
|
|
52
|
+
"""Provide access to the ChargingController endpoints."""
|
|
53
|
+
return ChargingController(self.global_configuration)
|
|
54
|
+
|
|
55
|
+
@LazyProperty
|
|
56
|
+
def energy(self):
|
|
57
|
+
"""Provide access to the EnergyController endpoints."""
|
|
58
|
+
return EnergyController(self.global_configuration)
|
|
59
|
+
|
|
60
|
+
@LazyProperty
|
|
61
|
+
def partner(self):
|
|
62
|
+
"""Provide access to the PartnerController endpoints."""
|
|
63
|
+
return PartnerController(self.global_configuration)
|
|
64
|
+
|
|
65
|
+
@LazyProperty
|
|
66
|
+
def user(self):
|
|
67
|
+
"""Provide access to the UserController endpoints."""
|
|
68
|
+
return UserController(self.global_configuration)
|
|
69
|
+
|
|
70
|
+
@LazyProperty
|
|
71
|
+
def vehicles(self):
|
|
72
|
+
"""Provide access to the VehiclesController endpoints."""
|
|
73
|
+
return VehiclesController(self.global_configuration)
|
|
74
|
+
|
|
75
|
+
@LazyProperty
|
|
76
|
+
def oauth_authorization(self):
|
|
77
|
+
"""Provide access to the OauthAuthorizationController endpoints."""
|
|
78
|
+
return OauthAuthorizationController(self.global_configuration)
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def oauth_2(self):
|
|
82
|
+
"""Provide access to the Oauth2 auth manager."""
|
|
83
|
+
return self.auth_managers["oauth2"]
|
|
84
|
+
|
|
85
|
+
def __init__(self, http_client_instance=None,
|
|
86
|
+
override_http_client_configuration=False, http_call_back=None,
|
|
87
|
+
timeout=60, max_retries=0, backoff_factor=2,
|
|
88
|
+
retry_statuses=None, retry_methods=None, proxy_settings=None,
|
|
89
|
+
logging_configuration=None, environment=Environment.PRODUCTION,
|
|
90
|
+
bearer_auth_credentials=None, oauth_2_credentials=None,
|
|
91
|
+
config=None):
|
|
92
|
+
"""Initialize a new instance of TeslafleetmanagementapiClient."""
|
|
93
|
+
self.config = config or Configuration(
|
|
94
|
+
http_client_instance=http_client_instance,
|
|
95
|
+
override_http_client_configuration=override_http_client_configuration,
|
|
96
|
+
http_call_back=http_call_back, timeout=timeout,
|
|
97
|
+
max_retries=max_retries, backoff_factor=backoff_factor,
|
|
98
|
+
retry_statuses=retry_statuses, retry_methods=retry_methods,
|
|
99
|
+
proxy_settings=proxy_settings,
|
|
100
|
+
logging_configuration=logging_configuration,
|
|
101
|
+
environment=environment,
|
|
102
|
+
bearer_auth_credentials=bearer_auth_credentials,
|
|
103
|
+
oauth_2_credentials=oauth_2_credentials)
|
|
104
|
+
|
|
105
|
+
self.global_configuration = GlobalConfiguration(self.config)\
|
|
106
|
+
.global_errors(BaseController.global_errors())\
|
|
107
|
+
.base_uri_executor(self.config.get_base_uri)\
|
|
108
|
+
.user_agent(BaseController.user_agent(),
|
|
109
|
+
BaseController.user_agent_parameters())
|
|
110
|
+
|
|
111
|
+
self.auth_managers = {
|
|
112
|
+
"bearerAuth": BearerAuth(self.config.bearer_auth_credentials),
|
|
113
|
+
"oauth2": Oauth2(self.config.oauth_2_credentials,
|
|
114
|
+
self.global_configuration),
|
|
115
|
+
}
|
|
116
|
+
self.global_configuration =\
|
|
117
|
+
self.global_configuration.auth_managers(self.auth_managers)
|
|
118
|
+
|
|
119
|
+
@classmethod
|
|
120
|
+
def from_environment(cls, dotenv_path=None, **overrides):
|
|
121
|
+
"""Create a client instance using environment variables.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
TeslafleetmanagementapiClient instance.
|
|
125
|
+
|
|
126
|
+
"""
|
|
127
|
+
return cls(config=Configuration
|
|
128
|
+
.from_environment(dotenv_path=dotenv_path, **overrides))
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""
|
|
2
|
+
teslafleetmanagementapi
|
|
3
|
+
|
|
4
|
+
This file was automatically generated by APIMATIC v3.0 (
|
|
5
|
+
https://www.apimatic.io ).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from apimatic_core.types.file_wrapper import FileWrapper as CoreFileWrapper
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FileWrapper(CoreFileWrapper):
|
|
12
|
+
"""A wrapper to allow passing in content type for file uploads."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, file, content_type: str="application/octet-stream") -> None:
|
|
15
|
+
"""Initialize a new `FileWrapper` instance.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
file: A readable file-like object or byte stream to wrap.
|
|
19
|
+
content_type (str, optional): The MIME type to associate with the
|
|
20
|
+
file. Defaults to `"application/octet-stream"`.
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
super().__init__(file, content_type)
|
|
24
|
+
|
|
25
|
+
def __repr__(self) -> str:
|
|
26
|
+
"""Return a detailed string representation of the instance.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
str: A detailed, unambiguous representation of the wrapper.
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
return (f"{self.__class__.__name__}("
|
|
33
|
+
f"file={self._file_stream!r}, "
|
|
34
|
+
f"content_type={self.content_type!r})")
|
|
35
|
+
|
|
36
|
+
def __str__(self) -> str:
|
|
37
|
+
"""Return a user-friendly string representation of the instance.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
str: A concise, readable representation of the wrapper.
|
|
41
|
+
|
|
42
|
+
"""
|
|
43
|
+
return (f"{self.__class__.__name__}("
|
|
44
|
+
f"file={self._file_stream!s}, "
|
|
45
|
+
f"content_type={self.content_type!s})")
|