@djust-b2b/djust-front-sdk 1.12.0 → 1.13.0

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.
@@ -7,17 +7,49 @@ exports.getMasterQuote = getMasterQuote;
7
7
  exports.updateMasterQuote = updateMasterQuote;
8
8
  exports.createSupplierQuotes = createSupplierQuotes;
9
9
  exports.getSupplierQuote = getSupplierQuote;
10
+ exports.acceptSupplierQuote = acceptSupplierQuote;
11
+ exports.updateSupplierQuoteCustomFields = updateSupplierQuoteCustomFields;
10
12
  exports.declineSupplierQuote = declineSupplierQuote;
11
13
  exports.postMessageToSupplierQuote = postMessageToSupplierQuote;
14
+ exports.initializeOrderFromSupplierQuote = initializeOrderFromSupplierQuote;
12
15
  const parameters_validation_1 = require("../../helpers/parameters-validation");
13
16
  const fetch_instance_1 = require("../../settings/fetch-instance");
14
17
  /**
15
- * Get master quotes
18
+ * 📄 Fetches a paginated list of master quotes.
19
+ *
20
+ * This function retrieves master quotes with optional filters for customer accounts and pagination parameters.
21
+ * If no parameters are provided, it fetches the default paginated list of master quotes.
22
+ *
23
+ * 🛠 **Endpoint**: `GET /v1/shop/master-quotes`
24
+ *
25
+ * | Parameter | Type | Required | Description |
26
+ * |----------------------|-------------------------------|------------|---------------------------------------------------------------|
27
+ * | `fromCustomerAccount`| `boolean` | ❌ | If `true`, filters quotes originating from customer accounts. |
28
+ * | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
29
+ * | `pageable.size` | `number` | ❌ | The number of items per page. |
30
+ * | `pageable.sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
31
+ *
32
+ * 📤 **Returns**:
33
+ * A `Promise` resolving to a `GetMasterQuotesResponse` object,
34
+ * containing the paginated list of master quotes with metadata such as total pages, size, and current page.
35
+ *
36
+ * 🛠 **Example usage**:
37
+ * ```ts
38
+ * const quotes = await getMasterQuotes({
39
+ * fromCustomerAccount: true,
40
+ * pageable: { page: 1, size: 10, sort: ["createdAt,desc"] },
41
+ * });
42
+ *
43
+ * console.log(quotes);
44
+ * ```
45
+ *
46
+ * @param {GetMasterQuotesParameters} params - Optional filters and pagination parameters.
47
+ * @returns {Promise<GetMasterQuotesResponse>} A promise resolving to the paginated master quotes response.
16
48
  */
17
49
  async function getMasterQuotes({ fromCustomerAccount, pageable, } = {}) {
18
50
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
19
51
  method: "GET",
20
- path: `/v1/shop/autocomplete`,
52
+ path: `/v1/shop/master-quotes`,
21
53
  params: {
22
54
  fromCustomerAccount,
23
55
  page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
@@ -28,7 +60,35 @@ async function getMasterQuotes({ fromCustomerAccount, pageable, } = {}) {
28
60
  return data;
29
61
  }
30
62
  /**
31
- * Create a master quote
63
+ * ✏️ Creates a new master quote.
64
+ *
65
+ * This function allows the creation of a new master quote by providing a description and a name.
66
+ * Both parameters are mandatory and validated before sending the request.
67
+ *
68
+ * 🛠 **Endpoint**: `POST /v1/shop/master-quotes`
69
+ *
70
+ * | Parameter | Type | Required | Description |
71
+ * |----------------|------------|------------|---------------------------------------------|
72
+ * | `description` | `string` | ✅ | The description of the master quote. |
73
+ * | `name` | `string` | ✅ | The name of the master quote. |
74
+ *
75
+ * 📤 **Returns**:
76
+ * A `Promise` resolving to a `CreateMasterQuoteResponse` object,
77
+ * representing the created master quote with its details.
78
+ *
79
+ * 🛠 **Example usage**:
80
+ * ```ts
81
+ * const newQuote = await createMasterQuote({
82
+ * description: "This is a test quote.",
83
+ * name: "Test Quote",
84
+ * });
85
+ *
86
+ * console.log(newQuote);
87
+ * ```
88
+ *
89
+ * @param {CreateMasterQuoteParameters} params - The parameters for creating the master quote.
90
+ * @throws {Error} If `description` or `name` is missing.
91
+ * @returns {Promise<CreateMasterQuoteResponse>} A promise resolving to the created master quote response.
32
92
  */
33
93
  async function createMasterQuote({ description, name, }) {
34
94
  (0, parameters_validation_1.required)({ description, name });
@@ -43,7 +103,29 @@ async function createMasterQuote({ description, name, }) {
43
103
  return data;
44
104
  }
45
105
  /**
46
- * Delete a master quote
106
+ * 📝 Deletes a master quote by its ID.
107
+ *
108
+ * This function allows you to delete an existing master quote by providing the `masterQuoteId`. Once the quote is deleted, it can no longer be retrieved or used in other operations.
109
+ *
110
+ * 🛠 **Endpoint**: `DELETE /v1/shop/master-quotes/{masterQuoteId}`
111
+ *
112
+ * | Parameter | Type | Required | Description |
113
+ * |-------------------|---------|------------|---------------------------------------------------------------|
114
+ * | `masterQuoteId` | `string`| ✅ | The unique identifier of the master quote to be deleted. |
115
+ *
116
+ * 📤 **Returns**:
117
+ * A `Promise<void>` indicating the operation was successful. No data is returned as the master quote is simply deleted.
118
+ *
119
+ * 🛠 **Example usage**:
120
+ * ```ts
121
+ * await deleteMasterQuote({
122
+ * masterQuoteId: "quote123",
123
+ * });
124
+ * ```
125
+ *
126
+ * @param {DeleteMasterQuoteParameters} params - The parameters required to delete the master quote.
127
+ * @throws {Error} If the required `masterQuoteId` is missing.
128
+ * @returns {Promise<void>} A promise that resolves when the master quote is successfully deleted.
47
129
  */
48
130
  async function deleteMasterQuote({ masterQuoteId, }) {
49
131
  (0, parameters_validation_1.required)({ masterQuoteId });
@@ -53,7 +135,29 @@ async function deleteMasterQuote({ masterQuoteId, }) {
53
135
  });
54
136
  }
55
137
  /**
56
- * Get a master quote by id
138
+ * 📄 Fetches the details of a specific master quote.
139
+ *
140
+ * This function retrieves a master quote identified by its unique `masterQuoteId`.
141
+ *
142
+ * 🛠 **Endpoint**: `GET /v1/shop/master-quotes/{masterQuoteId}`
143
+ *
144
+ * | Parameter | Type | Required | Description |
145
+ * |-------------------|------------|------------|--------------------------------------------------|
146
+ * | `masterQuoteId` | `string` | ✅ | The unique identifier of the master quote to fetch. |
147
+ *
148
+ * 📤 **Returns**:
149
+ * A `Promise` resolving to a `GetMasterQuoteResponse` object, containing the details of the requested master quote.
150
+ *
151
+ * 🛠 **Example usage**:
152
+ * ```ts
153
+ * const masterQuote = await getMasterQuote({ masterQuoteId: "12345" });
154
+ *
155
+ * console.log(masterQuote);
156
+ * ```
157
+ *
158
+ * @param {GetMasterQuoteParameters} params - The parameters required to fetch the master quote.
159
+ * @throws {Error} If `masterQuoteId` is missing.
160
+ * @returns {Promise<GetMasterQuoteResponse>} A promise resolving to the details of the master quote.
57
161
  */
58
162
  async function getMasterQuote({ masterQuoteId, }) {
59
163
  (0, parameters_validation_1.required)({ masterQuoteId });
@@ -64,7 +168,37 @@ async function getMasterQuote({ masterQuoteId, }) {
64
168
  return data;
65
169
  }
66
170
  /**
67
- * Update a master quote
171
+ * ✏️ Updates an existing master quote.
172
+ *
173
+ * This function modifies the specified master quote by updating custom field values, adding new details, or removing existing ones.
174
+ *
175
+ * 🛠 **Endpoint**: `PUT /v1/shop/master-quotes/{masterQuoteId}`
176
+ *
177
+ * | Parameter | Type | Required | Description |
178
+ * |------------------------------|--------------------------------------------|------------|------------------------------------------------------|
179
+ * | `masterQuoteId` | `string` | ✅ | The unique identifier of the master quote to update. |
180
+ * | `customFieldValues` | `{ customFieldId: string; customFieldValue?: string; }[]` | ❌ | Custom field values to update for the master quote. |
181
+ * | `masterQuoteDetailsToAdd` | `{ productVariantId: string; quantity: number; }[]` | ❌ | Details to add to the master quote. |
182
+ * | `masterQuoteDetailsToRemove` | `string[]` | ❌ | IDs of details to remove from the master quote. |
183
+ *
184
+ * 📤 **Returns**:
185
+ * A `Promise` resolving to an `UpdateMasterQuoteResponse` object, which contains the updated details of the master quote.
186
+ *
187
+ * 🛠 **Example usage**:
188
+ * ```ts
189
+ * const updatedQuote = await updateMasterQuote({
190
+ * masterQuoteId: "12345",
191
+ * customFieldValues: [{ customFieldId: "field1", customFieldValue: "value1" }],
192
+ * masterQuoteDetailsToAdd: [{ productVariantId: "variant1", quantity: 5 }],
193
+ * masterQuoteDetailsToRemove: ["detail1", "detail2"],
194
+ * });
195
+ *
196
+ * console.log(updatedQuote);
197
+ * ```
198
+ *
199
+ * @param {UpdateMasterQuoteParameters} params - The parameters required to update the master quote.
200
+ * @throws {Error} If `masterQuoteId` is missing.
201
+ * @returns {Promise<UpdateMasterQuoteResponse>} A promise resolving to the updated details of the master quote.
68
202
  */
69
203
  async function updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, }) {
70
204
  (0, parameters_validation_1.required)({ masterQuoteId });
@@ -80,7 +214,46 @@ async function updateMasterQuote({ masterQuoteId, customFieldValues, masterQuote
80
214
  return data;
81
215
  }
82
216
  /**
83
- * Create supplier quotes
217
+ * ✏️ Creates supplier quotes.
218
+ *
219
+ * This function generates supplier quotes based on the provided parameters, including billing and shipping information, quantities, and supplier details.
220
+ *
221
+ * 🛠 **Endpoint**: `POST /v1/shop/supplier-quotes`
222
+ *
223
+ * | Parameter | Type | Required | Description |
224
+ * |--------------------------------|----------------------------------------------------------------------------------------|------------|-----------------------------------------------------------------------------|
225
+ * | `billingAddressId` | `string` | ❌ | The ID of the billing address for the supplier quotes. |
226
+ * | `createSupplierQuoteRequests` | `{ createQuoteDeliveryLineRequests: { quantity: number; shippingAddressId: string; }[]; masterQuoteDetailId: string; quantity: number; supplierIds: string[]; }[]` | ✅ | Array of supplier quote request objects, including delivery and supplier details. |
227
+ * | `masterQuoteId` | `string` | ❌ | The ID of the master quote associated with the supplier quotes. |
228
+ * | `supplierQuoteUrl` | `string` | ✅ | The URL for the supplier quote. |
229
+ *
230
+ * 📤 **Returns**:
231
+ * A `Promise` resolving to a `CreateSupplierQuotesResponse` object, containing the newly created supplier quotes.
232
+ *
233
+ * 🛠 **Example usage**:
234
+ * ```ts
235
+ * const response = await createSupplierQuotes({
236
+ * billingAddressId: "address123",
237
+ * createSupplierQuoteRequests: [
238
+ * {
239
+ * createQuoteDeliveryLineRequests: [
240
+ * { quantity: 10, shippingAddressId: "ship123" },
241
+ * ],
242
+ * masterQuoteDetailId: "detail123",
243
+ * quantity: 20,
244
+ * supplierIds: ["supplier1", "supplier2"],
245
+ * },
246
+ * ],
247
+ * masterQuoteId: "master123",
248
+ * supplierQuoteUrl: "https://example.com/supplier-quote",
249
+ * });
250
+ *
251
+ * console.log(response);
252
+ * ```
253
+ *
254
+ * @param {CreateSupplierQuotesParameters} params - The parameters required to create supplier quotes.
255
+ * @throws {Error} If `createSupplierQuoteRequests` or `supplierQuoteUrl` is missing.
256
+ * @returns {Promise<CreateSupplierQuotesResponse>} A promise resolving to the created supplier quotes.
84
257
  */
85
258
  async function createSupplierQuotes({ billingAddressId, createSupplierQuoteRequests, masterQuoteId, supplierQuoteUrl, }) {
86
259
  (0, parameters_validation_1.required)({ createSupplierQuoteRequests, supplierQuoteUrl });
@@ -97,7 +270,31 @@ async function createSupplierQuotes({ billingAddressId, createSupplierQuoteReque
97
270
  return data;
98
271
  }
99
272
  /**
100
- * Get supplier quote
273
+ * ✏️ Retrieves a supplier quote by ID.
274
+ *
275
+ * This function fetches detailed information about a specific supplier quote, including customer details, billing address, quote lines, and status.
276
+ *
277
+ * 🛠 **Endpoint**: `GET /v1/shop/supplier-quotes/{supplierQuoteId}`
278
+ *
279
+ * | Parameter | Type | Required | Description |
280
+ * |--------------------|-----------|------------|------------------------------------------------------|
281
+ * | `supplierQuoteId` | `string` | ✅ | The unique identifier of the supplier quote to retrieve. |
282
+ *
283
+ * 📤 **Returns**:
284
+ * A `Promise` resolving to a `GetSupplierQuoteResponse` object, containing the details of the requested supplier quote.
285
+ *
286
+ * 🛠 **Example usage**:
287
+ * ```ts
288
+ * const response = await getSupplierQuote({
289
+ * supplierQuoteId: "quote123",
290
+ * });
291
+ *
292
+ * console.log(response);
293
+ * ```
294
+ *
295
+ * @param {GetSupplierQuoteParameters} params - The parameters required to retrieve a supplier quote.
296
+ * @throws {Error} If `supplierQuoteId` is missing.
297
+ * @returns {Promise<GetSupplierQuoteResponse>} A promise resolving to the supplier quote details.
101
298
  */
102
299
  async function getSupplierQuote({ supplierQuoteId, }) {
103
300
  (0, parameters_validation_1.required)({ supplierQuoteId });
@@ -108,18 +305,149 @@ async function getSupplierQuote({ supplierQuoteId, }) {
108
305
  return data;
109
306
  }
110
307
  /**
111
- * Decline supplier quote
308
+ * Accepts a supplier quote.
309
+ *
310
+ * This function allows the user to accept a specific supplier quote, which may trigger further actions in the purchasing or negotiation process.
311
+ *
312
+ * 🛠 **Endpoint**: `PUT /v1/shop/supplier-quotes/{supplierQuoteId}/accept`
313
+ *
314
+ * | Parameter | Type | Required | Description |
315
+ * |---------------------|-----------|------------|---------------------------------------------------------------------|
316
+ * | `supplierQuoteId` | `string` | ✅ | The unique identifier of the supplier quote to be accepted. |
317
+ *
318
+ * 📤 **Returns**:
319
+ * A `Promise` resolving to an `AcceptSupplierQuoteResponse` object, confirming that the supplier quote has been accepted.
320
+ *
321
+ * 🛠 **Example usage**:
322
+ * ```ts
323
+ * const response = await acceptSupplierQuote({
324
+ * supplierQuoteId: "quote123",
325
+ * });
326
+ *
327
+ * console.log(response);
328
+ * ```
329
+ *
330
+ * @param {AcceptSupplierQuoteParameters} params - The parameters required to accept a supplier quote.
331
+ * @throws {Error} If the required `supplierQuoteId` is missing.
332
+ * @returns {Promise<AcceptSupplierQuoteResponse>} A promise resolving to the result of the supplier quote acceptance operation.
333
+ */
334
+ async function acceptSupplierQuote({ supplierQuoteId, }) {
335
+ (0, parameters_validation_1.required)({ supplierQuoteId });
336
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
337
+ method: "PUT",
338
+ path: `/v1/shop/supplier-quotes/${supplierQuoteId}/accept`,
339
+ });
340
+ return data;
341
+ }
342
+ /**
343
+ * 📝 Updates custom fields of a supplier quote.
344
+ *
345
+ * This function allows you to update custom fields associated with a specific supplier quote.
346
+ * You can modify the values of the custom fields, providing a flexible way to manage additional information for the quote.
347
+ *
348
+ * 🛠 **Endpoint**: `PATCH /v1/shop/supplier-quotes/{supplierQuoteId}/custom-fields`
349
+ *
350
+ * | Parameter | Type | Required | Description |
351
+ * |---------------------|---------|------------|----------------------------------------------------------------------|
352
+ * | `supplierQuoteId` | `string`| ✅ | The unique identifier of the supplier quote to be updated. |
353
+ * | `customFieldValues` | `array` | ✅ | An array of custom field values to be updated for the supplier quote. |
354
+ * | `idType` | `string`| ✅ | The ID type used for the custom fields. |
355
+ *
356
+ * 📤 **Returns**:
357
+ * A `Promise` resolving to an `UpdateSupplierQuoteCustomFieldsResponse` object, which confirms that the custom fields have been updated successfully.
358
+ *
359
+ * 🛠 **Example usage**:
360
+ * ```ts
361
+ * const response = await updateSupplierQuoteCustomFields({
362
+ * supplierQuoteId: "quote123",
363
+ * customFieldValues: [{ customFieldId: "field1", customFieldValue: "value1" }],
364
+ * idType: "EXTERNAL_ID",
365
+ * });
366
+ *
367
+ * console.log(response);
368
+ * ```
369
+ *
370
+ * @param {UpdateSupplierQuoteCustomFieldsParameters} params - The parameters required to update custom fields for a supplier quote.
371
+ * @throws {Error} If the required `supplierQuoteId` is missing.
372
+ * @returns {Promise<UpdateSupplierQuoteCustomFieldsResponse>} A promise resolving to the result of the custom fields update operation.
373
+ */
374
+ async function updateSupplierQuoteCustomFields({ supplierQuoteId, customFieldValues, idType, }) {
375
+ (0, parameters_validation_1.required)({ supplierQuoteId });
376
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
377
+ method: "PATCH",
378
+ path: `/v1/shop/supplier-quotes/${supplierQuoteId}/custom-fields`,
379
+ body: JSON.stringify({
380
+ customFieldValues,
381
+ idType,
382
+ }),
383
+ });
384
+ return data;
385
+ }
386
+ /**
387
+ * ❌ Declines a supplier quote.
388
+ *
389
+ * This function allows the user to decline a specific supplier quote by its unique identifier.
390
+ *
391
+ * 🛠 **Endpoint**: `PUT /v1/shop/supplier-quotes/{supplierQuoteId}/decline`
392
+ *
393
+ * | Parameter | Type | Required | Description |
394
+ * |--------------------|-----------|------------|------------------------------------------------------|
395
+ * | `supplierQuoteId` | `string` | ✅ | The unique identifier of the supplier quote to decline. |
396
+ *
397
+ * 📤 **Returns**:
398
+ * A `Promise` resolving to a `DeclineSupplierQuoteResponse` object, indicating the result of the decline operation.
399
+ *
400
+ * 🛠 **Example usage**:
401
+ * ```ts
402
+ * const response = await declineSupplierQuote({
403
+ * supplierQuoteId: "quote123",
404
+ * });
405
+ *
406
+ * console.log(response);
407
+ * ```
408
+ *
409
+ * @param {DeclineSupplierQuoteParameters} params - The parameters required to decline a supplier quote.
410
+ * @throws {Error} If `supplierQuoteId` is missing.
411
+ * @returns {Promise<DeclineSupplierQuoteResponse>} A promise resolving to the result of the decline operation.
112
412
  */
113
413
  async function declineSupplierQuote({ supplierQuoteId, }) {
114
414
  (0, parameters_validation_1.required)({ supplierQuoteId });
115
415
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
116
- method: "POST",
416
+ method: "PUT",
117
417
  path: `/v1/shop/supplier-quotes/${supplierQuoteId}/decline`,
118
418
  });
119
419
  return data;
120
420
  }
121
421
  /**
122
- * Post message to supplier quote
422
+ * 💬 Posts a message to a supplier quote.
423
+ *
424
+ * This function allows the user to send a message to a specific supplier quote, useful for communication regarding the quote's details.
425
+ *
426
+ * 🛠 **Endpoint**: `POST /v1/shop/supplier-quotes/{supplierQuoteId}/messages`
427
+ *
428
+ * | Parameter | Type | Required | Description |
429
+ * |---------------------|-----------|------------|--------------------------------------------------------------|
430
+ * | `supplierQuoteId` | `string` | ✅ | The unique identifier of the supplier quote to which the message will be sent. |
431
+ * | `message` | `string` | ✅ | The content of the message to be sent to the supplier quote. |
432
+ * | `username` | `string` | ✅ | The username of the person sending the message. |
433
+ *
434
+ * 📤 **Returns**:
435
+ * A `Promise` resolving to a `PostMessageToSupplierQuoteResponse` object, confirming that the message was successfully posted.
436
+ *
437
+ * 🛠 **Example usage**:
438
+ * ```ts
439
+ * const response = await postMessageToSupplierQuote({
440
+ * supplierQuoteId: "quote123",
441
+ * message: "Please review the updated pricing.",
442
+ * username: "admin_user",
443
+ * });
444
+ *
445
+ * console.log(response);
446
+ * ```
447
+ *
448
+ * @param {PostMessageToSupplierQuoteParameters} params - The parameters required to send a message to a supplier quote.
449
+ * @throws {Error} If any of the required parameters (`supplierQuoteId`, `message`, `username`) are missing.
450
+ * @returns {Promise<PostMessageToSupplierQuoteResponse>} A promise resolving to the result of the message posting operation.
123
451
  */
124
452
  async function postMessageToSupplierQuote({ supplierQuoteId, message, username, }) {
125
453
  (0, parameters_validation_1.required)({ supplierQuoteId, message, username });
@@ -130,3 +458,46 @@ async function postMessageToSupplierQuote({ supplierQuoteId, message, username,
130
458
  });
131
459
  return data;
132
460
  }
461
+ /**
462
+ * 📝 Initializes an order from a supplier quote.
463
+ *
464
+ * This function allows you to initialize an order based on a specific supplier quote, specifying which quote lines and quantities should be included in the order. Additionally, it lets you preview a set number of lines before the final order is created.
465
+ *
466
+ * 🛠 **Endpoint**: `POST /v1/shop/supplier-quotes/{supplierQuoteId}/initialize-orders`
467
+ *
468
+ * | Parameter | Type | Required | Description |
469
+ * |-------------------------|---------|------------|----------------------------------------------------------------------|
470
+ * | `supplierQuoteId` | `string`| ✅ | The unique identifier of the supplier quote from which to initialize the order. |
471
+ * | `nbPreviewLines` | `number`| ❌ | The number of lines to fetch in the order response. |
472
+ * | `quoteLineIdsAndQuantities` | `array` | ✅ | A list of quote line IDs along with the respective quantities to be included in the order. |
473
+ *
474
+ * 📤 **Returns**:
475
+ * A `Promise` resolving to an `InitializeOrderFromSupplierQuoteResponse` object, confirming the successful initialization of the order.
476
+ *
477
+ * 🛠 **Example usage**:
478
+ * ```ts
479
+ * const response = await initializeOrderFromSupplierQuote({
480
+ * supplierQuoteId: "quote123",
481
+ * nbPreviewLines: 5,
482
+ * quoteLineIdsAndQuantities: [{ quoteLineId: "line1", quantity: 10 }],
483
+ * });
484
+ *
485
+ * console.log(response);
486
+ * ```
487
+ *
488
+ * @param {InitializeOrderFromSupplierQuoteParameters} params - The parameters required to initialize an order from a supplier quote.
489
+ * @throws {Error} If the required `supplierQuoteId` or `quoteLineIdsAndQuantities` are missing.
490
+ * @returns {Promise<InitializeOrderFromSupplierQuoteResponse>} A promise resolving to the result of the order initialization operation.
491
+ */
492
+ async function initializeOrderFromSupplierQuote({ supplierQuoteId, nbPreviewLines, quoteLineIdsAndQuantities, }) {
493
+ (0, parameters_validation_1.required)({ supplierQuoteId, quoteLineIdsAndQuantities });
494
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
495
+ method: "POST",
496
+ path: `/v1/shop/supplier-quotes/${supplierQuoteId}/initialize-orders`,
497
+ params: {
498
+ nbPreviewLines,
499
+ },
500
+ body: JSON.stringify({ quoteLineIdsAndQuantities }),
501
+ });
502
+ return data;
503
+ }
@@ -4,7 +4,10 @@ import { PageableParameters } from "../../interfaces/models/common";
4
4
  * Request parameters type definitions
5
5
  */
6
6
  export interface GetSuppliersParameters {
7
+ supplierIds: string[];
8
+ idType: SupplierIdType;
7
9
  pageable: PageableParameters;
10
+ supplierStatus: string[];
8
11
  }
9
12
  export interface GetSupplierParameters {
10
13
  supplierId: string;
@@ -1,13 +1,101 @@
1
1
  import { GetSupplierEvaluationsParameters, GetSupplierEvaluationsResponse, GetSupplierParameters, GetSupplierResponse, GetSuppliersParameters, GetSuppliersResponse } from "./definitions";
2
2
  /**
3
- * Get suppliers
3
+ * 📄 Fetches a paginated list of suppliers.
4
+ *
5
+ * This function retrieves a list of suppliers based on the provided pagination parameters.
6
+ * If no specific filters or sorting are provided, it fetches the default paginated list.
7
+ *
8
+ * 🛠 **Endpoint**: `GET /v1/shop/suppliers`
9
+ *
10
+ * | Parameter | Type | Required | Description |
11
+ * |----------------------|-------------------------------|------------|---------------------------------------------------------------|
12
+ * | `pageable.page` | `number` | ✅ | The page number to fetch (0-based index). |
13
+ * | `pageable.size` | `number` | ✅ | The number of items per page. |
14
+ * | `pageable.sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
15
+ * | `supplierStatus` | `string` | ❌ | Available values : ACTIVE, INACTIVE, SUSPENDED |
16
+ * | `supplierIds` | `string[]` | ❌ | Only returns information from its suppliers id |
17
+ * | `idType` | `string[]` | ❌ | Specifies the type of the id (ex: DJUST_ID, EXTERNAL_ID ) |
18
+ *
19
+ * 📤 **Returns**:
20
+ * A `Promise` resolving to a `GetSuppliersResponse` object,
21
+ * containing the paginated list of suppliers with metadata such as total pages, size, and current page.
22
+ *
23
+ * 🛠 **Example usage**:
24
+ * ```ts
25
+ * const suppliers = await getSuppliers({
26
+ * pageable: { page: 0, size: 10, sort: ["createdAt,desc"] },
27
+ * supplierStatus: 'ACTIVE',
28
+ * idType: 'EXTERNAL_ID'
29
+ * });
30
+ *
31
+ * console.log(suppliers);
32
+ * ```
33
+ *
34
+ * @param {GetSuppliersParameters} params - The pagination parameters for fetching suppliers.
35
+ * @throws {Error} If `pageable` is missing or invalid.
36
+ * @returns {Promise<GetSuppliersResponse>} A promise resolving to the paginated suppliers response.
4
37
  */
5
- export declare function getSuppliers({ pageable, }: GetSuppliersParameters): Promise<GetSuppliersResponse>;
38
+ export declare function getSuppliers({ pageable, supplierStatus, supplierIds, idType, }: GetSuppliersParameters): Promise<GetSuppliersResponse>;
6
39
  /**
7
- * Get a supplier
40
+ * 📄 Fetches the details of a specific supplier.
41
+ *
42
+ * This function retrieves detailed information about a supplier, identified by its unique `supplierId` and optional `idType`.
43
+ *
44
+ * 🛠 **Endpoint**: `GET /v1/shop/suppliers/{supplierId}`
45
+ *
46
+ * | Parameter | Type | Required | Description |
47
+ * |----------------|------------|------------|---------------------------------------------------------|
48
+ * | `supplierId` | `string` | ✅ | The unique id of the supplier to fetch. |
49
+ * | `idType` | `string` | ❌ | Specifies the type of the id (ex: DJUST_ID, EXTERNAL_ID)|
50
+ *
51
+ * 📤 **Returns**:
52
+ * A `Promise` resolving to a `GetSupplierResponse` object, containing the details of the supplier.
53
+ *
54
+ * 🛠 **Example usage**:
55
+ * ```ts
56
+ * const supplier = await getSupplier({ supplierId: "supplier123", idType: "DJUST_ID" });
57
+ *
58
+ * console.log(supplier);
59
+ * ```
60
+ *
61
+ * @param {GetSupplierParameters} params - The parameters for fetching the supplier details.
62
+ * @throws {Error} If `supplierId` is missing.
63
+ * @returns {Promise<GetSupplierResponse>} A promise resolving to the supplier details.
8
64
  */
9
65
  export declare function getSupplier({ supplierId, idType, }: GetSupplierParameters): Promise<GetSupplierResponse>;
10
66
  /**
11
- * Get supplier evaluations
67
+ * 📄 Fetches evaluations for a specific supplier.
68
+ *
69
+ * This function retrieves a list of evaluations associated with a supplier, identified by its `supplierId`.
70
+ * Pagination and sorting options are available to refine the results.
71
+ *
72
+ * 🛠 **Endpoint**: `GET /v1/shop/suppliers/{supplierId}/evaluations`
73
+ *
74
+ * | Parameter | Type | Required | Description |
75
+ * |----------------------|-------------------------------|------------|---------------------------------------------------------------|
76
+ * | `supplierId` | `string` | ✅ | The unique id of the supplier. |
77
+ * | `idType` | `string` | ❌ | Specifies the type of the id (ex: DJUST_ID, EXTERNAL_ID) |
78
+ * | `pageable.page` | `number` | ✅ | The page number to fetch (0-based index). |
79
+ * | `pageable.size` | `number` | ✅ | The number of items per page. |
80
+ * | `pageable.sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
81
+ *
82
+ * 📤 **Returns**:
83
+ * A `Promise` resolving to a `GetSupplierEvaluationsResponse` object,
84
+ * containing the paginated list of supplier evaluations with metadata.
85
+ *
86
+ * 🛠 **Example usage**:
87
+ * ```ts
88
+ * const evaluations = await getSupplierEvaluations({
89
+ * supplierId: "supplier123",
90
+ * idType: "EXTERNAL_ID",
91
+ * pageable: { page: 1, size: 10, sort: ["createdAt,desc"] },
92
+ * });
93
+ *
94
+ * console.log(evaluations);
95
+ * ```
96
+ *
97
+ * @param {GetSupplierEvaluationsParameters} params - The parameters for fetching supplier evaluations.
98
+ * @throws {Error} If `supplierId` or `pageable` is missing.
99
+ * @returns {Promise<GetSupplierEvaluationsResponse>} A promise resolving to the supplier evaluations response.
12
100
  */
13
101
  export declare function getSupplierEvaluations({ supplierId, idType, pageable, }: GetSupplierEvaluationsParameters): Promise<GetSupplierEvaluationsResponse>;