partnermax 0.2.0 → 0.2.1
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 +60 -47
- package/LICENSE +201 -201
- package/README.md +370 -370
- package/api-promise.js +1 -1
- package/client.js +1 -1
- package/client.mjs +1 -1
- package/core/api-promise.js +1 -1
- package/core/api-promise.mjs +1 -1
- package/error.js +1 -1
- package/package.json +9 -15
- package/resource.js +1 -1
- package/resources/dealers/dealers.js +1 -1
- package/resources/dealers/nlt/nlt.js +1 -1
- package/resources/dealers/nlt.js +1 -1
- package/resources/dealers/vehicles/vehicles.js +1 -1
- package/resources/dealers/vehicles.js +1 -1
- package/resources/dealers.js +1 -1
- package/resources.js +1 -1
- package/src/api-promise.ts +2 -2
- package/src/client.ts +841 -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/resource.ts +11 -11
- package/src/core/uploads.ts +2 -2
- package/src/error.ts +2 -2
- package/src/index.ts +22 -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/resource.ts +2 -2
- package/src/resources/dealers/dealers.ts +348 -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 +427 -427
- package/src/resources/dealers/nlt-settings.ts +269 -269
- package/src/resources/dealers/nlt.ts +3 -3
- package/src/resources/dealers/vehicles/images.ts +153 -153
- package/src/resources/dealers/vehicles/index.ts +25 -25
- package/src/resources/dealers/vehicles/vehicles.ts +796 -796
- package/src/resources/dealers/vehicles.ts +3 -3
- package/src/resources/dealers.ts +3 -3
- package/src/resources/index.ts +12 -12
- package/src/resources/keys.ts +128 -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,427 +1,427 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../../core/resource';
|
|
4
|
-
import { APIPromise } from '../../../core/api-promise';
|
|
5
|
-
import { RequestOptions } from '../../../internal/request-options';
|
|
6
|
-
import { path } from '../../../internal/utils/path';
|
|
7
|
-
|
|
8
|
-
export class Offers extends APIResource {
|
|
9
|
-
/**
|
|
10
|
-
* Full offer detail. Payload shape mirrors apimax MCP `get_nlt_offer_details`
|
|
11
|
-
* bit-for-bit (mcp_server.py:1546-1606).
|
|
12
|
-
*/
|
|
13
|
-
retrieve(
|
|
14
|
-
offerID: string,
|
|
15
|
-
params: OfferRetrieveParams,
|
|
16
|
-
options?: RequestOptions,
|
|
17
|
-
): APIPromise<OfferRetrieveResponse> {
|
|
18
|
-
const { dealer_id } = params;
|
|
19
|
-
return this._client.get(path`/v1/dealers/${dealer_id}/nlt/offers/${offerID}`, options);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Listing of NLT offers with monthly canon repriced for this dealer.
|
|
24
|
-
*
|
|
25
|
-
* Strategy:
|
|
26
|
-
*
|
|
27
|
-
* 1. Resolve + ACL the dealer.
|
|
28
|
-
* 2. Pull at most `limit + 1` offers from the catalog after the cursor. The extra
|
|
29
|
-
* row lets us know if there's a next page without a second COUNT(\*) query.
|
|
30
|
-
* 3. Apply text/enum filters server-side via SQL where possible (brand, segment,
|
|
31
|
-
* fuel) and the numeric `canone_max_eur` filter in Python after the pricing
|
|
32
|
-
* pass (the DB has no "displayed canon" column; we synthesize it per dealer).
|
|
33
|
-
* 4. For each surviving offer, price the (duration, km) cells the caller filtered
|
|
34
|
-
* to (if specified) or all 18, pick the cheapest cell as the headline.
|
|
35
|
-
*/
|
|
36
|
-
list(
|
|
37
|
-
dealerID: string,
|
|
38
|
-
query: OfferListParams | null | undefined = {},
|
|
39
|
-
options?: RequestOptions,
|
|
40
|
-
): APIPromise<OfferListResponse> {
|
|
41
|
-
return this._client.get(path`/v1/dealers/${dealerID}/nlt/offers`, { query, ...options });
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Single row in the offers list. Pricing is dealer-aware.
|
|
47
|
-
*
|
|
48
|
-
* Field names: American English snake_case. Values: Italian raw, apimax-aligned
|
|
49
|
-
* (`fuel_type: "Benzina"`, `segment: "SUV piccoli"`). No enum normalization —
|
|
50
|
-
* apimax labels are surfaced verbatim, exactly as the detail endpoint does, so the
|
|
51
|
-
* partner client sees the same string in both listing and detail.
|
|
52
|
-
*/
|
|
53
|
-
export interface NltOfferSummary {
|
|
54
|
-
brand: string;
|
|
55
|
-
|
|
56
|
-
dealer_id: string;
|
|
57
|
-
|
|
58
|
-
duration_months: number;
|
|
59
|
-
|
|
60
|
-
km_per_year_at_quote: number;
|
|
61
|
-
|
|
62
|
-
model: string;
|
|
63
|
-
|
|
64
|
-
monthly_canon_from_eur: number;
|
|
65
|
-
|
|
66
|
-
offer_id: string;
|
|
67
|
-
|
|
68
|
-
slug: string;
|
|
69
|
-
|
|
70
|
-
vat_treatment: 'private' | 'business';
|
|
71
|
-
|
|
72
|
-
canonical_url?: string | null;
|
|
73
|
-
|
|
74
|
-
fuel_type?: string | null;
|
|
75
|
-
|
|
76
|
-
has_promo?: boolean;
|
|
77
|
-
|
|
78
|
-
image_url?: string | null;
|
|
79
|
-
|
|
80
|
-
segment?: string | null;
|
|
81
|
-
|
|
82
|
-
trim?: string | null;
|
|
83
|
-
|
|
84
|
-
vehicle_type?: 'auto' | 'vcom';
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Full offer detail.
|
|
89
|
-
*
|
|
90
|
-
* Shape mirrors `_tool_get_nlt_offer_details` (apimax MCP) with all field names
|
|
91
|
-
* translated to American English snake_case for the partner SDK contract. VALUES
|
|
92
|
-
* stay Italian raw (apimax-aligned). The dict `technical_details` keeps Italian
|
|
93
|
-
* KEYS because they are `mnet_dettagli` column names (raw DB).
|
|
94
|
-
*/
|
|
95
|
-
export interface OfferRetrieveResponse {
|
|
96
|
-
found: boolean;
|
|
97
|
-
|
|
98
|
-
network_dealer_count: number;
|
|
99
|
-
|
|
100
|
-
offer_id: string;
|
|
101
|
-
|
|
102
|
-
slug: string;
|
|
103
|
-
|
|
104
|
-
title: string;
|
|
105
|
-
|
|
106
|
-
vat_included: boolean;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Container for optional add-ons (apimax: `addons_disponibili`).
|
|
110
|
-
*/
|
|
111
|
-
available_addons?: OfferRetrieveResponse.AvailableAddons;
|
|
112
|
-
|
|
113
|
-
brand?: string | null;
|
|
114
|
-
|
|
115
|
-
description_full?: string | null;
|
|
116
|
-
|
|
117
|
-
description_short?: string | null;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Three down-payment scenarios in EUR (whole amounts).
|
|
121
|
-
*
|
|
122
|
-
* apimax: `anticipo_scenari_eur` (keys remapped to American English snake_case for
|
|
123
|
-
* partnermax SDK: `zero/medium/standard`).
|
|
124
|
-
*/
|
|
125
|
-
down_payment_scenarios_eur?: OfferRetrieveResponse.DownPaymentScenariosEur | null;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Italian labels paired 1:1 with `NltDownPaymentScenariosEur`.
|
|
129
|
-
*
|
|
130
|
-
* apimax: `anticipo_scenari_labels` — used by Custom GPT to render the three
|
|
131
|
-
* options in conversation. Values stay in Italian raw ("Senza anticipo" /
|
|
132
|
-
* "Anticipo 12,5%" / "Anticipo 25%").
|
|
133
|
-
*/
|
|
134
|
-
down_payment_scenarios_labels?: OfferRetrieveResponse.DownPaymentScenariosLabels | null;
|
|
135
|
-
|
|
136
|
-
faqs?: Array<OfferRetrieveResponse.Faq>;
|
|
137
|
-
|
|
138
|
-
fuel_type?: string | null;
|
|
139
|
-
|
|
140
|
-
gallery?: Array<OfferRetrieveResponse.Gallery>;
|
|
141
|
-
|
|
142
|
-
image_url?: string | null;
|
|
143
|
-
|
|
144
|
-
included_accessories?: Array<OfferRetrieveResponse.IncludedAccessory>;
|
|
145
|
-
|
|
146
|
-
included_services?: Array<OfferRetrieveResponse.IncludedService>;
|
|
147
|
-
|
|
148
|
-
last_modified?: string | null;
|
|
149
|
-
|
|
150
|
-
min_monthly_canon_eur?: number | null;
|
|
151
|
-
|
|
152
|
-
model?: string | null;
|
|
153
|
-
|
|
154
|
-
network_offers?: Array<OfferRetrieveResponse.NetworkOffer>;
|
|
155
|
-
|
|
156
|
-
primary_dealer_city?: string | null;
|
|
157
|
-
|
|
158
|
-
primary_dealer_name?: string | null;
|
|
159
|
-
|
|
160
|
-
primary_dealer_province?: string | null;
|
|
161
|
-
|
|
162
|
-
private_only?: boolean | null;
|
|
163
|
-
|
|
164
|
-
quotations?: Array<OfferRetrieveResponse.Quotation>;
|
|
165
|
-
|
|
166
|
-
schema_org?: { [key: string]: unknown } | null;
|
|
167
|
-
|
|
168
|
-
segment?: string | null;
|
|
169
|
-
|
|
170
|
-
standard_equipment?: Array<string>;
|
|
171
|
-
|
|
172
|
-
tags?: Array<OfferRetrieveResponse.Tag>;
|
|
173
|
-
|
|
174
|
-
technical_details?: { [key: string]: unknown };
|
|
175
|
-
|
|
176
|
-
total_price_eur?: number | null;
|
|
177
|
-
|
|
178
|
-
transmission?: string | null;
|
|
179
|
-
|
|
180
|
-
trim?: string | null;
|
|
181
|
-
|
|
182
|
-
vehicle_type?: 'auto' | 'vcom';
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export namespace OfferRetrieveResponse {
|
|
186
|
-
/**
|
|
187
|
-
* Container for optional add-ons (apimax: `addons_disponibili`).
|
|
188
|
-
*/
|
|
189
|
-
export interface AvailableAddons {
|
|
190
|
-
/**
|
|
191
|
-
* Replacement-vehicle add-on lookup (apimax:
|
|
192
|
-
* `addons_disponibili.auto_sostitutiva`).
|
|
193
|
-
*
|
|
194
|
-
* Always category B (utilitaria) per founder decision — the spoken "average
|
|
195
|
-
* customer" segment.
|
|
196
|
-
*/
|
|
197
|
-
replacement_vehicle?: AvailableAddons.ReplacementVehicle | null;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Tyre-replacement add-on lookup (apimax: `addons_disponibili.pneumatici`).
|
|
201
|
-
*
|
|
202
|
-
* Populated when `mnet_dettagli.pneumatici_anteriori` matches `R\d+` and a row
|
|
203
|
-
* exists in `nlt_pneumatici` for that diameter. Null otherwise. Replacement rule
|
|
204
|
-
* (founder decision 2026-05-12): 1 set of 4 tyres every 30 000 km, rounded up.
|
|
205
|
-
*/
|
|
206
|
-
tires?: AvailableAddons.Tires | null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export namespace AvailableAddons {
|
|
210
|
-
/**
|
|
211
|
-
* Replacement-vehicle add-on lookup (apimax:
|
|
212
|
-
* `addons_disponibili.auto_sostitutiva`).
|
|
213
|
-
*
|
|
214
|
-
* Always category B (utilitaria) per founder decision — the spoken "average
|
|
215
|
-
* customer" segment.
|
|
216
|
-
*/
|
|
217
|
-
export interface ReplacementVehicle {
|
|
218
|
-
category_description: string;
|
|
219
|
-
|
|
220
|
-
default_category: string;
|
|
221
|
-
|
|
222
|
-
monthly_cost_eur: number;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Tyre-replacement add-on lookup (apimax: `addons_disponibili.pneumatici`).
|
|
227
|
-
*
|
|
228
|
-
* Populated when `mnet_dettagli.pneumatici_anteriori` matches `R\d+` and a row
|
|
229
|
-
* exists in `nlt_pneumatici` for that diameter. Null otherwise. Replacement rule
|
|
230
|
-
* (founder decision 2026-05-12): 1 set of 4 tyres every 30 000 km, rounded up.
|
|
231
|
-
*/
|
|
232
|
-
export interface Tires {
|
|
233
|
-
diameter_in: number;
|
|
234
|
-
|
|
235
|
-
replacement_rule: string;
|
|
236
|
-
|
|
237
|
-
set_cost_eur: number;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Three down-payment scenarios in EUR (whole amounts).
|
|
243
|
-
*
|
|
244
|
-
* apimax: `anticipo_scenari_eur` (keys remapped to American English snake_case for
|
|
245
|
-
* partnermax SDK: `zero/medium/standard`).
|
|
246
|
-
*/
|
|
247
|
-
export interface DownPaymentScenariosEur {
|
|
248
|
-
medium: number;
|
|
249
|
-
|
|
250
|
-
standard: number;
|
|
251
|
-
|
|
252
|
-
zero: number;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Italian labels paired 1:1 with `NltDownPaymentScenariosEur`.
|
|
257
|
-
*
|
|
258
|
-
* apimax: `anticipo_scenari_labels` — used by Custom GPT to render the three
|
|
259
|
-
* options in conversation. Values stay in Italian raw ("Senza anticipo" /
|
|
260
|
-
* "Anticipo 12,5%" / "Anticipo 25%").
|
|
261
|
-
*/
|
|
262
|
-
export interface DownPaymentScenariosLabels {
|
|
263
|
-
medium: string;
|
|
264
|
-
|
|
265
|
-
standard: string;
|
|
266
|
-
|
|
267
|
-
zero: string;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* One Italian Q&A entry derived per-offer.
|
|
272
|
-
*
|
|
273
|
-
* apimax: `build_offer_faqs` in `seo_engine/nlt_faq_builder.py` — generates up to
|
|
274
|
-
* ~11 Q&A pairs (dimensions, fuel, transmission, CO2, monthly canon at preset
|
|
275
|
-
* combo, available durations, VAT inclusion, down-payment tiers, etc.). Partnermax
|
|
276
|
-
* surfaces them all, 1:1.
|
|
277
|
-
*/
|
|
278
|
-
export interface Faq {
|
|
279
|
-
answer: string;
|
|
280
|
-
|
|
281
|
-
question: string;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* One image in the offer gallery (apimax: `gallery[]`).
|
|
286
|
-
*/
|
|
287
|
-
export interface Gallery {
|
|
288
|
-
is_cover: boolean;
|
|
289
|
-
|
|
290
|
-
url: string;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* One accessory bundled with the offer (apimax: `accessori_inclusi[]`).
|
|
295
|
-
*/
|
|
296
|
-
export interface IncludedAccessory {
|
|
297
|
-
code: string;
|
|
298
|
-
|
|
299
|
-
description: string;
|
|
300
|
-
|
|
301
|
-
extra_price_eur: number;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* One NLT service normally included in the canone.
|
|
306
|
-
*
|
|
307
|
-
* apimax: `_get_services_included` (`nlt_resolver.py:719`). Source is the global
|
|
308
|
-
* `nlt_services` table (active rows only). Same set of services across the network
|
|
309
|
-
* (Assicurazione RCA / Kasco / Incendio-Furto, Manutenzione, Assistenza Stradale,
|
|
310
|
-
* Bollo, Pneumatici, Veicolo in anticipo, Vettura sostitutiva). Not per-offer.
|
|
311
|
-
*/
|
|
312
|
-
export interface IncludedService {
|
|
313
|
-
name: string;
|
|
314
|
-
|
|
315
|
-
description?: string | null;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* One network dealer's quote for this offer (apimax: `network_offers[]`).
|
|
320
|
-
*
|
|
321
|
-
* Sorted by `min_monthly_canon_eur ASC`. In partnermax this list is scoped to
|
|
322
|
-
* dealers owned by the calling partner (`utenti.parent_id = partner.user_id`) —
|
|
323
|
-
* same shape as the apimax cross-network list, partner-scoped to avoid data
|
|
324
|
-
* leakage.
|
|
325
|
-
*/
|
|
326
|
-
export interface NetworkOffer {
|
|
327
|
-
dealer_id: number;
|
|
328
|
-
|
|
329
|
-
dealer_name: string;
|
|
330
|
-
|
|
331
|
-
min_monthly_canon_eur: number;
|
|
332
|
-
|
|
333
|
-
city?: string | null;
|
|
334
|
-
|
|
335
|
-
contact_url?: string | null;
|
|
336
|
-
|
|
337
|
-
google_maps_url?: string | null;
|
|
338
|
-
|
|
339
|
-
phone?: string | null;
|
|
340
|
-
|
|
341
|
-
province?: string | null;
|
|
342
|
-
|
|
343
|
-
rating_value?: number | null;
|
|
344
|
-
|
|
345
|
-
review_count?: number | null;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* One priced cell of the 18-combination matrix.
|
|
350
|
-
*
|
|
351
|
-
* apimax: `quotazioni[]` entry — `_compute_quotazioni_dealer_aware`
|
|
352
|
-
* (mcp_server.py:180). Reflects the dealer's vetrina formula applied to each
|
|
353
|
-
* (durata, km) combo; cells with implausible canon (<€50) are dropped upstream, so
|
|
354
|
-
* the list may contain fewer than 18 rows.
|
|
355
|
-
*/
|
|
356
|
-
export interface Quotation {
|
|
357
|
-
duration_months: number;
|
|
358
|
-
|
|
359
|
-
km_per_year: number;
|
|
360
|
-
|
|
361
|
-
monthly_canon_eur: number;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Category tag for an offer (apimax: `tags[]`).
|
|
366
|
-
*
|
|
367
|
-
* Populated from `nlt_offerta_tag` ⋈ `nlt_offerte_tag`. Examples in production:
|
|
368
|
-
* "Promo", "Stock pronto", "GreenChoice".
|
|
369
|
-
*/
|
|
370
|
-
export interface Tag {
|
|
371
|
-
name: string;
|
|
372
|
-
|
|
373
|
-
color?: string | null;
|
|
374
|
-
|
|
375
|
-
icon?: string | null;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Cursor-paginated list of offer summaries.
|
|
381
|
-
*/
|
|
382
|
-
export interface OfferListResponse {
|
|
383
|
-
data: Array<NltOfferSummary>;
|
|
384
|
-
|
|
385
|
-
has_more: boolean;
|
|
386
|
-
|
|
387
|
-
next_cursor?: string | null;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
export interface OfferRetrieveParams {
|
|
391
|
-
dealer_id: string;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
export interface OfferListParams {
|
|
395
|
-
brand?: string | null;
|
|
396
|
-
|
|
397
|
-
canone_max_eur?: number | null;
|
|
398
|
-
|
|
399
|
-
cursor?: string | null;
|
|
400
|
-
|
|
401
|
-
duration_months?: number | null;
|
|
402
|
-
|
|
403
|
-
fuel_type?: string | null;
|
|
404
|
-
|
|
405
|
-
km_per_year?: number | null;
|
|
406
|
-
|
|
407
|
-
limit?: number;
|
|
408
|
-
|
|
409
|
-
segment?: string | null;
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Macro discriminator: 'auto' (passenger vehicles) or 'vcom' (light commercial ≤35
|
|
413
|
-
* q.li: vans, panel trucks, multispace, pickups, minibuses). Omit to return the
|
|
414
|
-
* mixed catalog.
|
|
415
|
-
*/
|
|
416
|
-
vehicle_type?: string | null;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
export declare namespace Offers {
|
|
420
|
-
export {
|
|
421
|
-
type NltOfferSummary as NltOfferSummary,
|
|
422
|
-
type OfferRetrieveResponse as OfferRetrieveResponse,
|
|
423
|
-
type OfferListResponse as OfferListResponse,
|
|
424
|
-
type OfferRetrieveParams as OfferRetrieveParams,
|
|
425
|
-
type OfferListParams as OfferListParams,
|
|
426
|
-
};
|
|
427
|
-
}
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../../internal/request-options';
|
|
6
|
+
import { path } from '../../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Offers extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Full offer detail. Payload shape mirrors apimax MCP `get_nlt_offer_details`
|
|
11
|
+
* bit-for-bit (mcp_server.py:1546-1606).
|
|
12
|
+
*/
|
|
13
|
+
retrieve(
|
|
14
|
+
offerID: string,
|
|
15
|
+
params: OfferRetrieveParams,
|
|
16
|
+
options?: RequestOptions,
|
|
17
|
+
): APIPromise<OfferRetrieveResponse> {
|
|
18
|
+
const { dealer_id } = params;
|
|
19
|
+
return this._client.get(path`/v1/dealers/${dealer_id}/nlt/offers/${offerID}`, options);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Listing of NLT offers with monthly canon repriced for this dealer.
|
|
24
|
+
*
|
|
25
|
+
* Strategy:
|
|
26
|
+
*
|
|
27
|
+
* 1. Resolve + ACL the dealer.
|
|
28
|
+
* 2. Pull at most `limit + 1` offers from the catalog after the cursor. The extra
|
|
29
|
+
* row lets us know if there's a next page without a second COUNT(\*) query.
|
|
30
|
+
* 3. Apply text/enum filters server-side via SQL where possible (brand, segment,
|
|
31
|
+
* fuel) and the numeric `canone_max_eur` filter in Python after the pricing
|
|
32
|
+
* pass (the DB has no "displayed canon" column; we synthesize it per dealer).
|
|
33
|
+
* 4. For each surviving offer, price the (duration, km) cells the caller filtered
|
|
34
|
+
* to (if specified) or all 18, pick the cheapest cell as the headline.
|
|
35
|
+
*/
|
|
36
|
+
list(
|
|
37
|
+
dealerID: string,
|
|
38
|
+
query: OfferListParams | null | undefined = {},
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): APIPromise<OfferListResponse> {
|
|
41
|
+
return this._client.get(path`/v1/dealers/${dealerID}/nlt/offers`, { query, ...options });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Single row in the offers list. Pricing is dealer-aware.
|
|
47
|
+
*
|
|
48
|
+
* Field names: American English snake_case. Values: Italian raw, apimax-aligned
|
|
49
|
+
* (`fuel_type: "Benzina"`, `segment: "SUV piccoli"`). No enum normalization —
|
|
50
|
+
* apimax labels are surfaced verbatim, exactly as the detail endpoint does, so the
|
|
51
|
+
* partner client sees the same string in both listing and detail.
|
|
52
|
+
*/
|
|
53
|
+
export interface NltOfferSummary {
|
|
54
|
+
brand: string;
|
|
55
|
+
|
|
56
|
+
dealer_id: string;
|
|
57
|
+
|
|
58
|
+
duration_months: number;
|
|
59
|
+
|
|
60
|
+
km_per_year_at_quote: number;
|
|
61
|
+
|
|
62
|
+
model: string;
|
|
63
|
+
|
|
64
|
+
monthly_canon_from_eur: number;
|
|
65
|
+
|
|
66
|
+
offer_id: string;
|
|
67
|
+
|
|
68
|
+
slug: string;
|
|
69
|
+
|
|
70
|
+
vat_treatment: 'private' | 'business';
|
|
71
|
+
|
|
72
|
+
canonical_url?: string | null;
|
|
73
|
+
|
|
74
|
+
fuel_type?: string | null;
|
|
75
|
+
|
|
76
|
+
has_promo?: boolean;
|
|
77
|
+
|
|
78
|
+
image_url?: string | null;
|
|
79
|
+
|
|
80
|
+
segment?: string | null;
|
|
81
|
+
|
|
82
|
+
trim?: string | null;
|
|
83
|
+
|
|
84
|
+
vehicle_type?: 'auto' | 'vcom';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Full offer detail.
|
|
89
|
+
*
|
|
90
|
+
* Shape mirrors `_tool_get_nlt_offer_details` (apimax MCP) with all field names
|
|
91
|
+
* translated to American English snake_case for the partner SDK contract. VALUES
|
|
92
|
+
* stay Italian raw (apimax-aligned). The dict `technical_details` keeps Italian
|
|
93
|
+
* KEYS because they are `mnet_dettagli` column names (raw DB).
|
|
94
|
+
*/
|
|
95
|
+
export interface OfferRetrieveResponse {
|
|
96
|
+
found: boolean;
|
|
97
|
+
|
|
98
|
+
network_dealer_count: number;
|
|
99
|
+
|
|
100
|
+
offer_id: string;
|
|
101
|
+
|
|
102
|
+
slug: string;
|
|
103
|
+
|
|
104
|
+
title: string;
|
|
105
|
+
|
|
106
|
+
vat_included: boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Container for optional add-ons (apimax: `addons_disponibili`).
|
|
110
|
+
*/
|
|
111
|
+
available_addons?: OfferRetrieveResponse.AvailableAddons;
|
|
112
|
+
|
|
113
|
+
brand?: string | null;
|
|
114
|
+
|
|
115
|
+
description_full?: string | null;
|
|
116
|
+
|
|
117
|
+
description_short?: string | null;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Three down-payment scenarios in EUR (whole amounts).
|
|
121
|
+
*
|
|
122
|
+
* apimax: `anticipo_scenari_eur` (keys remapped to American English snake_case for
|
|
123
|
+
* partnermax SDK: `zero/medium/standard`).
|
|
124
|
+
*/
|
|
125
|
+
down_payment_scenarios_eur?: OfferRetrieveResponse.DownPaymentScenariosEur | null;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Italian labels paired 1:1 with `NltDownPaymentScenariosEur`.
|
|
129
|
+
*
|
|
130
|
+
* apimax: `anticipo_scenari_labels` — used by Custom GPT to render the three
|
|
131
|
+
* options in conversation. Values stay in Italian raw ("Senza anticipo" /
|
|
132
|
+
* "Anticipo 12,5%" / "Anticipo 25%").
|
|
133
|
+
*/
|
|
134
|
+
down_payment_scenarios_labels?: OfferRetrieveResponse.DownPaymentScenariosLabels | null;
|
|
135
|
+
|
|
136
|
+
faqs?: Array<OfferRetrieveResponse.Faq>;
|
|
137
|
+
|
|
138
|
+
fuel_type?: string | null;
|
|
139
|
+
|
|
140
|
+
gallery?: Array<OfferRetrieveResponse.Gallery>;
|
|
141
|
+
|
|
142
|
+
image_url?: string | null;
|
|
143
|
+
|
|
144
|
+
included_accessories?: Array<OfferRetrieveResponse.IncludedAccessory>;
|
|
145
|
+
|
|
146
|
+
included_services?: Array<OfferRetrieveResponse.IncludedService>;
|
|
147
|
+
|
|
148
|
+
last_modified?: string | null;
|
|
149
|
+
|
|
150
|
+
min_monthly_canon_eur?: number | null;
|
|
151
|
+
|
|
152
|
+
model?: string | null;
|
|
153
|
+
|
|
154
|
+
network_offers?: Array<OfferRetrieveResponse.NetworkOffer>;
|
|
155
|
+
|
|
156
|
+
primary_dealer_city?: string | null;
|
|
157
|
+
|
|
158
|
+
primary_dealer_name?: string | null;
|
|
159
|
+
|
|
160
|
+
primary_dealer_province?: string | null;
|
|
161
|
+
|
|
162
|
+
private_only?: boolean | null;
|
|
163
|
+
|
|
164
|
+
quotations?: Array<OfferRetrieveResponse.Quotation>;
|
|
165
|
+
|
|
166
|
+
schema_org?: { [key: string]: unknown } | null;
|
|
167
|
+
|
|
168
|
+
segment?: string | null;
|
|
169
|
+
|
|
170
|
+
standard_equipment?: Array<string>;
|
|
171
|
+
|
|
172
|
+
tags?: Array<OfferRetrieveResponse.Tag>;
|
|
173
|
+
|
|
174
|
+
technical_details?: { [key: string]: unknown };
|
|
175
|
+
|
|
176
|
+
total_price_eur?: number | null;
|
|
177
|
+
|
|
178
|
+
transmission?: string | null;
|
|
179
|
+
|
|
180
|
+
trim?: string | null;
|
|
181
|
+
|
|
182
|
+
vehicle_type?: 'auto' | 'vcom';
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export namespace OfferRetrieveResponse {
|
|
186
|
+
/**
|
|
187
|
+
* Container for optional add-ons (apimax: `addons_disponibili`).
|
|
188
|
+
*/
|
|
189
|
+
export interface AvailableAddons {
|
|
190
|
+
/**
|
|
191
|
+
* Replacement-vehicle add-on lookup (apimax:
|
|
192
|
+
* `addons_disponibili.auto_sostitutiva`).
|
|
193
|
+
*
|
|
194
|
+
* Always category B (utilitaria) per founder decision — the spoken "average
|
|
195
|
+
* customer" segment.
|
|
196
|
+
*/
|
|
197
|
+
replacement_vehicle?: AvailableAddons.ReplacementVehicle | null;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Tyre-replacement add-on lookup (apimax: `addons_disponibili.pneumatici`).
|
|
201
|
+
*
|
|
202
|
+
* Populated when `mnet_dettagli.pneumatici_anteriori` matches `R\d+` and a row
|
|
203
|
+
* exists in `nlt_pneumatici` for that diameter. Null otherwise. Replacement rule
|
|
204
|
+
* (founder decision 2026-05-12): 1 set of 4 tyres every 30 000 km, rounded up.
|
|
205
|
+
*/
|
|
206
|
+
tires?: AvailableAddons.Tires | null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export namespace AvailableAddons {
|
|
210
|
+
/**
|
|
211
|
+
* Replacement-vehicle add-on lookup (apimax:
|
|
212
|
+
* `addons_disponibili.auto_sostitutiva`).
|
|
213
|
+
*
|
|
214
|
+
* Always category B (utilitaria) per founder decision — the spoken "average
|
|
215
|
+
* customer" segment.
|
|
216
|
+
*/
|
|
217
|
+
export interface ReplacementVehicle {
|
|
218
|
+
category_description: string;
|
|
219
|
+
|
|
220
|
+
default_category: string;
|
|
221
|
+
|
|
222
|
+
monthly_cost_eur: number;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Tyre-replacement add-on lookup (apimax: `addons_disponibili.pneumatici`).
|
|
227
|
+
*
|
|
228
|
+
* Populated when `mnet_dettagli.pneumatici_anteriori` matches `R\d+` and a row
|
|
229
|
+
* exists in `nlt_pneumatici` for that diameter. Null otherwise. Replacement rule
|
|
230
|
+
* (founder decision 2026-05-12): 1 set of 4 tyres every 30 000 km, rounded up.
|
|
231
|
+
*/
|
|
232
|
+
export interface Tires {
|
|
233
|
+
diameter_in: number;
|
|
234
|
+
|
|
235
|
+
replacement_rule: string;
|
|
236
|
+
|
|
237
|
+
set_cost_eur: number;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Three down-payment scenarios in EUR (whole amounts).
|
|
243
|
+
*
|
|
244
|
+
* apimax: `anticipo_scenari_eur` (keys remapped to American English snake_case for
|
|
245
|
+
* partnermax SDK: `zero/medium/standard`).
|
|
246
|
+
*/
|
|
247
|
+
export interface DownPaymentScenariosEur {
|
|
248
|
+
medium: number;
|
|
249
|
+
|
|
250
|
+
standard: number;
|
|
251
|
+
|
|
252
|
+
zero: number;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Italian labels paired 1:1 with `NltDownPaymentScenariosEur`.
|
|
257
|
+
*
|
|
258
|
+
* apimax: `anticipo_scenari_labels` — used by Custom GPT to render the three
|
|
259
|
+
* options in conversation. Values stay in Italian raw ("Senza anticipo" /
|
|
260
|
+
* "Anticipo 12,5%" / "Anticipo 25%").
|
|
261
|
+
*/
|
|
262
|
+
export interface DownPaymentScenariosLabels {
|
|
263
|
+
medium: string;
|
|
264
|
+
|
|
265
|
+
standard: string;
|
|
266
|
+
|
|
267
|
+
zero: string;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* One Italian Q&A entry derived per-offer.
|
|
272
|
+
*
|
|
273
|
+
* apimax: `build_offer_faqs` in `seo_engine/nlt_faq_builder.py` — generates up to
|
|
274
|
+
* ~11 Q&A pairs (dimensions, fuel, transmission, CO2, monthly canon at preset
|
|
275
|
+
* combo, available durations, VAT inclusion, down-payment tiers, etc.). Partnermax
|
|
276
|
+
* surfaces them all, 1:1.
|
|
277
|
+
*/
|
|
278
|
+
export interface Faq {
|
|
279
|
+
answer: string;
|
|
280
|
+
|
|
281
|
+
question: string;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* One image in the offer gallery (apimax: `gallery[]`).
|
|
286
|
+
*/
|
|
287
|
+
export interface Gallery {
|
|
288
|
+
is_cover: boolean;
|
|
289
|
+
|
|
290
|
+
url: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* One accessory bundled with the offer (apimax: `accessori_inclusi[]`).
|
|
295
|
+
*/
|
|
296
|
+
export interface IncludedAccessory {
|
|
297
|
+
code: string;
|
|
298
|
+
|
|
299
|
+
description: string;
|
|
300
|
+
|
|
301
|
+
extra_price_eur: number;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* One NLT service normally included in the canone.
|
|
306
|
+
*
|
|
307
|
+
* apimax: `_get_services_included` (`nlt_resolver.py:719`). Source is the global
|
|
308
|
+
* `nlt_services` table (active rows only). Same set of services across the network
|
|
309
|
+
* (Assicurazione RCA / Kasco / Incendio-Furto, Manutenzione, Assistenza Stradale,
|
|
310
|
+
* Bollo, Pneumatici, Veicolo in anticipo, Vettura sostitutiva). Not per-offer.
|
|
311
|
+
*/
|
|
312
|
+
export interface IncludedService {
|
|
313
|
+
name: string;
|
|
314
|
+
|
|
315
|
+
description?: string | null;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* One network dealer's quote for this offer (apimax: `network_offers[]`).
|
|
320
|
+
*
|
|
321
|
+
* Sorted by `min_monthly_canon_eur ASC`. In partnermax this list is scoped to
|
|
322
|
+
* dealers owned by the calling partner (`utenti.parent_id = partner.user_id`) —
|
|
323
|
+
* same shape as the apimax cross-network list, partner-scoped to avoid data
|
|
324
|
+
* leakage.
|
|
325
|
+
*/
|
|
326
|
+
export interface NetworkOffer {
|
|
327
|
+
dealer_id: number;
|
|
328
|
+
|
|
329
|
+
dealer_name: string;
|
|
330
|
+
|
|
331
|
+
min_monthly_canon_eur: number;
|
|
332
|
+
|
|
333
|
+
city?: string | null;
|
|
334
|
+
|
|
335
|
+
contact_url?: string | null;
|
|
336
|
+
|
|
337
|
+
google_maps_url?: string | null;
|
|
338
|
+
|
|
339
|
+
phone?: string | null;
|
|
340
|
+
|
|
341
|
+
province?: string | null;
|
|
342
|
+
|
|
343
|
+
rating_value?: number | null;
|
|
344
|
+
|
|
345
|
+
review_count?: number | null;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* One priced cell of the 18-combination matrix.
|
|
350
|
+
*
|
|
351
|
+
* apimax: `quotazioni[]` entry — `_compute_quotazioni_dealer_aware`
|
|
352
|
+
* (mcp_server.py:180). Reflects the dealer's vetrina formula applied to each
|
|
353
|
+
* (durata, km) combo; cells with implausible canon (<€50) are dropped upstream, so
|
|
354
|
+
* the list may contain fewer than 18 rows.
|
|
355
|
+
*/
|
|
356
|
+
export interface Quotation {
|
|
357
|
+
duration_months: number;
|
|
358
|
+
|
|
359
|
+
km_per_year: number;
|
|
360
|
+
|
|
361
|
+
monthly_canon_eur: number;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Category tag for an offer (apimax: `tags[]`).
|
|
366
|
+
*
|
|
367
|
+
* Populated from `nlt_offerta_tag` ⋈ `nlt_offerte_tag`. Examples in production:
|
|
368
|
+
* "Promo", "Stock pronto", "GreenChoice".
|
|
369
|
+
*/
|
|
370
|
+
export interface Tag {
|
|
371
|
+
name: string;
|
|
372
|
+
|
|
373
|
+
color?: string | null;
|
|
374
|
+
|
|
375
|
+
icon?: string | null;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Cursor-paginated list of offer summaries.
|
|
381
|
+
*/
|
|
382
|
+
export interface OfferListResponse {
|
|
383
|
+
data: Array<NltOfferSummary>;
|
|
384
|
+
|
|
385
|
+
has_more: boolean;
|
|
386
|
+
|
|
387
|
+
next_cursor?: string | null;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export interface OfferRetrieveParams {
|
|
391
|
+
dealer_id: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface OfferListParams {
|
|
395
|
+
brand?: string | null;
|
|
396
|
+
|
|
397
|
+
canone_max_eur?: number | null;
|
|
398
|
+
|
|
399
|
+
cursor?: string | null;
|
|
400
|
+
|
|
401
|
+
duration_months?: number | null;
|
|
402
|
+
|
|
403
|
+
fuel_type?: string | null;
|
|
404
|
+
|
|
405
|
+
km_per_year?: number | null;
|
|
406
|
+
|
|
407
|
+
limit?: number;
|
|
408
|
+
|
|
409
|
+
segment?: string | null;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Macro discriminator: 'auto' (passenger vehicles) or 'vcom' (light commercial ≤35
|
|
413
|
+
* q.li: vans, panel trucks, multispace, pickups, minibuses). Omit to return the
|
|
414
|
+
* mixed catalog.
|
|
415
|
+
*/
|
|
416
|
+
vehicle_type?: string | null;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export declare namespace Offers {
|
|
420
|
+
export {
|
|
421
|
+
type NltOfferSummary as NltOfferSummary,
|
|
422
|
+
type OfferRetrieveResponse as OfferRetrieveResponse,
|
|
423
|
+
type OfferListResponse as OfferListResponse,
|
|
424
|
+
type OfferRetrieveParams as OfferRetrieveParams,
|
|
425
|
+
type OfferListParams as OfferListParams,
|
|
426
|
+
};
|
|
427
|
+
}
|