@dimo-network/data-sdk 1.2.1 → 1.2.3

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.
@@ -15,8 +15,12 @@ jobs:
15
15
  - uses: actions/setup-node@v3
16
16
  with:
17
17
  node-version: 20
18
- - run: npm ci
19
- - run: npm test
18
+ - name: Clear npm cache
19
+ run: npm cache clean --force
20
+ - name: Install dependencies
21
+ run: npm ci
22
+ - name: Run tests
23
+ run: npm test
20
24
  - name: Run build
21
25
  run: npm run build
22
26
  - name: Check dist directory
@@ -31,8 +35,12 @@ jobs:
31
35
  with:
32
36
  node-version: 20
33
37
  registry-url: https://registry.npmjs.org/
34
- - run: npm ci
35
- - run: npm test
38
+ - name: Clear npm cache
39
+ run: npm cache clean --force
40
+ - name: Install dependencies
41
+ run: npm ci
42
+ - name: Run tests
43
+ run: npm test
36
44
  - name: Run build
37
45
  run: npm run build
38
46
  - name: Check dist directory
package/CONTRIBUTING.md CHANGED
@@ -64,19 +64,17 @@ If you find a bug or have a suggestion for improving an existing example, please
64
64
  2. Under the `constructor`, locate a `this.setResource()` function call
65
65
  3. Update the endpoint of interest accordingly
66
66
 
67
- [Note] Some Vehicle Signal Decoding API endpoints uses `eth-addr` as one of the query parameters, for clarification and style purposes, please use `address` as the key when you pass a query parameter.
68
-
69
- ### Updating SDK Functions
70
- 1. Locate the functions under `/src/api/functions`
71
- 2. Update existing functions or create new functions
72
- 3. Export the modified function(s) in `/src/api/functions/index.ts`
73
- 4. Locate the resource mapping under `/src/api/resources/<directory>/index.ts`
74
- 5. Apply the new changes under `this.setResource()` function call
75
-
76
67
  ### Updating GraphQL Queries
77
68
  1. Locate the queries under `/src/graphql/resources/<directory>/index.ts`
78
69
  2. Under the `constructor`, locate a `this.setQueries()` function call
79
70
  3. Update the query of interest accordingly
80
71
 
72
+ ### Updating SDK Utility Functions
73
+ 1. Locate the functions under `/src/api/functions` or `/src/graphql/functions`
74
+ 2. Update existing functions or create new functions
75
+ 3. Export the modified function(s) in `/src/api/functions/index.ts` or `/src/graphql/functions/index.ts`
76
+ 4. Locate the resource mapping under `/src/api/resources/<directory>/index.ts` or `/src/graphql/resources/<directory>/index.ts`
77
+ 5. Apply the new changes under `this.setResource()` for REST API or `this.setQueries()` for GraphQL API
78
+
81
79
  ### Translating the README
82
80
  DIMO welcomes translation work done on the SDK.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  ![X (formerly Twitter) URL](https://img.shields.io/twitter/url?url=https%3A%2F%2Ftwitter.com%2FDIMO_Network&style=social)
7
7
 
8
8
  # DIMO Data SDK
9
- This is an official DIMO Data SDK written in NodeJS/TypeScript. The objective of this project is to make our API more accessible to the general public.
9
+ This is an official DIMO Data SDK written in TypeScript. The objective of this project is to make our API more accessible to the general public.
10
10
 
11
11
  ## Installation
12
12
  Use [npm](https://www.npmjs.com/package/@dimo-network/data-sdk):
@@ -29,57 +29,61 @@ Please visit the DIMO [Developer Documentation](https://docs.dimo.org/developer-
29
29
  ## How to Use the SDK
30
30
 
31
31
  Import the SDK library:
32
+
33
+ (TypeScript / ES Modules)
32
34
  ```ts
33
35
  import { DIMO } from '@dimo-network/data-sdk';
34
36
  ```
35
37
 
36
- Initiate the SDK depending on the environment of your interest, we currently support both `Production` and `Dev` environments:
38
+ (CommonJS)
39
+ ```js
40
+ const { DIMO } = require('@dimo-network/data-sdk/dist/index.cjs')
41
+ ```
42
+
43
+ Initiate the SDK:
37
44
 
38
45
  ```ts
39
46
  const dimo = new DIMO('Production');
40
47
  ```
41
- or
42
48
 
43
- ```ts
44
- const dimo = new DIMO('Dev');
45
- ```
46
49
  ### Developer Registration
47
50
  As part of the authentication process, you will need to obtain a Developer License via the [DIMO Developer Console](https://console.dimo.org/). To get started with registration, follow the steps below:
48
51
  1. Sign up on the [DIMO Developer Console](https://console.dimo.org/).
49
- 2. Get DIMO Credits either by paying in your local currency (via Stripe) or paying with a balance (if you have one).
52
+ 2. Get DIMO Credits (DCX) either by paying in your local currency (via Stripe) or paying with a balance (if you have one).
50
53
  3. Click on `Create app` and fill out the details about your project namespace (external-facing, e.g. `Drive2Survive LLC.`) and your application name (internal, e.g. `app-prod`)
51
- 4. Generate an API key and add in your preferred redirect URI
54
+ 4. Generate an API key and add in your preferred redirect URI.
52
55
 
53
56
  ### Authentication
54
57
 
55
- The SDK provides you with all the steps needed in the [Authentication Flow](https://docs.dimo.org/developer-platform/getting-started/developer-guide/authentication) to obtain an `access_token`.
58
+ The SDK provides you with all the steps needed in the [Authentication Flow](https://docs.dimo.org/developer-platform/getting-started/developer-guide/authentication) to obtain a Developer JWT.
56
59
 
57
60
  #### Prerequisites for Authentication
58
- 1. A valid Developer License
59
- 2. A valid API key
61
+ 1. A valid Developer License with a `client_id`
62
+ 2. A valid API key, generated via the Developer Console
63
+ 3. A proper [project set up with TypeScript](https://www.digitalocean.com/community/tutorials/setting-up-a-node-project-with-typescript).
60
64
 
61
65
  #### API Authentication
62
66
 
63
67
  ##### (Option 1 - PREFERRED) getToken Function
64
- As mentioned earlier, this is the streamlined function call to directly get the `access_token`. The `address` field in challenge generation is omitted since it is essentially the `client_id` of your application per Developer License:
68
+ This is a utility function call to get a Developer JWT in one step:
65
69
 
66
70
  ```ts
67
- const authHeader = await dimo.auth.getToken({
71
+ const developerJwt = await dimo.auth.getToken({
68
72
  client_id: '<client_id>',
69
73
  domain: '<domain>',
70
- private_key: '<private_key>',
74
+ private_key: '<api_key>',
71
75
  });
72
76
  ```
73
77
 
74
- Once you have the `authHeader`, you'll have access to the DIMO API endpoints. For endpoints that require the authorization headers, you can simply pass the results.
78
+ Once you have the `developerJwt`, you'll have access to the DIMO API endpoints. For endpoints that require the authorization headers, you can simply pass the results.
75
79
 
76
80
  ```ts
77
- // Pass the auth object to a protected endpoint
78
- await dimo.user.get(auth);
81
+ // Pass the developerJwt object to a protected endpoint
82
+ await dimo.user.get(developerJwt);
79
83
 
80
- // Pass the auth object to a protected endpoint with body parameters
84
+ // Pass the developerJwt object to a protected endpoint with body parameters
81
85
  await dimo.tokenexchange.exchange({
82
- ...auth,
86
+ ...developerJwt,
83
87
  privileges: [4],
84
88
  tokenId: <vehicle_token_id>
85
89
  });
@@ -93,7 +97,7 @@ Start by navigating to the SDK directory that was installed, if you used NPM, yo
93
97
 
94
98
  ```ts
95
99
  // After .credentials.json are provided
96
- const authHeader = await dimo.authenticate();
100
+ const developerJwt = await dimo.authenticate();
97
101
  // The rest would be the same as option 1
98
102
  ```
99
103
 
@@ -102,20 +106,20 @@ The SDK supports async await and your typical JS Promises. HTTP operations can b
102
106
 
103
107
  ```ts
104
108
  // Async Await
105
- async function getAllDeviceMakes() {
109
+ async function countCars() {
106
110
  try {
107
- let response = await dimo.devicedefinitions.listDeviceMakes();
111
+ let response = await dimo.identity.countDimoVehicles();
108
112
  // Do something with the response
109
113
  }
110
114
  catch (err) { /* ... */ }
111
115
  }
112
- getAllDeviceMakes();
116
+ countCars();
113
117
  ```
114
118
 
115
119
  ```js
116
120
  // JS Promises
117
- dimo.devicedefinitions.listDeviceMakes().then((result) => {
118
- return result.device_makes.length;
121
+ dimo.identity.countDimoVehicles().then((result) => {
122
+ return result;
119
123
  }).catch((err) => {
120
124
  /* ...handle the error... */
121
125
  });
@@ -125,9 +129,9 @@ dimo.devicedefinitions.listDeviceMakes().then((result) => {
125
129
 
126
130
  For query parameters, simply feed in an input that matches with the expected query parameters:
127
131
  ```ts
128
- dimo.devicedefinitions.getByMMY({
129
- make: '<vehicle_make>',
130
- model: '<vehicle_model',
132
+ dimo.devicedefinitions.search({
133
+ query: '<query>',
134
+ makeSlug: '<makeSlug>',
131
135
  year: 2021
132
136
  });
133
137
  ```
@@ -135,17 +139,21 @@ dimo.devicedefinitions.getByMMY({
135
139
 
136
140
  For path parameters, simply feed in an input that matches with the expected path parameters:
137
141
  ```ts
138
- dimo.devicedefinitions.getById({ id: '26G4j1YDKZhFeCsn12MAlyU3Y2H' })
142
+ dimo.attestation.createVinVC({
143
+ ...vehicle_jwt,
144
+ tokenId: 117315,
145
+ force: false
146
+ })
139
147
  ```
140
148
 
141
- #### Permission Tokens
149
+ #### Vehicle JWT
142
150
 
143
- As the 2nd leg of the API authentication, applications may exchange for short-lived [permissions JWT](https://docs.dimo.org/developer-platform/getting-started/developer-guide/authentication#getting-a-jwt) for specific vehicles that granted permissions to the app. This uses the [DIMO Token Exchange API](https://docs.dimo.org/developer-platform/api-references/dimo-protocol/token-exchange-api/token-exchange-api-endpoints).
151
+ As the 2nd leg of the API authentication, applications may exchange for short-lived [Vehicle JWT](https://docs.dimo.org/developer-platform/getting-started/developer-guide/authentication#getting-a-jwt) for specific vehicles that granted permissions to the app. This uses the [DIMO Token Exchange API](https://docs.dimo.org/developer-platform/api-references/dimo-protocol/token-exchange-api/token-exchange-api-endpoints).
144
152
 
145
- For the end users of your application, they will need to share their vehicle permissions via the DIMO Mobile App or via your implementation of [Login with DIMO](https://docs.dimo.org/developer-platform/getting-started/developer-guide/login-with-dimo). Once vehicles are shared, you will be able to get a permissions JWT.
153
+ For the end users of your application, they will need to share their vehicle permissions via the DIMO Mobile App or via your implementation of [Login with DIMO](https://docs.dimo.org/developer-platform/getting-started/developer-guide/login-with-dimo) or even by sharing on the Vehicle NFT directly. Once vehicles are shared, you will be able to get a Vehicle JWT.
146
154
 
147
155
  ```ts
148
- const privToken = await dimo.tokenexchange.exchange({
156
+ const vehicle_jwt = await dimo.tokenexchange.exchange({
149
157
  ...auth,
150
158
  privileges: [1, 5],
151
159
  tokenId: <vehicle_token_id>
@@ -153,19 +161,19 @@ const privToken = await dimo.tokenexchange.exchange({
153
161
 
154
162
  // Vehicle Status uses privId 1
155
163
  await dimo.devicedata.getVehicleStatus({
156
- ...privToken,
164
+ ...vehicle_jwt,
157
165
  tokenId: <vehicle_token_id>
158
166
  });
159
167
 
160
168
  // Proof of Movement Verifiable Credentials uses privId 4
161
169
  await dimo.attestation.createPomVC({
162
- ...privToken,
170
+ ...vehicle_jwt,
163
171
  tokenId: <vehicle_token_id>
164
172
  })
165
173
 
166
174
  // VIN Verifiable Credentials uses privId 5
167
175
  await dimo.attestation.createVinVC({
168
- ...privToken,
176
+ ...vehicle_jwt,
169
177
  tokenId: <vehicle_token_id>
170
178
  });
171
179
  ```
@@ -178,14 +186,14 @@ The SDK accepts any type of valid custom GraphQL queries, but we've also include
178
186
  The GraphQL entry points are designed almost identical to the REST API entry points. For any GraphQL API that requires auth headers (Telemetry API for example), you can use the same pattern as you would in the REST protected endpoints.
179
187
 
180
188
  ```ts
181
- const privToken = await dimo.tokenexchange.exchange({
182
- ...auth,
189
+ const vehicleJwt = await dimo.tokenexchange.exchange({
190
+ ...vehicleJwt,
183
191
  privileges: [1, 3, 4],
184
192
  tokenId: <vehicle_token_id>
185
193
  });
186
194
 
187
- const tele = await dimo.telemetry.query({
188
- ...privToken,
195
+ const something = await dimo.telemetry.query({
196
+ ...vehicleJwt,
189
197
  query: `
190
198
  query {
191
199
  some_valid_GraphQL_query
@@ -193,11 +201,24 @@ const tele = await dimo.telemetry.query({
193
201
  `
194
202
  });
195
203
  ```
204
+ #### Getting a Vehicle's VIN
205
+ In order to get to the VIN of a given vehicle, your application (aka Developer License) will need [permissions to view VIN credentials (Privilege ID: 5)](https://docs.dimo.org/developer-platform/api-references/token-exchange-api#privilege-definitions). As long as you have permissions to view the vehicle's VIN, simply call the `getVin` utility function.
206
+
207
+ ```ts
208
+ const getVin = async(vehicle_jwt: any) => {
209
+ return await dimo.telemetry.getVin({
210
+ ...vehicle_jwt,
211
+ tokenId: <vehicle_token_id>
212
+ });
213
+ }
214
+ ```
215
+
216
+ This utility function streamlines two calls: [Creating a VIN VC on Attestation API](https://docs.dimo.org/developer-platform/api-references/attestation-api#create-a-vehicle-vin-vc) and [Getting the Latest VIN VC on Telemetry API](https://docs.dimo.org/developer-platform/api-references/attestation-api#create-a-vehicle-vin-vc).
196
217
 
197
218
  #### Send a custom GraphQL query
198
219
  To send a custom GraphQL query, you can simply call the `query` function on any GraphQL API Endpoints and pass in any valid GraphQL query. To check whether your GraphQL query is valid, please visit our [Identity API GraphQL Playground](https://identity-api.dimo.zone/) or [Telemetry API GraphQL Playground](https://telemetry-api.dimo.zone/).
199
220
 
200
- ```js
221
+ ```ts
201
222
  const yourQuery = `{
202
223
  vehicles (first:10) {
203
224
  totalCount
@@ -1,2 +1,2 @@
1
1
  import { DimoEnvironment } from '../environments';
2
- export declare const Method: (resource: any, baseUrl: any, params: any, env: keyof typeof DimoEnvironment) => Promise<any>;
2
+ export declare const Method: (resource: any, baseUrl: any, params: any | undefined, env: keyof typeof DimoEnvironment) => Promise<any>;
@@ -6,7 +6,7 @@ export const Method = async (resource, baseUrl, params = {}, env) => {
6
6
  * Headers
7
7
  */
8
8
  let headers = {};
9
- if (['access_token', 'privilege_token'].includes(resource.auth)) {
9
+ if (['developer_jwt', 'vehicle_jwt'].includes(resource.auth)) {
10
10
  if (params.headers.Authorization) {
11
11
  headers = params.headers;
12
12
  }
@@ -115,12 +115,12 @@ export const Method = async (resource, baseUrl, params = {}, env) => {
115
115
  if (!resource.return) {
116
116
  return response.data;
117
117
  }
118
- // Special returns for access_token & privilege token
118
+ // Special returns for different JWTs
119
119
  let authHeader = {};
120
- if (resource.return === 'access_token') {
120
+ if (resource.return === 'developer_jwt') {
121
121
  authHeader = { Authorization: `Bearer ${response.data.access_token}` };
122
122
  }
123
- else if (resource.return === 'privilege_token') {
123
+ else if (resource.return === 'vehicle_jwt') {
124
124
  authHeader = { Authorization: `Bearer ${response.data.token}` };
125
125
  }
126
126
  return { headers: authHeader };
@@ -6,15 +6,15 @@ export class Attestation extends Resource {
6
6
  createVinVC: {
7
7
  method: 'POST',
8
8
  path: '/v1/vc/vin/:tokenId',
9
- auth: 'privilege_token',
9
+ auth: 'vehicle_jwt',
10
10
  queryParams: {
11
- 'force': true
11
+ 'force': false
12
12
  }
13
13
  },
14
14
  createPomVC: {
15
15
  method: 'POST',
16
16
  path: '/v1/vc/pom/:tokenId',
17
- auth: 'privilege_token'
17
+ auth: 'vehicle_jwt'
18
18
  }
19
19
  });
20
20
  }
@@ -31,7 +31,7 @@ export class Auth extends Resource {
31
31
  headers: {
32
32
  'content-type': 'application/x-www-form-urlencoded'
33
33
  },
34
- return: 'access_token'
34
+ return: 'developer_jwt'
35
35
  },
36
36
  getToken: {
37
37
  method: 'FUNCTION',
@@ -3,26 +3,26 @@ export class DeviceDefinitions extends Resource {
3
3
  constructor(api, env) {
4
4
  super(api, 'DeviceDefinitions', env);
5
5
  this.setResource({
6
- getByMMY: {
7
- method: 'GET',
8
- queryParams: {
9
- 'make': true,
10
- 'model': true,
11
- 'year': true
6
+ decodeVin: {
7
+ method: 'POST',
8
+ path: '/device-definitions/decode-vin',
9
+ body: {
10
+ countryCode: true,
11
+ vin: true
12
12
  },
13
- path: '/device-definitions'
14
- },
15
- getById: {
16
- method: 'GET',
17
- path: '/device-definitions/:id'
13
+ auth: 'developer_jwt'
18
14
  },
19
- listDeviceMakes: {
15
+ search: {
20
16
  method: 'GET',
21
- path: '/device-makes'
22
- },
23
- getDeviceTypeById: {
24
- method: 'GET',
25
- path: '/device-types/:id'
17
+ path: '/device-definitions/search',
18
+ queryParams: {
19
+ query: true,
20
+ makeSlug: false,
21
+ modelSlug: false,
22
+ year: false,
23
+ page: false,
24
+ pageSize: false
25
+ }
26
26
  }
27
27
  });
28
28
  }
@@ -2,153 +2,6 @@ import { Resource } from '../../Resource';
2
2
  export class Devices extends Resource {
3
3
  constructor(api, env) {
4
4
  super(api, 'Devices', env);
5
- this.setResource({
6
- createVehicle: {
7
- method: 'POST',
8
- path: '/v1/user/devices',
9
- body: {
10
- countryCode: true,
11
- deviceDefinitionId: true
12
- },
13
- auth: 'access_token'
14
- },
15
- createVehicleFromSmartcar: {
16
- method: 'POST',
17
- path: '/v1/user/devices/fromsmartcar',
18
- body: {
19
- code: true,
20
- countryCode: true,
21
- redirectURI: true
22
- },
23
- auth: 'access_token'
24
- },
25
- createVehicleFromVin: {
26
- method: 'POST',
27
- path: '/v1/user/devices/fromvin',
28
- body: {
29
- canProtocol: false,
30
- countryCode: true,
31
- vin: true
32
- },
33
- auth: 'access_token'
34
- },
35
- updateVehicleVin: {
36
- method: 'PATCH',
37
- path: '/v1/user/devices/:userDeviceId/vin',
38
- auth: 'access_token'
39
- },
40
- getClaimingPayload: {
41
- method: 'POST',
42
- path: '/v1/aftermarket/device/by-serial/:serial/commands/claim',
43
- auth: 'access_token'
44
- },
45
- signClaimingPayload: {
46
- method: 'POST',
47
- path: '/v1/aftermarket/device/by-serial/:serial/commands/claim',
48
- body: {
49
- claimRequest: true
50
- },
51
- auth: 'access_token'
52
- },
53
- getMintingPayload: {
54
- method: 'POST',
55
- path: '/v1/user/devices/:userDeviceId/commands/mint',
56
- auth: 'access_token'
57
- },
58
- signMintingPayload: {
59
- method: 'POST',
60
- path: '/v1/user/devices/:userDeviceId/commands/mint',
61
- body: {
62
- mintRequest: true
63
- },
64
- auth: 'access_token'
65
- },
66
- optInShareData: {
67
- method: 'POST',
68
- path: '/v1/user/devices/:userDeviceId/commands/opt-in',
69
- auth: 'access_token'
70
- },
71
- refreshSmartcarData: {
72
- method: 'POST',
73
- path: '/v1/user/devices/:userDeviceId/commands/refresh',
74
- auth: 'access_token'
75
- },
76
- getPairingPayload: {
77
- method: 'GET',
78
- path: '/v1/user/devices/:userDeviceId/aftermarket/commands/pair',
79
- auth: 'access_token'
80
- },
81
- signPairingPayload: {
82
- method: 'POST',
83
- path: '/v1/user/devices/:userDeviceId/aftermarket/commands/pair',
84
- body: {
85
- userSignature: true
86
- },
87
- auth: 'access_token'
88
- },
89
- getUnpairingPayload: {
90
- method: 'GET',
91
- path: '/v1/user/devices/:userDeviceId/aftermarket/commands/unpair',
92
- auth: 'access_token'
93
- },
94
- signUnpairingPayload: {
95
- method: 'POST',
96
- path: '/v1/user/devices/:userDeviceId/aftermarket/commands/unpair',
97
- body: {
98
- userSignature: true
99
- },
100
- auth: 'access_token'
101
- },
102
- lockDoors: {
103
- method: 'POST',
104
- path: '/v1/vehicle/:tokenId/commands/doors/lock',
105
- auth: 'privilege_token'
106
- },
107
- unlockDoors: {
108
- method: 'POST',
109
- path: '/v1/vehicle/:tokenId/commands/doors/unlock',
110
- auth: 'privilege_token'
111
- },
112
- openFrunk: {
113
- method: 'POST',
114
- path: '/v1/vehicle/:tokenId/commands/frunk/open',
115
- auth: 'privilege_token'
116
- },
117
- openTrunk: {
118
- method: 'POST',
119
- path: '/v1/vehicle/:tokenId/commands/trunk/open',
120
- auth: 'privilege_token'
121
- },
122
- listErrorCodes: {
123
- method: 'GET',
124
- path: '/v1/user/devices/:userDeviceId/error-codes',
125
- auth: 'access_token'
126
- },
127
- submitErrorCodes: {
128
- method: 'POST',
129
- path: '/v1/user/devices/:userDeviceId/error-codes',
130
- body: {
131
- queryDeviceErrorCodes: true
132
- },
133
- auth: 'access_token'
134
- },
135
- clearErrorCodes: {
136
- method: 'POST',
137
- path: '/v1/user/devices/:userDeviceId/error-codes/clear',
138
- auth: 'access_token'
139
- },
140
- getAftermarketDevice: {
141
- method: 'GET',
142
- path: '/v1/aftermarket/device/:tokenId',
143
- },
144
- getAftermarketDeviceImage: {
145
- method: 'GET',
146
- path: '/v1/aftermarket/device/:tokenId/image',
147
- },
148
- getAftermarketDeviceMetadataByAddress: {
149
- method: 'GET',
150
- path: '/v1/aftermarket/device/by-address/:address',
151
- }
152
- });
5
+ this.setResource({});
153
6
  }
154
7
  }
@@ -5,5 +5,4 @@ import { Devices } from './Devices';
5
5
  import { TokenExchange } from './TokenExchange';
6
6
  import { Trips } from './Trips';
7
7
  import { Valuations } from './Valuations';
8
- import { VehicleSignalDecoding } from './VehicleSignalDecoding';
9
- export { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations, VehicleSignalDecoding };
8
+ export { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations };
@@ -5,5 +5,4 @@ import { Devices } from './Devices';
5
5
  import { TokenExchange } from './TokenExchange';
6
6
  import { Trips } from './Trips';
7
7
  import { Valuations } from './Valuations';
8
- import { VehicleSignalDecoding } from './VehicleSignalDecoding';
9
- export { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations, VehicleSignalDecoding };
8
+ export { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations };
@@ -12,8 +12,8 @@ export class TokenExchange extends Resource {
12
12
  privileges: true,
13
13
  tokenId: true
14
14
  },
15
- auth: 'access_token',
16
- return: 'privilege_token'
15
+ auth: 'developer_jwt',
16
+ return: 'vehicle_jwt'
17
17
  }
18
18
  });
19
19
  }
@@ -9,7 +9,7 @@ export class Trips extends Resource {
9
9
  queryParams: {
10
10
  page: false
11
11
  },
12
- auth: 'privilege_token'
12
+ auth: 'vehicle_jwt'
13
13
  }
14
14
  });
15
15
  }
@@ -5,18 +5,18 @@ export class Valuations extends Resource {
5
5
  this.setResource({
6
6
  getValuations: {
7
7
  method: 'GET',
8
- path: '/v1/user/devices/:userDeviceId/valuations',
9
- auth: 'access_token'
8
+ path: '/v2/vehicles/:tokenId/valuations',
9
+ auth: 'vehicle_jwt'
10
10
  },
11
11
  getInstantOffers: {
12
12
  method: 'GET',
13
- path: '/v1/user/devices/:userDeviceId/instant-offer',
14
- auth: 'access_token'
13
+ path: '/v2/vehicles/:tokenId/instant-offer',
14
+ auth: 'vehicle_jwt'
15
15
  },
16
16
  getOffers: {
17
17
  method: 'GET',
18
- path: '/v1/user/devices/:userDeviceId/offers',
19
- auth: 'access_token'
18
+ path: '/v2/vehicles/:tokenId/offers',
19
+ auth: 'vehicle_jwt'
20
20
  }
21
21
  });
22
22
  }
package/dist/dimo.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DimoEnvironment } from './environments';
2
2
  import { Identity, Telemetry } from './graphql/resources/DimoGraphqlResources';
3
- import { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations, VehicleSignalDecoding } from './api/resources/DimoRestResources';
3
+ import { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations } from './api/resources/DimoRestResources';
4
4
  export declare class DIMO {
5
5
  attestation: Attestation;
6
6
  auth: Auth;
@@ -11,7 +11,6 @@ export declare class DIMO {
11
11
  tokenexchange: TokenExchange;
12
12
  trips: Trips;
13
13
  valuations: Valuations;
14
- vehiclesignaldecoding: VehicleSignalDecoding;
15
14
  constructor(env: keyof typeof DimoEnvironment);
16
15
  authenticate(): Promise<any>;
17
16
  }
package/dist/dimo.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DimoEnvironment } from './environments';
2
2
  import { DimoError } from './errors';
3
3
  import { Identity, Telemetry } from './graphql/resources/DimoGraphqlResources';
4
- import { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations, VehicleSignalDecoding } from './api/resources/DimoRestResources';
4
+ import { Attestation, Auth, DeviceDefinitions, Devices, TokenExchange, Trips, Valuations } from './api/resources/DimoRestResources';
5
5
  // import { Stream } from './streamr';
6
6
  export class DIMO {
7
7
  attestation;
@@ -13,7 +13,6 @@ export class DIMO {
13
13
  tokenexchange;
14
14
  trips;
15
15
  valuations;
16
- vehiclesignaldecoding;
17
16
  constructor(env) {
18
17
  this.identity = new Identity(DimoEnvironment[env].Identity, env);
19
18
  this.telemetry = new Telemetry(DimoEnvironment[env].Telemetry, env);
@@ -27,7 +26,6 @@ export class DIMO {
27
26
  this.tokenexchange = new TokenExchange(DimoEnvironment[env].TokenExchange, env);
28
27
  this.trips = new Trips(DimoEnvironment[env].Trips, env);
29
28
  this.valuations = new Valuations(DimoEnvironment[env].Valuations, env);
30
- this.vehiclesignaldecoding = new VehicleSignalDecoding(DimoEnvironment[env].VehicleSignalDecoding, env);
31
29
  }
32
30
  // Helper Function
33
31
  async authenticate() {