tesla-api-sdk 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {tesla_api_sdk-1.0.0.dist-info → tesla_api_sdk-1.0.2.dist-info}/METADATA +40 -34
  2. {tesla_api_sdk-1.0.0.dist-info → tesla_api_sdk-1.0.2.dist-info}/RECORD +34 -24
  3. {tesla_api_sdk-1.0.0.dist-info → tesla_api_sdk-1.0.2.dist-info}/WHEEL +1 -1
  4. teslafleetmanagementapi/configuration.py +13 -11
  5. teslafleetmanagementapi/controllers/__init__.py +2 -1
  6. teslafleetmanagementapi/controllers/base_controller.py +1 -1
  7. teslafleetmanagementapi/controllers/charging_controller.py +6 -3
  8. teslafleetmanagementapi/controllers/energy_controller.py +14 -11
  9. teslafleetmanagementapi/controllers/{oauth_authorization_controller.py → o_auth_authorization_controller.py} +24 -24
  10. teslafleetmanagementapi/controllers/partner_controller.py +7 -4
  11. teslafleetmanagementapi/controllers/user_controller.py +7 -4
  12. teslafleetmanagementapi/controllers/vehicle_commands_controller.py +891 -0
  13. teslafleetmanagementapi/controllers/vehicles_controller.py +24 -21
  14. teslafleetmanagementapi/exceptions/__init__.py +1 -1
  15. teslafleetmanagementapi/exceptions/{oauth_provider_exception.py → o_auth_provider_exception.py} +3 -3
  16. teslafleetmanagementapi/http/auth/__init__.py +1 -1
  17. teslafleetmanagementapi/http/auth/{oauth_2.py → thirdpartytoken.py} +111 -82
  18. teslafleetmanagementapi/models/__init__.py +12 -3
  19. teslafleetmanagementapi/models/actuate_trunk_request.py +92 -0
  20. teslafleetmanagementapi/models/add_charge_schedule_request.py +272 -0
  21. teslafleetmanagementapi/models/add_precondition_schedule_request.py +203 -0
  22. teslafleetmanagementapi/models/adjust_volume_request.py +92 -0
  23. teslafleetmanagementapi/models/api_1_vehicles_response_get_vehicle.py +1 -1
  24. teslafleetmanagementapi/models/command_response.py +109 -0
  25. teslafleetmanagementapi/models/command_result.py +105 -0
  26. teslafleetmanagementapi/models/guest_mode_request.py +92 -0
  27. teslafleetmanagementapi/models/kind_get_wall_connector_charging_history.py +1 -1
  28. teslafleetmanagementapi/models/{oauth_provider_error.py → o_auth_provider_error.py} +1 -1
  29. teslafleetmanagementapi/models/o_auth_scope_thirdpartytoken.py +84 -0
  30. teslafleetmanagementapi/models/{oauth_token.py → o_auth_token.py} +2 -2
  31. teslafleetmanagementapi/models/which_trunk.py +45 -0
  32. teslafleetmanagementapi/teslafleetmanagementapi_client.py +23 -14
  33. {tesla_api_sdk-1.0.0.dist-info → tesla_api_sdk-1.0.2.dist-info}/licenses/LICENSE +0 -0
  34. {tesla_api_sdk-1.0.0.dist-info → tesla_api_sdk-1.0.2.dist-info}/top_level.txt +0 -0
@@ -4,6 +4,9 @@ This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io
4
4
  """
5
5
 
6
6
  # ruff: noqa: D410, E501, E101, D206
7
+ from apimatic_core.authentication.multiple.and_auth_group import (
8
+ And,
9
+ )
7
10
  from apimatic_core.authentication.multiple.single_auth import (
8
11
  Single,
9
12
  )
@@ -82,7 +85,7 @@ class VehiclesController(BaseController):
82
85
  .header_param(Parameter()
83
86
  .key("accept")
84
87
  .value("application/json"))
85
- .auth(Single("bearerAuth")),
88
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
86
89
  ).response(
87
90
  ResponseHandler()
88
91
  .deserializer(APIHelper.json_deserialize)
@@ -119,7 +122,7 @@ class VehiclesController(BaseController):
119
122
  .header_param(Parameter()
120
123
  .key("accept")
121
124
  .value("application/json"))
122
- .auth(Single("bearerAuth")),
125
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
123
126
  ).response(
124
127
  ResponseHandler()
125
128
  .deserializer(APIHelper.json_deserialize)
@@ -157,7 +160,7 @@ class VehiclesController(BaseController):
157
160
  .header_param(Parameter()
158
161
  .key("accept")
159
162
  .value("application/json"))
160
- .auth(Single("bearerAuth")),
163
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
161
164
  ).response(
162
165
  ResponseHandler()
163
166
  .deserializer(APIHelper.json_deserialize)
@@ -195,7 +198,7 @@ class VehiclesController(BaseController):
195
198
  .header_param(Parameter()
196
199
  .key("accept")
197
200
  .value("application/json"))
198
- .auth(Single("bearerAuth")),
201
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
199
202
  ).response(
200
203
  ResponseHandler()
201
204
  .deserializer(APIHelper.json_deserialize)
@@ -232,7 +235,7 @@ class VehiclesController(BaseController):
232
235
  .header_param(Parameter()
233
236
  .key("accept")
234
237
  .value("application/json"))
235
- .auth(Single("bearerAuth")),
238
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
236
239
  ).response(
237
240
  ResponseHandler()
238
241
  .deserializer(APIHelper.json_deserialize)
@@ -269,7 +272,7 @@ class VehiclesController(BaseController):
269
272
  .header_param(Parameter()
270
273
  .key("accept")
271
274
  .value("application/json"))
272
- .auth(Single("bearerAuth")),
275
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
273
276
  ).response(
274
277
  ResponseHandler()
275
278
  .deserializer(APIHelper.json_deserialize)
@@ -306,7 +309,7 @@ class VehiclesController(BaseController):
306
309
  .header_param(Parameter()
307
310
  .key("accept")
308
311
  .value("application/json"))
309
- .auth(Single("bearerAuth")),
312
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
310
313
  ).response(
311
314
  ResponseHandler()
312
315
  .deserializer(APIHelper.json_deserialize)
@@ -342,7 +345,7 @@ class VehiclesController(BaseController):
342
345
  .header_param(Parameter()
343
346
  .key("accept")
344
347
  .value("application/json"))
345
- .auth(Single("bearerAuth")),
348
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
346
349
  ).response(
347
350
  ResponseHandler()
348
351
  .deserializer(APIHelper.json_deserialize)
@@ -370,7 +373,7 @@ class VehiclesController(BaseController):
370
373
  .header_param(Parameter()
371
374
  .key("accept")
372
375
  .value("application/json"))
373
- .auth(Single("bearerAuth")),
376
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
374
377
  ).response(
375
378
  ResponseHandler()
376
379
  .deserializer(APIHelper.json_deserialize)
@@ -407,7 +410,7 @@ class VehiclesController(BaseController):
407
410
  .header_param(Parameter()
408
411
  .key("accept")
409
412
  .value("application/json"))
410
- .auth(Single("bearerAuth")),
413
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
411
414
  ).response(
412
415
  ResponseHandler()
413
416
  .deserializer(APIHelper.json_deserialize)
@@ -444,7 +447,7 @@ class VehiclesController(BaseController):
444
447
  .header_param(Parameter()
445
448
  .key("accept")
446
449
  .value("application/json"))
447
- .auth(Single("bearerAuth")),
450
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
448
451
  ).response(
449
452
  ResponseHandler()
450
453
  .deserializer(APIHelper.json_deserialize)
@@ -481,7 +484,7 @@ class VehiclesController(BaseController):
481
484
  .header_param(Parameter()
482
485
  .key("accept")
483
486
  .value("application/json"))
484
- .auth(Single("bearerAuth")),
487
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
485
488
  ).response(
486
489
  ResponseHandler()
487
490
  .deserializer(APIHelper.json_deserialize)
@@ -517,7 +520,7 @@ class VehiclesController(BaseController):
517
520
  .header_param(Parameter()
518
521
  .key("accept")
519
522
  .value("application/json"))
520
- .auth(Single("bearerAuth")),
523
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
521
524
  ).response(
522
525
  ResponseHandler()
523
526
  .deserializer(APIHelper.json_deserialize)
@@ -560,7 +563,7 @@ class VehiclesController(BaseController):
560
563
  .value(body)
561
564
  .is_required(True))
562
565
  .body_serializer(APIHelper.json_serialize)
563
- .auth(Single("bearerAuth")),
566
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
564
567
  ).response(
565
568
  ResponseHandler()
566
569
  .is_api_response(True),
@@ -595,7 +598,7 @@ class VehiclesController(BaseController):
595
598
  .header_param(Parameter()
596
599
  .key("accept")
597
600
  .value("application/json"))
598
- .auth(Single("bearerAuth")),
601
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
599
602
  ).response(
600
603
  ResponseHandler()
601
604
  .deserializer(APIHelper.json_deserialize)
@@ -633,7 +636,7 @@ class VehiclesController(BaseController):
633
636
  .key("accept")
634
637
  .value("application/json"))
635
638
  .body_serializer(APIHelper.json_serialize)
636
- .auth(Single("bearerAuth")),
639
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
637
640
  ).response(
638
641
  ResponseHandler()
639
642
  .deserializer(APIHelper.json_deserialize)
@@ -672,7 +675,7 @@ class VehiclesController(BaseController):
672
675
  .key("accept")
673
676
  .value("application/json"))
674
677
  .body_serializer(APIHelper.json_serialize)
675
- .auth(Single("bearerAuth")),
678
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
676
679
  ).response(
677
680
  ResponseHandler()
678
681
  .deserializer(APIHelper.json_deserialize)
@@ -710,7 +713,7 @@ class VehiclesController(BaseController):
710
713
  .header_param(Parameter()
711
714
  .key("accept")
712
715
  .value("application/json"))
713
- .auth(Single("bearerAuth")),
716
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
714
717
  ).response(
715
718
  ResponseHandler()
716
719
  .deserializer(APIHelper.json_deserialize)
@@ -747,7 +750,7 @@ class VehiclesController(BaseController):
747
750
  .header_param(Parameter()
748
751
  .key("accept")
749
752
  .value("application/json"))
750
- .auth(Single("bearerAuth")),
753
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
751
754
  ).response(
752
755
  ResponseHandler()
753
756
  .deserializer(APIHelper.json_deserialize)
@@ -787,7 +790,7 @@ class VehiclesController(BaseController):
787
790
  .key("accept")
788
791
  .value("application/json"))
789
792
  .body_serializer(APIHelper.json_serialize)
790
- .auth(Single("bearerAuth")),
793
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
791
794
  ).response(
792
795
  ResponseHandler()
793
796
  .deserializer(APIHelper.json_deserialize)
@@ -824,7 +827,7 @@ class VehiclesController(BaseController):
824
827
  .header_param(Parameter()
825
828
  .key("accept")
826
829
  .value("application/json"))
827
- .auth(Single("bearerAuth")),
830
+ .auth(And(Single("bearerAuth"), Single("thirdpartytoken"))),
828
831
  ).response(
829
832
  ResponseHandler()
830
833
  .deserializer(APIHelper.json_deserialize)
@@ -2,5 +2,5 @@
2
2
  # ruff: noqa: RUF022 | `__all__` is not sorted
3
3
  __all__ = [
4
4
  "api_exception",
5
- "oauth_provider_exception",
5
+ "o_auth_provider_exception",
6
6
  ]
@@ -12,9 +12,9 @@ from teslafleetmanagementapi.exceptions.api_exception import (
12
12
  )
13
13
 
14
14
 
15
- class OauthProviderException(ApiException):
15
+ class OAuthProviderException(ApiException):
16
16
  def __init__(self, reason, response):
17
- """Initialize OauthProviderException object.
17
+ """Initialize OAuthProviderException object.
18
18
 
19
19
  Args:
20
20
  reason (string): The reason (or error message) for the Exception
@@ -22,7 +22,7 @@ class OauthProviderException(ApiException):
22
22
  response (HttpResponse): The HttpResponse of the API call.
23
23
 
24
24
  """
25
- super(OauthProviderException, self).__init__(reason, response)
25
+ super(OAuthProviderException, self).__init__(reason, response)
26
26
  dictionary = APIHelper.json_deserialize(self.response.text)
27
27
  if isinstance(dictionary, dict):
28
28
  self.unbox(dictionary)
@@ -2,5 +2,5 @@
2
2
  # ruff: noqa: RUF022 | `__all__` is not sorted
3
3
  __all__ = [
4
4
  "bearer_auth",
5
- "oauth_2",
5
+ "thirdpartytoken",
6
6
  ]
@@ -21,15 +21,15 @@ from teslafleetmanagementapi.api_helper import (
21
21
  from teslafleetmanagementapi.configuration import (
22
22
  Server,
23
23
  )
24
- from teslafleetmanagementapi.controllers.oauth_authorization_controller import (
25
- OauthAuthorizationController,
24
+ from teslafleetmanagementapi.controllers.o_auth_authorization_controller import (
25
+ OAuthAuthorizationController,
26
26
  )
27
- from teslafleetmanagementapi.models.oauth_token import (
28
- OauthToken,
27
+ from teslafleetmanagementapi.models.o_auth_token import (
28
+ OAuthToken,
29
29
  )
30
30
 
31
31
 
32
- class Oauth2(HeaderAuth):
32
+ class Thirdpartytoken(HeaderAuth):
33
33
  """
34
34
  An authentication handler that applies `AuthorizationCodeAuth` to
35
35
  outgoing requests. It constructs the required credential values and integrates
@@ -39,7 +39,7 @@ class Oauth2(HeaderAuth):
39
39
  @property
40
40
  def error_message(self):
41
41
  """Return reason about the authentication failure."""
42
- return "Oauth2: OAuthToken is undefined or expired."
42
+ return "Thirdpartytoken: OAuthToken is undefined or expired."
43
43
 
44
44
  def __init__(self, auth_credentials_model, config):
45
45
  """
@@ -51,25 +51,30 @@ class Oauth2(HeaderAuth):
51
51
  config: The configuration instance.
52
52
 
53
53
  """
54
- self._oauth_client_id = auth_credentials_model.oauth_client_id \
54
+ self._o_auth_client_id = auth_credentials_model.o_auth_client_id \
55
55
  if auth_credentials_model is not None else None
56
- self._oauth_client_secret = auth_credentials_model.oauth_client_secret \
56
+ self._o_auth_client_secret = auth_credentials_model.o_auth_client_secret \
57
57
  if auth_credentials_model is not None else None
58
- self._oauth_redirect_uri = auth_credentials_model.oauth_redirect_uri \
58
+ self._o_auth_redirect_uri = auth_credentials_model.o_auth_redirect_uri \
59
59
  if auth_credentials_model is not None else None
60
60
  if auth_credentials_model is not None \
61
- and isinstance(auth_credentials_model.oauth_token, OauthToken):
62
- self._oauth_token = OauthToken.from_dictionary(
63
- APIHelper.to_dictionary(auth_credentials_model.oauth_token))
61
+ and isinstance(auth_credentials_model.o_auth_token, OAuthToken):
62
+ self._o_auth_token = OAuthToken.from_dictionary(
63
+ APIHelper.to_dictionary(auth_credentials_model.o_auth_token))
64
64
  else:
65
- self._oauth_token = auth_credentials_model.oauth_token \
65
+ self._o_auth_token = auth_credentials_model.o_auth_token \
66
66
  if auth_credentials_model is not None else None
67
+ if auth_credentials_model is not None \
68
+ and isinstance(auth_credentials_model.o_auth_scopes, list):
69
+ self._o_auth_scopes = auth_credentials_model.o_auth_scopes
70
+ else:
71
+ self._o_auth_scopes = None
67
72
  self._config = config
68
- self._o_auth_api = OauthAuthorizationController(config)
73
+ self._o_auth_api = OAuthAuthorizationController(config)
69
74
  auth_params = {}
70
- if (isinstance(self._oauth_token, OauthToken)
71
- and hasattr(self._oauth_token, "access_token")):
72
- auth_params = {"Authorization": f"Bearer {self._oauth_token.access_token}"}
75
+ if (isinstance(self._o_auth_token, OAuthToken)
76
+ and hasattr(self._o_auth_token, "access_token")):
77
+ auth_params = {"Authorization": f"Bearer {self._o_auth_token.access_token}"}
73
78
  super().__init__(auth_params=auth_params)
74
79
 
75
80
  def is_valid(self):
@@ -80,8 +85,8 @@ class Oauth2(HeaderAuth):
80
85
  bool: True if the credentials are valid, False otherwise.
81
86
 
82
87
  """
83
- return (self._oauth_token and isinstance(self._oauth_token, OauthToken)
84
- and not self.is_token_expired(self._oauth_token))
88
+ return (self._o_auth_token and isinstance(self._o_auth_token, OAuthToken)
89
+ and not self.is_token_expired(self._o_auth_token))
85
90
 
86
91
  def get_authorization_url(self, state=None, additional_params=None):
87
92
  """
@@ -102,9 +107,11 @@ class Oauth2(HeaderAuth):
102
107
  auth_url += "/authorize"
103
108
  query_params = {
104
109
  "response_type": "code",
105
- "client_id": self._oauth_client_id,
106
- "redirect_uri": self._oauth_redirect_uri,
110
+ "client_id": self._o_auth_client_id,
111
+ "redirect_uri": self._o_auth_redirect_uri,
107
112
  }
113
+ if self._o_auth_scopes:
114
+ query_params["scope"] = " ".join(self._o_auth_scopes)
108
115
  if state:
109
116
  query_params["state"] = state
110
117
  if additional_params:
@@ -122,8 +129,8 @@ class Oauth2(HeaderAuth):
122
129
 
123
130
  """
124
131
  encoded = AuthHelper.get_base64_encoded_value(
125
- self._oauth_client_id,
126
- self._oauth_client_secret,
132
+ self._o_auth_client_id,
133
+ self._o_auth_client_secret,
127
134
  )
128
135
  return f"Basic {encoded}"
129
136
 
@@ -139,10 +146,10 @@ class Oauth2(HeaderAuth):
139
146
  OAuthToken: The OAuth token.
140
147
 
141
148
  """
142
- token = self._o_auth_api.request_token_oauth_2(
149
+ token = self._o_auth_api.request_token_thirdpartytoken(
143
150
  self.build_basic_auth_header(),
144
151
  auth_code,
145
- self._oauth_redirect_uri,
152
+ self._o_auth_redirect_uri,
146
153
  _optional_form_parameters=additional_params,
147
154
  ).body
148
155
  if hasattr(token, "expires_in"):
@@ -153,25 +160,25 @@ class Oauth2(HeaderAuth):
153
160
  )
154
161
  return token
155
162
 
156
- def is_token_expired(self, oauth_token=None):
163
+ def is_token_expired(self, o_auth_token=None):
157
164
  """
158
165
  Check if OAuth token has expired.
159
166
 
160
167
  Args:
161
- oauth_token (OauthToken): The OAuth token whose expiry is to be checked.
168
+ o_auth_token (OAuthToken): The OAuth token whose expiry is to be checked.
162
169
 
163
170
  Returns:
164
171
  bool: True if OAuth token has expired, False otherwise.
165
172
 
166
173
  """
167
- if oauth_token is None:
168
- return (hasattr(self._oauth_token, "expiry")
174
+ if o_auth_token is None:
175
+ return (hasattr(self._o_auth_token, "expiry")
169
176
  and AuthHelper.is_token_expired(
170
- self._oauth_token.expiry))
177
+ self._o_auth_token.expiry))
171
178
 
172
- return (hasattr(oauth_token, "expiry")
179
+ return (hasattr(o_auth_token, "expiry")
173
180
  and AuthHelper.is_token_expired(
174
- oauth_token.expiry))
181
+ o_auth_token.expiry))
175
182
 
176
183
  def refresh_token(self, additional_params=None):
177
184
  """
@@ -184,9 +191,10 @@ class Oauth2(HeaderAuth):
184
191
  OAuthToken: The refreshed OAuth token.
185
192
 
186
193
  """
187
- token = self._o_auth_api.refresh_token_oauth_2(
194
+ token = self._o_auth_api.refresh_token_thirdpartytoken(
188
195
  self.build_basic_auth_header(),
189
- self._oauth_token.refresh_token,
196
+ self._o_auth_token.refresh_token,
197
+ " ".join(self._o_auth_scopes) if self._o_auth_scopes else None,
190
198
  _optional_form_parameters=additional_params,
191
199
  ).body
192
200
  if hasattr(token, "expires_in"):
@@ -198,7 +206,7 @@ class Oauth2(HeaderAuth):
198
206
  return token
199
207
 
200
208
 
201
- class Oauth2Credentials:
209
+ class ThirdpartytokenCredentials:
202
210
  """
203
211
  A model for authentication credentials. Provides simple validation,
204
212
  cloning support, and optional construction from environment variables.
@@ -206,76 +214,88 @@ class Oauth2Credentials:
206
214
  """
207
215
 
208
216
  @property
209
- def oauth_client_id(self):
217
+ def o_auth_client_id(self):
210
218
  """
211
219
  OAuth 2 Client ID.
212
220
  """
213
- return self._oauth_client_id
221
+ return self._o_auth_client_id
214
222
 
215
223
  @property
216
- def oauth_client_secret(self):
224
+ def o_auth_client_secret(self):
217
225
  """
218
226
  OAuth 2 Client Secret.
219
227
  """
220
- return self._oauth_client_secret
228
+ return self._o_auth_client_secret
221
229
 
222
230
  @property
223
- def oauth_redirect_uri(self):
231
+ def o_auth_redirect_uri(self):
224
232
  """
225
233
  OAuth 2 Redirection endpoint or Callback Uri.
226
234
  """
227
- return self._oauth_redirect_uri
235
+ return self._o_auth_redirect_uri
228
236
 
229
237
  @property
230
- def oauth_token(self):
238
+ def o_auth_token(self):
231
239
  """
232
240
  Object for storing information about the OAuth token.
233
241
  """
234
- return self._oauth_token
242
+ return self._o_auth_token
235
243
 
236
- def __init__(self, oauth_client_id, oauth_client_secret, oauth_redirect_uri,
237
- oauth_token=None):
244
+ @property
245
+ def o_auth_scopes(self):
246
+ """
247
+ List of scopes that apply to the OAuth token.
248
+ """
249
+ return self._o_auth_scopes
250
+
251
+ def __init__(self, o_auth_client_id, o_auth_client_secret,
252
+ o_auth_redirect_uri, o_auth_token=None, o_auth_scopes=None):
238
253
  """
239
254
  Initialize the credentials.
240
255
 
241
256
  Args:
242
- oauth_client_id: The oauth_client_id property value to set.
243
- oauth_client_secret: The oauth_client_secret property value to set.
244
- oauth_redirect_uri: The oauth_redirect_uri property value to set.
245
- oauth_token: The oauth_token property value to set.
257
+ o_auth_client_id: The o_auth_client_id property value to set.
258
+ o_auth_client_secret: The o_auth_client_secret property value to set.
259
+ o_auth_redirect_uri: The o_auth_redirect_uri property value to set.
260
+ o_auth_token: The o_auth_token property value to set.
261
+ o_auth_scopes: The o_auth_scopes property value to set.
246
262
 
247
263
  Raises:
248
264
  ValueError: If any required value is missing.
249
265
 
250
266
  """
251
- if oauth_client_id is None:
252
- raise ValueError("oauth_client_id cannot be None")
253
- if oauth_client_secret is None:
254
- raise ValueError("oauth_client_secret cannot be None")
255
- if oauth_redirect_uri is None:
256
- raise ValueError("oauth_redirect_uri cannot be None")
257
- self._oauth_client_id = oauth_client_id
258
- self._oauth_client_secret = oauth_client_secret
259
- self._oauth_redirect_uri = oauth_redirect_uri
260
- self._oauth_token = oauth_token
267
+ if o_auth_client_id is None:
268
+ raise ValueError("o_auth_client_id cannot be None")
269
+ if o_auth_client_secret is None:
270
+ raise ValueError("o_auth_client_secret cannot be None")
271
+ if o_auth_redirect_uri is None:
272
+ raise ValueError("o_auth_redirect_uri cannot be None")
273
+ self._o_auth_client_id = o_auth_client_id
274
+ self._o_auth_client_secret = o_auth_client_secret
275
+ self._o_auth_redirect_uri = o_auth_redirect_uri
276
+ self._o_auth_token = o_auth_token
277
+ self._o_auth_scopes = o_auth_scopes
261
278
 
262
- def clone_with(self, oauth_client_id=None, oauth_client_secret=None,
263
- oauth_redirect_uri=None, oauth_token=None):
279
+ def clone_with(self, o_auth_client_id=None, o_auth_client_secret=None,
280
+ o_auth_redirect_uri=None, o_auth_token=None,
281
+ o_auth_scopes=None):
264
282
  """
265
283
  Return a new instance with optional value overrides.
266
284
 
267
285
  Args:
268
- oauth_client_id: The oauth_client_id property value to set.
269
- oauth_client_secret: The oauth_client_secret property value to set.
270
- oauth_redirect_uri: The oauth_redirect_uri property value to set.
271
- oauth_token: The oauth_token property value to set.
286
+ o_auth_client_id: The o_auth_client_id property value to set.
287
+ o_auth_client_secret: The o_auth_client_secret property value to set.
288
+ o_auth_redirect_uri: The o_auth_redirect_uri property value to set.
289
+ o_auth_token: The o_auth_token property value to set.
290
+ o_auth_scopes: The o_auth_scopes property value to set.
272
291
 
273
292
  """
274
- return Oauth2Credentials(
275
- oauth_client_id or self.oauth_client_id,
276
- oauth_client_secret or self.oauth_client_secret,
277
- oauth_redirect_uri or self.oauth_redirect_uri,
278
- oauth_token or self.oauth_token)
293
+ return ThirdpartytokenCredentials(
294
+ o_auth_client_id or self.o_auth_client_id,
295
+ o_auth_client_secret or self.o_auth_client_secret,
296
+ o_auth_redirect_uri or self.o_auth_redirect_uri,
297
+ o_auth_token or self.o_auth_token,
298
+ o_auth_scopes or self.o_auth_scopes)
279
299
 
280
300
  @classmethod
281
301
  def from_environment(cls):
@@ -286,26 +306,35 @@ class Oauth2Credentials:
286
306
  A credentials instance or ``None`` if values are missing.
287
307
 
288
308
  """
289
- oauth_client_id = os.getenv(
290
- "OAUTH_2_OAUTH_CLIENT_ID",
309
+ o_auth_client_id = os.getenv(
310
+ "THIRDPARTYTOKEN_O_AUTH_CLIENT_ID",
311
+ None,
312
+ )
313
+ o_auth_client_secret = os.getenv(
314
+ "THIRDPARTYTOKEN_O_AUTH_CLIENT_SECRET",
291
315
  None,
292
316
  )
293
- oauth_client_secret = os.getenv(
294
- "OAUTH_2_OAUTH_CLIENT_SECRET",
317
+ o_auth_redirect_uri = os.getenv(
318
+ "THIRDPARTYTOKEN_O_AUTH_REDIRECT_URI",
295
319
  None,
296
320
  )
297
- oauth_redirect_uri = os.getenv(
298
- "OAUTH_2_OAUTH_REDIRECT_URI",
321
+ o_auth_scopes = os.getenv(
322
+ "THIRDPARTYTOKEN_O_AUTH_SCOPES",
299
323
  None,
300
324
  )
301
325
 
302
- if (oauth_client_id is None
303
- or oauth_client_secret is None
304
- or oauth_redirect_uri is None):
326
+ if (o_auth_client_id is None
327
+ or o_auth_client_secret is None
328
+ or o_auth_redirect_uri is None):
305
329
  return None
306
330
 
331
+ o_auth_scopes = [
332
+ v.strip() for v in o_auth_scopes.split(",") if v.strip()
333
+ ] if o_auth_scopes else None
334
+
307
335
  return cls(
308
- oauth_client_id=oauth_client_id,
309
- oauth_client_secret=oauth_client_secret,
310
- oauth_redirect_uri=oauth_redirect_uri,
336
+ o_auth_client_id=o_auth_client_id,
337
+ o_auth_client_secret=o_auth_client_secret,
338
+ o_auth_redirect_uri=o_auth_redirect_uri,
339
+ o_auth_scopes=o_auth_scopes,
311
340
  )
@@ -1,6 +1,10 @@
1
1
  # ruff: noqa: D104 | Missing docstring in public package
2
2
  # ruff: noqa: RUF022 | `__all__` is not sorted
3
3
  __all__ = [
4
+ "actuate_trunk_request",
5
+ "add_charge_schedule_request",
6
+ "add_precondition_schedule_request",
7
+ "adjust_volume_request",
4
8
  "api_1_dx_vehicles_options_response",
5
9
  "api_1_dx_warranty_details_response",
6
10
  "api_1_vehicles_mobile_enabled_response",
@@ -26,6 +30,8 @@ __all__ = [
26
30
  "charging_session",
27
31
  "charging_sessions_data",
28
32
  "charging_sessions_response",
33
+ "command_response",
34
+ "command_result",
29
35
  "default_real_mode",
30
36
  "driver",
31
37
  "drivers_response",
@@ -36,6 +42,7 @@ __all__ = [
36
42
  "fleet_telemetry_errors_response",
37
43
  "fleet_telemetry_jws_request",
38
44
  "generic_update_response",
45
+ "guest_mode_request",
39
46
  "kind",
40
47
  "kind_get_wall_connector_charging_history",
41
48
  "live_status_response",
@@ -43,8 +50,9 @@ __all__ = [
43
50
  "location_1",
44
51
  "me_response",
45
52
  "mobile_enabled",
46
- "oauth_provider_error",
47
- "oauth_token",
53
+ "o_auth_provider_error",
54
+ "o_auth_scope_thirdpartytoken",
55
+ "o_auth_token",
48
56
  "off_grid_vehicle_charging_reserve_request",
49
57
  "operation_request",
50
58
  "orders_response",
@@ -81,5 +89,6 @@ __all__ = [
81
89
  "tou_settings",
82
90
  "vehicle_base",
83
91
  "vehicle_option",
84
- "warranty_item",
92
+ "warranty_item",
93
+ "which_trunk",
85
94
  ]