partnermax 0.2.0 → 0.2.2
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.
- package/CHANGELOG.md +75 -47
- package/LICENSE +201 -201
- package/README.md +394 -370
- package/api-promise.js +1 -1
- package/client.d.mts +9 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +9 -3
- package/client.d.ts.map +1 -1
- package/client.js +12 -2
- package/client.js.map +1 -1
- package/client.mjs +12 -2
- package/client.mjs.map +1 -1
- package/core/api-promise.js +1 -1
- package/core/api-promise.mjs +1 -1
- package/core/pagination.d.mts +57 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +57 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +108 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +102 -0
- package/core/pagination.mjs.map +1 -0
- package/error.js +1 -1
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/package.json +19 -15
- package/pagination.d.mts +3 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +3 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +3 -0
- package/pagination.mjs.map +1 -0
- package/resource.js +1 -1
- package/resources/dealers/dealers.d.mts +7 -71
- package/resources/dealers/dealers.d.mts.map +1 -1
- package/resources/dealers/dealers.d.ts +7 -71
- package/resources/dealers/dealers.d.ts.map +1 -1
- package/resources/dealers/dealers.js +3 -16
- package/resources/dealers/dealers.js.map +1 -1
- package/resources/dealers/dealers.mjs +2 -15
- package/resources/dealers/dealers.mjs.map +1 -1
- package/resources/dealers/index.d.mts +2 -2
- package/resources/dealers/index.d.mts.map +1 -1
- package/resources/dealers/index.d.ts +2 -2
- package/resources/dealers/index.d.ts.map +1 -1
- package/resources/dealers/index.js.map +1 -1
- package/resources/dealers/index.mjs.map +1 -1
- package/resources/dealers/nlt/index.d.mts +1 -1
- package/resources/dealers/nlt/index.d.mts.map +1 -1
- package/resources/dealers/nlt/index.d.ts +1 -1
- package/resources/dealers/nlt/index.d.ts.map +1 -1
- package/resources/dealers/nlt/nlt.d.mts +2 -2
- package/resources/dealers/nlt/nlt.d.mts.map +1 -1
- package/resources/dealers/nlt/nlt.d.ts +2 -2
- package/resources/dealers/nlt/nlt.d.ts.map +1 -1
- package/resources/dealers/nlt/nlt.js +1 -1
- package/resources/dealers/nlt/offers.d.mts +55 -78
- package/resources/dealers/nlt/offers.d.mts.map +1 -1
- package/resources/dealers/nlt/offers.d.ts +55 -78
- package/resources/dealers/nlt/offers.d.ts.map +1 -1
- package/resources/dealers/nlt/offers.js +9 -11
- package/resources/dealers/nlt/offers.js.map +1 -1
- package/resources/dealers/nlt/offers.mjs +9 -11
- package/resources/dealers/nlt/offers.mjs.map +1 -1
- package/resources/dealers/nlt-settings.d.mts +24 -64
- package/resources/dealers/nlt-settings.d.mts.map +1 -1
- package/resources/dealers/nlt-settings.d.ts +24 -64
- package/resources/dealers/nlt-settings.d.ts.map +1 -1
- package/resources/dealers/nlt-settings.js +4 -13
- package/resources/dealers/nlt-settings.js.map +1 -1
- package/resources/dealers/nlt-settings.mjs +4 -13
- package/resources/dealers/nlt-settings.mjs.map +1 -1
- package/resources/dealers/nlt.js +1 -1
- package/resources/dealers/vehicles/images.d.mts +3 -2
- package/resources/dealers/vehicles/images.d.mts.map +1 -1
- package/resources/dealers/vehicles/images.d.ts +3 -2
- package/resources/dealers/vehicles/images.d.ts.map +1 -1
- package/resources/dealers/vehicles/images.js +3 -2
- package/resources/dealers/vehicles/images.js.map +1 -1
- package/resources/dealers/vehicles/images.mjs +3 -2
- package/resources/dealers/vehicles/images.mjs.map +1 -1
- package/resources/dealers/vehicles/index.d.mts +1 -1
- package/resources/dealers/vehicles/index.d.mts.map +1 -1
- package/resources/dealers/vehicles/index.d.ts +1 -1
- package/resources/dealers/vehicles/index.d.ts.map +1 -1
- package/resources/dealers/vehicles/index.js.map +1 -1
- package/resources/dealers/vehicles/index.mjs.map +1 -1
- package/resources/dealers/vehicles/vehicles.d.mts +57 -70
- package/resources/dealers/vehicles/vehicles.d.mts.map +1 -1
- package/resources/dealers/vehicles/vehicles.d.ts +57 -70
- package/resources/dealers/vehicles/vehicles.d.ts.map +1 -1
- package/resources/dealers/vehicles/vehicles.js +19 -19
- package/resources/dealers/vehicles/vehicles.js.map +1 -1
- package/resources/dealers/vehicles/vehicles.mjs +18 -18
- package/resources/dealers/vehicles/vehicles.mjs.map +1 -1
- package/resources/dealers/vehicles.js +1 -1
- package/resources/dealers.js +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/keys.d.mts +7 -6
- package/resources/keys.d.mts.map +1 -1
- package/resources/keys.d.ts +7 -6
- package/resources/keys.d.ts.map +1 -1
- package/resources/keys.js +7 -6
- package/resources/keys.js.map +1 -1
- package/resources/keys.mjs +7 -6
- package/resources/keys.mjs.map +1 -1
- package/resources.js +1 -1
- package/src/api-promise.ts +2 -2
- package/src/client.ts +868 -841
- package/src/core/README.md +3 -3
- package/src/core/api-promise.ts +92 -92
- package/src/core/error.ts +130 -130
- package/src/core/pagination.ts +170 -0
- package/src/core/resource.ts +11 -11
- package/src/core/uploads.ts +2 -2
- package/src/error.ts +2 -2
- package/src/index.ts +23 -22
- package/src/internal/README.md +3 -3
- package/src/internal/builtin-types.ts +93 -93
- package/src/internal/detect-platform.ts +196 -196
- package/src/internal/errors.ts +33 -33
- package/src/internal/headers.ts +97 -97
- package/src/internal/parse.ts +56 -56
- package/src/internal/request-options.ts +91 -91
- package/src/internal/shim-types.ts +26 -26
- package/src/internal/shims.ts +107 -107
- package/src/internal/to-file.ts +154 -154
- package/src/internal/types.ts +93 -93
- package/src/internal/uploads.ts +187 -187
- package/src/internal/utils/base64.ts +40 -40
- package/src/internal/utils/bytes.ts +32 -32
- package/src/internal/utils/env.ts +18 -18
- package/src/internal/utils/log.ts +128 -128
- package/src/internal/utils/path.ts +88 -88
- package/src/internal/utils/query.ts +23 -23
- package/src/internal/utils/sleep.ts +3 -3
- package/src/internal/utils/uuid.ts +17 -17
- package/src/internal/utils/values.ts +105 -105
- package/src/internal/utils.ts +9 -9
- package/src/lib/.keep +4 -4
- package/src/pagination.ts +2 -0
- package/src/resource.ts +2 -2
- package/src/resources/dealers/dealers.ts +260 -348
- package/src/resources/dealers/index.ts +28 -28
- package/src/resources/dealers/nlt/index.ts +11 -11
- package/src/resources/dealers/nlt/nlt.ts +29 -29
- package/src/resources/dealers/nlt/offers.ts +403 -427
- package/src/resources/dealers/nlt-settings.ts +229 -269
- package/src/resources/dealers/nlt.ts +3 -3
- package/src/resources/dealers/vehicles/images.ts +154 -153
- package/src/resources/dealers/vehicles/index.ts +26 -25
- package/src/resources/dealers/vehicles/vehicles.ts +786 -796
- package/src/resources/dealers/vehicles.ts +3 -3
- package/src/resources/dealers.ts +3 -3
- package/src/resources/index.ts +11 -12
- package/src/resources/keys.ts +129 -128
- package/src/resources.ts +1 -1
- package/src/tsconfig.json +11 -11
- package/src/uploads.ts +2 -2
- package/src/version.ts +1 -1
- package/uploads.js +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1,796 +1,786 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../../core/resource';
|
|
4
|
-
import * as ImagesAPI from './images';
|
|
5
|
-
import {
|
|
6
|
-
ImageCreateParams,
|
|
7
|
-
ImageDeleteParams,
|
|
8
|
-
ImageListParams,
|
|
9
|
-
Images,
|
|
10
|
-
VehicleImage,
|
|
11
|
-
VehicleImageList,
|
|
12
|
-
} from './images';
|
|
13
|
-
import { APIPromise } from '../../../core/api-promise';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* AI-content worker
|
|
30
|
-
*
|
|
31
|
-
* embedding
|
|
32
|
-
* MCP / Custom GPT / NLWeb surfaces. The response returns immediately (no
|
|
33
|
-
* synchronous wait on the worker).
|
|
34
|
-
*/
|
|
35
|
-
create(dealerID: string, params: VehicleCreateParams, options?: RequestOptions): APIPromise<VehicleDetail> {
|
|
36
|
-
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
37
|
-
return this._client.post(path`/v1/dealers/${dealerID}/vehicles`, {
|
|
38
|
-
body,
|
|
39
|
-
...options,
|
|
40
|
-
headers: buildHeaders([
|
|
41
|
-
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
42
|
-
options?.headers,
|
|
43
|
-
]),
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get Vehicle
|
|
49
|
-
*/
|
|
50
|
-
retrieve(
|
|
51
|
-
vehicleID: string,
|
|
52
|
-
params: VehicleRetrieveParams,
|
|
53
|
-
options?: RequestOptions,
|
|
54
|
-
): APIPromise<VehicleDetail> {
|
|
55
|
-
const { dealer_id, ...query } = params;
|
|
56
|
-
return this._client.get(path`/v1/dealers/${dealer_id}/vehicles/${vehicleID}`, { query, ...options });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Partial update of a vehicle.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
update(
|
|
67
|
-
vehicleID: string,
|
|
68
|
-
params: VehicleUpdateParams,
|
|
69
|
-
options?: RequestOptions,
|
|
70
|
-
): APIPromise<VehicleDetail> {
|
|
71
|
-
const { dealer_id, 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
72
|
-
return this._client.patch(path`/v1/dealers/${dealer_id}/vehicles/${vehicleID}`, {
|
|
73
|
-
body,
|
|
74
|
-
...options,
|
|
75
|
-
headers: buildHeaders([
|
|
76
|
-
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
77
|
-
options?.headers,
|
|
78
|
-
]),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* List vehicles in a dealer's stock owned by the calling partner.
|
|
84
|
-
*
|
|
85
|
-
* Cursor pagination is opaque base64url over the last vehicle UUID. Default sort
|
|
86
|
-
* is `i.data_inserimento ASC` so freshly provisioned vehicles surface at the tail.
|
|
87
|
-
* Soft-deleted rows are excluded unless `include_deleted=true` is set explicitly —
|
|
88
|
-
* this preserves the soft-delete semantic across the API contract.
|
|
89
|
-
*/
|
|
90
|
-
list(
|
|
91
|
-
dealerID: string,
|
|
92
|
-
query: VehicleListParams | null | undefined = {},
|
|
93
|
-
options?: RequestOptions,
|
|
94
|
-
):
|
|
95
|
-
return this._client.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* `
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* Returns `409 vehicle_already_deleted` if the row is already soft- deleted — same
|
|
115
|
-
* idempotency pattern as the dealers DELETE endpoint.
|
|
116
|
-
*/
|
|
117
|
-
delete(vehicleID: string, params: VehicleDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
118
|
-
const { dealer_id } = params;
|
|
119
|
-
return this._client.delete(path`/v1/dealers/${dealer_id}/vehicles/${vehicleID}`, {
|
|
120
|
-
...options,
|
|
121
|
-
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Provision up to `BULK_MAX_ROWS` vehicles in a single synchronous call.
|
|
127
|
-
*
|
|
128
|
-
* Each row is processed inside its own `SAVEPOINT` so a failure on row N
|
|
129
|
-
* (validation, plate conflict, motornet not in catalogue, race) is isolated — the
|
|
130
|
-
* SAVEPOINT rolls back, the per-row outcome is collected with a structured error
|
|
131
|
-
* code, and the loop continues with row N+1.
|
|
132
|
-
*
|
|
133
|
-
* Successful rows accumulate in the outer transaction and are committed together
|
|
134
|
-
* at the end of the request. Failed rows leave no trace in the database.
|
|
135
|
-
*
|
|
136
|
-
* Returns `207 Multi-Status`. The response carries:
|
|
137
|
-
*
|
|
138
|
-
* - `total`, `succeeded`, `failed` — aggregate counters for quick branch logic on
|
|
139
|
-
* the partner side.
|
|
140
|
-
* - `results` — array of per-row outcomes, indexed by the position in the request
|
|
141
|
-
* `vehicles[]` array. Successful rows include the full `VehicleDetail`; failed
|
|
142
|
-
* rows include `error_code` + `error_message` keyed to the same codes as the
|
|
143
|
-
* single-POST surface so the partner reuses one error handler for both paths.
|
|
144
|
-
*
|
|
145
|
-
* For imports larger than `BULK_MAX_ROWS` (currently 100), the partner is expected
|
|
146
|
-
* to chunk the array client-side. A 5 000-vehicle initial migration is 50 calls;
|
|
147
|
-
* the partner controls concurrency.
|
|
148
|
-
*/
|
|
149
|
-
bulk(
|
|
150
|
-
dealerID: string,
|
|
151
|
-
params: VehicleBulkParams,
|
|
152
|
-
options?: RequestOptions,
|
|
153
|
-
): APIPromise<BulkCreateVehiclesResponse> {
|
|
154
|
-
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
155
|
-
return this._client.post(path`/v1/dealers/${dealerID}/vehicles/bulk`, {
|
|
156
|
-
body,
|
|
157
|
-
...options,
|
|
158
|
-
headers: buildHeaders([
|
|
159
|
-
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
160
|
-
options?.headers,
|
|
161
|
-
]),
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* - `
|
|
181
|
-
*
|
|
182
|
-
* - `
|
|
183
|
-
*
|
|
184
|
-
* - `
|
|
185
|
-
*
|
|
186
|
-
* - `
|
|
187
|
-
*
|
|
188
|
-
* - `
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* `
|
|
250
|
-
*
|
|
251
|
-
* `
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
* index.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* - **
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* - **
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Body param:
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
*
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
*
|
|
507
|
-
*/
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* Body param:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
*
|
|
518
|
-
*/
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Body param
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
*
|
|
529
|
-
*/
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
*
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
*
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
*
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
*
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
*
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
*
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
*
|
|
736
|
-
*/
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
*
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
*
|
|
747
|
-
*/
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
type
|
|
775
|
-
type
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
type
|
|
781
|
-
type
|
|
782
|
-
type
|
|
783
|
-
type
|
|
784
|
-
type
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
export {
|
|
789
|
-
Images as Images,
|
|
790
|
-
type VehicleImage as VehicleImage,
|
|
791
|
-
type VehicleImageList as VehicleImageList,
|
|
792
|
-
type ImageCreateParams as ImageCreateParams,
|
|
793
|
-
type ImageListParams as ImageListParams,
|
|
794
|
-
type ImageDeleteParams as ImageDeleteParams,
|
|
795
|
-
};
|
|
796
|
-
}
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import * as ImagesAPI from './images';
|
|
5
|
+
import {
|
|
6
|
+
ImageCreateParams,
|
|
7
|
+
ImageDeleteParams,
|
|
8
|
+
ImageListParams,
|
|
9
|
+
Images,
|
|
10
|
+
VehicleImage,
|
|
11
|
+
VehicleImageList,
|
|
12
|
+
} from './images';
|
|
13
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
14
|
+
import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
|
|
15
|
+
import { buildHeaders } from '../../../internal/headers';
|
|
16
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
17
|
+
import { path } from '../../../internal/utils/path';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Used-vehicle stock management for partner-owned dealers. The partner uploads each used vehicle by its canonical Motornet UNI code; DealerMAX joins the partner-provided pricing and stock metadata with the catalog master so the resulting listing is immediately indexed by the AI surfaces (MCP server, ChatGPT Custom GPT, NLWeb /ask, and the SEO/JSON-LD layer).
|
|
21
|
+
*/
|
|
22
|
+
export class Vehicles extends APIResource {
|
|
23
|
+
images: ImagesAPI.Images = new ImagesAPI.Images(this._client);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Provision a new used vehicle in a dealer's stock.
|
|
27
|
+
*
|
|
28
|
+
* The write is atomic: a plate conflict or catalogue-code error leaves no partial
|
|
29
|
+
* stock record behind. On success the asynchronous AI-content worker picks up the
|
|
30
|
+
* new vehicle within 60 seconds and generates the SEO body plus semantic
|
|
31
|
+
* embedding; at that point the vehicle becomes discoverable on the cross-network
|
|
32
|
+
* MCP / Custom GPT / NLWeb surfaces. The response returns immediately (no
|
|
33
|
+
* synchronous wait on the worker).
|
|
34
|
+
*/
|
|
35
|
+
create(dealerID: string, params: VehicleCreateParams, options?: RequestOptions): APIPromise<VehicleDetail> {
|
|
36
|
+
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
37
|
+
return this._client.post(path`/v1/dealers/${dealerID}/vehicles`, {
|
|
38
|
+
body,
|
|
39
|
+
...options,
|
|
40
|
+
headers: buildHeaders([
|
|
41
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
42
|
+
options?.headers,
|
|
43
|
+
]),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get Vehicle
|
|
49
|
+
*/
|
|
50
|
+
retrieve(
|
|
51
|
+
vehicleID: string,
|
|
52
|
+
params: VehicleRetrieveParams,
|
|
53
|
+
options?: RequestOptions,
|
|
54
|
+
): APIPromise<VehicleDetail> {
|
|
55
|
+
const { dealer_id, ...query } = params;
|
|
56
|
+
return this._client.get(path`/v1/dealers/${dealer_id}/vehicles/${vehicleID}`, { query, ...options });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Partial update of a vehicle.
|
|
61
|
+
*
|
|
62
|
+
* Applies the transmitted fields inside a single transaction. Fields not present
|
|
63
|
+
* in the body are not touched; explicit `null` clears only fields that are
|
|
64
|
+
* nullable in the public contract.
|
|
65
|
+
*/
|
|
66
|
+
update(
|
|
67
|
+
vehicleID: string,
|
|
68
|
+
params: VehicleUpdateParams,
|
|
69
|
+
options?: RequestOptions,
|
|
70
|
+
): APIPromise<VehicleDetail> {
|
|
71
|
+
const { dealer_id, 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
72
|
+
return this._client.patch(path`/v1/dealers/${dealer_id}/vehicles/${vehicleID}`, {
|
|
73
|
+
body,
|
|
74
|
+
...options,
|
|
75
|
+
headers: buildHeaders([
|
|
76
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
77
|
+
options?.headers,
|
|
78
|
+
]),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* List vehicles in a dealer's stock owned by the calling partner.
|
|
84
|
+
*
|
|
85
|
+
* Cursor pagination is opaque base64url over the last vehicle UUID. Default sort
|
|
86
|
+
* is `i.data_inserimento ASC` so freshly provisioned vehicles surface at the tail.
|
|
87
|
+
* Soft-deleted rows are excluded unless `include_deleted=true` is set explicitly —
|
|
88
|
+
* this preserves the soft-delete semantic across the API contract.
|
|
89
|
+
*/
|
|
90
|
+
list(
|
|
91
|
+
dealerID: string,
|
|
92
|
+
query: VehicleListParams | null | undefined = {},
|
|
93
|
+
options?: RequestOptions,
|
|
94
|
+
): PagePromise<VehicleSummariesCursorPage, VehicleSummary> {
|
|
95
|
+
return this._client.getAPIList(path`/v1/dealers/${dealerID}/vehicles`, CursorPage<VehicleSummary>, {
|
|
96
|
+
query,
|
|
97
|
+
...options,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Withdraw a vehicle from sale without deleting the row.
|
|
103
|
+
*
|
|
104
|
+
* Marks the vehicle as no longer for sale. The plate becomes reusable on the
|
|
105
|
+
* network the moment this returns.
|
|
106
|
+
*
|
|
107
|
+
* Soft-delete is the canonical "remove this vehicle from sale" surface. The
|
|
108
|
+
* AI-citation consumers (MCP `_tool_search_vehicles`, Custom GPT
|
|
109
|
+
* `search_vehicles_network`, NLWeb `/ask`) each filter their own
|
|
110
|
+
* public-availability state. The result on the partner side is the same: a
|
|
111
|
+
* soft-deleted vehicle disappears from every AI surface within the next index
|
|
112
|
+
* cycle.
|
|
113
|
+
*
|
|
114
|
+
* Returns `409 vehicle_already_deleted` if the row is already soft- deleted — same
|
|
115
|
+
* idempotency pattern as the dealers DELETE endpoint.
|
|
116
|
+
*/
|
|
117
|
+
delete(vehicleID: string, params: VehicleDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
118
|
+
const { dealer_id } = params;
|
|
119
|
+
return this._client.delete(path`/v1/dealers/${dealer_id}/vehicles/${vehicleID}`, {
|
|
120
|
+
...options,
|
|
121
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Provision up to `BULK_MAX_ROWS` vehicles in a single synchronous call.
|
|
127
|
+
*
|
|
128
|
+
* Each row is processed inside its own `SAVEPOINT` so a failure on row N
|
|
129
|
+
* (validation, plate conflict, motornet not in catalogue, race) is isolated — the
|
|
130
|
+
* SAVEPOINT rolls back, the per-row outcome is collected with a structured error
|
|
131
|
+
* code, and the loop continues with row N+1.
|
|
132
|
+
*
|
|
133
|
+
* Successful rows accumulate in the outer transaction and are committed together
|
|
134
|
+
* at the end of the request. Failed rows leave no trace in the database.
|
|
135
|
+
*
|
|
136
|
+
* Returns `207 Multi-Status`. The response carries:
|
|
137
|
+
*
|
|
138
|
+
* - `total`, `succeeded`, `failed` — aggregate counters for quick branch logic on
|
|
139
|
+
* the partner side.
|
|
140
|
+
* - `results` — array of per-row outcomes, indexed by the position in the request
|
|
141
|
+
* `vehicles[]` array. Successful rows include the full `VehicleDetail`; failed
|
|
142
|
+
* rows include `error_code` + `error_message` keyed to the same codes as the
|
|
143
|
+
* single-POST surface so the partner reuses one error handler for both paths.
|
|
144
|
+
*
|
|
145
|
+
* For imports larger than `BULK_MAX_ROWS` (currently 100), the partner is expected
|
|
146
|
+
* to chunk the array client-side. A 5 000-vehicle initial migration is 50 calls;
|
|
147
|
+
* the partner controls concurrency.
|
|
148
|
+
*/
|
|
149
|
+
bulk(
|
|
150
|
+
dealerID: string,
|
|
151
|
+
params: VehicleBulkParams,
|
|
152
|
+
options?: RequestOptions,
|
|
153
|
+
): APIPromise<BulkCreateVehiclesResponse> {
|
|
154
|
+
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
155
|
+
return this._client.post(path`/v1/dealers/${dealerID}/vehicles/bulk`, {
|
|
156
|
+
body,
|
|
157
|
+
...options,
|
|
158
|
+
headers: buildHeaders([
|
|
159
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
160
|
+
options?.headers,
|
|
161
|
+
]),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export type VehicleSummariesCursorPage = CursorPage<VehicleSummary>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* AI-generated editorial content for a single vehicle.
|
|
170
|
+
*
|
|
171
|
+
* Produced asynchronously by the `usato_ai_content_worker` in `azurenet-engine`
|
|
172
|
+
* within ~60 seconds of vehicle creation. While the worker is still pending, every
|
|
173
|
+
* field is `null`; once the worker completes the row this object carries the full
|
|
174
|
+
* editorial set the cross-network AI consumers (MCP, ChatGPT Custom GPT, NLWeb)
|
|
175
|
+
* display.
|
|
176
|
+
*
|
|
177
|
+
* Layered descriptions:
|
|
178
|
+
*
|
|
179
|
+
* - `tagline` — 8–12 word headline. Use on listing cards / push notifications.
|
|
180
|
+
* - `short` — 1–2 sentence summary (≤ 220 chars). Use as the meta description
|
|
181
|
+
* fallback.
|
|
182
|
+
* - `medium` — paragraph (~400 chars). Use on vehicle-detail SEO blurbs.
|
|
183
|
+
* - `long` — full marketing description (1500–3000 chars). Use on detail pages.
|
|
184
|
+
* - `highlights` — array of 3–7 selling points. Render as a bullet list above the
|
|
185
|
+
* description.
|
|
186
|
+
* - `faq` — array of `{question, answer}` objects. Render as accordion / JSON-LD
|
|
187
|
+
* `FAQPage`.
|
|
188
|
+
* - `seo_title` — ≤ 60 chars, `<title>`-ready.
|
|
189
|
+
* - `seo_description` — ≤ 160 chars, meta description-ready.
|
|
190
|
+
* - `slug` — URL-safe slug used in the canonical URL on the dealer site.
|
|
191
|
+
*
|
|
192
|
+
* The Italian language is canonical (`lang='it'`). Multi-language is on the
|
|
193
|
+
* roadmap; until then the partner gets exactly what the consumer AI surfaces get.
|
|
194
|
+
*/
|
|
195
|
+
export interface AIContent {
|
|
196
|
+
/**
|
|
197
|
+
* Array of `{question, answer}` objects. Each entry has two string keys; render
|
|
198
|
+
* with the partner's own FAQ UI or feed into a `FAQPage` JSON-LD block.
|
|
199
|
+
*/
|
|
200
|
+
faq?: Array<{ [key: string]: string }> | null;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* UTC timestamp of the most recent AI generation. `null` until the worker first
|
|
204
|
+
* processes the vehicle (≤ 60 seconds after vehicle creation).
|
|
205
|
+
*/
|
|
206
|
+
generated_at?: string | null;
|
|
207
|
+
|
|
208
|
+
highlights?: Array<string> | null;
|
|
209
|
+
|
|
210
|
+
long?: string | null;
|
|
211
|
+
|
|
212
|
+
medium?: string | null;
|
|
213
|
+
|
|
214
|
+
seo_description?: string | null;
|
|
215
|
+
|
|
216
|
+
seo_title?: string | null;
|
|
217
|
+
|
|
218
|
+
short?: string | null;
|
|
219
|
+
|
|
220
|
+
slug?: string | null;
|
|
221
|
+
|
|
222
|
+
tagline?: string | null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Response of `POST /v1/dealers/{dealer_id}/vehicles/bulk`.
|
|
227
|
+
*
|
|
228
|
+
* HTTP status is `207 Multi-Status` (rather than 201) to make partial success
|
|
229
|
+
* explicit at the protocol level. The aggregate counters at the top let a partner
|
|
230
|
+
* short-circuit when every row succeeded; the `results` array carries per-row
|
|
231
|
+
* detail when not.
|
|
232
|
+
*/
|
|
233
|
+
export interface BulkCreateVehiclesResponse {
|
|
234
|
+
failed: number;
|
|
235
|
+
|
|
236
|
+
results: Array<BulkRowOutcome>;
|
|
237
|
+
|
|
238
|
+
succeeded: number;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Number of rows in the request body.
|
|
242
|
+
*/
|
|
243
|
+
total: number;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Per-row result inside `BulkCreateVehiclesResponse`.
|
|
248
|
+
*
|
|
249
|
+
* On success `vehicle` is populated (full `VehicleDetail`) and
|
|
250
|
+
* `error_code`/`error_message` are null. On failure `vehicle` is null and
|
|
251
|
+
* `error_code`/`error_message` carry the same code that the corresponding
|
|
252
|
+
* single-create POST would have raised (e.g. `motornet_code_not_in_catalogue`,
|
|
253
|
+
* `vehicle_plate_already_registered`, `validation_error`).
|
|
254
|
+
*/
|
|
255
|
+
export interface BulkRowOutcome {
|
|
256
|
+
/**
|
|
257
|
+
* Zero-based index of the row in the request `vehicles[]` array. Stable across
|
|
258
|
+
* retries — the partner can correlate failures back to its own batch by this
|
|
259
|
+
* index.
|
|
260
|
+
*/
|
|
261
|
+
row_index: number;
|
|
262
|
+
|
|
263
|
+
status: 'succeeded' | 'failed';
|
|
264
|
+
|
|
265
|
+
error_code?: string | null;
|
|
266
|
+
|
|
267
|
+
error_message?: string | null;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Full vehicle resource. Returned by `GET /v1/dealers/{id}/vehicles/{id}`,
|
|
271
|
+
* `POST /v1/dealers/{id}/vehicles`, and `PATCH /v1/dealers/{id}/vehicles/{id}`.
|
|
272
|
+
*
|
|
273
|
+
* Carries three layers of information:
|
|
274
|
+
*
|
|
275
|
+
* - **Partner-supplied** — what the partner posted (`plate`, `description`,
|
|
276
|
+
* `sale_price_eur`, etc.).
|
|
277
|
+
* - **Catalogue-derived** — `technical_details` is a flat dictionary of
|
|
278
|
+
* Motornet-backed technical attributes using Italian domain labels such as
|
|
279
|
+
* `cilindrata`, `kw`, `hp`, `lunghezza`, `consumo_medio`, and `emissioni_co2`.
|
|
280
|
+
* - **AI-derived** — `ai_content` carries the editorial output the cross-network
|
|
281
|
+
* consumers display (descriptions, highlights, FAQ, SEO meta). `null` until the
|
|
282
|
+
* worker has processed the vehicle.
|
|
283
|
+
*
|
|
284
|
+
* Dealer-internal margin and operations data remains outside this SDK surface;
|
|
285
|
+
* partners receive only the inventory, commercial, catalogue, media, and
|
|
286
|
+
* AI-derived fields needed to publish the vehicle.
|
|
287
|
+
*/
|
|
288
|
+
vehicle?: VehicleDetail | null;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Full vehicle resource. Returned by `GET /v1/dealers/{id}/vehicles/{id}`,
|
|
293
|
+
* `POST /v1/dealers/{id}/vehicles`, and `PATCH /v1/dealers/{id}/vehicles/{id}`.
|
|
294
|
+
*
|
|
295
|
+
* Carries three layers of information:
|
|
296
|
+
*
|
|
297
|
+
* - **Partner-supplied** — what the partner posted (`plate`, `description`,
|
|
298
|
+
* `sale_price_eur`, etc.).
|
|
299
|
+
* - **Catalogue-derived** — `technical_details` is a flat dictionary of
|
|
300
|
+
* Motornet-backed technical attributes using Italian domain labels such as
|
|
301
|
+
* `cilindrata`, `kw`, `hp`, `lunghezza`, `consumo_medio`, and `emissioni_co2`.
|
|
302
|
+
* - **AI-derived** — `ai_content` carries the editorial output the cross-network
|
|
303
|
+
* consumers display (descriptions, highlights, FAQ, SEO meta). `null` until the
|
|
304
|
+
* worker has processed the vehicle.
|
|
305
|
+
*
|
|
306
|
+
* Dealer-internal margin and operations data remains outside this SDK surface;
|
|
307
|
+
* partners receive only the inventory, commercial, catalogue, media, and
|
|
308
|
+
* AI-derived fields needed to publish the vehicle.
|
|
309
|
+
*/
|
|
310
|
+
export interface VehicleDetail {
|
|
311
|
+
certified_km: number;
|
|
312
|
+
|
|
313
|
+
created_at: string;
|
|
314
|
+
|
|
315
|
+
dealer_id: string;
|
|
316
|
+
|
|
317
|
+
description: string;
|
|
318
|
+
|
|
319
|
+
extended_warranty_enabled: boolean;
|
|
320
|
+
|
|
321
|
+
is_for_sale: boolean;
|
|
322
|
+
|
|
323
|
+
is_visible: boolean;
|
|
324
|
+
|
|
325
|
+
last_modified_at: string;
|
|
326
|
+
|
|
327
|
+
motornet_code: string;
|
|
328
|
+
|
|
329
|
+
partner_id: string;
|
|
330
|
+
|
|
331
|
+
plate: string;
|
|
332
|
+
|
|
333
|
+
registration_year: number;
|
|
334
|
+
|
|
335
|
+
sale_price_eur: number;
|
|
336
|
+
|
|
337
|
+
vat_displayed: boolean;
|
|
338
|
+
|
|
339
|
+
vehicle_damaged: boolean;
|
|
340
|
+
|
|
341
|
+
vehicle_id: string;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Editorial content generated by the partnermax AI pipeline. `null` immediately
|
|
345
|
+
* after `POST` until the worker has produced the row (≤ 60 seconds). Populated for
|
|
346
|
+
* the same consumer-AI surfaces (MCP, Custom GPT, NLWeb).
|
|
347
|
+
*/
|
|
348
|
+
ai_content?: AIContent | null;
|
|
349
|
+
|
|
350
|
+
alloy_wheel_size?: number | null;
|
|
351
|
+
|
|
352
|
+
brand?: string | null;
|
|
353
|
+
|
|
354
|
+
color?: string | null;
|
|
355
|
+
|
|
356
|
+
extended_warranty_months?: number | null;
|
|
357
|
+
|
|
358
|
+
fuel_type?: string | null;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Vehicle photos in display order. The first entry is the cover photo
|
|
362
|
+
* (`position=1` in the dedicated images endpoint).
|
|
363
|
+
*/
|
|
364
|
+
image_urls?: Array<string>;
|
|
365
|
+
|
|
366
|
+
model?: string | null;
|
|
367
|
+
|
|
368
|
+
notes?: string | null;
|
|
369
|
+
|
|
370
|
+
registration_month?: number | null;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Flat dictionary of Motornet-backed technical attributes for this
|
|
374
|
+
* `motornet_code`. Keys stay in Italian domain vocabulary; native units are
|
|
375
|
+
* preserved (mm, kg, kW, CV, g/km, etc.).
|
|
376
|
+
*/
|
|
377
|
+
technical_details?: { [key: string]: unknown };
|
|
378
|
+
|
|
379
|
+
trim?: string | null;
|
|
380
|
+
|
|
381
|
+
vin?: string | null;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Cursor-paginated list of vehicle summaries.
|
|
386
|
+
*/
|
|
387
|
+
export interface VehicleList {
|
|
388
|
+
data: Array<VehicleSummary>;
|
|
389
|
+
|
|
390
|
+
has_more: boolean;
|
|
391
|
+
|
|
392
|
+
next_cursor?: string | null;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Compact vehicle payload for list endpoints.
|
|
397
|
+
*
|
|
398
|
+
* Catalogue fields (`brand`, `model`, `trim`, `fuel_type`) are derived from
|
|
399
|
+
* DealerMAX's licensed Motornet-backed catalogue at read time. Italian raw labels
|
|
400
|
+
* are surfaced verbatim so partner clients see the same vocabulary as
|
|
401
|
+
* consumer-facing DealerMAX surfaces.
|
|
402
|
+
*/
|
|
403
|
+
export interface VehicleSummary {
|
|
404
|
+
certified_km: number;
|
|
405
|
+
|
|
406
|
+
created_at: string;
|
|
407
|
+
|
|
408
|
+
dealer_id: string;
|
|
409
|
+
|
|
410
|
+
is_for_sale: boolean;
|
|
411
|
+
|
|
412
|
+
is_visible: boolean;
|
|
413
|
+
|
|
414
|
+
motornet_code: string;
|
|
415
|
+
|
|
416
|
+
plate: string;
|
|
417
|
+
|
|
418
|
+
registration_year: number;
|
|
419
|
+
|
|
420
|
+
sale_price_eur: number;
|
|
421
|
+
|
|
422
|
+
vehicle_id: string;
|
|
423
|
+
|
|
424
|
+
brand?: string | null;
|
|
425
|
+
|
|
426
|
+
color?: string | null;
|
|
427
|
+
|
|
428
|
+
fuel_type?: string | null;
|
|
429
|
+
|
|
430
|
+
model?: string | null;
|
|
431
|
+
|
|
432
|
+
trim?: string | null;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export interface VehicleCreateParams {
|
|
436
|
+
/**
|
|
437
|
+
* Body param: Certified odometer reading at intake, in kilometres.
|
|
438
|
+
*/
|
|
439
|
+
certified_km: number;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Body param: Motornet UNI code identifying the exact vehicle configuration. Must
|
|
443
|
+
* exist in the used-vehicle catalogue at submission time; otherwise the call
|
|
444
|
+
* returns 422 `motornet_code_not_in_catalogue`. Partners may send a code from
|
|
445
|
+
* their own Motornet agreement or use the paid control-plane targa/VIN resolver
|
|
446
|
+
* before creating the vehicle.
|
|
447
|
+
*/
|
|
448
|
+
motornet_code: string;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Body param: Italian licence plate. Uppercased server-side. UNIQUE across the
|
|
452
|
+
* network for active vehicles; reusable once the previous holder withdraws the
|
|
453
|
+
* vehicle from sale.
|
|
454
|
+
*/
|
|
455
|
+
plate: string;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Body param: Year of first registration. Upper bound is current year + 1.
|
|
459
|
+
*/
|
|
460
|
+
registration_year: number;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Body param: Public sale price in EUR. Surfaced on MCP / Custom GPT / NLWeb and
|
|
464
|
+
* on the dealer's site JSON-LD `Offer.price`.
|
|
465
|
+
*/
|
|
466
|
+
sale_price_eur: number;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Body param
|
|
470
|
+
*/
|
|
471
|
+
alloy_wheel_size?: number | null;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Body param
|
|
475
|
+
*/
|
|
476
|
+
color?: string | null;
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Body param: Partner-supplied long description. Surfaced on the dealer site
|
|
480
|
+
* detail page.
|
|
481
|
+
*/
|
|
482
|
+
description?: string;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Body param
|
|
486
|
+
*/
|
|
487
|
+
extended_warranty_enabled?: boolean;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Body param
|
|
491
|
+
*/
|
|
492
|
+
extended_warranty_months?: number | null;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Body param: When false the vehicle remains in stock but is not offered for sale.
|
|
496
|
+
*/
|
|
497
|
+
is_for_sale?: boolean;
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Body param: Soft-publish flag. When false the row exists in stock but is
|
|
501
|
+
* excluded from consumer-facing AI surfaces.
|
|
502
|
+
*/
|
|
503
|
+
is_visible?: boolean;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Body param: Free-form short notes for partner-facing vehicle detail views.
|
|
507
|
+
*/
|
|
508
|
+
notes?: string | null;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Body param: Month of registration (1–12).
|
|
512
|
+
*/
|
|
513
|
+
registration_month?: number | null;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Body param: If true the public price is displayed VAT-exposed (B2B); otherwise
|
|
517
|
+
* VAT-inclusive (B2C).
|
|
518
|
+
*/
|
|
519
|
+
vat_displayed?: boolean;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Body param
|
|
523
|
+
*/
|
|
524
|
+
vehicle_damaged?: boolean;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Body param: ISO 3779 vehicle identification number. Optional but strongly
|
|
528
|
+
* recommended.
|
|
529
|
+
*/
|
|
530
|
+
vin?: string | null;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Header param
|
|
534
|
+
*/
|
|
535
|
+
'Idempotency-Key'?: string;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export interface VehicleRetrieveParams {
|
|
539
|
+
/**
|
|
540
|
+
* Path param
|
|
541
|
+
*/
|
|
542
|
+
dealer_id: string;
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Query param: If true, the detail of a soft-deleted vehicle is returned. Default
|
|
546
|
+
* false — soft-deleted rows return 404 to keep behaviour consistent with the list
|
|
547
|
+
* endpoint.
|
|
548
|
+
*/
|
|
549
|
+
include_deleted?: boolean;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export interface VehicleUpdateParams {
|
|
553
|
+
/**
|
|
554
|
+
* Path param
|
|
555
|
+
*/
|
|
556
|
+
dealer_id: string;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Body param
|
|
560
|
+
*/
|
|
561
|
+
alloy_wheel_size?: number | null;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Body param
|
|
565
|
+
*/
|
|
566
|
+
certified_km?: number | null;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Body param
|
|
570
|
+
*/
|
|
571
|
+
color?: string | null;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Body param
|
|
575
|
+
*/
|
|
576
|
+
description?: string | null;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Body param
|
|
580
|
+
*/
|
|
581
|
+
extended_warranty_enabled?: boolean | null;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Body param
|
|
585
|
+
*/
|
|
586
|
+
extended_warranty_months?: number | null;
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Body param
|
|
590
|
+
*/
|
|
591
|
+
is_for_sale?: boolean | null;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Body param
|
|
595
|
+
*/
|
|
596
|
+
is_visible?: boolean | null;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Body param
|
|
600
|
+
*/
|
|
601
|
+
notes?: string | null;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Body param
|
|
605
|
+
*/
|
|
606
|
+
registration_month?: number | null;
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* Body param
|
|
610
|
+
*/
|
|
611
|
+
sale_price_eur?: number | null;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Body param
|
|
615
|
+
*/
|
|
616
|
+
vat_displayed?: boolean | null;
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Body param
|
|
620
|
+
*/
|
|
621
|
+
vehicle_damaged?: boolean | null;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Header param
|
|
625
|
+
*/
|
|
626
|
+
'Idempotency-Key'?: string;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export interface VehicleListParams extends CursorPageParams {
|
|
630
|
+
/**
|
|
631
|
+
* If true, soft-deleted rows (`venduto_il` populated) are also returned. Default
|
|
632
|
+
* false — listings hide soft-deleted vehicles.
|
|
633
|
+
*/
|
|
634
|
+
include_deleted?: boolean;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Filter on the sale flag.
|
|
638
|
+
*/
|
|
639
|
+
is_for_sale?: boolean | null;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Filter on the visibility flag.
|
|
643
|
+
*/
|
|
644
|
+
is_visible?: boolean | null;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export interface VehicleDeleteParams {
|
|
648
|
+
dealer_id: string;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
export interface VehicleBulkParams {
|
|
652
|
+
/**
|
|
653
|
+
* Body param: Array of vehicles to create. Between 1 and 100 rows per call. For
|
|
654
|
+
* larger imports, the partner is expected to chunk client-side (e.g. 50 calls of
|
|
655
|
+
* 100 rows each for a 5 000-vehicle migration).
|
|
656
|
+
*/
|
|
657
|
+
vehicles: Array<VehicleBulkParams.Vehicle>;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Header param
|
|
661
|
+
*/
|
|
662
|
+
'Idempotency-Key'?: string;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
export namespace VehicleBulkParams {
|
|
666
|
+
/**
|
|
667
|
+
* Request body for vehicle provisioning.
|
|
668
|
+
*
|
|
669
|
+
* The partner sends a small, vehicle-specific payload. All technical specs (brand,
|
|
670
|
+
* model, trim, fuel type, displacement, dimensions, CO2, etc.) are derived
|
|
671
|
+
* server-side from DealerMAX's licensed Motornet-backed catalogue — the partner
|
|
672
|
+
* never types them.
|
|
673
|
+
*
|
|
674
|
+
* Fields immutable after creation: `motornet_code`, `plate`, `vin`. Other fields
|
|
675
|
+
* may be updated via PATCH.
|
|
676
|
+
*/
|
|
677
|
+
export interface Vehicle {
|
|
678
|
+
/**
|
|
679
|
+
* Certified odometer reading at intake, in kilometres.
|
|
680
|
+
*/
|
|
681
|
+
certified_km: number;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Motornet UNI code identifying the exact vehicle configuration. Must exist in the
|
|
685
|
+
* used-vehicle catalogue at submission time; otherwise the call returns 422
|
|
686
|
+
* `motornet_code_not_in_catalogue`. Partners may send a code from their own
|
|
687
|
+
* Motornet agreement or use the paid control-plane targa/VIN resolver before
|
|
688
|
+
* creating the vehicle.
|
|
689
|
+
*/
|
|
690
|
+
motornet_code: string;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Italian licence plate. Uppercased server-side. UNIQUE across the network for
|
|
694
|
+
* active vehicles; reusable once the previous holder withdraws the vehicle from
|
|
695
|
+
* sale.
|
|
696
|
+
*/
|
|
697
|
+
plate: string;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Year of first registration. Upper bound is current year + 1.
|
|
701
|
+
*/
|
|
702
|
+
registration_year: number;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Public sale price in EUR. Surfaced on MCP / Custom GPT / NLWeb and on the
|
|
706
|
+
* dealer's site JSON-LD `Offer.price`.
|
|
707
|
+
*/
|
|
708
|
+
sale_price_eur: number;
|
|
709
|
+
|
|
710
|
+
alloy_wheel_size?: number | null;
|
|
711
|
+
|
|
712
|
+
color?: string | null;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Partner-supplied long description. Surfaced on the dealer site detail page.
|
|
716
|
+
*/
|
|
717
|
+
description?: string;
|
|
718
|
+
|
|
719
|
+
extended_warranty_enabled?: boolean;
|
|
720
|
+
|
|
721
|
+
extended_warranty_months?: number | null;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* When false the vehicle remains in stock but is not offered for sale.
|
|
725
|
+
*/
|
|
726
|
+
is_for_sale?: boolean;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Soft-publish flag. When false the row exists in stock but is excluded from
|
|
730
|
+
* consumer-facing AI surfaces.
|
|
731
|
+
*/
|
|
732
|
+
is_visible?: boolean;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Free-form short notes for partner-facing vehicle detail views.
|
|
736
|
+
*/
|
|
737
|
+
notes?: string | null;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Month of registration (1–12).
|
|
741
|
+
*/
|
|
742
|
+
registration_month?: number | null;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* If true the public price is displayed VAT-exposed (B2B); otherwise VAT-inclusive
|
|
746
|
+
* (B2C).
|
|
747
|
+
*/
|
|
748
|
+
vat_displayed?: boolean;
|
|
749
|
+
|
|
750
|
+
vehicle_damaged?: boolean;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* ISO 3779 vehicle identification number. Optional but strongly recommended.
|
|
754
|
+
*/
|
|
755
|
+
vin?: string | null;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
Vehicles.Images = Images;
|
|
760
|
+
|
|
761
|
+
export declare namespace Vehicles {
|
|
762
|
+
export {
|
|
763
|
+
type AIContent as AIContent,
|
|
764
|
+
type BulkCreateVehiclesResponse as BulkCreateVehiclesResponse,
|
|
765
|
+
type BulkRowOutcome as BulkRowOutcome,
|
|
766
|
+
type VehicleDetail as VehicleDetail,
|
|
767
|
+
type VehicleList as VehicleList,
|
|
768
|
+
type VehicleSummary as VehicleSummary,
|
|
769
|
+
type VehicleSummariesCursorPage as VehicleSummariesCursorPage,
|
|
770
|
+
type VehicleCreateParams as VehicleCreateParams,
|
|
771
|
+
type VehicleRetrieveParams as VehicleRetrieveParams,
|
|
772
|
+
type VehicleUpdateParams as VehicleUpdateParams,
|
|
773
|
+
type VehicleListParams as VehicleListParams,
|
|
774
|
+
type VehicleDeleteParams as VehicleDeleteParams,
|
|
775
|
+
type VehicleBulkParams as VehicleBulkParams,
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
export {
|
|
779
|
+
Images as Images,
|
|
780
|
+
type VehicleImage as VehicleImage,
|
|
781
|
+
type VehicleImageList as VehicleImageList,
|
|
782
|
+
type ImageCreateParams as ImageCreateParams,
|
|
783
|
+
type ImageListParams as ImageListParams,
|
|
784
|
+
type ImageDeleteParams as ImageDeleteParams,
|
|
785
|
+
};
|
|
786
|
+
}
|