dimo-python-sdk 1.4.0__tar.gz → 1.6.0__tar.gz

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. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/PKG-INFO +1 -1
  2. dimo_python_sdk-1.6.0/dimo/api/attestation.py +138 -0
  3. dimo_python_sdk-1.4.0/dimo/api/vehicle_events.py → dimo_python_sdk-1.6.0/dimo/api/vehicle_triggers.py +22 -22
  4. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/dimo.py +2 -2
  5. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/environments.py +2 -2
  6. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo_python_sdk.egg-info/PKG-INFO +1 -1
  7. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo_python_sdk.egg-info/SOURCES.txt +1 -1
  8. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/pyproject.toml +1 -1
  9. dimo_python_sdk-1.4.0/dimo/api/attestation.py +0 -28
  10. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/LICENSE +0 -0
  11. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/README.md +0 -0
  12. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/__init__.py +0 -0
  13. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/api/__init__.py +0 -0
  14. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/api/auth.py +0 -0
  15. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/api/device_definitions.py +0 -0
  16. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/api/token_exchange.py +0 -0
  17. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/api/trips.py +0 -0
  18. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/api/valuations.py +0 -0
  19. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/constants.py +0 -0
  20. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/errors.py +0 -0
  21. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/eth_signer.py +0 -0
  22. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/graphql/__init__.py +0 -0
  23. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/graphql/identity.py +0 -0
  24. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/graphql/telemetry.py +0 -0
  25. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/permission_decoder.py +0 -0
  26. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo/request.py +0 -0
  27. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo_python_sdk.egg-info/dependency_links.txt +0 -0
  28. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo_python_sdk.egg-info/requires.txt +0 -0
  29. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/dimo_python_sdk.egg-info/top_level.txt +0 -0
  30. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/setup.cfg +0 -0
  31. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/tests/test_dimo.py +0 -0
  32. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/tests/test_errors.py +0 -0
  33. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/tests/test_permission_decoder.py +0 -0
  34. {dimo_python_sdk-1.4.0 → dimo_python_sdk-1.6.0}/tests/test_request.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dimo-python-sdk
3
- Version: 1.4.0
3
+ Version: 1.6.0
4
4
  Summary: DIMO SDK in Python
5
5
  Author-email: Barrett Kowalsky <barrettkowalsky@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/DIMO-Network/dimo-python-sdk
@@ -0,0 +1,138 @@
1
+ from dimo.errors import check_type, check_optional_type
2
+ from typing import Optional
3
+
4
+
5
+ class Attestation:
6
+ def __init__(self, request_method, get_auth_headers):
7
+ self._request = request_method
8
+ self._get_auth_headers = get_auth_headers
9
+
10
+ def create_vin_vc(self, vehicle_jwt: str, token_id: int) -> dict:
11
+ """
12
+ Generate cryptographic proof of a vehicle's VIN or retrieve existing unexpired attestation.
13
+
14
+ Args:
15
+ vehicle_jwt (str): Authentication JWT token
16
+ token_id (int): Vehicle token identifier
17
+
18
+ Returns:
19
+ dict: Response containing vcUrl, vcQuery, and confirmation message
20
+ """
21
+ check_type("vehicle_jwt", vehicle_jwt, str)
22
+ check_type("token_id", token_id, int)
23
+ url = f"/v2/attestation/vin/{token_id}"
24
+ return self._request(
25
+ "POST",
26
+ "Attestation",
27
+ url,
28
+ headers=self._get_auth_headers(vehicle_jwt),
29
+ )
30
+
31
+ def create_pom_vc(self, vehicle_jwt: str, token_id: int) -> dict:
32
+ """
33
+ Create proof of movement verifiable credential (v1 API).
34
+
35
+ Args:
36
+ vehicle_jwt (str): Authentication JWT token
37
+ token_id (int): Vehicle token identifier
38
+
39
+ Returns:
40
+ dict: Response from the API
41
+ """
42
+ check_type("vehicle_jwt", vehicle_jwt, str)
43
+ check_type("token_id", token_id, int)
44
+ url = f"/v1/vc/pom/{token_id}"
45
+ return self._request(
46
+ "POST", "Attestation", url, headers=self._get_auth_headers(vehicle_jwt)
47
+ )
48
+
49
+ def create_odometer_statement(
50
+ self, vehicle_jwt: str, token_id: int, timestamp: Optional[str] = None
51
+ ) -> dict:
52
+ """
53
+ Produce verifiable odometer reading attestation.
54
+
55
+ Args:
56
+ vehicle_jwt (str): Authentication JWT token
57
+ token_id (int): Vehicle token identifier
58
+ timestamp (str, optional): Specific moment for reading (ISO 8601 format)
59
+
60
+ Returns:
61
+ dict: Success message directing to telemetry-api retrieval
62
+ """
63
+ check_type("vehicle_jwt", vehicle_jwt, str)
64
+ check_type("token_id", token_id, int)
65
+ check_optional_type("timestamp", timestamp, str)
66
+
67
+ url = f"/v2/attestation/odometer-statement/{token_id}"
68
+ data = {}
69
+ if timestamp:
70
+ data["timestamp"] = timestamp
71
+
72
+ return self._request(
73
+ "POST",
74
+ "Attestation",
75
+ url,
76
+ headers=self._get_auth_headers(vehicle_jwt),
77
+ data=data if data else None,
78
+ )
79
+
80
+ def create_vehicle_health(
81
+ self, vehicle_jwt: str, token_id: int, start_time: str, end_time: str
82
+ ) -> dict:
83
+ """
84
+ Generate health status verification for specified timeframe.
85
+
86
+ Args:
87
+ vehicle_jwt (str): Authentication JWT token
88
+ token_id (int): Vehicle token identifier
89
+ start_time (str): Report beginning (ISO 8601 format)
90
+ end_time (str): Report conclusion (ISO 8601 format)
91
+
92
+ Returns:
93
+ dict: Success message with telemetry-api retrieval instructions
94
+ """
95
+ check_type("vehicle_jwt", vehicle_jwt, str)
96
+ check_type("token_id", token_id, int)
97
+ check_type("start_time", start_time, str)
98
+ check_type("end_time", end_time, str)
99
+
100
+ url = f"/v2/attestation/vehicle-health/{token_id}"
101
+ data = {"startTime": start_time, "endTime": end_time}
102
+
103
+ return self._request(
104
+ "POST",
105
+ "Attestation",
106
+ url,
107
+ headers=self._get_auth_headers(vehicle_jwt),
108
+ data=data,
109
+ )
110
+
111
+ def create_vehicle_position(
112
+ self, vehicle_jwt: str, token_id: int, timestamp: str
113
+ ) -> dict:
114
+ """
115
+ Produce location verification at specified moment.
116
+
117
+ Args:
118
+ vehicle_jwt (str): Authentication JWT token
119
+ token_id (int): Vehicle token identifier
120
+ timestamp (str): Location snapshot timing (ISO 8601 format)
121
+
122
+ Returns:
123
+ dict: Success message with telemetry-api retrieval instructions
124
+ """
125
+ check_type("vehicle_jwt", vehicle_jwt, str)
126
+ check_type("token_id", token_id, int)
127
+ check_type("timestamp", timestamp, str)
128
+
129
+ url = f"/v2/attestation/vehicle-position/{token_id}"
130
+ data = {"timestamp": timestamp}
131
+
132
+ return self._request(
133
+ "POST",
134
+ "Attestation",
135
+ url,
136
+ headers=self._get_auth_headers(vehicle_jwt),
137
+ data=data,
138
+ )
@@ -1,7 +1,7 @@
1
1
  from dimo.errors import check_type
2
2
 
3
3
 
4
- class VehicleEvents:
4
+ class VehicleTriggers:
5
5
 
6
6
  def __init__(self, request_method, get_auth_headers):
7
7
  self._request = request_method
@@ -14,7 +14,7 @@ class VehicleEvents:
14
14
  check_type("developer_jwt", developer_jwt, str)
15
15
  url = f"/v1/webhooks"
16
16
  return self._request(
17
- "GET", "VehicleEvents", url, headers=self._get_auth_headers(developer_jwt)
17
+ "GET", "VehicleTriggers", url, headers=self._get_auth_headers(developer_jwt)
18
18
  )
19
19
 
20
20
  def register_webhook(self, developer_jwt: str, request: object):
@@ -26,7 +26,7 @@ class VehicleEvents:
26
26
  url = f"/v1/webhooks"
27
27
  return self._request(
28
28
  "POST",
29
- "VehicleEvents",
29
+ "VehicleTriggers",
30
30
  url,
31
31
  headers=self._get_auth_headers(developer_jwt),
32
32
  data=request,
@@ -39,21 +39,21 @@ class VehicleEvents:
39
39
  check_type("developer_jwt", developer_jwt, str)
40
40
  url = f"/v1/webhooks/signals"
41
41
  return self._request(
42
- "GET", "VehicleEvents", url, headers=self._get_auth_headers(developer_jwt)
42
+ "GET", "VehicleTriggers", url, headers=self._get_auth_headers(developer_jwt)
43
43
  )
44
44
 
45
- def list_vehicle_subscriptions(self, developer_jwt: str, token_id: str):
45
+ def list_vehicle_subscriptions(self, developer_jwt: str, token_did: str):
46
46
  """
47
47
  Lists all webhooks that a specified vehicle token id is subscribed to
48
48
  """
49
49
  check_type("developer_jwt", developer_jwt, str)
50
- check_type("token_id", token_id, str)
51
- url = f"/v1/webhooks/vehicles/{token_id}"
50
+ check_type("token_id", token_did, str)
51
+ url = f"/v1/webhooks/vehicles/{token_did}"
52
52
  return self._request(
53
- "GET", "VehicleEvents", url, headers=self._get_auth_headers(developer_jwt)
53
+ "GET", "VehicleTriggers", url, headers=self._get_auth_headers(developer_jwt)
54
54
  )
55
55
 
56
- def list_vehicle_subscriptions_by_event(self, developer_jwt: str, webhook_id: str):
56
+ def list_vehicle_subscriptions_by_trigger(self, developer_jwt: str, webhook_id: str):
57
57
  """
58
58
  Lists all vehicle subscriptions for a given webhook id
59
59
  """
@@ -61,7 +61,7 @@ class VehicleEvents:
61
61
  check_type("webhook_id", webhook_id, str)
62
62
  url = f"/v1/webhooks/{webhook_id}"
63
63
  return self._request(
64
- "GET", "VehicleEvents", url, headers=self._get_auth_headers(developer_jwt)
64
+ "GET", "VehicleTriggers", url, headers=self._get_auth_headers(developer_jwt)
65
65
  )
66
66
 
67
67
  def update_webhook(self, developer_jwt: str, webhook_id: str, request: object):
@@ -74,7 +74,7 @@ class VehicleEvents:
74
74
  url = f"/v1/webhooks/{webhook_id}"
75
75
  return self._request(
76
76
  "PUT",
77
- "VehicleEvents",
77
+ "VehicleTriggers",
78
78
  url,
79
79
  headers=self._get_auth_headers(developer_jwt),
80
80
  data=request,
@@ -89,7 +89,7 @@ class VehicleEvents:
89
89
  url = f"/v1/webhooks/{webhook_id}"
90
90
  return self._request(
91
91
  "DELETE",
92
- "VehicleEvents",
92
+ "VehicleTriggers",
93
93
  url,
94
94
  headers=self._get_auth_headers(developer_jwt),
95
95
  )
@@ -102,19 +102,19 @@ class VehicleEvents:
102
102
  check_type("webhook_id", webhook_id, str)
103
103
  url = f"/v1/webhooks/{webhook_id}/subscribe/all"
104
104
  return self._request(
105
- "POST", "VehicleEvents", url, headers=self._get_auth_headers(developer_jwt)
105
+ "POST", "VehicleTriggers", url, headers=self._get_auth_headers(developer_jwt)
106
106
  )
107
107
 
108
- def subscribe_vehicle(self, developer_jwt: str, token_id: str, webhook_id: str):
108
+ def subscribe_vehicle(self, developer_jwt: str, token_did: str, webhook_id: str):
109
109
  """
110
110
  Subscribes a single vehicle to a specified webhook
111
111
  """
112
112
  check_type("developer_jwt", developer_jwt, str)
113
- check_type("token_id", token_id, str)
113
+ check_type("token_id", token_did, str)
114
114
  check_type("webhook_id", webhook_id, str)
115
- url = f"/v1/webhooks/{webhook_id}/subscribe/{token_id}"
115
+ url = f"/v1/webhooks/{webhook_id}/subscribe/{token_did}"
116
116
  return self._request(
117
- "POST", "VehicleEvents", url, headers=self._get_auth_headers(developer_jwt)
117
+ "POST", "VehicleTriggers", url, headers=self._get_auth_headers(developer_jwt)
118
118
  )
119
119
 
120
120
  def unsubscribe_all_vehicles(self, developer_jwt: str, webhook_id: str):
@@ -126,22 +126,22 @@ class VehicleEvents:
126
126
  url = f"/v1/webhooks/{webhook_id}/unsubscribe/all"
127
127
  return self._request(
128
128
  "DELETE",
129
- "VehicleEvents",
129
+ "VehicleTriggers",
130
130
  url,
131
131
  headers=self._get_auth_headers(developer_jwt),
132
132
  )
133
133
 
134
- def unsubscribe_vehicle(self, developer_jwt: str, token_id: str, webhook_id: str):
134
+ def unsubscribe_vehicle(self, developer_jwt: str, token_did: str, webhook_id: str):
135
135
  """
136
136
  Unsubscribes a single vehicle from a specified webhook
137
137
  """
138
138
  check_type("developer_jwt", developer_jwt, str)
139
- check_type("token_id", token_id, str)
139
+ check_type("token_id", token_did, str)
140
140
  check_type("webhook_id", webhook_id, str)
141
- url = f"/v1/webhooks/{webhook_id}/unsubscribe/{token_id}"
141
+ url = f"/v1/webhooks/{webhook_id}/unsubscribe/{token_did}"
142
142
  return self._request(
143
143
  "DELETE",
144
- "VehicleEvents",
144
+ "VehicleTriggers",
145
145
  url,
146
146
  headers=self._get_auth_headers(developer_jwt),
147
147
  )
@@ -6,7 +6,7 @@ from .api.device_definitions import DeviceDefinitions
6
6
  from .api.token_exchange import TokenExchange
7
7
  from .api.trips import Trips
8
8
  from .api.valuations import Valuations
9
- from .api.vehicle_events import VehicleEvents
9
+ from .api.vehicle_triggers import VehicleTriggers
10
10
 
11
11
  from .graphql.identity import Identity
12
12
  from .graphql.telemetry import Telemetry
@@ -84,7 +84,7 @@ class DIMO:
84
84
  "valuations": (Valuations, ("request", "_get_auth_headers")),
85
85
  "identity": (Identity, ("self",)),
86
86
  "telemetry": (Telemetry, ("self",)),
87
- "vehicle_events": (VehicleEvents, ("request", "_get_auth_headers")),
87
+ "vehicle_triggers": (VehicleTriggers, ("request", "_get_auth_headers")),
88
88
  }
89
89
  if name in mapping:
90
90
  cls, deps = mapping[name]
@@ -9,7 +9,7 @@ dimo_environment = {
9
9
  "Trips": "https://trips-api.dimo.zone",
10
10
  "User": "https://users-api.dimo.zone",
11
11
  "Valuations": "https://valuations-api.dimo.zone",
12
- "VehicleEvents": "https://vehicle-events-api.dimo.zone",
12
+ "VehicleTriggers": "https://vehicle-triggers-api.dimo.zone",
13
13
  },
14
14
  "Dev": {
15
15
  "Attestation": "https://attestation-api.dev.dimo.zone",
@@ -21,6 +21,6 @@ dimo_environment = {
21
21
  "Trips": "https://trips-api.dev.dimo.zone",
22
22
  "User": "https://users-api.dev.dimo.zone",
23
23
  "Valuations": "https://valuations-api.dev.dimo.zone",
24
- "VehicleEvents": "https://vehicle-events-api.dev.dimo.zone",
24
+ "VehicleTriggers": "https://vehicle-triggers-api.dev.dimo.zone",
25
25
  },
26
26
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dimo-python-sdk
3
- Version: 1.4.0
3
+ Version: 1.6.0
4
4
  Summary: DIMO SDK in Python
5
5
  Author-email: Barrett Kowalsky <barrettkowalsky@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/DIMO-Network/dimo-python-sdk
@@ -16,7 +16,7 @@ dimo/api/device_definitions.py
16
16
  dimo/api/token_exchange.py
17
17
  dimo/api/trips.py
18
18
  dimo/api/valuations.py
19
- dimo/api/vehicle_events.py
19
+ dimo/api/vehicle_triggers.py
20
20
  dimo/graphql/__init__.py
21
21
  dimo/graphql/identity.py
22
22
  dimo/graphql/telemetry.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dimo-python-sdk"
7
- version = "1.4.0"
7
+ version = "1.6.0"
8
8
  authors = [
9
9
  { name="Barrett Kowalsky", email="barrettkowalsky@gmail.com" },
10
10
  ]
@@ -1,28 +0,0 @@
1
- from dimo.errors import check_type
2
-
3
-
4
- class Attestation:
5
- def __init__(self, request_method, get_auth_headers):
6
- self._request = request_method
7
- self._get_auth_headers = get_auth_headers
8
-
9
- def create_vin_vc(self, vehicle_jwt: str, token_id: int) -> dict:
10
- check_type("vehicle_jwt", vehicle_jwt, str)
11
- check_type("token_id", token_id, int)
12
- params = {"force": True}
13
- url = f"/v1/vc/vin/{token_id}"
14
- return self._request(
15
- "POST",
16
- "Attestation",
17
- url,
18
- params=params,
19
- headers=self._get_auth_headers(vehicle_jwt),
20
- )
21
-
22
- def create_pom_vc(self, vehicle_jwt: str, token_id: int) -> dict:
23
- check_type("vehicle_jwt", vehicle_jwt, str)
24
- check_type("token_id", token_id, int)
25
- url = f"/v1/vc/pom/{token_id}"
26
- return self._request(
27
- "POST", "Attestation", url, headers=self._get_auth_headers(vehicle_jwt)
28
- )
File without changes