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
@@ -0,0 +1,109 @@
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
+ from teslafleetmanagementapi.models.command_result import (
11
+ CommandResult,
12
+ )
13
+
14
+
15
+ class CommandResponse(object):
16
+ """Implementation of the 'CommandResponse' model.
17
+
18
+ Attributes:
19
+ response (CommandResult): The model property of type CommandResult.
20
+ additional_properties (Dict[str, Any]): The additional properties for the
21
+ model.
22
+
23
+ """
24
+
25
+ # Create a mapping from Model property names to API property names
26
+ _names = {
27
+ "response": "response",
28
+ }
29
+
30
+ _optionals = [
31
+ "response",
32
+ ]
33
+
34
+ def __init__(
35
+ self,
36
+ response=APIHelper.SKIP,
37
+ additional_properties=None):
38
+ """Initialize a CommandResponse instance."""
39
+ # Initialize members of the class
40
+ if response is not APIHelper.SKIP:
41
+ self.response = response
42
+
43
+ # Add additional model properties to the instance
44
+ if additional_properties is None:
45
+ additional_properties = {}
46
+ self.additional_properties = additional_properties
47
+
48
+ @classmethod
49
+ def from_dictionary(cls,
50
+ dictionary):
51
+ """Create an instance of this model from a dictionary
52
+
53
+ Args:
54
+ dictionary (dictionary): A dictionary representation of the object
55
+ as obtained from the deserialization of the server's response. The
56
+ keys MUST match property names in the API description.
57
+
58
+ Returns:
59
+ object: An instance of this structure class.
60
+
61
+ """
62
+ if not isinstance(dictionary, dict) or dictionary is None:
63
+ return None
64
+
65
+ # Extract variables from the dictionary
66
+ response =\
67
+ CommandResult.from_dictionary(
68
+ dictionary.get("response"))\
69
+ if "response" in dictionary.keys()\
70
+ else APIHelper.SKIP
71
+
72
+ additional_properties = APIHelper.get_additional_properties(
73
+ dictionary={k: v for k, v in dictionary.items()
74
+ if k not in cls._names.values()},
75
+ unboxing_function=lambda value: value)
76
+
77
+ # Return an object of this model
78
+ return cls(response,
79
+ additional_properties)
80
+
81
+ def __repr__(self):
82
+ """Return a unambiguous string representation."""
83
+ _response=(
84
+ self.response
85
+ if hasattr(self, "response")
86
+ else None
87
+ )
88
+ _additional_properties=self.additional_properties
89
+ return (
90
+ f"{self.__class__.__name__}("
91
+ f"response={_response!r}, "
92
+ f"additional_properties={_additional_properties!r}, "
93
+ f")"
94
+ )
95
+
96
+ def __str__(self):
97
+ """Return a human-readable string representation."""
98
+ _response=(
99
+ self.response
100
+ if hasattr(self, "response")
101
+ else None
102
+ )
103
+ _additional_properties=self.additional_properties
104
+ return (
105
+ f"{self.__class__.__name__}("
106
+ f"response={_response!s}, "
107
+ f"additional_properties={_additional_properties!s}, "
108
+ f")"
109
+ )
@@ -0,0 +1,105 @@
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 CommandResult(object):
13
+ """Implementation of the 'CommandResult' model.
14
+
15
+ Attributes:
16
+ result (bool): The model property of type bool.
17
+ reason (str): The model property of type str.
18
+ additional_properties (Dict[str, Any]): The additional properties for the
19
+ model.
20
+
21
+ """
22
+
23
+ # Create a mapping from Model property names to API property names
24
+ _names = {
25
+ "result": "result",
26
+ "reason": "reason",
27
+ }
28
+
29
+ def __init__(
30
+ self,
31
+ result=None,
32
+ reason=None,
33
+ additional_properties=None):
34
+ """Initialize a CommandResult instance."""
35
+ # Initialize members of the class
36
+ self.result = result
37
+ self.reason = reason
38
+
39
+ # Add additional model properties to the instance
40
+ if additional_properties is None:
41
+ additional_properties = {}
42
+ self.additional_properties = additional_properties
43
+
44
+ @classmethod
45
+ def from_dictionary(cls,
46
+ dictionary):
47
+ """Create an instance of this model from a dictionary
48
+
49
+ Args:
50
+ dictionary (dictionary): A dictionary representation of the object
51
+ as obtained from the deserialization of the server's response. The
52
+ keys MUST match property names in the API description.
53
+
54
+ Returns:
55
+ object: An instance of this structure class.
56
+
57
+ """
58
+ if not isinstance(dictionary, dict) or dictionary is None:
59
+ return None
60
+
61
+ # Extract variables from the dictionary
62
+ result =\
63
+ dictionary.get("result")\
64
+ if "result" in dictionary.keys()\
65
+ else None
66
+ reason =\
67
+ dictionary.get("reason")\
68
+ if dictionary.get("reason")\
69
+ else None
70
+
71
+ additional_properties = APIHelper.get_additional_properties(
72
+ dictionary={k: v for k, v in dictionary.items()
73
+ if k not in cls._names.values()},
74
+ unboxing_function=lambda value: value)
75
+
76
+ # Return an object of this model
77
+ return cls(result,
78
+ reason,
79
+ additional_properties)
80
+
81
+ def __repr__(self):
82
+ """Return a unambiguous string representation."""
83
+ _result=self.result
84
+ _reason=self.reason
85
+ _additional_properties=self.additional_properties
86
+ return (
87
+ f"{self.__class__.__name__}("
88
+ f"result={_result!r}, "
89
+ f"reason={_reason!r}, "
90
+ f"additional_properties={_additional_properties!r}, "
91
+ f")"
92
+ )
93
+
94
+ def __str__(self):
95
+ """Return a human-readable string representation."""
96
+ _result=self.result
97
+ _reason=self.reason
98
+ _additional_properties=self.additional_properties
99
+ return (
100
+ f"{self.__class__.__name__}("
101
+ f"result={_result!s}, "
102
+ f"reason={_reason!s}, "
103
+ f"additional_properties={_additional_properties!s}, "
104
+ f")"
105
+ )
@@ -0,0 +1,92 @@
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 GuestModeRequest(object):
13
+ """Implementation of the 'GuestModeRequest' model.
14
+
15
+ Attributes:
16
+ enable (bool): Enable or disable Guest Mode
17
+ additional_properties (Dict[str, Any]): The additional properties for the
18
+ model.
19
+
20
+ """
21
+
22
+ # Create a mapping from Model property names to API property names
23
+ _names = {
24
+ "enable": "enable",
25
+ }
26
+
27
+ def __init__(
28
+ self,
29
+ enable=None,
30
+ additional_properties=None):
31
+ """Initialize a GuestModeRequest instance."""
32
+ # Initialize members of the class
33
+ self.enable = enable
34
+
35
+ # Add additional model properties to the instance
36
+ if additional_properties is None:
37
+ additional_properties = {}
38
+ self.additional_properties = additional_properties
39
+
40
+ @classmethod
41
+ def from_dictionary(cls,
42
+ dictionary):
43
+ """Create an instance of this model from a dictionary
44
+
45
+ Args:
46
+ dictionary (dictionary): A dictionary representation of the object
47
+ as obtained from the deserialization of the server's response. The
48
+ keys MUST match property names in the API description.
49
+
50
+ Returns:
51
+ object: An instance of this structure class.
52
+
53
+ """
54
+ if not isinstance(dictionary, dict) or dictionary is None:
55
+ return None
56
+
57
+ # Extract variables from the dictionary
58
+ enable =\
59
+ dictionary.get("enable")\
60
+ if "enable" in dictionary.keys()\
61
+ else None
62
+
63
+ additional_properties = APIHelper.get_additional_properties(
64
+ dictionary={k: v for k, v in dictionary.items()
65
+ if k not in cls._names.values()},
66
+ unboxing_function=lambda value: value)
67
+
68
+ # Return an object of this model
69
+ return cls(enable,
70
+ additional_properties)
71
+
72
+ def __repr__(self):
73
+ """Return a unambiguous string representation."""
74
+ _enable=self.enable
75
+ _additional_properties=self.additional_properties
76
+ return (
77
+ f"{self.__class__.__name__}("
78
+ f"enable={_enable!r}, "
79
+ f"additional_properties={_additional_properties!r}, "
80
+ f")"
81
+ )
82
+
83
+ def __str__(self):
84
+ """Return a human-readable string representation."""
85
+ _enable=self.enable
86
+ _additional_properties=self.additional_properties
87
+ return (
88
+ f"{self.__class__.__name__}("
89
+ f"enable={_enable!s}, "
90
+ f"additional_properties={_additional_properties!s}, "
91
+ f")"
92
+ )
@@ -6,7 +6,7 @@ This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io
6
6
  # ruff: noqa: E501
7
7
 
8
8
  class KindGetWallConnectorChargingHistory(object):
9
- """Implementation of the 'kind_Get wall connector charging history' enum.
9
+ """Implementation of the 'kind_getWallConnectorChargingHistory' enum.
10
10
 
11
11
  Attributes:
12
12
  CHARGE: The enum member of type str.
@@ -5,7 +5,7 @@ This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io
5
5
 
6
6
  # ruff: noqa: E501
7
7
 
8
- class OauthProviderError(object):
8
+ class OAuthProviderError(object):
9
9
  """Implementation of the 'OAuthProviderError' enum.
10
10
 
11
11
  OAuth 2 Authorization error codes
@@ -0,0 +1,84 @@
1
+ """teslafleetmanagementapi.
2
+
3
+ This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
4
+ """
5
+
6
+ # ruff: noqa: E501
7
+
8
+ class OAuthScopeThirdpartytoken(object):
9
+ """Implementation of the 'OAuth ScopeThirdpartytoken' enum.
10
+
11
+ OAuth 2 scopes supported by the API
12
+
13
+ Attributes:
14
+ OPENID: Allow Tesla customers to sign in to the application with their Tesla
15
+ credentials.
16
+ OFFLINE_ACCESS: Allow getting a refresh token without needing user to log in
17
+ again.
18
+ USER_DATA: Contact information, home address, profile picture, and referral
19
+ information.
20
+ VEHICLE_DEVICE_DATA: Allow access to your vehicle’s live data, service
21
+ history, service scheduling data, service communications, eligible
22
+ upgrades, nearby Superchargers and ownership details.
23
+ VEHICLE_LOCATION: Allow access to vehicle location information, including
24
+ precise and coarse location data.
25
+ VEHICLE_CMDS: Commands like add/remove driver, access Live Camera, unlock,
26
+ wake up, remote start, and schedule software updates.
27
+ VEHICLE_CHARGING_CMDS: Vehicle charging history, billed amount, charging
28
+ location, and commands to schedule, start, or stop charging.
29
+ VEHICLE_SPECS: Access detailed vehicle specifications. Partner tokens only;
30
+ usable without owner authorization.
31
+ ENERGY_DEVICE_DATA: Energy live status, site info, backup history, energy
32
+ history, and charge history.
33
+ ENERGY_CMDS: Update energy settings like backup reserve percent, operation
34
+ mode, and storm mode.
35
+ ENTERPRISE_MANAGEMENT: Allow access to enterprise management functions for
36
+ businesses.
37
+
38
+ """
39
+
40
+ OPENID = "openid"
41
+
42
+ OFFLINE_ACCESS = "offline_access"
43
+
44
+ USER_DATA = "user_data"
45
+
46
+ VEHICLE_DEVICE_DATA = "vehicle_device_data"
47
+
48
+ VEHICLE_LOCATION = "vehicle_location"
49
+
50
+ VEHICLE_CMDS = "vehicle_cmds"
51
+
52
+ VEHICLE_CHARGING_CMDS = "vehicle_charging_cmds"
53
+
54
+ VEHICLE_SPECS = "vehicle_specs"
55
+
56
+ ENERGY_DEVICE_DATA = "energy_device_data"
57
+
58
+ ENERGY_CMDS = "energy_cmds"
59
+
60
+ ENTERPRISE_MANAGEMENT = "enterprise_management"
61
+
62
+ @classmethod
63
+ def from_value(cls, value, default=None):
64
+ """Return the matching enum value for the given input."""
65
+ if value is None:
66
+ return default
67
+
68
+ # If numeric and matches directly
69
+ if isinstance(value, int):
70
+ for name, val in cls.__dict__.items():
71
+ if not name.startswith("_") and val == value:
72
+ return val
73
+
74
+ # If string, perform case-insensitive match
75
+ if isinstance(value, str):
76
+ value_lower = value.lower()
77
+ for name, val in cls.__dict__.items():
78
+ if not name.startswith("_") and (
79
+ name.lower() == value_lower or str(val).lower() == value_lower
80
+ ):
81
+ return val
82
+
83
+ # Fallback to default
84
+ return default
@@ -9,7 +9,7 @@ from teslafleetmanagementapi.api_helper import (
9
9
  )
10
10
 
11
11
 
12
- class OauthToken(object):
12
+ class OAuthToken(object):
13
13
  """Implementation of the 'OAuthToken' model.
14
14
 
15
15
  OAuth 2 Authorization endpoint response
@@ -50,7 +50,7 @@ class OauthToken(object):
50
50
  scope=APIHelper.SKIP,
51
51
  expiry=APIHelper.SKIP,
52
52
  refresh_token=APIHelper.SKIP):
53
- """Initialize a OauthToken instance."""
53
+ """Initialize a OAuthToken instance."""
54
54
  # Initialize members of the class
55
55
  self.access_token = access_token
56
56
  self.token_type = token_type
@@ -0,0 +1,45 @@
1
+ """teslafleetmanagementapi.
2
+
3
+ This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
4
+ """
5
+
6
+ # ruff: noqa: E501
7
+
8
+ class WhichTrunk(object):
9
+ """Implementation of the 'WhichTrunk' enum.
10
+
11
+ Attributes:
12
+ FRONT: The enum member of type str.
13
+ REAR: The enum member of type str.
14
+ additional_properties (Dict[str, Any]): The additional properties for the
15
+ model.
16
+
17
+ """
18
+
19
+ FRONT = "front"
20
+
21
+ REAR = "rear"
22
+
23
+ @classmethod
24
+ def from_value(cls, value, default=None):
25
+ """Return the matching enum value for the given input."""
26
+ if value is None:
27
+ return default
28
+
29
+ # If numeric and matches directly
30
+ if isinstance(value, int):
31
+ for name, val in cls.__dict__.items():
32
+ if not name.startswith("_") and val == value:
33
+ return val
34
+
35
+ # If string, perform case-insensitive match
36
+ if isinstance(value, str):
37
+ value_lower = value.lower()
38
+ for name, val in cls.__dict__.items():
39
+ if not name.startswith("_") and (
40
+ name.lower() == value_lower or str(val).lower() == value_lower
41
+ ):
42
+ return val
43
+
44
+ # Fallback to default
45
+ return default
@@ -24,8 +24,8 @@ from teslafleetmanagementapi.controllers.charging_controller import (
24
24
  from teslafleetmanagementapi.controllers.energy_controller import (
25
25
  EnergyController,
26
26
  )
27
- from teslafleetmanagementapi.controllers.oauth_authorization_controller import (
28
- OauthAuthorizationController,
27
+ from teslafleetmanagementapi.controllers.o_auth_authorization_controller import (
28
+ OAuthAuthorizationController,
29
29
  )
30
30
  from teslafleetmanagementapi.controllers.partner_controller import (
31
31
  PartnerController,
@@ -33,14 +33,17 @@ from teslafleetmanagementapi.controllers.partner_controller import (
33
33
  from teslafleetmanagementapi.controllers.user_controller import (
34
34
  UserController,
35
35
  )
36
+ from teslafleetmanagementapi.controllers.vehicle_commands_controller import (
37
+ VehicleCommandsController,
38
+ )
36
39
  from teslafleetmanagementapi.controllers.vehicles_controller import (
37
40
  VehiclesController,
38
41
  )
39
42
  from teslafleetmanagementapi.http.auth.bearer_auth import (
40
43
  BearerAuth,
41
44
  )
42
- from teslafleetmanagementapi.http.auth.oauth_2 import (
43
- Oauth2,
45
+ from teslafleetmanagementapi.http.auth.thirdpartytoken import (
46
+ Thirdpartytoken,
44
47
  )
45
48
 
46
49
 
@@ -73,21 +76,26 @@ class TeslafleetmanagementapiClient(object):
73
76
  return VehiclesController(self.global_configuration)
74
77
 
75
78
  @LazyProperty
76
- def oauth_authorization(self):
77
- """Provide access to the OauthAuthorizationController endpoints."""
78
- return OauthAuthorizationController(self.global_configuration)
79
+ def vehicle_commands(self):
80
+ """Provide access to the VehicleCommandsController endpoints."""
81
+ return VehicleCommandsController(self.global_configuration)
82
+
83
+ @LazyProperty
84
+ def o_auth_authorization(self):
85
+ """Provide access to the OAuthAuthorizationController endpoints."""
86
+ return OAuthAuthorizationController(self.global_configuration)
79
87
 
80
88
  @property
81
- def oauth_2(self):
82
- """Provide access to the Oauth2 auth manager."""
83
- return self.auth_managers["oauth2"]
89
+ def thirdpartytoken(self):
90
+ """Provide access to the Thirdpartytoken auth manager."""
91
+ return self.auth_managers["thirdpartytoken"]
84
92
 
85
93
  def __init__(self, http_client_instance=None,
86
94
  override_http_client_configuration=False, http_call_back=None,
87
95
  timeout=60, max_retries=0, backoff_factor=2,
88
96
  retry_statuses=None, retry_methods=None, proxy_settings=None,
89
97
  logging_configuration=None, environment=Environment.PRODUCTION,
90
- bearer_auth_credentials=None, oauth_2_credentials=None,
98
+ bearer_auth_credentials=None, thirdpartytoken_credentials=None,
91
99
  config=None):
92
100
  """Initialize a new instance of TeslafleetmanagementapiClient."""
93
101
  self.config = config or Configuration(
@@ -100,7 +108,7 @@ class TeslafleetmanagementapiClient(object):
100
108
  logging_configuration=logging_configuration,
101
109
  environment=environment,
102
110
  bearer_auth_credentials=bearer_auth_credentials,
103
- oauth_2_credentials=oauth_2_credentials)
111
+ thirdpartytoken_credentials=thirdpartytoken_credentials)
104
112
 
105
113
  self.global_configuration = GlobalConfiguration(self.config)\
106
114
  .global_errors(BaseController.global_errors())\
@@ -110,8 +118,9 @@ class TeslafleetmanagementapiClient(object):
110
118
 
111
119
  self.auth_managers = {
112
120
  "bearerAuth": BearerAuth(self.config.bearer_auth_credentials),
113
- "oauth2": Oauth2(self.config.oauth_2_credentials,
114
- self.global_configuration),
121
+ "thirdpartytoken": Thirdpartytoken(
122
+ self.config.thirdpartytoken_credentials,
123
+ self.global_configuration),
115
124
  }
116
125
  self.global_configuration =\
117
126
  self.global_configuration.auth_managers(self.auth_managers)