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.
Files changed (179) hide show
  1. package/CHANGELOG.md +75 -47
  2. package/LICENSE +201 -201
  3. package/README.md +394 -370
  4. package/api-promise.js +1 -1
  5. package/client.d.mts +9 -3
  6. package/client.d.mts.map +1 -1
  7. package/client.d.ts +9 -3
  8. package/client.d.ts.map +1 -1
  9. package/client.js +12 -2
  10. package/client.js.map +1 -1
  11. package/client.mjs +12 -2
  12. package/client.mjs.map +1 -1
  13. package/core/api-promise.js +1 -1
  14. package/core/api-promise.mjs +1 -1
  15. package/core/pagination.d.mts +57 -0
  16. package/core/pagination.d.mts.map +1 -0
  17. package/core/pagination.d.ts +57 -0
  18. package/core/pagination.d.ts.map +1 -0
  19. package/core/pagination.js +108 -0
  20. package/core/pagination.js.map +1 -0
  21. package/core/pagination.mjs +102 -0
  22. package/core/pagination.mjs.map +1 -0
  23. package/error.js +1 -1
  24. package/index.d.mts +1 -0
  25. package/index.d.mts.map +1 -1
  26. package/index.d.ts +1 -0
  27. package/index.d.ts.map +1 -1
  28. package/index.js +3 -1
  29. package/index.js.map +1 -1
  30. package/index.mjs +1 -0
  31. package/index.mjs.map +1 -1
  32. package/internal/tslib.js +17 -17
  33. package/package.json +19 -15
  34. package/pagination.d.mts +3 -0
  35. package/pagination.d.mts.map +1 -0
  36. package/pagination.d.ts +3 -0
  37. package/pagination.d.ts.map +1 -0
  38. package/pagination.js +6 -0
  39. package/pagination.js.map +1 -0
  40. package/pagination.mjs +3 -0
  41. package/pagination.mjs.map +1 -0
  42. package/resource.js +1 -1
  43. package/resources/dealers/dealers.d.mts +7 -71
  44. package/resources/dealers/dealers.d.mts.map +1 -1
  45. package/resources/dealers/dealers.d.ts +7 -71
  46. package/resources/dealers/dealers.d.ts.map +1 -1
  47. package/resources/dealers/dealers.js +3 -16
  48. package/resources/dealers/dealers.js.map +1 -1
  49. package/resources/dealers/dealers.mjs +2 -15
  50. package/resources/dealers/dealers.mjs.map +1 -1
  51. package/resources/dealers/index.d.mts +2 -2
  52. package/resources/dealers/index.d.mts.map +1 -1
  53. package/resources/dealers/index.d.ts +2 -2
  54. package/resources/dealers/index.d.ts.map +1 -1
  55. package/resources/dealers/index.js.map +1 -1
  56. package/resources/dealers/index.mjs.map +1 -1
  57. package/resources/dealers/nlt/index.d.mts +1 -1
  58. package/resources/dealers/nlt/index.d.mts.map +1 -1
  59. package/resources/dealers/nlt/index.d.ts +1 -1
  60. package/resources/dealers/nlt/index.d.ts.map +1 -1
  61. package/resources/dealers/nlt/nlt.d.mts +2 -2
  62. package/resources/dealers/nlt/nlt.d.mts.map +1 -1
  63. package/resources/dealers/nlt/nlt.d.ts +2 -2
  64. package/resources/dealers/nlt/nlt.d.ts.map +1 -1
  65. package/resources/dealers/nlt/nlt.js +1 -1
  66. package/resources/dealers/nlt/offers.d.mts +55 -78
  67. package/resources/dealers/nlt/offers.d.mts.map +1 -1
  68. package/resources/dealers/nlt/offers.d.ts +55 -78
  69. package/resources/dealers/nlt/offers.d.ts.map +1 -1
  70. package/resources/dealers/nlt/offers.js +9 -11
  71. package/resources/dealers/nlt/offers.js.map +1 -1
  72. package/resources/dealers/nlt/offers.mjs +9 -11
  73. package/resources/dealers/nlt/offers.mjs.map +1 -1
  74. package/resources/dealers/nlt-settings.d.mts +24 -64
  75. package/resources/dealers/nlt-settings.d.mts.map +1 -1
  76. package/resources/dealers/nlt-settings.d.ts +24 -64
  77. package/resources/dealers/nlt-settings.d.ts.map +1 -1
  78. package/resources/dealers/nlt-settings.js +4 -13
  79. package/resources/dealers/nlt-settings.js.map +1 -1
  80. package/resources/dealers/nlt-settings.mjs +4 -13
  81. package/resources/dealers/nlt-settings.mjs.map +1 -1
  82. package/resources/dealers/nlt.js +1 -1
  83. package/resources/dealers/vehicles/images.d.mts +3 -2
  84. package/resources/dealers/vehicles/images.d.mts.map +1 -1
  85. package/resources/dealers/vehicles/images.d.ts +3 -2
  86. package/resources/dealers/vehicles/images.d.ts.map +1 -1
  87. package/resources/dealers/vehicles/images.js +3 -2
  88. package/resources/dealers/vehicles/images.js.map +1 -1
  89. package/resources/dealers/vehicles/images.mjs +3 -2
  90. package/resources/dealers/vehicles/images.mjs.map +1 -1
  91. package/resources/dealers/vehicles/index.d.mts +1 -1
  92. package/resources/dealers/vehicles/index.d.mts.map +1 -1
  93. package/resources/dealers/vehicles/index.d.ts +1 -1
  94. package/resources/dealers/vehicles/index.d.ts.map +1 -1
  95. package/resources/dealers/vehicles/index.js.map +1 -1
  96. package/resources/dealers/vehicles/index.mjs.map +1 -1
  97. package/resources/dealers/vehicles/vehicles.d.mts +57 -70
  98. package/resources/dealers/vehicles/vehicles.d.mts.map +1 -1
  99. package/resources/dealers/vehicles/vehicles.d.ts +57 -70
  100. package/resources/dealers/vehicles/vehicles.d.ts.map +1 -1
  101. package/resources/dealers/vehicles/vehicles.js +19 -19
  102. package/resources/dealers/vehicles/vehicles.js.map +1 -1
  103. package/resources/dealers/vehicles/vehicles.mjs +18 -18
  104. package/resources/dealers/vehicles/vehicles.mjs.map +1 -1
  105. package/resources/dealers/vehicles.js +1 -1
  106. package/resources/dealers.js +1 -1
  107. package/resources/index.d.mts +1 -1
  108. package/resources/index.d.mts.map +1 -1
  109. package/resources/index.d.ts +1 -1
  110. package/resources/index.d.ts.map +1 -1
  111. package/resources/index.js.map +1 -1
  112. package/resources/index.mjs.map +1 -1
  113. package/resources/keys.d.mts +7 -6
  114. package/resources/keys.d.mts.map +1 -1
  115. package/resources/keys.d.ts +7 -6
  116. package/resources/keys.d.ts.map +1 -1
  117. package/resources/keys.js +7 -6
  118. package/resources/keys.js.map +1 -1
  119. package/resources/keys.mjs +7 -6
  120. package/resources/keys.mjs.map +1 -1
  121. package/resources.js +1 -1
  122. package/src/api-promise.ts +2 -2
  123. package/src/client.ts +868 -841
  124. package/src/core/README.md +3 -3
  125. package/src/core/api-promise.ts +92 -92
  126. package/src/core/error.ts +130 -130
  127. package/src/core/pagination.ts +170 -0
  128. package/src/core/resource.ts +11 -11
  129. package/src/core/uploads.ts +2 -2
  130. package/src/error.ts +2 -2
  131. package/src/index.ts +23 -22
  132. package/src/internal/README.md +3 -3
  133. package/src/internal/builtin-types.ts +93 -93
  134. package/src/internal/detect-platform.ts +196 -196
  135. package/src/internal/errors.ts +33 -33
  136. package/src/internal/headers.ts +97 -97
  137. package/src/internal/parse.ts +56 -56
  138. package/src/internal/request-options.ts +91 -91
  139. package/src/internal/shim-types.ts +26 -26
  140. package/src/internal/shims.ts +107 -107
  141. package/src/internal/to-file.ts +154 -154
  142. package/src/internal/types.ts +93 -93
  143. package/src/internal/uploads.ts +187 -187
  144. package/src/internal/utils/base64.ts +40 -40
  145. package/src/internal/utils/bytes.ts +32 -32
  146. package/src/internal/utils/env.ts +18 -18
  147. package/src/internal/utils/log.ts +128 -128
  148. package/src/internal/utils/path.ts +88 -88
  149. package/src/internal/utils/query.ts +23 -23
  150. package/src/internal/utils/sleep.ts +3 -3
  151. package/src/internal/utils/uuid.ts +17 -17
  152. package/src/internal/utils/values.ts +105 -105
  153. package/src/internal/utils.ts +9 -9
  154. package/src/lib/.keep +4 -4
  155. package/src/pagination.ts +2 -0
  156. package/src/resource.ts +2 -2
  157. package/src/resources/dealers/dealers.ts +260 -348
  158. package/src/resources/dealers/index.ts +28 -28
  159. package/src/resources/dealers/nlt/index.ts +11 -11
  160. package/src/resources/dealers/nlt/nlt.ts +29 -29
  161. package/src/resources/dealers/nlt/offers.ts +403 -427
  162. package/src/resources/dealers/nlt-settings.ts +229 -269
  163. package/src/resources/dealers/nlt.ts +3 -3
  164. package/src/resources/dealers/vehicles/images.ts +154 -153
  165. package/src/resources/dealers/vehicles/index.ts +26 -25
  166. package/src/resources/dealers/vehicles/vehicles.ts +786 -796
  167. package/src/resources/dealers/vehicles.ts +3 -3
  168. package/src/resources/dealers.ts +3 -3
  169. package/src/resources/index.ts +11 -12
  170. package/src/resources/keys.ts +129 -128
  171. package/src/resources.ts +1 -1
  172. package/src/tsconfig.json +11 -11
  173. package/src/uploads.ts +2 -2
  174. package/src/version.ts +1 -1
  175. package/uploads.js +1 -1
  176. package/version.d.mts +1 -1
  177. package/version.d.ts +1 -1
  178. package/version.js +1 -1
  179. package/version.mjs +1 -1
@@ -1,427 +1,403 @@
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 { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
6
+ import { RequestOptions } from '../../../internal/request-options';
7
+ import { path } from '../../../internal/utils/path';
8
+
9
+ export class Offers extends APIResource {
10
+ /**
11
+ * Full offer detail. Payload shape mirrors apimax MCP `get_nlt_offer_details`
12
+ * bit-for-bit (mcp_server.py:1546-1606).
13
+ */
14
+ retrieve(
15
+ offerID: string,
16
+ params: OfferRetrieveParams,
17
+ options?: RequestOptions,
18
+ ): APIPromise<OfferRetrieveResponse> {
19
+ const { dealer_id } = params;
20
+ return this._client.get(path`/v1/dealers/${dealer_id}/nlt/offers/${offerID}`, options);
21
+ }
22
+
23
+ /**
24
+ * Listing of NLT offers with monthly canon repriced for this dealer.
25
+ *
26
+ * The response is cursor-paginated and dealer-aware: filters are applied to the
27
+ * shared NLT catalogue, then each returned offer is repriced with the dealer's
28
+ * configured mark-up, down-payment tiers, duration, and yearly-km filters. The
29
+ * headline canon is the cheapest eligible priced cell.
30
+ */
31
+ list(
32
+ dealerID: string,
33
+ query: OfferListParams | null | undefined = {},
34
+ options?: RequestOptions,
35
+ ): PagePromise<NltOfferSummariesCursorPage, NltOfferSummary> {
36
+ return this._client.getAPIList(path`/v1/dealers/${dealerID}/nlt/offers`, CursorPage<NltOfferSummary>, {
37
+ query,
38
+ ...options,
39
+ });
40
+ }
41
+ }
42
+
43
+ export type NltOfferSummariesCursorPage = CursorPage<NltOfferSummary>;
44
+
45
+ /**
46
+ * Single row in the offers list. Pricing is dealer-aware.
47
+ *
48
+ * Field names: American English snake_case. Values use DealerMAX's Italian
49
+ * catalogue vocabulary (`fuel_type: "Benzina"`, `segment: "SUV piccoli"`). No enum
50
+ * normalization labels are surfaced verbatim, exactly as the detail endpoint
51
+ * does, so the 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
+ * Field names use American-English snake_case for the partner SDK contract. Values
91
+ * stay Italian raw where the underlying automotive catalogue uses Italian labels.
92
+ * The dict `technical_details` keeps Italian domain keys.
93
+ */
94
+ export interface OfferRetrieveResponse {
95
+ found: boolean;
96
+
97
+ network_dealer_count: number;
98
+
99
+ offer_id: string;
100
+
101
+ slug: string;
102
+
103
+ title: string;
104
+
105
+ vat_included: boolean;
106
+
107
+ /**
108
+ * Container for optional add-ons.
109
+ */
110
+ available_addons?: OfferRetrieveResponse.AvailableAddons;
111
+
112
+ brand?: string | null;
113
+
114
+ description_full?: string | null;
115
+
116
+ description_short?: string | null;
117
+
118
+ /**
119
+ * Three down-payment scenarios in EUR (whole amounts).
120
+ *
121
+ * Keys use American-English snake_case for the partnermax SDK: `zero`, `medium`,
122
+ * `standard`.
123
+ */
124
+ down_payment_scenarios_eur?: OfferRetrieveResponse.DownPaymentScenariosEur | null;
125
+
126
+ /**
127
+ * Italian labels paired 1:1 with `NltDownPaymentScenariosEur`.
128
+ *
129
+ * Values stay in Italian raw ("Senza anticipo" / "Anticipo 12,5%" / "Anticipo
130
+ * 25%") so partner UIs match DealerMAX consumer-facing copy.
131
+ */
132
+ down_payment_scenarios_labels?: OfferRetrieveResponse.DownPaymentScenariosLabels | null;
133
+
134
+ faqs?: Array<OfferRetrieveResponse.Faq>;
135
+
136
+ fuel_type?: string | null;
137
+
138
+ gallery?: Array<OfferRetrieveResponse.Gallery>;
139
+
140
+ image_url?: string | null;
141
+
142
+ included_accessories?: Array<OfferRetrieveResponse.IncludedAccessory>;
143
+
144
+ included_services?: Array<OfferRetrieveResponse.IncludedService>;
145
+
146
+ last_modified?: string | null;
147
+
148
+ min_monthly_canon_eur?: number | null;
149
+
150
+ model?: string | null;
151
+
152
+ network_offers?: Array<OfferRetrieveResponse.NetworkOffer>;
153
+
154
+ primary_dealer_city?: string | null;
155
+
156
+ primary_dealer_name?: string | null;
157
+
158
+ primary_dealer_province?: string | null;
159
+
160
+ private_only?: boolean | null;
161
+
162
+ quotations?: Array<OfferRetrieveResponse.Quotation>;
163
+
164
+ schema_org?: { [key: string]: unknown } | null;
165
+
166
+ segment?: string | null;
167
+
168
+ standard_equipment?: Array<string>;
169
+
170
+ tags?: Array<OfferRetrieveResponse.Tag>;
171
+
172
+ technical_details?: { [key: string]: unknown };
173
+
174
+ total_price_eur?: number | null;
175
+
176
+ transmission?: string | null;
177
+
178
+ trim?: string | null;
179
+
180
+ vehicle_type?: 'auto' | 'vcom';
181
+ }
182
+
183
+ export namespace OfferRetrieveResponse {
184
+ /**
185
+ * Container for optional add-ons.
186
+ */
187
+ export interface AvailableAddons {
188
+ /**
189
+ * Replacement-vehicle add-on lookup.
190
+ *
191
+ * Always category B (utilitaria) per founder decision — the spoken "average
192
+ * customer" segment.
193
+ */
194
+ replacement_vehicle?: AvailableAddons.ReplacementVehicle | null;
195
+
196
+ /**
197
+ * Tyre-replacement add-on lookup.
198
+ *
199
+ * Populated when the catalogue carries a parseable tyre diameter and a
200
+ * DealerMAX-managed tyre package exists for that diameter. Null otherwise.
201
+ * Replacement rule: 1 set of 4 tyres every 30 000 km, rounded up.
202
+ */
203
+ tires?: AvailableAddons.Tires | null;
204
+ }
205
+
206
+ export namespace AvailableAddons {
207
+ /**
208
+ * Replacement-vehicle add-on lookup.
209
+ *
210
+ * Always category B (utilitaria) per founder decision — the spoken "average
211
+ * customer" segment.
212
+ */
213
+ export interface ReplacementVehicle {
214
+ category_description: string;
215
+
216
+ default_category: string;
217
+
218
+ monthly_cost_eur: number;
219
+ }
220
+
221
+ /**
222
+ * Tyre-replacement add-on lookup.
223
+ *
224
+ * Populated when the catalogue carries a parseable tyre diameter and a
225
+ * DealerMAX-managed tyre package exists for that diameter. Null otherwise.
226
+ * Replacement rule: 1 set of 4 tyres every 30 000 km, rounded up.
227
+ */
228
+ export interface Tires {
229
+ diameter_in: number;
230
+
231
+ replacement_rule: string;
232
+
233
+ set_cost_eur: number;
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Three down-payment scenarios in EUR (whole amounts).
239
+ *
240
+ * Keys use American-English snake_case for the partnermax SDK: `zero`, `medium`,
241
+ * `standard`.
242
+ */
243
+ export interface DownPaymentScenariosEur {
244
+ medium: number;
245
+
246
+ standard: number;
247
+
248
+ zero: number;
249
+ }
250
+
251
+ /**
252
+ * Italian labels paired 1:1 with `NltDownPaymentScenariosEur`.
253
+ *
254
+ * Values stay in Italian raw ("Senza anticipo" / "Anticipo 12,5%" / "Anticipo
255
+ * 25%") so partner UIs match DealerMAX consumer-facing copy.
256
+ */
257
+ export interface DownPaymentScenariosLabels {
258
+ medium: string;
259
+
260
+ standard: string;
261
+
262
+ zero: string;
263
+ }
264
+
265
+ /**
266
+ * One Italian Q&A entry derived per-offer.
267
+ *
268
+ * Generated from the same grounded offer payload used by DealerMAX consumer-facing
269
+ * surfaces: dimensions, fuel, transmission, CO2, monthly canon, available
270
+ * durations, VAT inclusion, down-payment tiers, etc.
271
+ */
272
+ export interface Faq {
273
+ answer: string;
274
+
275
+ question: string;
276
+ }
277
+
278
+ /**
279
+ * One image in the offer gallery.
280
+ */
281
+ export interface Gallery {
282
+ is_cover: boolean;
283
+
284
+ url: string;
285
+ }
286
+
287
+ /**
288
+ * One accessory bundled with the offer.
289
+ */
290
+ export interface IncludedAccessory {
291
+ code: string;
292
+
293
+ description: string;
294
+
295
+ extra_price_eur: number;
296
+ }
297
+
298
+ /**
299
+ * One NLT service normally included in the canone.
300
+ *
301
+ * Same set of services across the network (Assicurazione RCA / Kasco /
302
+ * Incendio-Furto, Manutenzione, Assistenza Stradale, Bollo, Pneumatici, Veicolo in
303
+ * anticipo, Vettura sostitutiva). Not per-offer.
304
+ */
305
+ export interface IncludedService {
306
+ name: string;
307
+
308
+ description?: string | null;
309
+ }
310
+
311
+ /**
312
+ * One network dealer's quote for this offer.
313
+ *
314
+ * Sorted by `min_monthly_canon_eur ASC`. In PartnerMAX this list is scoped to the
315
+ * calling partner's `partner_dealers` rows and returns the partner-owned
316
+ * `external_dealer_id`. Legacy `dlr_<id>` values remain only for compatibility
317
+ * callers.
318
+ */
319
+ export interface NetworkOffer {
320
+ dealer_id: string;
321
+
322
+ dealer_name: string;
323
+
324
+ min_monthly_canon_eur: number;
325
+
326
+ city?: string | null;
327
+
328
+ contact_url?: string | null;
329
+
330
+ google_maps_url?: string | null;
331
+
332
+ phone?: string | null;
333
+
334
+ province?: string | null;
335
+
336
+ rating_value?: number | null;
337
+
338
+ review_count?: number | null;
339
+ }
340
+
341
+ /**
342
+ * One priced cell of the 18-combination matrix.
343
+ *
344
+ * Reflects the dealer-aware pricing formula applied to each (duration, yearly-km)
345
+ * combination. Cells with implausible canons are filtered upstream, so the list
346
+ * may contain fewer than 18 rows.
347
+ */
348
+ export interface Quotation {
349
+ duration_months: number;
350
+
351
+ km_per_year: number;
352
+
353
+ monthly_canon_eur: number;
354
+ }
355
+
356
+ /**
357
+ * Category tag for an offer.
358
+ *
359
+ * Examples in production: "Promo", "Stock pronto", "GreenChoice".
360
+ */
361
+ export interface Tag {
362
+ name: string;
363
+
364
+ color?: string | null;
365
+
366
+ icon?: string | null;
367
+ }
368
+ }
369
+
370
+ export interface OfferRetrieveParams {
371
+ dealer_id: string;
372
+ }
373
+
374
+ export interface OfferListParams extends CursorPageParams {
375
+ brand?: string | null;
376
+
377
+ canone_max_eur?: number | null;
378
+
379
+ duration_months?: number | null;
380
+
381
+ fuel_type?: string | null;
382
+
383
+ km_per_year?: number | null;
384
+
385
+ segment?: string | null;
386
+
387
+ /**
388
+ * Macro discriminator: 'auto' (passenger vehicles) or 'vcom' (light commercial ≤35
389
+ * q.li: vans, panel trucks, multispace, pickups, minibuses). Omit to return the
390
+ * mixed catalog.
391
+ */
392
+ vehicle_type?: string | null;
393
+ }
394
+
395
+ export declare namespace Offers {
396
+ export {
397
+ type NltOfferSummary as NltOfferSummary,
398
+ type OfferRetrieveResponse as OfferRetrieveResponse,
399
+ type NltOfferSummariesCursorPage as NltOfferSummariesCursorPage,
400
+ type OfferRetrieveParams as OfferRetrieveParams,
401
+ type OfferListParams as OfferListParams,
402
+ };
403
+ }