linxcommerce-webapi-sdk 1.0.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.
package/dist/index.mjs ADDED
@@ -0,0 +1,4586 @@
1
+ // src/services/customers/customers-service.ts
2
+ import { z as z13 } from "zod";
3
+
4
+ // src/http/handlers/handler-chain.ts
5
+ var RequestHandlerChain = class {
6
+ constructor() {
7
+ /** Array of handlers in the chain */
8
+ this.handlers = [];
9
+ }
10
+ /**
11
+ * Adds a handler to the end of the chain.
12
+ * Links the new handler to the previous one in the chain.
13
+ * @param handler - The request handler to add
14
+ */
15
+ addHandler(handler) {
16
+ if (this.handlers.length > 0) {
17
+ const previousHandler = this.handlers[this.handlers.length - 1];
18
+ previousHandler.next = handler;
19
+ }
20
+ this.handlers.push(handler);
21
+ }
22
+ /**
23
+ * Executes the handler chain for a standard request.
24
+ * @template T - The expected response data type
25
+ * @param request - The HTTP request to process
26
+ * @returns A promise that resolves to the HTTP response
27
+ * @throws Error if no handlers are added to the chain
28
+ */
29
+ async callChain(request) {
30
+ if (!this.handlers.length) {
31
+ throw new Error("No handlers added to the chain");
32
+ }
33
+ return this.handlers[0].handle(request);
34
+ }
35
+ /**
36
+ * Executes the handler chain for a streaming request.
37
+ * @template T - The expected response data type for each chunk
38
+ * @param request - The HTTP request to process
39
+ * @returns An async generator that yields HTTP responses
40
+ * @throws Error if no handlers are added to the chain
41
+ */
42
+ async *streamChain(request) {
43
+ if (!this.handlers.length) {
44
+ throw new Error("No handlers added to the chain");
45
+ }
46
+ yield* this.handlers[0].stream(request);
47
+ }
48
+ };
49
+
50
+ // src/http/error.ts
51
+ var HttpError = class extends Error {
52
+ /**
53
+ * Creates a new HTTP error.
54
+ * @param metadata - HTTP response metadata
55
+ * @param raw - Raw response object (optional)
56
+ * @param error - Custom error message (optional, defaults to status text)
57
+ */
58
+ constructor(metadata, raw, error) {
59
+ super(error);
60
+ this.error = metadata.statusText;
61
+ this.metadata = metadata;
62
+ this.raw = raw;
63
+ }
64
+ };
65
+
66
+ // src/http/hooks/custom-hook.ts
67
+ var CustomHook = class {
68
+ /**
69
+ * Called before an HTTP request is sent.
70
+ * Default implementation returns the request unchanged.
71
+ * @param request - The HTTP request to be sent
72
+ * @param params - Additional custom parameters
73
+ * @returns A promise that resolves to the unmodified request
74
+ */
75
+ async beforeRequest(request, params) {
76
+ return request;
77
+ }
78
+ /**
79
+ * Called after a successful HTTP response is received.
80
+ * Default implementation returns the response unchanged.
81
+ * @param request - The original HTTP request
82
+ * @param response - The HTTP response received
83
+ * @param params - Additional custom parameters
84
+ * @returns A promise that resolves to the unmodified response
85
+ */
86
+ async afterResponse(request, response, params) {
87
+ return response;
88
+ }
89
+ /**
90
+ * Called when an HTTP request results in an error.
91
+ * Default implementation wraps the error response in an HttpError object.
92
+ * @param request - The original HTTP request
93
+ * @param response - The error response received
94
+ * @param params - Additional custom parameters
95
+ * @returns A promise that resolves to an HttpError object
96
+ */
97
+ async onError(request, response, params) {
98
+ return new HttpError(response.metadata, response.raw);
99
+ }
100
+ };
101
+
102
+ // src/http/serialization/base-serializer.ts
103
+ var Serializer = class {
104
+ /**
105
+ * Serializes a parameter value based on its type and serialization style.
106
+ * @param param - The request parameter to serialize
107
+ * @returns The serialized string representation
108
+ */
109
+ serializeValue(param) {
110
+ if (Array.isArray(param.value)) {
111
+ return this.serializeArray(param.value, param);
112
+ }
113
+ if (this.isNonNullObject(param.value)) {
114
+ return this.serializeObject(param.value, param);
115
+ }
116
+ return this.serializePrimitive(param);
117
+ }
118
+ /**
119
+ * Serializes a primitive value (string, number, boolean).
120
+ * @param param - The request parameter containing the primitive value
121
+ * @returns The serialized primitive string
122
+ */
123
+ serializePrimitive(param) {
124
+ if (param.style === "label" /* LABEL */) {
125
+ return `.${param.value}`;
126
+ } else if (param.style === "matrix" /* MATRIX */) {
127
+ return `;${param.key}=${param.value}`;
128
+ } else if (param.style === "form" /* FORM */) {
129
+ return `${encodeURIComponent(param.key || "")}=${encodeURIComponent(`${param.value}`)}`;
130
+ }
131
+ return `${param.value}`;
132
+ }
133
+ /**
134
+ * Serializes an array value according to the specified style.
135
+ * @param value - The array to serialize
136
+ * @param param - The request parameter configuration
137
+ * @returns The serialized array string
138
+ */
139
+ serializeArray(value, param) {
140
+ if (param.explode) {
141
+ this.serializeArrayExploded(value, param);
142
+ return this.serializeArrayExploded(value, param);
143
+ }
144
+ if (param.style === "simple" /* SIMPLE */) {
145
+ return `${value.join(",")}`;
146
+ } else if (param.style === "label" /* LABEL */) {
147
+ return `.${value.join(",")}`;
148
+ } else if (param.style === "matrix" /* MATRIX */) {
149
+ return `;${param.key}=${value.join(",")}`;
150
+ } else if (param.style === "form" /* FORM */) {
151
+ return `${encodeURIComponent(param.key || "")}=${encodeURIComponent(value.join(","))}`;
152
+ } else if (param.style === "space_delimited" /* SPACE_DELIMITED */) {
153
+ return `${param.key}=${value.join(" ")}`;
154
+ } else if (param.style === "pipe_delimited" /* PIPE_DELIMITED */) {
155
+ return `${param.key}=${value.join("|")}`;
156
+ }
157
+ return `${value.join(",")}`;
158
+ }
159
+ /**
160
+ * Serializes an array in exploded format where each value is a separate parameter.
161
+ * @param value - The array to serialize
162
+ * @param param - The request parameter configuration
163
+ * @returns The serialized exploded array string
164
+ */
165
+ serializeArrayExploded(value, param) {
166
+ if (param.style === "simple" /* SIMPLE */) {
167
+ return value.map((val) => `${val}`).join(",");
168
+ } else if (param.style === "label" /* LABEL */) {
169
+ return value.map((val) => `.${val}`).join("");
170
+ } else if (param.style === "matrix" /* MATRIX */) {
171
+ return value.map((val) => `;${param.key}=${val}`).join("");
172
+ } else if (param.style === "form" /* FORM */ || param.style === "space_delimited" /* SPACE_DELIMITED */ || param.style === "pipe_delimited" /* PIPE_DELIMITED */) {
173
+ return value.map((val) => `${encodeURIComponent(param.key || "")}=${encodeURIComponent(`${val}`)}`).join("&");
174
+ }
175
+ return `${value.join(",")}`;
176
+ }
177
+ /**
178
+ * Serializes an object value according to the specified style.
179
+ * @param obj - The object to serialize
180
+ * @param param - The request parameter configuration
181
+ * @returns The serialized object string
182
+ */
183
+ serializeObject(obj, param) {
184
+ if (param.explode) {
185
+ if (param.style === "simple" /* SIMPLE */) {
186
+ return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join(",");
187
+ } else if (param.style === "label" /* LABEL */) {
188
+ return Object.entries(obj).map(([key, val]) => `.${key}=${val}`).join("");
189
+ } else if (param.style === "matrix" /* MATRIX */) {
190
+ return Object.entries(obj).map(([key, val]) => `;${key}=${val}`).join("");
191
+ } else if (param.style === "form" /* FORM */) {
192
+ return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join("&");
193
+ }
194
+ }
195
+ if (param.style === "simple" /* SIMPLE */) {
196
+ return Object.entries(obj).map(([key, val]) => `${key},${val}`).join(",");
197
+ } else if (param.style === "label" /* LABEL */) {
198
+ return `.${Object.entries(obj).map(([key, val]) => `${key},${val}`).join(",")}`;
199
+ } else if (param.style === "matrix" /* MATRIX */) {
200
+ return `;${param.key}=${Object.entries(obj).map(([key, val]) => `${key},${val}`).join(",")}`;
201
+ } else if (param.style === "form" /* FORM */) {
202
+ return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join("&");
203
+ } else if (param.style === "deep_object" /* DEEP_OBJECT */) {
204
+ return Object.entries(obj).map(([key, val]) => {
205
+ return `${param.key}[${key}]=${val}`;
206
+ }).join("&");
207
+ }
208
+ return Object.entries(obj).map(([key, val]) => `${key}=${val}`).join("&");
209
+ }
210
+ /**
211
+ * Type guard to check if a value is a non-null object.
212
+ * @param value - The value to check
213
+ * @returns True if the value is an object and not null
214
+ */
215
+ isNonNullObject(value) {
216
+ return typeof value === "object" && value !== null;
217
+ }
218
+ };
219
+
220
+ // src/http/transport/transport-hook-adapter.ts
221
+ var TransportHookAdapter = class {
222
+ constructor() {
223
+ this.hook = new CustomHook();
224
+ }
225
+ /**
226
+ * Invokes the custom hook before sending the request.
227
+ * Converts the Request to HttpRequest format, calls the hook, then converts back.
228
+ *
229
+ * @param request - The internal Request object
230
+ * @param params - Additional parameters to pass to the hook
231
+ * @returns The modified Request after hook processing
232
+ */
233
+ async beforeRequest(request, params) {
234
+ const hookRequest = this.requestToHookRequest(request);
235
+ const newRequest = await this.hook.beforeRequest(hookRequest, params);
236
+ const newTransportRequest = request.copy({
237
+ baseUrl: newRequest.baseUrl,
238
+ method: newRequest.method,
239
+ path: newRequest.path,
240
+ body: newRequest.body,
241
+ queryParams: this.hookParamsToTransportParams(
242
+ newRequest.queryParams,
243
+ request.queryParams,
244
+ true
245
+ ),
246
+ headers: this.hookParamsToTransportParams(newRequest.headers, request.headers, false),
247
+ pathParams: this.hookParamsToTransportParams(newRequest.pathParams, request.headers, false)
248
+ });
249
+ return newTransportRequest;
250
+ }
251
+ /**
252
+ * Invokes the custom hook after receiving a response.
253
+ * Converts the Request to HttpRequest format and calls the hook with the response.
254
+ *
255
+ * @param request - The internal Request object
256
+ * @param response - The HTTP response received
257
+ * @param params - Additional parameters to pass to the hook
258
+ * @returns The potentially modified response after hook processing
259
+ */
260
+ async afterResponse(request, response, params) {
261
+ const hookRequest = this.requestToHookRequest(request);
262
+ return this.hook.afterResponse(hookRequest, response, params);
263
+ }
264
+ /**
265
+ * Invokes the custom hook when an error occurs.
266
+ * Converts the Request to HttpRequest format and calls the error hook.
267
+ *
268
+ * @param request - The internal Request object
269
+ * @param response - The HTTP response that triggered the error
270
+ * @param params - Additional parameters to pass to the hook
271
+ * @returns The HttpError from the hook
272
+ */
273
+ async onError(request, response, params) {
274
+ const hookRequest = this.requestToHookRequest(request);
275
+ return this.hook.onError(hookRequest, response, params);
276
+ }
277
+ /**
278
+ * Converts the internal Request representation to the hook's HttpRequest format.
279
+ * Extracts parameter values from RequestParameter wrappers.
280
+ *
281
+ * @param request - The internal Request object
282
+ * @returns An HttpRequest object for hook processing
283
+ */
284
+ requestToHookRequest(request) {
285
+ const hookHeaders = /* @__PURE__ */ new Map();
286
+ request.headers.forEach((header, key) => {
287
+ hookHeaders.set(key, header.value);
288
+ });
289
+ const hookQueryParams = /* @__PURE__ */ new Map();
290
+ request.queryParams.forEach((queryParam, key) => {
291
+ hookQueryParams.set(key, queryParam.value);
292
+ });
293
+ const hookPathParams = /* @__PURE__ */ new Map();
294
+ request.pathParams.forEach((pathParam, key) => {
295
+ hookPathParams.set(key, pathParam.value);
296
+ });
297
+ const hookRequest = {
298
+ baseUrl: request.baseUrl,
299
+ method: request.method,
300
+ path: request.path,
301
+ headers: hookHeaders,
302
+ body: request.body,
303
+ queryParams: hookQueryParams,
304
+ pathParams: hookPathParams
305
+ };
306
+ return hookRequest;
307
+ }
308
+ /**
309
+ * Converts hook parameter maps back to RequestParameter format.
310
+ * Preserves serialization metadata from the original parameters.
311
+ *
312
+ * @template T - The parameter value type
313
+ * @param hookParams - The parameter map from hook processing
314
+ * @param originalTransportParams - The original RequestParameter map for metadata
315
+ * @param encode - Whether to encode the parameters
316
+ * @returns A map of RequestParameter objects for transport
317
+ */
318
+ hookParamsToTransportParams(hookParams, originalTransportParams, encode) {
319
+ const transportParams = /* @__PURE__ */ new Map();
320
+ hookParams.forEach((hookParamValue, hookParamKey) => {
321
+ var _a, _b, _c, _d, _e;
322
+ const requestParam = originalTransportParams.get(hookParamKey);
323
+ transportParams.set(hookParamKey, {
324
+ key: hookParamKey,
325
+ value: hookParamValue,
326
+ encode: (_a = requestParam == null ? void 0 : requestParam.encode) != null ? _a : false,
327
+ style: (requestParam == null ? void 0 : requestParam.style) || "none" /* NONE */,
328
+ explode: (_b = requestParam == null ? void 0 : requestParam.explode) != null ? _b : false,
329
+ isLimit: (_c = requestParam == null ? void 0 : requestParam.isLimit) != null ? _c : false,
330
+ isOffset: (_d = requestParam == null ? void 0 : requestParam.isOffset) != null ? _d : false,
331
+ isCursor: (_e = requestParam == null ? void 0 : requestParam.isCursor) != null ? _e : false
332
+ });
333
+ });
334
+ return transportParams;
335
+ }
336
+ };
337
+
338
+ // src/http/utils/content-type.ts
339
+ function getContentTypeDefinition(contentType) {
340
+ const ct = contentType.toLowerCase();
341
+ if (ct.startsWith("application/") && ct.includes("xml")) {
342
+ return "xml" /* Xml */;
343
+ }
344
+ if (ct === "application/x-www-form-urlencoded") {
345
+ return "form" /* FormUrlEncoded */;
346
+ }
347
+ if (ct === "text/event-stream") {
348
+ return "eventStream" /* EventStream */;
349
+ }
350
+ if (ct === "application/json" || ct === "text/json" || ct.includes("+json")) {
351
+ return "json" /* Json */;
352
+ }
353
+ if (ct === "application/javascript") {
354
+ return "text" /* Text */;
355
+ }
356
+ if (ct.startsWith("text/")) {
357
+ return "text" /* Text */;
358
+ }
359
+ if (ct === "image/svg+xml") {
360
+ return "text" /* Text */;
361
+ }
362
+ if (ct.startsWith("image/")) {
363
+ return "image" /* Image */;
364
+ }
365
+ if (ct === "application/octet-stream" || ct === "application/pdf") {
366
+ return "binary" /* Binary */;
367
+ }
368
+ if (ct === "*/*") {
369
+ return "binary" /* Binary */;
370
+ }
371
+ return "binary" /* Binary */;
372
+ }
373
+
374
+ // src/http/handlers/hook-handler.ts
375
+ var HookHandler = class {
376
+ constructor(hook) {
377
+ this.hook = hook;
378
+ }
379
+ /**
380
+ * Handles a standard HTTP request with hook invocation.
381
+ * Calls beforeRequest hook, processes the request, and calls afterResponse or onError hooks.
382
+ * @template T - The expected response data type
383
+ * @param request - The HTTP request to process
384
+ * @returns A promise that resolves to the HTTP response
385
+ * @throws Error if no next handler is set, or if error handling fails
386
+ */
387
+ async handle(request) {
388
+ var _a;
389
+ if (!this.next) {
390
+ throw new Error("No next handler set in hook handler.");
391
+ }
392
+ const hook = new TransportHookAdapter();
393
+ const hookParams = this.getHookParams(request);
394
+ const nextRequest = await hook.beforeRequest(request, hookParams);
395
+ const response = await this.next.handle(nextRequest);
396
+ if (response.metadata.status < 400) {
397
+ return await hook.afterResponse(nextRequest, response, hookParams);
398
+ }
399
+ const arrayBuffer = response.raw;
400
+ const rawContentType = ((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.toLocaleLowerCase()) || "";
401
+ const contentType = getContentTypeDefinition(rawContentType);
402
+ const statusCode = response.metadata.status;
403
+ const error = request.errors.find((error2) => {
404
+ return error2.contentType === contentType && error2.status === statusCode;
405
+ });
406
+ if (error) {
407
+ const decodedBody2 = new TextDecoder().decode(arrayBuffer);
408
+ const json = JSON.parse(decodedBody2);
409
+ const customError = new error.error((json == null ? void 0 : json.message) || "", json);
410
+ customError.metadata = response.metadata;
411
+ customError.throw();
412
+ }
413
+ const decodedBody = new TextDecoder().decode(arrayBuffer);
414
+ throw new HttpError(
415
+ response.metadata,
416
+ arrayBuffer,
417
+ `Unexpected response body for error status.
418
+ StatusCode: ${response.metadata.status}
419
+ Body: ${decodedBody}`
420
+ );
421
+ }
422
+ /**
423
+ * Handles a streaming HTTP request with hook invocation.
424
+ * Calls beforeRequest hook and afterResponse/onError hooks for each chunk.
425
+ * @template T - The expected response data type for each chunk
426
+ * @param request - The HTTP request to process
427
+ * @returns An async generator that yields HTTP responses
428
+ * @throws Error if no next handler is set, or if error handling fails
429
+ */
430
+ async *stream(request) {
431
+ if (!this.next) {
432
+ throw new Error("No next handler set in hook handler.");
433
+ }
434
+ const hook = new TransportHookAdapter();
435
+ const hookParams = this.getHookParams(request);
436
+ const nextRequest = await hook.beforeRequest(request, hookParams);
437
+ const stream = this.next.stream(nextRequest);
438
+ for await (const response of stream) {
439
+ if (response.metadata.status < 400) {
440
+ yield await hook.afterResponse(nextRequest, response, hookParams);
441
+ } else {
442
+ throw await hook.onError(nextRequest, response, hookParams);
443
+ }
444
+ }
445
+ }
446
+ /**
447
+ * Extracts hook parameters from the request configuration.
448
+ * @template T - The response data type
449
+ * @param request - The HTTP request
450
+ * @returns A map of hook parameter names to values
451
+ */
452
+ getHookParams(_request) {
453
+ const hookParams = /* @__PURE__ */ new Map();
454
+ return hookParams;
455
+ }
456
+ };
457
+
458
+ // src/http/handlers/response-validation-handler.ts
459
+ import { ZodUndefined } from "zod";
460
+
461
+ // src/http/utils/response-matcher.ts
462
+ var ResponseMatcher = class {
463
+ /**
464
+ * Creates a new response matcher.
465
+ * @param responses - Array of possible response definitions for an endpoint
466
+ */
467
+ constructor(responses) {
468
+ this.responses = responses;
469
+ }
470
+ /**
471
+ * Finds the matching response definition for an HTTP response.
472
+ * Matches based on status code and content type from the response headers.
473
+ * @param response - The HTTP response to match
474
+ * @returns The matching response definition, or undefined if no match found
475
+ */
476
+ getResponseDefinition(response) {
477
+ var _a;
478
+ const rawContentType = ((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.toLocaleLowerCase()) || "";
479
+ const contentType = getContentTypeDefinition(rawContentType);
480
+ const statusCode = response.metadata.status;
481
+ if (!this.responses.length) {
482
+ return;
483
+ }
484
+ if (this.responses.length === 1) {
485
+ return this.responses[0];
486
+ }
487
+ return this.responses.find((response2) => {
488
+ return response2.contentType === contentType && response2.status === statusCode;
489
+ });
490
+ }
491
+ };
492
+
493
+ // src/http/handlers/response-validation-handler.ts
494
+ var ResponseValidationHandler = class {
495
+ /**
496
+ * Handles a standard HTTP request and validates its response.
497
+ * @template T - The expected response data type
498
+ * @param request - The HTTP request to process
499
+ * @returns A promise that resolves to the validated HTTP response
500
+ */
501
+ async handle(request) {
502
+ const response = await this.next.handle(request);
503
+ return this.decodeBody(request, response);
504
+ }
505
+ /**
506
+ * Handles a streaming HTTP request and validates response chunks.
507
+ * @template T - The expected response data type for each chunk
508
+ * @param request - The HTTP request to process
509
+ * @returns An async generator that yields validated HTTP responses
510
+ * @throws Error if response headers are enabled (streaming not supported with headers)
511
+ */
512
+ async *stream(request) {
513
+ const stream = this.next.stream(request);
514
+ for await (const response of stream) {
515
+ const responseChunks = this.splitByDataChunks(response);
516
+ for (const chunk of responseChunks) {
517
+ yield this.decodeBody(request, chunk);
518
+ }
519
+ }
520
+ }
521
+ splitByDataChunks(response) {
522
+ var _a;
523
+ if (!((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.includes("text/event-stream"))) {
524
+ return [response];
525
+ }
526
+ const text = new TextDecoder().decode(response.raw);
527
+ const encoder = new TextEncoder();
528
+ return text.split("\n").filter((line) => line.startsWith("data: ")).map((part) => ({
529
+ ...response,
530
+ raw: encoder.encode(part).buffer
531
+ }));
532
+ }
533
+ decodeBody(request, response) {
534
+ var _a;
535
+ const responseMatcher = new ResponseMatcher(request.responses);
536
+ const responseDefinition = responseMatcher.getResponseDefinition(response);
537
+ if (!responseDefinition || !this.hasContent(responseDefinition, response)) {
538
+ return response;
539
+ }
540
+ const contentType = responseDefinition.contentType;
541
+ const contentTypeHandlers = {
542
+ ["binary" /* Binary */]: this.decodeFile,
543
+ ["image" /* Image */]: this.decodeFile,
544
+ ["multipartFormData" /* MultipartFormData */]: this.decodeMultipartFormData,
545
+ ["text" /* Text */]: this.decodeText,
546
+ ["xml" /* Xml */]: this.decodeText,
547
+ ["form" /* FormUrlEncoded */]: this.decodeFormUrlEncoded,
548
+ ["eventStream" /* EventStream */]: this.decodeEventStream
549
+ };
550
+ if (contentTypeHandlers[contentType]) {
551
+ return contentTypeHandlers[contentType].call(this, request, responseDefinition, response);
552
+ }
553
+ if ((_a = response.metadata.headers["content-type"]) == null ? void 0 : _a.includes("text/event-stream")) {
554
+ return this.decodeEventStream(request, responseDefinition, response);
555
+ }
556
+ return this.decodeJson(request, responseDefinition, response);
557
+ }
558
+ decodeFile(request, responseDefinition, response) {
559
+ return {
560
+ ...response,
561
+ data: this.validate(request, responseDefinition, response.raw)
562
+ };
563
+ }
564
+ decodeMultipartFormData(request, responseDefinition, response) {
565
+ const formData = this.fromFormData(response.raw);
566
+ return {
567
+ ...response,
568
+ data: this.validate(request, responseDefinition, formData)
569
+ };
570
+ }
571
+ decodeText(request, responseDefinition, response) {
572
+ const decodedBody = new TextDecoder().decode(response.raw);
573
+ return {
574
+ ...response,
575
+ data: this.validate(request, responseDefinition, decodedBody)
576
+ };
577
+ }
578
+ decodeFormUrlEncoded(request, responseDefinition, response) {
579
+ const decodedBody = new TextDecoder().decode(response.raw);
580
+ const urlEncoded = this.fromUrlEncoded(decodedBody);
581
+ return {
582
+ ...response,
583
+ data: this.validate(request, responseDefinition, urlEncoded)
584
+ };
585
+ }
586
+ decodeEventStream(request, responseDefinition, response) {
587
+ let decodedBody = new TextDecoder().decode(response.raw);
588
+ if (decodedBody.startsWith("data: ")) {
589
+ decodedBody = decodedBody.substring(6);
590
+ }
591
+ const json = JSON.parse(decodedBody);
592
+ return {
593
+ ...response,
594
+ data: this.validate(request, responseDefinition, json)
595
+ };
596
+ }
597
+ decodeJson(request, responseDefinition, response) {
598
+ const decodedBody = new TextDecoder().decode(response.raw);
599
+ const json = JSON.parse(decodedBody);
600
+ return {
601
+ ...response,
602
+ data: this.validate(request, responseDefinition, json)
603
+ };
604
+ }
605
+ /**
606
+ * Validates response data against the expected schema if validation is enabled.
607
+ * @template T - The expected data type
608
+ * @param request - The HTTP request containing validation settings
609
+ * @param response - The response definition with schema
610
+ * @param data - The data to validate
611
+ * @returns The validated data (parsed if validation enabled, raw otherwise)
612
+ */
613
+ validate(request, response, data) {
614
+ var _a, _b;
615
+ if ((_b = (_a = request.config.validation) == null ? void 0 : _a.responseValidation) != null ? _b : true) {
616
+ return response.schema.parse(data);
617
+ }
618
+ return data;
619
+ }
620
+ /**
621
+ * Checks if a response should contain data based on its schema and status.
622
+ * @template T - The response data type
623
+ * @param responseDefinition - The response definition
624
+ * @param response - The HTTP response
625
+ * @returns True if the response should have content, false otherwise
626
+ */
627
+ hasContent(responseDefinition, response) {
628
+ return !!responseDefinition.schema && !(responseDefinition.schema instanceof ZodUndefined) && response.metadata.status !== 204;
629
+ }
630
+ /**
631
+ * Parses URL-encoded data into an object.
632
+ * @param urlEncodedData - The URL-encoded string
633
+ * @returns An object with decoded key-value pairs
634
+ */
635
+ fromUrlEncoded(urlEncodedData) {
636
+ const pairs = urlEncodedData.split("&");
637
+ const result = {};
638
+ pairs.forEach((pair) => {
639
+ const [key, value] = pair.split("=");
640
+ if (key && value !== void 0) {
641
+ result[decodeURIComponent(key)] = decodeURIComponent(value);
642
+ }
643
+ });
644
+ return result;
645
+ }
646
+ /**
647
+ * Parses multipart form data into an object.
648
+ * @param arrayBuffer - The raw form data as ArrayBuffer
649
+ * @returns An object with form field names and values
650
+ */
651
+ fromFormData(arrayBuffer) {
652
+ const decoder = new TextDecoder();
653
+ const text = decoder.decode(arrayBuffer);
654
+ const boundary = text.split("\r\n")[0];
655
+ const parts = text.split(boundary).slice(1, -1);
656
+ const formDataObj = {};
657
+ parts.forEach((part) => {
658
+ const [header, value] = part.split("\r\n\r\n");
659
+ const nameMatch = header.match(/name="([^"]+)"/);
660
+ if (nameMatch) {
661
+ const name = nameMatch[1].trim();
662
+ formDataObj[name] = (value == null ? void 0 : value.trim()) || "";
663
+ }
664
+ });
665
+ return formDataObj;
666
+ }
667
+ };
668
+
669
+ // src/http/handlers/request-validation-handler.ts
670
+ import { ZodError } from "zod";
671
+
672
+ // src/http/errors/validation-error.ts
673
+ var ValidationError = class extends Error {
674
+ /**
675
+ * Creates a new validation error from a Zod error.
676
+ * @param zodError - The Zod validation error containing issue details
677
+ * @param object - The object that failed validation
678
+ */
679
+ constructor(zodError, object) {
680
+ let actual;
681
+ try {
682
+ actual = JSON.stringify(object, void 0, 2);
683
+ } catch (err) {
684
+ actual = object;
685
+ }
686
+ const error = [
687
+ `ValidationError:`,
688
+ ...zodError.issues.map(
689
+ (issue) => ` Property: ${issue.path.join(".")}. Message: ${issue.message}`
690
+ ),
691
+ " Validated:",
692
+ ...actual.split("\n").map((line) => ` ${line}`)
693
+ ].join("\n");
694
+ super(error);
695
+ this.error = error;
696
+ }
697
+ };
698
+
699
+ // src/http/handlers/request-validation-handler.ts
700
+ var RequestValidationHandler = class {
701
+ /**
702
+ * Handles a standard HTTP request with validation.
703
+ * @template T - The expected response data type
704
+ * @param request - The HTTP request to validate
705
+ * @returns A promise that resolves to the HTTP response
706
+ * @throws Error if no next handler is set
707
+ */
708
+ async handle(request) {
709
+ if (!this.next) {
710
+ throw new Error("No next handler set in ContentTypeHandler.");
711
+ }
712
+ this.validateRequest(request);
713
+ return this.next.handle(request);
714
+ }
715
+ /**
716
+ * Handles a streaming HTTP request with validation.
717
+ * @template T - The expected response data type for each chunk
718
+ * @param request - The HTTP request to validate
719
+ * @returns An async generator that yields HTTP responses
720
+ * @throws Error if no next handler is set
721
+ */
722
+ async *stream(request) {
723
+ if (!this.next) {
724
+ throw new Error("No next handler set in ContentTypeHandler.");
725
+ }
726
+ this.validateRequest(request);
727
+ yield* this.next.stream(request);
728
+ }
729
+ /**
730
+ * Validates and serializes the request body based on its content type.
731
+ * @param request - The HTTP request to validate
732
+ * @throws ValidationError if Zod schema validation fails
733
+ */
734
+ validateRequest(request) {
735
+ var _a, _b;
736
+ if (request.requestContentType === "json" /* Json */) {
737
+ try {
738
+ const parsedBody = (_a = request.requestSchema) == null ? void 0 : _a.parse(request.body);
739
+ request.body = JSON.stringify(parsedBody);
740
+ } catch (error) {
741
+ if (error instanceof ZodError) {
742
+ throw new ValidationError(error, request.body);
743
+ }
744
+ throw error;
745
+ }
746
+ } else if (request.requestContentType === "xml" /* Xml */ || request.requestContentType === "text" /* Text */ || request.requestContentType === "image" /* Image */ || request.requestContentType === "binary" /* Binary */) {
747
+ request.body = request.body;
748
+ } else if (request.requestContentType === "form" /* FormUrlEncoded */) {
749
+ request.body = this.toFormUrlEncoded(request);
750
+ } else if (request.requestContentType === "multipartFormData" /* MultipartFormData */) {
751
+ request.body = this.toFormData(request.body, request.filename, request.filenames);
752
+ } else {
753
+ request.body = JSON.stringify((_b = request.requestSchema) == null ? void 0 : _b.parse(request.body));
754
+ }
755
+ }
756
+ /**
757
+ * Converts request body to URL-encoded form data format.
758
+ * @param request - The HTTP request with body to convert
759
+ * @returns URL-encoded string representation of the body
760
+ */
761
+ toFormUrlEncoded(request) {
762
+ var _a;
763
+ if (request.body === void 0) {
764
+ return "";
765
+ }
766
+ if (typeof request.body === "string") {
767
+ return request.body;
768
+ }
769
+ if (request.body instanceof URLSearchParams) {
770
+ return request.body.toString();
771
+ }
772
+ const validatedBody = (_a = request.requestSchema) == null ? void 0 : _a.parse(request.body);
773
+ if (validatedBody instanceof FormData) {
774
+ const params = new URLSearchParams();
775
+ validatedBody.forEach((value, key) => {
776
+ if (value != null) {
777
+ params.append(key, value.toString());
778
+ }
779
+ });
780
+ return params.toString();
781
+ }
782
+ if (typeof validatedBody === "object" && !Array.isArray(validatedBody)) {
783
+ const params = new URLSearchParams();
784
+ for (const [key, value] of Object.entries(validatedBody)) {
785
+ if (value != null) {
786
+ params.append(key, `${value}`);
787
+ }
788
+ }
789
+ return params.toString();
790
+ }
791
+ return "";
792
+ }
793
+ /**
794
+ * Converts request body to multipart form data format.
795
+ * Handles files (ArrayBuffer), arrays, and regular values.
796
+ * @param body - The request body object
797
+ * @param filename - Optional filename for single file uploads
798
+ * @param filenames - Optional filenames array for array of file uploads
799
+ * @returns FormData object with serialized body
800
+ */
801
+ toFormData(body, filename, filenames) {
802
+ const formData = new FormData();
803
+ Object.keys(body).forEach((key) => {
804
+ const value = body[key];
805
+ if (Array.isArray(value)) {
806
+ value.forEach((v, i) => {
807
+ if (v instanceof ArrayBuffer) {
808
+ const fileFilename = filenames && filenames[i] ? filenames[i] : `${key}[${i}]`;
809
+ formData.append(`${key}[${i}]`, new Blob([v]), fileFilename);
810
+ } else {
811
+ formData.append(`${key}[${i}]`, v);
812
+ }
813
+ });
814
+ } else if (value instanceof ArrayBuffer) {
815
+ const fileFilename = filename || key;
816
+ formData.append(key, new Blob([value]), fileFilename);
817
+ } else {
818
+ formData.append(key, value);
819
+ }
820
+ });
821
+ return formData;
822
+ }
823
+ };
824
+
825
+ // src/http/utils/line-decoder.ts
826
+ var LineDecoder = class {
827
+ constructor() {
828
+ this.lineBuffer = "";
829
+ this.decoder = new TextDecoder();
830
+ this.encoder = new TextEncoder();
831
+ }
832
+ /**
833
+ * Splits the given chunk into lines.
834
+ * Stores incomplete lines in a buffer and returns them when the next chunk arrives.
835
+ *
836
+ * @param chunk - The data chunk to split into lines
837
+ * @returns An array of complete lines as Uint8Array
838
+ */
839
+ splitLines(chunk) {
840
+ this.lineBuffer += this.decoder.decode(chunk);
841
+ let lineEndIndex;
842
+ const lines = [];
843
+ while ((lineEndIndex = this.lineBuffer.indexOf("\n")) >= 0) {
844
+ const line = this.lineBuffer.slice(0, lineEndIndex + 1);
845
+ this.lineBuffer = this.lineBuffer.slice(lineEndIndex + 1);
846
+ if (line.length > 1) {
847
+ lines.push(this.encoder.encode(line));
848
+ }
849
+ }
850
+ return lines;
851
+ }
852
+ /**
853
+ * Returns the remaining lines in the buffer.
854
+ * Call this after the stream ends to get any incomplete final line.
855
+ *
856
+ * @returns An array containing the buffered line, or empty if buffer is empty
857
+ */
858
+ flush() {
859
+ if (this.lineBuffer.length === 0) {
860
+ return [];
861
+ }
862
+ const lines = [this.encoder.encode(this.lineBuffer)];
863
+ this.lineBuffer = "";
864
+ return lines;
865
+ }
866
+ };
867
+
868
+ // src/http/transport/request-fetch-adapter.ts
869
+ var RequestFetchAdapter = class {
870
+ constructor(request) {
871
+ this.request = request;
872
+ this.requestInit = {};
873
+ this.setMethod(request.method);
874
+ this.setHeaders(request.getHeaders());
875
+ this.setCookies(request.getCookies());
876
+ this.setBody(request.body);
877
+ this.setTimeout(request.config.timeoutMs);
878
+ }
879
+ /**
880
+ * Executes the HTTP request and returns the response.
881
+ * Fetches the full response body as an ArrayBuffer.
882
+ *
883
+ * @returns A promise resolving to the HTTP response with metadata and body
884
+ */
885
+ async send() {
886
+ const response = await fetch(this.request.constructFullUrl(), this.requestInit);
887
+ const metadata = {
888
+ status: response.status,
889
+ statusText: response.statusText || "",
890
+ headers: this.getHeaders(response)
891
+ };
892
+ return {
893
+ metadata,
894
+ raw: await response.clone().arrayBuffer()
895
+ };
896
+ }
897
+ /**
898
+ * Executes the HTTP request as a stream, yielding chunks as they arrive.
899
+ * Uses the Fetch API's ReadableStream and LineDecoder to split into lines.
900
+ *
901
+ * @returns An async generator yielding HTTP response chunks
902
+ * @throws Error if responseHeaders is enabled (streaming not supported with responseHeaders)
903
+ */
904
+ async *stream() {
905
+ const response = await fetch(this.request.constructFullUrl(), this.requestInit);
906
+ const metadata = {
907
+ status: response.status,
908
+ statusText: response.statusText || "",
909
+ headers: this.getHeaders(response)
910
+ };
911
+ if (response.status >= 400) {
912
+ throw new HttpError(metadata, await response.clone().arrayBuffer());
913
+ }
914
+ if (!response.body) {
915
+ return yield {
916
+ metadata,
917
+ raw: await response.clone().arrayBuffer()
918
+ };
919
+ }
920
+ const reader = response.body.getReader();
921
+ const lineDecoder = new LineDecoder();
922
+ while (true) {
923
+ const { done, value } = await reader.read();
924
+ if (done) {
925
+ break;
926
+ }
927
+ for (const line of lineDecoder.splitLines(value)) {
928
+ yield {
929
+ metadata,
930
+ raw: this.toArrayBuffer(line)
931
+ };
932
+ }
933
+ }
934
+ for (const line of lineDecoder.flush()) {
935
+ yield {
936
+ metadata,
937
+ raw: this.toArrayBuffer(line)
938
+ };
939
+ }
940
+ }
941
+ setMethod(method) {
942
+ if (!method) {
943
+ return;
944
+ }
945
+ this.requestInit = {
946
+ ...this.requestInit,
947
+ method
948
+ };
949
+ }
950
+ setBody(body) {
951
+ if (!body) {
952
+ return;
953
+ }
954
+ this.requestInit = {
955
+ ...this.requestInit,
956
+ body
957
+ };
958
+ }
959
+ setHeaders(headers) {
960
+ if (!headers) {
961
+ return;
962
+ }
963
+ this.requestInit = {
964
+ ...this.requestInit,
965
+ headers
966
+ };
967
+ }
968
+ setCookies(cookies) {
969
+ if (!cookies || Object.keys(cookies).length === 0) {
970
+ return;
971
+ }
972
+ const cookieString = Object.entries(cookies).map(([key, value]) => `${key}=${value}`).join("; ");
973
+ this.requestInit = {
974
+ ...this.requestInit,
975
+ headers: {
976
+ ...this.requestInit.headers,
977
+ Cookie: cookieString
978
+ }
979
+ };
980
+ }
981
+ setTimeout(timeoutMs) {
982
+ if (!timeoutMs) {
983
+ return;
984
+ }
985
+ this.requestInit = {
986
+ ...this.requestInit,
987
+ signal: AbortSignal.timeout(timeoutMs)
988
+ };
989
+ }
990
+ getHeaders(response) {
991
+ const headers = {};
992
+ response.headers.forEach((value, key) => {
993
+ headers[key] = value;
994
+ });
995
+ return headers;
996
+ }
997
+ toArrayBuffer(uint8Array) {
998
+ return uint8Array.buffer.slice(
999
+ uint8Array.byteOffset,
1000
+ uint8Array.byteOffset + uint8Array.byteLength
1001
+ );
1002
+ }
1003
+ };
1004
+
1005
+ // src/http/handlers/terminating-handler.ts
1006
+ var TerminatingHandler = class {
1007
+ /**
1008
+ * Executes the actual HTTP request using the configured client adapter.
1009
+ * @template T - The expected response data type
1010
+ * @param request - The HTTP request to execute
1011
+ * @returns A promise that resolves to the HTTP response
1012
+ */
1013
+ async handle(request) {
1014
+ return new RequestFetchAdapter(request).send();
1015
+ }
1016
+ /**
1017
+ * Executes a streaming HTTP request using the configured client adapter.
1018
+ * @template T - The expected response data type for each chunk
1019
+ * @param request - The HTTP request to execute
1020
+ * @returns An async generator that yields HTTP responses
1021
+ */
1022
+ async *stream(request) {
1023
+ yield* new RequestFetchAdapter(request).stream();
1024
+ }
1025
+ };
1026
+
1027
+ // src/http/handlers/retry-handler.ts
1028
+ var RetryHandler = class {
1029
+ /**
1030
+ * Handles a standard HTTP request with retry logic.
1031
+ * Retries failed requests based on the configured retry settings.
1032
+ * Implements exponential backoff with optional jitter between retry attempts.
1033
+ * @template T - The expected response data type
1034
+ * @param request - The HTTP request to process
1035
+ * @returns A promise that resolves to the HTTP response
1036
+ * @throws Error if no next handler is set, or if all retry attempts fail
1037
+ */
1038
+ async handle(request) {
1039
+ var _a, _b;
1040
+ if (!this.next) {
1041
+ throw new Error("No next handler set in retry handler.");
1042
+ }
1043
+ const maxAttempts = (_b = (_a = request.config.retry) == null ? void 0 : _a.attempts) != null ? _b : 3;
1044
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
1045
+ try {
1046
+ return await this.next.handle(request);
1047
+ } catch (error) {
1048
+ if (!this.shouldRetry(error, request) || attempt === maxAttempts) {
1049
+ throw error;
1050
+ }
1051
+ const delayMs = this.calculateDelay(attempt, request);
1052
+ await this.delay(delayMs);
1053
+ }
1054
+ }
1055
+ throw new Error("Error retrying request.");
1056
+ }
1057
+ /**
1058
+ * Handles a streaming HTTP request with retry logic.
1059
+ * @template T - The expected response data type for each chunk
1060
+ * @param request - The HTTP request to process
1061
+ * @returns An async generator that yields HTTP responses
1062
+ * @throws Error if no next handler is set, or if all retry attempts fail
1063
+ */
1064
+ async *stream(request) {
1065
+ var _a, _b;
1066
+ if (!this.next) {
1067
+ throw new Error("No next handler set in retry handler.");
1068
+ }
1069
+ const maxAttempts = (_b = (_a = request.config.retry) == null ? void 0 : _a.attempts) != null ? _b : 3;
1070
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
1071
+ try {
1072
+ yield* this.next.stream(request);
1073
+ return;
1074
+ } catch (error) {
1075
+ if (!this.shouldRetry(error, request) || attempt === maxAttempts) {
1076
+ throw error;
1077
+ }
1078
+ const delayMs = this.calculateDelay(attempt, request);
1079
+ await this.delay(delayMs);
1080
+ }
1081
+ }
1082
+ throw new Error("Error retrying request.");
1083
+ }
1084
+ /**
1085
+ * Determines if an error should trigger a retry.
1086
+ * Checks both HTTP status codes and HTTP methods against the configured retry settings.
1087
+ * By default, retries all 5xx server errors and specific 4xx client errors (408 Timeout, 429 Rate Limit).
1088
+ * @param error - The error to check
1089
+ * @param request - The HTTP request being retried
1090
+ * @returns True if the request should be retried, false otherwise
1091
+ */
1092
+ shouldRetry(error, request) {
1093
+ var _a, _b, _c;
1094
+ if (!(error instanceof HttpError)) {
1095
+ return false;
1096
+ }
1097
+ const httpMethodsToRetry = (_b = (_a = request.config.retry) == null ? void 0 : _a.httpMethodsToRetry) != null ? _b : [
1098
+ "GET",
1099
+ "POST",
1100
+ "PUT",
1101
+ "DELETE",
1102
+ "PATCH",
1103
+ "HEAD",
1104
+ "OPTIONS"
1105
+ ];
1106
+ const shouldRetryStatus = ((_c = request.config.retry) == null ? void 0 : _c.statusCodesToRetry) ? request.config.retry.statusCodesToRetry.includes(error.metadata.status) : error.metadata.status >= 500 || [408, 429].includes(error.metadata.status);
1107
+ const shouldRetryMethod = httpMethodsToRetry.includes(request.method);
1108
+ return shouldRetryStatus && shouldRetryMethod;
1109
+ }
1110
+ /**
1111
+ * Calculates the delay before the next retry attempt using exponential backoff.
1112
+ * Optionally adds jitter to prevent thundering herd problems.
1113
+ * @param attempt - The current retry attempt number (1-indexed)
1114
+ * @param request - The HTTP request being retried
1115
+ * @returns The delay in milliseconds, capped at the configured maximum delay
1116
+ */
1117
+ calculateDelay(attempt, request) {
1118
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1119
+ const baseDelay = (_b = (_a = request.config.retry) == null ? void 0 : _a.delayMs) != null ? _b : 150;
1120
+ const backoffFactor = (_d = (_c = request.config.retry) == null ? void 0 : _c.backoffFactor) != null ? _d : 2;
1121
+ const maxDelay = (_f = (_e = request.config.retry) == null ? void 0 : _e.maxDelayMs) != null ? _f : 5e3;
1122
+ const jitter = (_h = (_g = request.config.retry) == null ? void 0 : _g.jitterMs) != null ? _h : 50;
1123
+ let delay = baseDelay * Math.pow(backoffFactor, attempt - 1);
1124
+ delay = Math.min(delay, maxDelay);
1125
+ if (jitter > 0) {
1126
+ delay += Math.random() * jitter;
1127
+ }
1128
+ return Math.floor(delay);
1129
+ }
1130
+ /**
1131
+ * Delays execution for a specified duration before retrying.
1132
+ * @param delayMs - The delay in milliseconds
1133
+ * @returns A promise that resolves after the delay
1134
+ */
1135
+ delay(delayMs) {
1136
+ if (delayMs <= 0) {
1137
+ return Promise.resolve();
1138
+ }
1139
+ return new Promise((resolve, reject) => {
1140
+ setTimeout(() => resolve(), delayMs);
1141
+ });
1142
+ }
1143
+ };
1144
+
1145
+ // src/http/transport/types.ts
1146
+ function isRequestCursorPagination(pagination) {
1147
+ return !!pagination && "cursorPath" in pagination;
1148
+ }
1149
+
1150
+ // src/http/client.ts
1151
+ var HttpClient = class {
1152
+ /**
1153
+ * Creates a new HTTP client with configured request handlers.
1154
+ * @param config - SDK configuration including base URL and authentication
1155
+ * @param hook - Optional custom hook for request/response interception
1156
+ */
1157
+ constructor(config, hook = new CustomHook()) {
1158
+ this.config = config;
1159
+ /** Chain of request handlers that process requests in sequence */
1160
+ this.requestHandlerChain = new RequestHandlerChain();
1161
+ this.requestHandlerChain.addHandler(new ResponseValidationHandler());
1162
+ this.requestHandlerChain.addHandler(new RequestValidationHandler());
1163
+ this.requestHandlerChain.addHandler(new RetryHandler());
1164
+ this.requestHandlerChain.addHandler(new HookHandler(hook));
1165
+ this.requestHandlerChain.addHandler(new TerminatingHandler());
1166
+ }
1167
+ /**
1168
+ * Executes a standard HTTP request.
1169
+ * @template T - The expected response data type
1170
+ * @param request - The HTTP request to execute
1171
+ * @returns A promise that resolves to the HTTP response
1172
+ */
1173
+ call(request) {
1174
+ return this.requestHandlerChain.callChain(request);
1175
+ }
1176
+ /**
1177
+ * Executes a standard HTTP request and returns only the data directly.
1178
+ * @template T - The expected response data type
1179
+ * @param request - The HTTP request to execute
1180
+ * @returns A promise that resolves to the response data
1181
+ */
1182
+ callDirect(request) {
1183
+ return this.call(request).then((response) => response.data);
1184
+ }
1185
+ /**
1186
+ * Executes a streaming HTTP request that yields responses incrementally.
1187
+ * @template T - The expected response data type for each chunk
1188
+ * @param request - The HTTP request to execute
1189
+ * @returns An async generator that yields HTTP responses
1190
+ */
1191
+ async *stream(request) {
1192
+ yield* this.requestHandlerChain.streamChain(request);
1193
+ }
1194
+ /**
1195
+ * Executes a paginated HTTP request and extracts the page data from the response.
1196
+ * @template FullResponse - The complete response type from the API
1197
+ * @template Page - The type of a single page of data
1198
+ * @param request - The paginated HTTP request to execute
1199
+ * @returns A promise that resolves to the paginated HTTP response
1200
+ * @throws Error if the response contains no data to paginate through
1201
+ */
1202
+ async callPaginated(request) {
1203
+ const response = await this.call(request);
1204
+ if (!response.data) {
1205
+ throw new Error("no response data to paginate through");
1206
+ }
1207
+ const page = this.getPage(request, response.data);
1208
+ return {
1209
+ ...response,
1210
+ data: page
1211
+ };
1212
+ }
1213
+ /**
1214
+ * Executes a cursor-paginated HTTP request and extracts both page data and the next cursor.
1215
+ * @template FullResponse - The complete response type from the API
1216
+ * @template Page - The type of a single page of data
1217
+ * @param request - The cursor-paginated HTTP request to execute
1218
+ * @returns A promise that resolves to the cursor-paginated HTTP response with next cursor
1219
+ * @throws Error if the response contains no data to paginate through
1220
+ */
1221
+ async callCursorPaginated(request) {
1222
+ const response = await this.call(request);
1223
+ if (!response.data) {
1224
+ throw new Error("no response data to paginate through");
1225
+ }
1226
+ const page = this.getPage(request, response.data);
1227
+ const nextCursor = this.getNextCursor(request, response.data);
1228
+ return {
1229
+ ...response,
1230
+ data: page,
1231
+ nextCursor
1232
+ };
1233
+ }
1234
+ /**
1235
+ * Updates the base URL for all subsequent requests.
1236
+ * @param url - The new base URL to use
1237
+ */
1238
+ setBaseUrl(url) {
1239
+ this.config.baseUrl = url;
1240
+ }
1241
+ /**
1242
+ * Updates the SDK configuration.
1243
+ * @param config - The new SDK configuration
1244
+ */
1245
+ setConfig(config) {
1246
+ this.config = config;
1247
+ }
1248
+ /**
1249
+ * Extracts page data from a full API response using the configured pagination path.
1250
+ * @template FullResponse - The complete response type from the API
1251
+ * @template Page - The type of a single page of data
1252
+ * @param request - The request containing pagination configuration
1253
+ * @param data - The full response data to extract the page from
1254
+ * @returns The extracted and parsed page data
1255
+ * @throws Error if pagination is not configured or page extraction fails
1256
+ */
1257
+ getPage(request, data) {
1258
+ var _a;
1259
+ if (!request.pagination) {
1260
+ throw new Error("getPage called for request without pagination property");
1261
+ }
1262
+ let curr = data;
1263
+ for (const segment of request.pagination.pagePath || []) {
1264
+ curr = curr[segment];
1265
+ }
1266
+ const page = (_a = request.pagination.pageSchema) == null ? void 0 : _a.parse(curr);
1267
+ if (!page) {
1268
+ throw new Error(
1269
+ `error getting page data. Curr: ${JSON.stringify(curr)}. PagePath: ${request.pagination.pagePath}. Data: ${JSON.stringify(data)}`
1270
+ );
1271
+ }
1272
+ return page;
1273
+ }
1274
+ /**
1275
+ * Extracts the next cursor from a full API response for cursor-based pagination.
1276
+ * @template FullResponse - The complete response type from the API
1277
+ * @template Page - The type of a single page of data
1278
+ * @param request - The request containing cursor pagination configuration
1279
+ * @param data - The full response data to extract the cursor from
1280
+ * @returns The next cursor string, null if no more pages, or undefined if not cursor pagination
1281
+ */
1282
+ getNextCursor(request, data) {
1283
+ var _a, _b;
1284
+ if (!isRequestCursorPagination(request.pagination)) {
1285
+ return void 0;
1286
+ }
1287
+ let curr = data;
1288
+ for (const segment of request.pagination.cursorPath) {
1289
+ if (curr === null || curr === void 0) {
1290
+ return null;
1291
+ }
1292
+ curr = curr[segment];
1293
+ }
1294
+ return (_b = (_a = request.pagination.cursorSchema) == null ? void 0 : _a.parse(curr)) != null ? _b : null;
1295
+ }
1296
+ };
1297
+
1298
+ // src/services/base-service.ts
1299
+ var BaseService = class {
1300
+ constructor(config) {
1301
+ this.config = config;
1302
+ this.client = new HttpClient(this.config);
1303
+ }
1304
+ /**
1305
+ * Sets service-level configuration that applies to all methods in this service.
1306
+ * @param config - Partial configuration to override SDK-level defaults
1307
+ * @returns This service instance for method chaining
1308
+ */
1309
+ setConfig(config) {
1310
+ this.serviceConfig = config;
1311
+ return this;
1312
+ }
1313
+ /**
1314
+ * Resolves configuration from the hierarchy: requestConfig > methodConfig > serviceConfig > sdkConfig
1315
+ * Merges all config levels into a single resolved config object.
1316
+ * @param methodConfig - Method-level configuration override
1317
+ * @param requestConfig - Request-level configuration override
1318
+ * @returns Merged configuration with all overrides applied
1319
+ */
1320
+ getResolvedConfig(methodConfig, requestConfig) {
1321
+ return {
1322
+ ...this.config,
1323
+ ...this.serviceConfig,
1324
+ ...methodConfig,
1325
+ ...requestConfig
1326
+ };
1327
+ }
1328
+ set baseUrl(baseUrl) {
1329
+ this.config.baseUrl = baseUrl;
1330
+ }
1331
+ set environment(environment) {
1332
+ this.config.environment = environment;
1333
+ }
1334
+ set timeoutMs(timeoutMs) {
1335
+ this.config.timeoutMs = timeoutMs;
1336
+ }
1337
+ set username(username) {
1338
+ this.config.username = username;
1339
+ }
1340
+ set password(password) {
1341
+ this.config.password = password;
1342
+ }
1343
+ };
1344
+
1345
+ // src/http/transport/request-builder.ts
1346
+ import z from "zod";
1347
+
1348
+ // src/http/serialization/path-serializer.ts
1349
+ var PathSerializer = class extends Serializer {
1350
+ /**
1351
+ * Serializes path parameters into a URL path by replacing template placeholders.
1352
+ * @param pathPattern - The URL path pattern with {placeholders}
1353
+ * @param pathArguments - Map of parameter names to their values
1354
+ * @returns The path with placeholders replaced by serialized values
1355
+ * @example
1356
+ * serialize("/users/{id}", Map([["id", {key: "id", value: 123}]])) returns "/users/123"
1357
+ */
1358
+ serialize(pathPattern, pathArguments) {
1359
+ let serializedPath = pathPattern;
1360
+ pathArguments.forEach((param) => {
1361
+ serializedPath = serializedPath.replace(`{${param.key}}`, `${this.serializeValue(param)}`);
1362
+ });
1363
+ return serializedPath;
1364
+ }
1365
+ };
1366
+
1367
+ // src/http/serialization/query-serializer.ts
1368
+ var QuerySerializer = class extends Serializer {
1369
+ /**
1370
+ * Serializes query parameters into a URL query string.
1371
+ * @param queryParams - Map of query parameter names to their values
1372
+ * @returns A query string starting with "?" if parameters exist, empty string otherwise
1373
+ * @example
1374
+ * serialize(Map([["name", {...}], ["age", {...}]])) returns "?name=John&age=30"
1375
+ */
1376
+ serialize(queryParams) {
1377
+ if (!queryParams || !queryParams.size) {
1378
+ return "";
1379
+ }
1380
+ const query = [];
1381
+ queryParams.forEach((param) => {
1382
+ if (param.value === void 0) {
1383
+ return;
1384
+ }
1385
+ return query.push(`${this.serializeValue(param)}`);
1386
+ });
1387
+ return query.length ? `?${query.join("&")}` : "";
1388
+ }
1389
+ };
1390
+
1391
+ // src/http/serialization/header-serializer.ts
1392
+ var HeaderSerializer = class extends Serializer {
1393
+ /**
1394
+ * Serializes header parameters into a headers object.
1395
+ * @param headerParams - Map of header names to their parameter values
1396
+ * @returns A HeadersInit object with serialized header values, or undefined if no headers
1397
+ */
1398
+ serialize(headerParams) {
1399
+ if (!headerParams || !headerParams.size) {
1400
+ return void 0;
1401
+ }
1402
+ const headers = {};
1403
+ headerParams.forEach((param) => {
1404
+ if (!param.key) {
1405
+ return;
1406
+ }
1407
+ headers[param.key] = this.serializeValue(param);
1408
+ });
1409
+ return headers;
1410
+ }
1411
+ };
1412
+
1413
+ // src/http/serialization/cookie-serializer.ts
1414
+ var CookieSerializer = class {
1415
+ /**
1416
+ * Serializes cookie parameters into a cookie object.
1417
+ * @param cookieParams - Map of cookie names to their parameter values
1418
+ * @returns A record of cookie names to serialized values, or undefined if no cookies
1419
+ */
1420
+ serialize(cookieParams) {
1421
+ if (!cookieParams || !cookieParams.size) {
1422
+ return void 0;
1423
+ }
1424
+ const cookies = {};
1425
+ cookieParams.forEach((param) => {
1426
+ if (!param.key || param.value === void 0) {
1427
+ return;
1428
+ }
1429
+ cookies[param.key] = this.serializeCookieValue(param);
1430
+ });
1431
+ return cookies;
1432
+ }
1433
+ /**
1434
+ * Serializes a single cookie value based on its type.
1435
+ * @param param - The cookie parameter to serialize
1436
+ * @returns The serialized cookie value string
1437
+ */
1438
+ serializeCookieValue(param) {
1439
+ if (Array.isArray(param.value)) {
1440
+ return this.serializeArray(param.value, param);
1441
+ }
1442
+ if (this.isNonNullObject(param.value)) {
1443
+ return this.serializeObject(param.value, param);
1444
+ }
1445
+ return this.serializePrimitive(param.value);
1446
+ }
1447
+ /**
1448
+ * Serializes a primitive cookie value.
1449
+ * @param value - The primitive value to serialize
1450
+ * @returns The string representation of the value
1451
+ */
1452
+ serializePrimitive(value) {
1453
+ return `${value}`;
1454
+ }
1455
+ /**
1456
+ * Serializes an array cookie value.
1457
+ * @param value - The array to serialize
1458
+ * @param param - The cookie parameter configuration
1459
+ * @returns The serialized array string
1460
+ */
1461
+ serializeArray(value, param) {
1462
+ if (param.explode) {
1463
+ if (value.length === 0)
1464
+ return "";
1465
+ const first = value[0];
1466
+ const rest = value.slice(1).map((v) => `${param.key}=${v}`).join("; ");
1467
+ return rest ? `${first}; ${rest}` : `${first}`;
1468
+ }
1469
+ return value.join(",");
1470
+ }
1471
+ /**
1472
+ * Serializes an object cookie value as JSON.
1473
+ * @param obj - The object to serialize
1474
+ * @param param - The cookie parameter configuration
1475
+ * @returns The JSON string representation of the object
1476
+ */
1477
+ serializeObject(obj, param) {
1478
+ return JSON.stringify(obj);
1479
+ }
1480
+ /**
1481
+ * Type guard to check if a value is a non-null object.
1482
+ * @param value - The value to check
1483
+ * @returns True if the value is an object and not null
1484
+ */
1485
+ isNonNullObject(value) {
1486
+ return typeof value === "object" && value !== null;
1487
+ }
1488
+ };
1489
+
1490
+ // src/http/transport/request.ts
1491
+ var Request = class {
1492
+ constructor(params) {
1493
+ this.baseUrl = "";
1494
+ this.headers = /* @__PURE__ */ new Map();
1495
+ this.queryParams = /* @__PURE__ */ new Map();
1496
+ this.pathParams = /* @__PURE__ */ new Map();
1497
+ this.cookies = /* @__PURE__ */ new Map();
1498
+ this.baseUrl = params.baseUrl;
1499
+ this.method = params.method;
1500
+ this.pathPattern = params.path;
1501
+ this.body = params.body;
1502
+ this.path = this.constructPath();
1503
+ this.config = params.config;
1504
+ this.pathParams = params.pathParams;
1505
+ this.headers = params.headers;
1506
+ this.queryParams = params.queryParams;
1507
+ this.cookies = params.cookies;
1508
+ this.responses = params.responses;
1509
+ this.errors = params.errors;
1510
+ this.requestSchema = params.requestSchema;
1511
+ this.requestContentType = params.requestContentType;
1512
+ this.pagination = params.pagination;
1513
+ this.filename = params.filename;
1514
+ this.filenames = params.filenames;
1515
+ }
1516
+ /**
1517
+ * Adds a header parameter to the request with OpenAPI serialization rules.
1518
+ *
1519
+ * @param key - The header name
1520
+ * @param param - The parameter configuration including value, style, and encoding options
1521
+ */
1522
+ addHeaderParam(key, param) {
1523
+ if (param.value === void 0) {
1524
+ return;
1525
+ }
1526
+ if (param.explode === void 0) {
1527
+ param.explode = false;
1528
+ }
1529
+ if (param.style === void 0) {
1530
+ param.style = "simple" /* SIMPLE */;
1531
+ }
1532
+ if (param.encode === void 0) {
1533
+ param.encode = false;
1534
+ }
1535
+ this.headers.set(key, param);
1536
+ }
1537
+ /**
1538
+ * Adds a query parameter to the request with OpenAPI serialization rules.
1539
+ *
1540
+ * @param key - The query parameter name
1541
+ * @param param - The parameter configuration including value, style, and encoding options
1542
+ */
1543
+ addQueryParam(key, param) {
1544
+ if (param.value === void 0) {
1545
+ return;
1546
+ }
1547
+ if (param.explode === void 0) {
1548
+ param.explode = true;
1549
+ }
1550
+ if (param.style === void 0) {
1551
+ param.style = "form" /* FORM */;
1552
+ }
1553
+ if (param.encode === void 0) {
1554
+ param.encode = true;
1555
+ }
1556
+ this.queryParams.set(key, param);
1557
+ }
1558
+ /**
1559
+ * Adds a path parameter to the request with OpenAPI serialization rules.
1560
+ *
1561
+ * @param key - The path parameter name (matches template variable in path pattern)
1562
+ * @param param - The parameter configuration including value, style, and encoding options
1563
+ */
1564
+ addPathParam(key, param) {
1565
+ if (param.value === void 0) {
1566
+ return;
1567
+ }
1568
+ if (param.explode === void 0) {
1569
+ param.explode = false;
1570
+ }
1571
+ if (param.style === void 0) {
1572
+ param.style = "simple" /* SIMPLE */;
1573
+ }
1574
+ if (param.encode === void 0) {
1575
+ param.encode = true;
1576
+ }
1577
+ this.pathParams.set(key, param);
1578
+ }
1579
+ /**
1580
+ * Sets the request body if the value is defined.
1581
+ *
1582
+ * @param body - The request body to send
1583
+ */
1584
+ addBody(body) {
1585
+ if (body === void 0) {
1586
+ return;
1587
+ }
1588
+ this.body = body;
1589
+ }
1590
+ /**
1591
+ * Updates this request from a modified hook request.
1592
+ * Used after hooks modify the request to sync changes back to the internal Request object.
1593
+ *
1594
+ * @param hookRequest - The modified request from hook processing
1595
+ */
1596
+ updateFromHookRequest(hookRequest) {
1597
+ this.baseUrl = hookRequest.baseUrl;
1598
+ this.method = hookRequest.method;
1599
+ this.path = hookRequest.path;
1600
+ this.body = hookRequest.body;
1601
+ }
1602
+ /**
1603
+ * Constructs the complete URL by combining base URL, path with substituted parameters,
1604
+ * and serialized query string.
1605
+ *
1606
+ * @returns The fully constructed URL ready for HTTP execution
1607
+ */
1608
+ constructFullUrl() {
1609
+ const queryString = new QuerySerializer().serialize(this.queryParams);
1610
+ const path = this.constructPath();
1611
+ let baseUrl = this.baseUrl;
1612
+ return `${baseUrl}${path}${queryString}`;
1613
+ }
1614
+ /**
1615
+ * Creates a copy of this request with optional parameter overrides.
1616
+ * Useful for pagination where you need to modify parameters while keeping the rest intact.
1617
+ *
1618
+ * @param overrides - Optional parameters to override in the copied request
1619
+ * @returns A new Request instance with the specified overrides
1620
+ */
1621
+ copy(overrides) {
1622
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
1623
+ const createRequestParams = {
1624
+ baseUrl: (_a = overrides == null ? void 0 : overrides.baseUrl) != null ? _a : this.baseUrl,
1625
+ errors: (_b = overrides == null ? void 0 : overrides.errors) != null ? _b : this.errors,
1626
+ method: (_c = overrides == null ? void 0 : overrides.method) != null ? _c : this.method,
1627
+ path: (_d = overrides == null ? void 0 : overrides.path) != null ? _d : this.path,
1628
+ body: (_e = overrides == null ? void 0 : overrides.body) != null ? _e : this.body,
1629
+ config: (_f = overrides == null ? void 0 : overrides.config) != null ? _f : this.config,
1630
+ pathParams: (_g = overrides == null ? void 0 : overrides.pathParams) != null ? _g : this.pathParams,
1631
+ queryParams: (_h = overrides == null ? void 0 : overrides.queryParams) != null ? _h : this.queryParams,
1632
+ headers: (_i = overrides == null ? void 0 : overrides.headers) != null ? _i : this.headers,
1633
+ cookies: (_j = overrides == null ? void 0 : overrides.cookies) != null ? _j : this.cookies,
1634
+ responses: (_k = overrides == null ? void 0 : overrides.responses) != null ? _k : this.responses,
1635
+ requestSchema: (_l = overrides == null ? void 0 : overrides.requestSchema) != null ? _l : this.requestSchema,
1636
+ requestContentType: (_m = overrides == null ? void 0 : overrides.requestContentType) != null ? _m : this.requestContentType,
1637
+ filename: (_n = overrides == null ? void 0 : overrides.filename) != null ? _n : this.filename,
1638
+ filenames: (_o = overrides == null ? void 0 : overrides.filenames) != null ? _o : this.filenames
1639
+ };
1640
+ return new Request({
1641
+ ...createRequestParams,
1642
+ ...overrides
1643
+ });
1644
+ }
1645
+ /**
1646
+ * Serializes headers to a format suitable for HTTP execution.
1647
+ *
1648
+ * @returns Serialized headers as HeadersInit, or undefined if no headers
1649
+ */
1650
+ getHeaders() {
1651
+ if (!this.headers || !this.headers.size) {
1652
+ return void 0;
1653
+ }
1654
+ return new HeaderSerializer().serialize(this.headers);
1655
+ }
1656
+ /**
1657
+ * Serializes cookies to a format suitable for HTTP execution.
1658
+ *
1659
+ * @returns Serialized cookies as a record, or undefined if no cookies
1660
+ */
1661
+ getCookies() {
1662
+ if (!this.cookies || !this.cookies.size) {
1663
+ return void 0;
1664
+ }
1665
+ return new CookieSerializer().serialize(this.cookies);
1666
+ }
1667
+ /**
1668
+ * Advances pagination parameters to fetch the next page.
1669
+ * Handles both cursor-based and limit-offset pagination strategies.
1670
+ *
1671
+ * @param cursor - The cursor value for cursor-based pagination (optional for limit-offset)
1672
+ */
1673
+ nextPage(cursor) {
1674
+ if (!this.pagination) {
1675
+ return;
1676
+ }
1677
+ if (isRequestCursorPagination(this.pagination)) {
1678
+ const cursorParam = this.getCursorParam();
1679
+ if (cursorParam && cursor !== void 0) {
1680
+ cursorParam.value = cursor;
1681
+ }
1682
+ return;
1683
+ }
1684
+ const offsetParam = this.getOffsetParam();
1685
+ if (offsetParam) {
1686
+ if (this.pagination.pageSize === void 0) {
1687
+ throw new Error("pageSize is required for limit-offset pagination");
1688
+ }
1689
+ offsetParam.value = Number(offsetParam.value) + this.pagination.pageSize;
1690
+ }
1691
+ }
1692
+ constructPath() {
1693
+ return new PathSerializer().serialize(this.pathPattern, this.pathParams);
1694
+ }
1695
+ getOffsetParam() {
1696
+ const offsetParam = this.getAllParams().find((param) => param.isOffset);
1697
+ return offsetParam;
1698
+ }
1699
+ getCursorParam() {
1700
+ const cursorParam = this.getAllParams().find((param) => param.isCursor);
1701
+ return cursorParam;
1702
+ }
1703
+ getAllParams() {
1704
+ const allParams = [];
1705
+ this.headers.forEach((val, _) => {
1706
+ allParams.push(val);
1707
+ });
1708
+ this.queryParams.forEach((val, _) => {
1709
+ allParams.push(val);
1710
+ });
1711
+ this.pathParams.forEach((val, _) => {
1712
+ allParams.push(val);
1713
+ });
1714
+ this.cookies.forEach((val, _) => {
1715
+ allParams.push(val);
1716
+ });
1717
+ return allParams;
1718
+ }
1719
+ };
1720
+
1721
+ // src/http/environment.ts
1722
+ var Environment = /* @__PURE__ */ ((Environment2) => {
1723
+ Environment2["DEFAULT"] = "https://{{apiLinxcommerce}}";
1724
+ Environment2["APILINXCOMMERCE"] = "https://{{apiLinxcommerce}}";
1725
+ Environment2["STOREURL"] = "https://{{storeUrl}}";
1726
+ Environment2["URLSTORE"] = "https://{{urlStore}}";
1727
+ Environment2["URLSTORESHOPPING"] = "https://{{urlStore}}Shopping";
1728
+ Environment2["URLLINX"] = "https://{{urlLinx}}";
1729
+ Environment2["VIACEP"] = "https://viacep.com.br";
1730
+ return Environment2;
1731
+ })(Environment || {});
1732
+
1733
+ // src/http/transport/request-builder.ts
1734
+ var RequestBuilder = class {
1735
+ /**
1736
+ * Creates a new request builder with default configuration.
1737
+ * Initializes retry settings, validation options, and empty parameter collections.
1738
+ */
1739
+ constructor() {
1740
+ this.params = {
1741
+ baseUrl: "https://{{apiLinxcommerce}}" /* DEFAULT */,
1742
+ method: "GET",
1743
+ path: "",
1744
+ config: {
1745
+ retry: {
1746
+ attempts: 3,
1747
+ delayMs: 150,
1748
+ maxDelayMs: 5e3,
1749
+ backoffFactor: 2,
1750
+ jitterMs: 50,
1751
+ httpMethodsToRetry: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
1752
+ },
1753
+ validation: { responseValidation: true }
1754
+ },
1755
+ responses: [],
1756
+ errors: [],
1757
+ requestSchema: z.any(),
1758
+ requestContentType: "json" /* Json */,
1759
+ pathParams: /* @__PURE__ */ new Map(),
1760
+ queryParams: /* @__PURE__ */ new Map(),
1761
+ headers: /* @__PURE__ */ new Map(),
1762
+ cookies: /* @__PURE__ */ new Map()
1763
+ };
1764
+ this.addHeaderParam({
1765
+ key: "User-Agent",
1766
+ value: "postman-codegen/2.25.51 linxcommerce-webapi-sdk/1.0.0 (typescript)"
1767
+ });
1768
+ }
1769
+ setConfig(config) {
1770
+ var _a, _b;
1771
+ let mergedRetry = (_a = config.retry) != null ? _a : this.params.config.retry;
1772
+ if (config.retry !== void 0 && this.params.config.retry !== void 0) {
1773
+ mergedRetry = { ...this.params.config.retry, ...config.retry };
1774
+ }
1775
+ let mergedValidation = (_b = config.validation) != null ? _b : this.params.config.validation;
1776
+ if (config.validation !== void 0 && this.params.config.validation !== void 0) {
1777
+ mergedValidation = { ...this.params.config.validation, ...config.validation };
1778
+ }
1779
+ this.params.config = {
1780
+ ...this.params.config,
1781
+ ...config,
1782
+ ...mergedRetry !== void 0 && { retry: mergedRetry },
1783
+ ...mergedValidation !== void 0 && { validation: mergedValidation }
1784
+ };
1785
+ return this;
1786
+ }
1787
+ /**
1788
+ * Sets the base URL for the request using hierarchical configuration resolution.
1789
+ *
1790
+ * Resolution logic:
1791
+ * 1. First tries to resolve 'baseUrl' (string) from the resolved config
1792
+ * 2. If no 'baseUrl' found, falls back to 'environment' (enum) from the resolved config
1793
+ * 3. 'baseUrl' always takes precedence over 'environment'
1794
+ *
1795
+ * @param config - Resolved configuration from all hierarchy levels
1796
+ * @returns This builder instance for method chaining
1797
+ */
1798
+ setBaseUrl(config) {
1799
+ if (!config) {
1800
+ return this;
1801
+ }
1802
+ if ("baseUrl" in config && typeof config.baseUrl === "string" && config.baseUrl) {
1803
+ this.params.baseUrl = config.baseUrl;
1804
+ return this;
1805
+ }
1806
+ if ("environment" in config && config.environment) {
1807
+ this.params.baseUrl = config.environment;
1808
+ }
1809
+ return this;
1810
+ }
1811
+ setMethod(method) {
1812
+ this.params.method = method;
1813
+ return this;
1814
+ }
1815
+ setPath(path) {
1816
+ this.params.path = path;
1817
+ return this;
1818
+ }
1819
+ setRequestContentType(contentType) {
1820
+ this.params.requestContentType = contentType;
1821
+ return this;
1822
+ }
1823
+ setRequestSchema(requestSchema) {
1824
+ this.params.requestSchema = requestSchema;
1825
+ return this;
1826
+ }
1827
+ setFilename(filename) {
1828
+ if (filename !== void 0) {
1829
+ this.params.filename = filename;
1830
+ }
1831
+ return this;
1832
+ }
1833
+ setFilenames(filenames) {
1834
+ if (filenames !== void 0) {
1835
+ this.params.filenames = filenames;
1836
+ }
1837
+ return this;
1838
+ }
1839
+ setPagination(pagination) {
1840
+ this.params.pagination = pagination;
1841
+ return this;
1842
+ }
1843
+ setCursorPagination(pagination) {
1844
+ this.params.pagination = pagination;
1845
+ return this;
1846
+ }
1847
+ addAccessTokenAuth(accessToken, prefix) {
1848
+ if (accessToken === void 0) {
1849
+ return this;
1850
+ }
1851
+ this.params.headers.set("Authorization", {
1852
+ key: "Authorization",
1853
+ value: `${prefix != null ? prefix : "BEARER"} ${accessToken}`,
1854
+ explode: false,
1855
+ style: "simple" /* SIMPLE */,
1856
+ encode: true,
1857
+ isLimit: false,
1858
+ isOffset: false,
1859
+ isCursor: false
1860
+ });
1861
+ return this;
1862
+ }
1863
+ addBasicAuth(username, password) {
1864
+ if (username === void 0 || password === void 0) {
1865
+ return this;
1866
+ }
1867
+ this.params.headers.set("Authorization", {
1868
+ key: "Authorization",
1869
+ value: `Basic ${this.toBase64(`${username}:${password}`)}`,
1870
+ explode: false,
1871
+ style: "simple" /* SIMPLE */,
1872
+ encode: true,
1873
+ isLimit: false,
1874
+ isOffset: false,
1875
+ isCursor: false
1876
+ });
1877
+ return this;
1878
+ }
1879
+ addApiKeyAuth(apiKey, keyName) {
1880
+ if (apiKey === void 0) {
1881
+ return this;
1882
+ }
1883
+ this.params.headers.set(keyName != null ? keyName : "X-API-KEY", {
1884
+ key: keyName != null ? keyName : "X-API-KEY",
1885
+ value: apiKey,
1886
+ explode: false,
1887
+ style: "simple" /* SIMPLE */,
1888
+ encode: true,
1889
+ isLimit: false,
1890
+ isOffset: false,
1891
+ isCursor: false
1892
+ });
1893
+ return this;
1894
+ }
1895
+ addResponse(response) {
1896
+ this.params.responses.push(response);
1897
+ return this;
1898
+ }
1899
+ addError(error) {
1900
+ this.params.errors.push(error);
1901
+ return this;
1902
+ }
1903
+ addBody(body) {
1904
+ if (body !== void 0) {
1905
+ this.params.body = body;
1906
+ }
1907
+ return this;
1908
+ }
1909
+ addPathParam(param) {
1910
+ var _a, _b, _c;
1911
+ if (param.value === void 0 || param.key === void 0) {
1912
+ return this;
1913
+ }
1914
+ this.params.pathParams.set(param.key, {
1915
+ key: param.key,
1916
+ value: param.value,
1917
+ explode: (_a = param.explode) != null ? _a : true,
1918
+ style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
1919
+ encode: (_c = param.encode) != null ? _c : true,
1920
+ isLimit: !!param.isLimit,
1921
+ isOffset: !!param.isOffset,
1922
+ isCursor: !!param.isCursor
1923
+ });
1924
+ return this;
1925
+ }
1926
+ addQueryParam(param) {
1927
+ var _a, _b, _c;
1928
+ if (param.key === void 0) {
1929
+ return this;
1930
+ }
1931
+ this.params.queryParams.set(param.key, {
1932
+ key: param.key,
1933
+ value: param.value,
1934
+ explode: (_a = param.explode) != null ? _a : true,
1935
+ style: (_b = param.style) != null ? _b : "form" /* FORM */,
1936
+ encode: (_c = param.encode) != null ? _c : true,
1937
+ isLimit: !!param.isLimit,
1938
+ isOffset: !!param.isOffset,
1939
+ isCursor: !!param.isCursor
1940
+ });
1941
+ return this;
1942
+ }
1943
+ addHeaderParam(param) {
1944
+ var _a, _b, _c;
1945
+ if (param.value === void 0 || param.key === void 0) {
1946
+ return this;
1947
+ }
1948
+ this.params.headers.set(param.key, {
1949
+ key: param.key,
1950
+ value: param.value,
1951
+ explode: (_a = param.explode) != null ? _a : true,
1952
+ style: (_b = param.style) != null ? _b : "simple" /* SIMPLE */,
1953
+ encode: (_c = param.encode) != null ? _c : false,
1954
+ isLimit: !!param.isLimit,
1955
+ isOffset: !!param.isOffset,
1956
+ isCursor: !!param.isCursor
1957
+ });
1958
+ return this;
1959
+ }
1960
+ addCookieParam(param) {
1961
+ var _a, _b, _c;
1962
+ if (param.value === void 0 || param.key === void 0) {
1963
+ return this;
1964
+ }
1965
+ this.params.cookies.set(param.key, {
1966
+ key: param.key,
1967
+ value: param.value,
1968
+ explode: (_a = param.explode) != null ? _a : true,
1969
+ style: (_b = param.style) != null ? _b : "form" /* FORM */,
1970
+ encode: (_c = param.encode) != null ? _c : false,
1971
+ isLimit: !!param.isLimit,
1972
+ isOffset: !!param.isOffset,
1973
+ isCursor: !!param.isCursor
1974
+ });
1975
+ return this;
1976
+ }
1977
+ /**
1978
+ * Builds and returns the configured Request object.
1979
+ * Call this method after configuring all request parameters.
1980
+ * @returns A new Request instance with all configured parameters
1981
+ */
1982
+ build() {
1983
+ return new Request(this.params);
1984
+ }
1985
+ /**
1986
+ * Converts a string to Base64 encoding.
1987
+ * Works in both Node.js and browser environments.
1988
+ * @param str - The string to encode
1989
+ * @returns The Base64-encoded string
1990
+ */
1991
+ toBase64(str) {
1992
+ if (typeof window === "undefined") {
1993
+ return Buffer.from(str, "utf-8").toString("base64");
1994
+ } else {
1995
+ return btoa(unescape(encodeURIComponent(str)));
1996
+ }
1997
+ }
1998
+ };
1999
+
2000
+ // src/services/customers/models/create-consumer-request.ts
2001
+ import { z as z4 } from "zod";
2002
+
2003
+ // src/services/customers/models/create-consumer-request-customer.ts
2004
+ import { z as z3 } from "zod";
2005
+
2006
+ // src/services/customers/models/customer-contact-1.ts
2007
+ import { z as z2 } from "zod";
2008
+ var customerContact1 = z2.lazy(() => {
2009
+ return z2.object({
2010
+ phone: z2.string().optional().nullable(),
2011
+ cellPhone: z2.string().optional().nullable()
2012
+ });
2013
+ });
2014
+ var customerContact1Response = z2.lazy(() => {
2015
+ return z2.object({
2016
+ Phone: z2.string().optional().nullable(),
2017
+ CellPhone: z2.string().optional().nullable()
2018
+ }).transform((data) => ({
2019
+ phone: data["Phone"],
2020
+ cellPhone: data["CellPhone"]
2021
+ }));
2022
+ });
2023
+ var customerContact1Request = z2.lazy(() => {
2024
+ return z2.object({
2025
+ phone: z2.string().optional().nullable(),
2026
+ cellPhone: z2.string().optional().nullable()
2027
+ }).transform((data) => ({
2028
+ Phone: data["phone"],
2029
+ CellPhone: data["cellPhone"]
2030
+ }));
2031
+ });
2032
+
2033
+ // src/services/customers/models/create-consumer-request-customer.ts
2034
+ var createConsumerRequestCustomer = z3.lazy(() => {
2035
+ return z3.object({
2036
+ customerType: z3.string().optional().nullable(),
2037
+ email: z3.string().optional().nullable(),
2038
+ password: z3.string().optional().nullable(),
2039
+ passwordCheck: z3.string().optional().nullable(),
2040
+ name: z3.string().optional().nullable(),
2041
+ surname: z3.string().optional().nullable(),
2042
+ birthDate: z3.string().optional().nullable(),
2043
+ gender: z3.string().optional().nullable(),
2044
+ cpf: z3.string().optional().nullable(),
2045
+ contact: customerContact1.optional().nullable()
2046
+ });
2047
+ });
2048
+ var createConsumerRequestCustomerResponse = z3.lazy(() => {
2049
+ return z3.object({
2050
+ CustomerType: z3.string().optional().nullable(),
2051
+ Email: z3.string().optional().nullable(),
2052
+ Password: z3.string().optional().nullable(),
2053
+ Password_Check: z3.string().optional().nullable(),
2054
+ Name: z3.string().optional().nullable(),
2055
+ Surname: z3.string().optional().nullable(),
2056
+ BirthDate: z3.string().optional().nullable(),
2057
+ Gender: z3.string().optional().nullable(),
2058
+ Cpf: z3.string().optional().nullable(),
2059
+ Contact: customerContact1Response.optional().nullable()
2060
+ }).transform((data) => ({
2061
+ customerType: data["CustomerType"],
2062
+ email: data["Email"],
2063
+ password: data["Password"],
2064
+ passwordCheck: data["Password_Check"],
2065
+ name: data["Name"],
2066
+ surname: data["Surname"],
2067
+ birthDate: data["BirthDate"],
2068
+ gender: data["Gender"],
2069
+ cpf: data["Cpf"],
2070
+ contact: data["Contact"]
2071
+ }));
2072
+ });
2073
+ var createConsumerRequestCustomerRequest = z3.lazy(() => {
2074
+ return z3.object({
2075
+ customerType: z3.string().optional().nullable(),
2076
+ email: z3.string().optional().nullable(),
2077
+ password: z3.string().optional().nullable(),
2078
+ passwordCheck: z3.string().optional().nullable(),
2079
+ name: z3.string().optional().nullable(),
2080
+ surname: z3.string().optional().nullable(),
2081
+ birthDate: z3.string().optional().nullable(),
2082
+ gender: z3.string().optional().nullable(),
2083
+ cpf: z3.string().optional().nullable(),
2084
+ contact: customerContact1Request.optional().nullable()
2085
+ }).transform((data) => ({
2086
+ CustomerType: data["customerType"],
2087
+ Email: data["email"],
2088
+ Password: data["password"],
2089
+ Password_Check: data["passwordCheck"],
2090
+ Name: data["name"],
2091
+ Surname: data["surname"],
2092
+ BirthDate: data["birthDate"],
2093
+ Gender: data["gender"],
2094
+ Cpf: data["cpf"],
2095
+ Contact: data["contact"]
2096
+ }));
2097
+ });
2098
+
2099
+ // src/services/customers/models/create-consumer-request.ts
2100
+ var createConsumerRequest = z4.lazy(() => {
2101
+ return z4.object({
2102
+ customer: createConsumerRequestCustomer.optional().nullable(),
2103
+ basketId: z4.number().optional().nullable()
2104
+ });
2105
+ });
2106
+ var createConsumerRequestResponse = z4.lazy(() => {
2107
+ return z4.object({
2108
+ Customer: createConsumerRequestCustomerResponse.optional().nullable(),
2109
+ BasketID: z4.number().optional().nullable()
2110
+ }).transform((data) => ({
2111
+ customer: data["Customer"],
2112
+ basketId: data["BasketID"]
2113
+ }));
2114
+ });
2115
+ var createConsumerRequestRequest = z4.lazy(() => {
2116
+ return z4.object({
2117
+ customer: createConsumerRequestCustomerRequest.optional().nullable(),
2118
+ basketId: z4.number().optional().nullable()
2119
+ }).transform((data) => ({
2120
+ Customer: data["customer"],
2121
+ BasketID: data["basketId"]
2122
+ }));
2123
+ });
2124
+
2125
+ // src/services/customers/models/create-business-account-request.ts
2126
+ import { z as z10 } from "zod";
2127
+
2128
+ // src/services/customers/models/create-business-account-request-customer.ts
2129
+ import { z as z6 } from "zod";
2130
+
2131
+ // src/services/customers/models/customer-contact-2.ts
2132
+ import { z as z5 } from "zod";
2133
+ var customerContact2 = z5.lazy(() => {
2134
+ return z5.object({
2135
+ phone: z5.string().optional().nullable(),
2136
+ phone2: z5.string().optional().nullable(),
2137
+ cellPhone: z5.string().optional().nullable(),
2138
+ fax: z5.string().optional().nullable()
2139
+ });
2140
+ });
2141
+ var customerContact2Response = z5.lazy(() => {
2142
+ return z5.object({
2143
+ Phone: z5.string().optional().nullable(),
2144
+ Phone2: z5.string().optional().nullable(),
2145
+ CellPhone: z5.string().optional().nullable(),
2146
+ Fax: z5.string().optional().nullable()
2147
+ }).transform((data) => ({
2148
+ phone: data["Phone"],
2149
+ phone2: data["Phone2"],
2150
+ cellPhone: data["CellPhone"],
2151
+ fax: data["Fax"]
2152
+ }));
2153
+ });
2154
+ var customerContact2Request = z5.lazy(() => {
2155
+ return z5.object({
2156
+ phone: z5.string().optional().nullable(),
2157
+ phone2: z5.string().optional().nullable(),
2158
+ cellPhone: z5.string().optional().nullable(),
2159
+ fax: z5.string().optional().nullable()
2160
+ }).transform((data) => ({
2161
+ Phone: data["phone"],
2162
+ Phone2: data["phone2"],
2163
+ CellPhone: data["cellPhone"],
2164
+ Fax: data["fax"]
2165
+ }));
2166
+ });
2167
+
2168
+ // src/services/customers/models/create-business-account-request-customer.ts
2169
+ var createBusinessAccountRequestCustomer = z6.lazy(() => {
2170
+ return z6.object({
2171
+ customerType: z6.string().optional().nullable(),
2172
+ sourceEnvironment: z6.string().optional().nullable(),
2173
+ email: z6.string().optional().nullable(),
2174
+ password: z6.string().optional().nullable(),
2175
+ passwordCheck: z6.string().optional().nullable(),
2176
+ passwordCurrent: z6.string().optional().nullable(),
2177
+ currentPassword: z6.string().optional().nullable(),
2178
+ generatePassword: z6.boolean().optional().nullable(),
2179
+ generateAndDefinePassword: z6.boolean().optional().nullable(),
2180
+ recoveryPasswordActionUrl: z6.string().optional().nullable(),
2181
+ name: z6.string().optional().nullable(),
2182
+ surname: z6.string().optional().nullable(),
2183
+ birthDate: z6.string().optional().nullable(),
2184
+ gender: z6.string().optional().nullable(),
2185
+ cpf: z6.string().optional().nullable(),
2186
+ rg: z6.string().optional().nullable(),
2187
+ tradingName: z6.string().optional().nullable(),
2188
+ cnpj: z6.string().optional().nullable(),
2189
+ contact: customerContact2.optional().nullable(),
2190
+ extendedProperties: z6.array(z6.string()).optional().nullable(),
2191
+ currentUserIPs: z6.string().optional().nullable(),
2192
+ provider: z6.string().optional().nullable(),
2193
+ isCustomerRelation: z6.boolean().optional().nullable(),
2194
+ reCaptchaToken: z6.string().optional().nullable(),
2195
+ isFromGuestSession: z6.boolean().optional().nullable(),
2196
+ prefixFormat: z6.string().optional().nullable()
2197
+ });
2198
+ });
2199
+ var createBusinessAccountRequestCustomerResponse = z6.lazy(() => {
2200
+ return z6.object({
2201
+ CustomerType: z6.string().optional().nullable(),
2202
+ SourceEnvironment: z6.string().optional().nullable(),
2203
+ Email: z6.string().optional().nullable(),
2204
+ Password: z6.string().optional().nullable(),
2205
+ Password_Check: z6.string().optional().nullable(),
2206
+ Password_Current: z6.string().optional().nullable(),
2207
+ CurrentPassword: z6.string().optional().nullable(),
2208
+ GeneratePassword: z6.boolean().optional().nullable(),
2209
+ GenerateAndDefinePassword: z6.boolean().optional().nullable(),
2210
+ RecoveryPasswordActionUrl: z6.string().optional().nullable(),
2211
+ Name: z6.string().optional().nullable(),
2212
+ Surname: z6.string().optional().nullable(),
2213
+ BirthDate: z6.string().optional().nullable(),
2214
+ Gender: z6.string().optional().nullable(),
2215
+ Cpf: z6.string().optional().nullable(),
2216
+ RG: z6.string().optional().nullable(),
2217
+ TradingName: z6.string().optional().nullable(),
2218
+ Cnpj: z6.string().optional().nullable(),
2219
+ Contact: customerContact2Response.optional().nullable(),
2220
+ ExtendedProperties: z6.array(z6.string()).optional().nullable(),
2221
+ CurrentUserIPs: z6.string().optional().nullable(),
2222
+ Provider: z6.string().optional().nullable(),
2223
+ IsCustomerRelation: z6.boolean().optional().nullable(),
2224
+ ReCaptchaToken: z6.string().optional().nullable(),
2225
+ IsFromGuestSession: z6.boolean().optional().nullable(),
2226
+ PrefixFormat: z6.string().optional().nullable()
2227
+ }).transform((data) => ({
2228
+ customerType: data["CustomerType"],
2229
+ sourceEnvironment: data["SourceEnvironment"],
2230
+ email: data["Email"],
2231
+ password: data["Password"],
2232
+ passwordCheck: data["Password_Check"],
2233
+ passwordCurrent: data["Password_Current"],
2234
+ currentPassword: data["CurrentPassword"],
2235
+ generatePassword: data["GeneratePassword"],
2236
+ generateAndDefinePassword: data["GenerateAndDefinePassword"],
2237
+ recoveryPasswordActionUrl: data["RecoveryPasswordActionUrl"],
2238
+ name: data["Name"],
2239
+ surname: data["Surname"],
2240
+ birthDate: data["BirthDate"],
2241
+ gender: data["Gender"],
2242
+ cpf: data["Cpf"],
2243
+ rg: data["RG"],
2244
+ tradingName: data["TradingName"],
2245
+ cnpj: data["Cnpj"],
2246
+ contact: data["Contact"],
2247
+ extendedProperties: data["ExtendedProperties"],
2248
+ currentUserIPs: data["CurrentUserIPs"],
2249
+ provider: data["Provider"],
2250
+ isCustomerRelation: data["IsCustomerRelation"],
2251
+ reCaptchaToken: data["ReCaptchaToken"],
2252
+ isFromGuestSession: data["IsFromGuestSession"],
2253
+ prefixFormat: data["PrefixFormat"]
2254
+ }));
2255
+ });
2256
+ var createBusinessAccountRequestCustomerRequest = z6.lazy(() => {
2257
+ return z6.object({
2258
+ customerType: z6.string().optional().nullable(),
2259
+ sourceEnvironment: z6.string().optional().nullable(),
2260
+ email: z6.string().optional().nullable(),
2261
+ password: z6.string().optional().nullable(),
2262
+ passwordCheck: z6.string().optional().nullable(),
2263
+ passwordCurrent: z6.string().optional().nullable(),
2264
+ currentPassword: z6.string().optional().nullable(),
2265
+ generatePassword: z6.boolean().optional().nullable(),
2266
+ generateAndDefinePassword: z6.boolean().optional().nullable(),
2267
+ recoveryPasswordActionUrl: z6.string().optional().nullable(),
2268
+ name: z6.string().optional().nullable(),
2269
+ surname: z6.string().optional().nullable(),
2270
+ birthDate: z6.string().optional().nullable(),
2271
+ gender: z6.string().optional().nullable(),
2272
+ cpf: z6.string().optional().nullable(),
2273
+ rg: z6.string().optional().nullable(),
2274
+ tradingName: z6.string().optional().nullable(),
2275
+ cnpj: z6.string().optional().nullable(),
2276
+ contact: customerContact2Request.optional().nullable(),
2277
+ extendedProperties: z6.array(z6.string()).optional().nullable(),
2278
+ currentUserIPs: z6.string().optional().nullable(),
2279
+ provider: z6.string().optional().nullable(),
2280
+ isCustomerRelation: z6.boolean().optional().nullable(),
2281
+ reCaptchaToken: z6.string().optional().nullable(),
2282
+ isFromGuestSession: z6.boolean().optional().nullable(),
2283
+ prefixFormat: z6.string().optional().nullable()
2284
+ }).transform((data) => ({
2285
+ CustomerType: data["customerType"],
2286
+ SourceEnvironment: data["sourceEnvironment"],
2287
+ Email: data["email"],
2288
+ Password: data["password"],
2289
+ Password_Check: data["passwordCheck"],
2290
+ Password_Current: data["passwordCurrent"],
2291
+ CurrentPassword: data["currentPassword"],
2292
+ GeneratePassword: data["generatePassword"],
2293
+ GenerateAndDefinePassword: data["generateAndDefinePassword"],
2294
+ RecoveryPasswordActionUrl: data["recoveryPasswordActionUrl"],
2295
+ Name: data["name"],
2296
+ Surname: data["surname"],
2297
+ BirthDate: data["birthDate"],
2298
+ Gender: data["gender"],
2299
+ Cpf: data["cpf"],
2300
+ RG: data["rg"],
2301
+ TradingName: data["tradingName"],
2302
+ Cnpj: data["cnpj"],
2303
+ Contact: data["contact"],
2304
+ ExtendedProperties: data["extendedProperties"],
2305
+ CurrentUserIPs: data["currentUserIPs"],
2306
+ Provider: data["provider"],
2307
+ IsCustomerRelation: data["isCustomerRelation"],
2308
+ ReCaptchaToken: data["reCaptchaToken"],
2309
+ IsFromGuestSession: data["isFromGuestSession"],
2310
+ PrefixFormat: data["prefixFormat"]
2311
+ }));
2312
+ });
2313
+
2314
+ // src/services/customers/models/addresses.ts
2315
+ import { z as z9 } from "zod";
2316
+
2317
+ // src/services/customers/models/extended-properties.ts
2318
+ import { z as z8 } from "zod";
2319
+
2320
+ // src/services/customers/models/html-attributes.ts
2321
+ import { z as z7 } from "zod";
2322
+ var htmlAttributes = z7.lazy(() => {
2323
+ return z7.object({
2324
+ additionalProp1: z7.string().optional().nullable(),
2325
+ additionalProp2: z7.string().optional().nullable(),
2326
+ additionalProp3: z7.string().optional().nullable()
2327
+ });
2328
+ });
2329
+ var htmlAttributesResponse = z7.lazy(() => {
2330
+ return z7.object({
2331
+ additionalProp1: z7.string().optional().nullable(),
2332
+ additionalProp2: z7.string().optional().nullable(),
2333
+ additionalProp3: z7.string().optional().nullable()
2334
+ }).transform((data) => ({
2335
+ additionalProp1: data["additionalProp1"],
2336
+ additionalProp2: data["additionalProp2"],
2337
+ additionalProp3: data["additionalProp3"]
2338
+ }));
2339
+ });
2340
+ var htmlAttributesRequest = z7.lazy(() => {
2341
+ return z7.object({
2342
+ additionalProp1: z7.string().optional().nullable(),
2343
+ additionalProp2: z7.string().optional().nullable(),
2344
+ additionalProp3: z7.string().optional().nullable()
2345
+ }).transform((data) => ({
2346
+ additionalProp1: data["additionalProp1"],
2347
+ additionalProp2: data["additionalProp2"],
2348
+ additionalProp3: data["additionalProp3"]
2349
+ }));
2350
+ });
2351
+
2352
+ // src/services/customers/models/extended-properties.ts
2353
+ var extendedProperties = z8.lazy(() => {
2354
+ return z8.object({
2355
+ prefix: z8.string().optional().nullable(),
2356
+ htmlAttributes: htmlAttributes.optional().nullable(),
2357
+ inputType: z8.string().optional().nullable(),
2358
+ name: z8.string().optional().nullable(),
2359
+ fieldName: z8.string().optional().nullable(),
2360
+ bindType: z8.string().optional().nullable(),
2361
+ entityMetadataId: z8.number().optional().nullable(),
2362
+ value: z8.string().optional().nullable(),
2363
+ values: z8.array(z8.string()).optional().nullable(),
2364
+ isNew: z8.boolean().optional().nullable(),
2365
+ isRequired: z8.boolean().optional().nullable(),
2366
+ displayName: z8.string().optional().nullable(),
2367
+ optionName: z8.string().optional().nullable()
2368
+ });
2369
+ });
2370
+ var extendedPropertiesResponse = z8.lazy(() => {
2371
+ return z8.object({
2372
+ Prefix: z8.string().optional().nullable(),
2373
+ HtmlAttributes: htmlAttributesResponse.optional().nullable(),
2374
+ InputType: z8.string().optional().nullable(),
2375
+ Name: z8.string().optional().nullable(),
2376
+ FieldName: z8.string().optional().nullable(),
2377
+ BindType: z8.string().optional().nullable(),
2378
+ EntityMetadataID: z8.number().optional().nullable(),
2379
+ Value: z8.string().optional().nullable(),
2380
+ Values: z8.array(z8.string()).optional().nullable(),
2381
+ IsNew: z8.boolean().optional().nullable(),
2382
+ IsRequired: z8.boolean().optional().nullable(),
2383
+ DisplayName: z8.string().optional().nullable(),
2384
+ OptionName: z8.string().optional().nullable()
2385
+ }).transform((data) => ({
2386
+ prefix: data["Prefix"],
2387
+ htmlAttributes: data["HtmlAttributes"],
2388
+ inputType: data["InputType"],
2389
+ name: data["Name"],
2390
+ fieldName: data["FieldName"],
2391
+ bindType: data["BindType"],
2392
+ entityMetadataId: data["EntityMetadataID"],
2393
+ value: data["Value"],
2394
+ values: data["Values"],
2395
+ isNew: data["IsNew"],
2396
+ isRequired: data["IsRequired"],
2397
+ displayName: data["DisplayName"],
2398
+ optionName: data["OptionName"]
2399
+ }));
2400
+ });
2401
+ var extendedPropertiesRequest = z8.lazy(() => {
2402
+ return z8.object({
2403
+ prefix: z8.string().optional().nullable(),
2404
+ htmlAttributes: htmlAttributesRequest.optional().nullable(),
2405
+ inputType: z8.string().optional().nullable(),
2406
+ name: z8.string().optional().nullable(),
2407
+ fieldName: z8.string().optional().nullable(),
2408
+ bindType: z8.string().optional().nullable(),
2409
+ entityMetadataId: z8.number().optional().nullable(),
2410
+ value: z8.string().optional().nullable(),
2411
+ values: z8.array(z8.string()).optional().nullable(),
2412
+ isNew: z8.boolean().optional().nullable(),
2413
+ isRequired: z8.boolean().optional().nullable(),
2414
+ displayName: z8.string().optional().nullable(),
2415
+ optionName: z8.string().optional().nullable()
2416
+ }).transform((data) => ({
2417
+ Prefix: data["prefix"],
2418
+ HtmlAttributes: data["htmlAttributes"],
2419
+ InputType: data["inputType"],
2420
+ Name: data["name"],
2421
+ FieldName: data["fieldName"],
2422
+ BindType: data["bindType"],
2423
+ EntityMetadataID: data["entityMetadataId"],
2424
+ Value: data["value"],
2425
+ Values: data["values"],
2426
+ IsNew: data["isNew"],
2427
+ IsRequired: data["isRequired"],
2428
+ DisplayName: data["displayName"],
2429
+ OptionName: data["optionName"]
2430
+ }));
2431
+ });
2432
+
2433
+ // src/services/customers/models/addresses.ts
2434
+ var addresses = z9.lazy(() => {
2435
+ return z9.object({
2436
+ id: z9.number().optional().nullable(),
2437
+ name: z9.string().optional().nullable(),
2438
+ contactName: z9.string().optional().nullable(),
2439
+ addressLine: z9.string().optional().nullable(),
2440
+ city: z9.string().optional().nullable(),
2441
+ neighbourhood: z9.string().optional().nullable(),
2442
+ number: z9.string().optional().nullable(),
2443
+ state: z9.string().optional().nullable(),
2444
+ postalCode: z9.string().optional().nullable(),
2445
+ addressNotes: z9.string().optional().nullable(),
2446
+ landmark: z9.string().optional().nullable(),
2447
+ isMainAddress: z9.boolean().optional().nullable(),
2448
+ setAsShippingAddress: z9.boolean().optional().nullable(),
2449
+ setAsBillingAddress: z9.boolean().optional().nullable(),
2450
+ latitude: z9.string().optional().nullable(),
2451
+ longitude: z9.string().optional().nullable(),
2452
+ extendedProperties: z9.array(extendedProperties).optional().nullable(),
2453
+ currentUserIPs: z9.string().optional().nullable(),
2454
+ prefixFormat: z9.string().optional().nullable()
2455
+ });
2456
+ });
2457
+ var addressesResponse = z9.lazy(() => {
2458
+ return z9.object({
2459
+ ID: z9.number().optional().nullable(),
2460
+ Name: z9.string().optional().nullable(),
2461
+ ContactName: z9.string().optional().nullable(),
2462
+ AddressLine: z9.string().optional().nullable(),
2463
+ City: z9.string().optional().nullable(),
2464
+ Neighbourhood: z9.string().optional().nullable(),
2465
+ Number: z9.string().optional().nullable(),
2466
+ State: z9.string().optional().nullable(),
2467
+ PostalCode: z9.string().optional().nullable(),
2468
+ AddressNotes: z9.string().optional().nullable(),
2469
+ Landmark: z9.string().optional().nullable(),
2470
+ IsMainAddress: z9.boolean().optional().nullable(),
2471
+ SetAsShippingAddress: z9.boolean().optional().nullable(),
2472
+ SetAsBillingAddress: z9.boolean().optional().nullable(),
2473
+ Latitude: z9.string().optional().nullable(),
2474
+ Longitude: z9.string().optional().nullable(),
2475
+ ExtendedProperties: z9.array(extendedPropertiesResponse).optional().nullable(),
2476
+ CurrentUserIPs: z9.string().optional().nullable(),
2477
+ PrefixFormat: z9.string().optional().nullable()
2478
+ }).transform((data) => ({
2479
+ id: data["ID"],
2480
+ name: data["Name"],
2481
+ contactName: data["ContactName"],
2482
+ addressLine: data["AddressLine"],
2483
+ city: data["City"],
2484
+ neighbourhood: data["Neighbourhood"],
2485
+ number: data["Number"],
2486
+ state: data["State"],
2487
+ postalCode: data["PostalCode"],
2488
+ addressNotes: data["AddressNotes"],
2489
+ landmark: data["Landmark"],
2490
+ isMainAddress: data["IsMainAddress"],
2491
+ setAsShippingAddress: data["SetAsShippingAddress"],
2492
+ setAsBillingAddress: data["SetAsBillingAddress"],
2493
+ latitude: data["Latitude"],
2494
+ longitude: data["Longitude"],
2495
+ extendedProperties: data["ExtendedProperties"],
2496
+ currentUserIPs: data["CurrentUserIPs"],
2497
+ prefixFormat: data["PrefixFormat"]
2498
+ }));
2499
+ });
2500
+ var addressesRequest = z9.lazy(() => {
2501
+ return z9.object({
2502
+ id: z9.number().optional().nullable(),
2503
+ name: z9.string().optional().nullable(),
2504
+ contactName: z9.string().optional().nullable(),
2505
+ addressLine: z9.string().optional().nullable(),
2506
+ city: z9.string().optional().nullable(),
2507
+ neighbourhood: z9.string().optional().nullable(),
2508
+ number: z9.string().optional().nullable(),
2509
+ state: z9.string().optional().nullable(),
2510
+ postalCode: z9.string().optional().nullable(),
2511
+ addressNotes: z9.string().optional().nullable(),
2512
+ landmark: z9.string().optional().nullable(),
2513
+ isMainAddress: z9.boolean().optional().nullable(),
2514
+ setAsShippingAddress: z9.boolean().optional().nullable(),
2515
+ setAsBillingAddress: z9.boolean().optional().nullable(),
2516
+ latitude: z9.string().optional().nullable(),
2517
+ longitude: z9.string().optional().nullable(),
2518
+ extendedProperties: z9.array(extendedPropertiesRequest).optional().nullable(),
2519
+ currentUserIPs: z9.string().optional().nullable(),
2520
+ prefixFormat: z9.string().optional().nullable()
2521
+ }).transform((data) => ({
2522
+ ID: data["id"],
2523
+ Name: data["name"],
2524
+ ContactName: data["contactName"],
2525
+ AddressLine: data["addressLine"],
2526
+ City: data["city"],
2527
+ Neighbourhood: data["neighbourhood"],
2528
+ Number: data["number"],
2529
+ State: data["state"],
2530
+ PostalCode: data["postalCode"],
2531
+ AddressNotes: data["addressNotes"],
2532
+ Landmark: data["landmark"],
2533
+ IsMainAddress: data["isMainAddress"],
2534
+ SetAsShippingAddress: data["setAsShippingAddress"],
2535
+ SetAsBillingAddress: data["setAsBillingAddress"],
2536
+ Latitude: data["latitude"],
2537
+ Longitude: data["longitude"],
2538
+ ExtendedProperties: data["extendedProperties"],
2539
+ CurrentUserIPs: data["currentUserIPs"],
2540
+ PrefixFormat: data["prefixFormat"]
2541
+ }));
2542
+ });
2543
+
2544
+ // src/services/customers/models/create-business-account-request.ts
2545
+ var createBusinessAccountRequest = z10.lazy(() => {
2546
+ return z10.object({
2547
+ customer: createBusinessAccountRequestCustomer.optional().nullable(),
2548
+ addresses: z10.array(addresses).optional().nullable(),
2549
+ shopperTicketId: z10.string().optional().nullable(),
2550
+ basketId: z10.number().optional().nullable(),
2551
+ customerId: z10.number().optional().nullable(),
2552
+ sessionId: z10.string().optional().nullable()
2553
+ });
2554
+ });
2555
+ var createBusinessAccountRequestResponse = z10.lazy(() => {
2556
+ return z10.object({
2557
+ Customer: createBusinessAccountRequestCustomerResponse.optional().nullable(),
2558
+ Addresses: z10.array(addressesResponse).optional().nullable(),
2559
+ ShopperTicketID: z10.string().optional().nullable(),
2560
+ BasketID: z10.number().optional().nullable(),
2561
+ CustomerID: z10.number().optional().nullable(),
2562
+ SessionID: z10.string().optional().nullable()
2563
+ }).transform((data) => ({
2564
+ customer: data["Customer"],
2565
+ addresses: data["Addresses"],
2566
+ shopperTicketId: data["ShopperTicketID"],
2567
+ basketId: data["BasketID"],
2568
+ customerId: data["CustomerID"],
2569
+ sessionId: data["SessionID"]
2570
+ }));
2571
+ });
2572
+ var createBusinessAccountRequestRequest = z10.lazy(() => {
2573
+ return z10.object({
2574
+ customer: createBusinessAccountRequestCustomerRequest.optional().nullable(),
2575
+ addresses: z10.array(addressesRequest).optional().nullable(),
2576
+ shopperTicketId: z10.string().optional().nullable(),
2577
+ basketId: z10.number().optional().nullable(),
2578
+ customerId: z10.number().optional().nullable(),
2579
+ sessionId: z10.string().optional().nullable()
2580
+ }).transform((data) => ({
2581
+ Customer: data["customer"],
2582
+ Addresses: data["addresses"],
2583
+ ShopperTicketID: data["shopperTicketId"],
2584
+ BasketID: data["basketId"],
2585
+ CustomerID: data["customerId"],
2586
+ SessionID: data["sessionId"]
2587
+ }));
2588
+ });
2589
+
2590
+ // src/services/customers/models/login-request.ts
2591
+ import { z as z11 } from "zod";
2592
+ var loginRequest = z11.lazy(() => {
2593
+ return z11.object({
2594
+ key: z11.string().optional().nullable(),
2595
+ password: z11.string().optional().nullable()
2596
+ });
2597
+ });
2598
+ var loginRequestResponse = z11.lazy(() => {
2599
+ return z11.object({
2600
+ Key: z11.string().optional().nullable(),
2601
+ Password: z11.string().optional().nullable()
2602
+ }).transform((data) => ({
2603
+ key: data["Key"],
2604
+ password: data["Password"]
2605
+ }));
2606
+ });
2607
+ var loginRequestRequest = z11.lazy(() => {
2608
+ return z11.object({
2609
+ key: z11.string().optional().nullable(),
2610
+ password: z11.string().optional().nullable()
2611
+ }).transform((data) => ({
2612
+ Key: data["key"],
2613
+ Password: data["password"]
2614
+ }));
2615
+ });
2616
+
2617
+ // src/services/customers/models/recover-password-request.ts
2618
+ import { z as z12 } from "zod";
2619
+ var recoverPasswordRequest = z12.lazy(() => {
2620
+ return z12.object({
2621
+ key: z12.string().optional().nullable()
2622
+ });
2623
+ });
2624
+ var recoverPasswordRequestResponse = z12.lazy(() => {
2625
+ return z12.object({
2626
+ Key: z12.string().optional().nullable()
2627
+ }).transform((data) => ({
2628
+ key: data["Key"]
2629
+ }));
2630
+ });
2631
+ var recoverPasswordRequestRequest = z12.lazy(() => {
2632
+ return z12.object({
2633
+ key: z12.string().optional().nullable()
2634
+ }).transform((data) => ({
2635
+ Key: data["key"]
2636
+ }));
2637
+ });
2638
+
2639
+ // src/services/customers/customers-service.ts
2640
+ var CustomersService = class extends BaseService {
2641
+ constructor() {
2642
+ super(...arguments);
2643
+ this.createConsumerConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
2644
+ this.createBusinessAccountConfig = {
2645
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
2646
+ };
2647
+ this.loginConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
2648
+ this.refreshLoginConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
2649
+ this.keepSessionActiveConfig = {
2650
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
2651
+ };
2652
+ this.consumerDetailConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
2653
+ this.updateConsumerConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
2654
+ this.recoverPasswordConfig = {
2655
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
2656
+ };
2657
+ this.logoutConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
2658
+ this.sendPinConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
2659
+ this.sendConfirmationEmailConfig = {
2660
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
2661
+ };
2662
+ }
2663
+ /**
2664
+ * Sets method-level configuration for createConsumer.
2665
+ * @param config - Partial configuration to override service-level defaults
2666
+ * @returns This service instance for method chaining
2667
+ */
2668
+ setCreateConsumerConfig(config) {
2669
+ this.createConsumerConfig = config;
2670
+ return this;
2671
+ }
2672
+ /**
2673
+ * Sets method-level configuration for createBusinessAccount.
2674
+ * @param config - Partial configuration to override service-level defaults
2675
+ * @returns This service instance for method chaining
2676
+ */
2677
+ setCreateBusinessAccountConfig(config) {
2678
+ this.createBusinessAccountConfig = config;
2679
+ return this;
2680
+ }
2681
+ /**
2682
+ * Sets method-level configuration for login.
2683
+ * @param config - Partial configuration to override service-level defaults
2684
+ * @returns This service instance for method chaining
2685
+ */
2686
+ setLoginConfig(config) {
2687
+ this.loginConfig = config;
2688
+ return this;
2689
+ }
2690
+ /**
2691
+ * Sets method-level configuration for refreshLogin.
2692
+ * @param config - Partial configuration to override service-level defaults
2693
+ * @returns This service instance for method chaining
2694
+ */
2695
+ setRefreshLoginConfig(config) {
2696
+ this.refreshLoginConfig = config;
2697
+ return this;
2698
+ }
2699
+ /**
2700
+ * Sets method-level configuration for keepSessionActive.
2701
+ * @param config - Partial configuration to override service-level defaults
2702
+ * @returns This service instance for method chaining
2703
+ */
2704
+ setKeepSessionActiveConfig(config) {
2705
+ this.keepSessionActiveConfig = config;
2706
+ return this;
2707
+ }
2708
+ /**
2709
+ * Sets method-level configuration for consumerDetail.
2710
+ * @param config - Partial configuration to override service-level defaults
2711
+ * @returns This service instance for method chaining
2712
+ */
2713
+ setConsumerDetailConfig(config) {
2714
+ this.consumerDetailConfig = config;
2715
+ return this;
2716
+ }
2717
+ /**
2718
+ * Sets method-level configuration for updateConsumer.
2719
+ * @param config - Partial configuration to override service-level defaults
2720
+ * @returns This service instance for method chaining
2721
+ */
2722
+ setUpdateConsumerConfig(config) {
2723
+ this.updateConsumerConfig = config;
2724
+ return this;
2725
+ }
2726
+ /**
2727
+ * Sets method-level configuration for recoverPassword.
2728
+ * @param config - Partial configuration to override service-level defaults
2729
+ * @returns This service instance for method chaining
2730
+ */
2731
+ setRecoverPasswordConfig(config) {
2732
+ this.recoverPasswordConfig = config;
2733
+ return this;
2734
+ }
2735
+ /**
2736
+ * Sets method-level configuration for logout.
2737
+ * @param config - Partial configuration to override service-level defaults
2738
+ * @returns This service instance for method chaining
2739
+ */
2740
+ setLogoutConfig(config) {
2741
+ this.logoutConfig = config;
2742
+ return this;
2743
+ }
2744
+ /**
2745
+ * Sets method-level configuration for sendPin.
2746
+ * @param config - Partial configuration to override service-level defaults
2747
+ * @returns This service instance for method chaining
2748
+ */
2749
+ setSendPinConfig(config) {
2750
+ this.sendPinConfig = config;
2751
+ return this;
2752
+ }
2753
+ /**
2754
+ * Sets method-level configuration for sendConfirmationEmail.
2755
+ * @param config - Partial configuration to override service-level defaults
2756
+ * @returns This service instance for method chaining
2757
+ */
2758
+ setSendConfirmationEmailConfig(config) {
2759
+ this.sendConfirmationEmailConfig = config;
2760
+ return this;
2761
+ }
2762
+ /**
2763
+ *
2764
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2765
+ * @returns {Promise<HttpResponse<any>>} - OK
2766
+ */
2767
+ async createConsumer(body, requestConfig) {
2768
+ const resolvedConfig = this.getResolvedConfig(this.createConsumerConfig, requestConfig);
2769
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/Register").setRequestSchema(createConsumerRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2770
+ schema: z13.any(),
2771
+ contentType: "json" /* Json */,
2772
+ status: 200
2773
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2774
+ return this.client.callDirect(request);
2775
+ }
2776
+ /**
2777
+ *
2778
+ * @param {string} params.accept -
2779
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2780
+ * @returns {Promise<HttpResponse<any>>} - OK
2781
+ */
2782
+ async createBusinessAccount(body, params, requestConfig) {
2783
+ const resolvedConfig = this.getResolvedConfig(this.createBusinessAccountConfig, requestConfig);
2784
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/Register").setRequestSchema(createBusinessAccountRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2785
+ schema: z13.any(),
2786
+ contentType: "json" /* Json */,
2787
+ status: 200
2788
+ }).addHeaderParam({
2789
+ key: "Accept",
2790
+ value: params == null ? void 0 : params.accept
2791
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2792
+ return this.client.callDirect(request);
2793
+ }
2794
+ /**
2795
+ *
2796
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2797
+ * @returns {Promise<HttpResponse<any>>} - OK
2798
+ */
2799
+ async login(body, requestConfig) {
2800
+ const resolvedConfig = this.getResolvedConfig(this.loginConfig, requestConfig);
2801
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/Login").setRequestSchema(loginRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2802
+ schema: z13.any(),
2803
+ contentType: "json" /* Json */,
2804
+ status: 200
2805
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2806
+ return this.client.callDirect(request);
2807
+ }
2808
+ /**
2809
+ *
2810
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2811
+ * @returns {Promise<HttpResponse<any>>} - OK
2812
+ */
2813
+ async refreshLogin(body, requestConfig) {
2814
+ const resolvedConfig = this.getResolvedConfig(this.refreshLoginConfig, requestConfig);
2815
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/RefreshLogin").setRequestSchema(z13.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2816
+ schema: z13.any(),
2817
+ contentType: "json" /* Json */,
2818
+ status: 200
2819
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2820
+ return this.client.callDirect(request);
2821
+ }
2822
+ /**
2823
+ *
2824
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2825
+ * @returns {Promise<HttpResponse<any>>} - OK
2826
+ */
2827
+ async keepSessionActive(body, requestConfig) {
2828
+ const resolvedConfig = this.getResolvedConfig(this.keepSessionActiveConfig, requestConfig);
2829
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/KeepAlive").setRequestSchema(z13.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2830
+ schema: z13.any(),
2831
+ contentType: "json" /* Json */,
2832
+ status: 200
2833
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2834
+ return this.client.callDirect(request);
2835
+ }
2836
+ /**
2837
+ *
2838
+ * @param {string} [params.customerId] -
2839
+ * @param {string} [params.sessionId] -
2840
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2841
+ * @returns {Promise<HttpResponse<any>>} - OK
2842
+ */
2843
+ async consumerDetail(params, requestConfig) {
2844
+ const resolvedConfig = this.getResolvedConfig(this.consumerDetailConfig, requestConfig);
2845
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/Profile/Customer/GetCustomer").setRequestSchema(z13.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2846
+ schema: z13.any(),
2847
+ contentType: "json" /* Json */,
2848
+ status: 200
2849
+ }).addQueryParam({
2850
+ key: "customerID",
2851
+ value: params == null ? void 0 : params.customerId
2852
+ }).addQueryParam({
2853
+ key: "sessionID",
2854
+ value: params == null ? void 0 : params.sessionId
2855
+ }).build();
2856
+ return this.client.callDirect(request);
2857
+ }
2858
+ /**
2859
+ *
2860
+ * @param {string} params.accept -
2861
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2862
+ * @returns {Promise<HttpResponse<any>>} - OK
2863
+ */
2864
+ async updateConsumer(body, params, requestConfig) {
2865
+ const resolvedConfig = this.getResolvedConfig(this.updateConsumerConfig, requestConfig);
2866
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/Update").setRequestSchema(z13.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2867
+ schema: z13.any(),
2868
+ contentType: "json" /* Json */,
2869
+ status: 200
2870
+ }).addHeaderParam({
2871
+ key: "Accept",
2872
+ value: params == null ? void 0 : params.accept
2873
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2874
+ return this.client.callDirect(request);
2875
+ }
2876
+ /**
2877
+ *
2878
+ * @param {string} params.accept -
2879
+ * @param {string} params.cacheControl -
2880
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2881
+ * @returns {Promise<HttpResponse<any>>} - OK
2882
+ */
2883
+ async recoverPassword(body, params, requestConfig) {
2884
+ const resolvedConfig = this.getResolvedConfig(this.recoverPasswordConfig, requestConfig);
2885
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Customer/RecoverPassword").setRequestSchema(recoverPasswordRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
2886
+ schema: z13.any(),
2887
+ contentType: "json" /* Json */,
2888
+ status: 200
2889
+ }).addHeaderParam({
2890
+ key: "Accept",
2891
+ value: params == null ? void 0 : params.accept
2892
+ }).addHeaderParam({
2893
+ key: "Cache-Control",
2894
+ value: params == null ? void 0 : params.cacheControl
2895
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2896
+ return this.client.callDirect(request);
2897
+ }
2898
+ /**
2899
+ *
2900
+ * @param {string} params.authorization -
2901
+ * @param {string} params.accept -
2902
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2903
+ * @returns {Promise<HttpResponse<any>>} - OK
2904
+ */
2905
+ async logout(body, params, requestConfig) {
2906
+ const resolvedConfig = this.getResolvedConfig(this.logoutConfig, requestConfig);
2907
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/Logout").setRequestSchema(z13.any()).setRequestContentType("json" /* Json */).addResponse({
2908
+ schema: z13.any(),
2909
+ contentType: "json" /* Json */,
2910
+ status: 200
2911
+ }).addHeaderParam({
2912
+ key: "Authorization",
2913
+ value: params == null ? void 0 : params.authorization
2914
+ }).addHeaderParam({
2915
+ key: "Accept",
2916
+ value: params == null ? void 0 : params.accept
2917
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2918
+ return this.client.callDirect(request);
2919
+ }
2920
+ /**
2921
+ *
2922
+ * @param {string} params.authorization -
2923
+ * @param {string} params.accept -
2924
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2925
+ * @returns {Promise<HttpResponse<any>>} - OK
2926
+ */
2927
+ async sendPin(body, params, requestConfig) {
2928
+ const resolvedConfig = this.getResolvedConfig(this.sendPinConfig, requestConfig);
2929
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/Account/RequestNewPin").setRequestSchema(z13.any()).setRequestContentType("json" /* Json */).addResponse({
2930
+ schema: z13.any(),
2931
+ contentType: "json" /* Json */,
2932
+ status: 200
2933
+ }).addHeaderParam({
2934
+ key: "Authorization",
2935
+ value: params == null ? void 0 : params.authorization
2936
+ }).addHeaderParam({
2937
+ key: "Accept",
2938
+ value: params == null ? void 0 : params.accept
2939
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2940
+ return this.client.callDirect(request);
2941
+ }
2942
+ /**
2943
+ *
2944
+ * @param {string} params.authorization -
2945
+ * @param {string} params.accept -
2946
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
2947
+ * @returns {Promise<HttpResponse<any>>} - OK
2948
+ */
2949
+ async sendConfirmationEmail(body, params, requestConfig) {
2950
+ const resolvedConfig = this.getResolvedConfig(this.sendConfirmationEmailConfig, requestConfig);
2951
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/Profile/Account/ResendEmailConfirmationMessage").setRequestSchema(z13.any()).setRequestContentType("json" /* Json */).addResponse({
2952
+ schema: z13.any(),
2953
+ contentType: "json" /* Json */,
2954
+ status: 200
2955
+ }).addHeaderParam({
2956
+ key: "Authorization",
2957
+ value: params == null ? void 0 : params.authorization
2958
+ }).addHeaderParam({
2959
+ key: "Accept",
2960
+ value: params == null ? void 0 : params.accept
2961
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
2962
+ return this.client.callDirect(request);
2963
+ }
2964
+ };
2965
+
2966
+ // src/services/products/products-service.ts
2967
+ import { z as z16 } from "zod";
2968
+
2969
+ // src/services/products/models/products-datasource-request.ts
2970
+ import { z as z14 } from "zod";
2971
+ var productsDatasourceRequest = z14.lazy(() => {
2972
+ return z14.object({
2973
+ pageNumber: z14.number().optional().nullable(),
2974
+ pageIndex: z14.number().optional().nullable(),
2975
+ pageSize: z14.number().optional().nullable()
2976
+ });
2977
+ });
2978
+ var productsDatasourceRequestResponse = z14.lazy(() => {
2979
+ return z14.object({
2980
+ PageNumber: z14.number().optional().nullable(),
2981
+ PageIndex: z14.number().optional().nullable(),
2982
+ PageSize: z14.number().optional().nullable()
2983
+ }).transform((data) => ({
2984
+ pageNumber: data["PageNumber"],
2985
+ pageIndex: data["PageIndex"],
2986
+ pageSize: data["PageSize"]
2987
+ }));
2988
+ });
2989
+ var productsDatasourceRequestRequest = z14.lazy(() => {
2990
+ return z14.object({
2991
+ pageNumber: z14.number().optional().nullable(),
2992
+ pageIndex: z14.number().optional().nullable(),
2993
+ pageSize: z14.number().optional().nullable()
2994
+ }).transform((data) => ({
2995
+ PageNumber: data["pageNumber"],
2996
+ PageIndex: data["pageIndex"],
2997
+ PageSize: data["pageSize"]
2998
+ }));
2999
+ });
3000
+
3001
+ // src/services/products/models/brands-request.ts
3002
+ import { z as z15 } from "zod";
3003
+ var brandsRequest = z15.lazy(() => {
3004
+ return z15.object({
3005
+ id: z15.number().optional().nullable()
3006
+ });
3007
+ });
3008
+ var brandsRequestResponse = z15.lazy(() => {
3009
+ return z15.object({
3010
+ id: z15.number().optional().nullable()
3011
+ }).transform((data) => ({
3012
+ id: data["id"]
3013
+ }));
3014
+ });
3015
+ var brandsRequestRequest = z15.lazy(() => {
3016
+ return z15.object({
3017
+ id: z15.number().optional().nullable()
3018
+ }).transform((data) => ({
3019
+ id: data["id"]
3020
+ }));
3021
+ });
3022
+
3023
+ // src/services/products/products-service.ts
3024
+ var ProductsService = class extends BaseService {
3025
+ constructor() {
3026
+ super(...arguments);
3027
+ this.productSearchConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3028
+ this.productDetailsConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3029
+ this.productsDatasourceConfig = {
3030
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3031
+ };
3032
+ this.searchCategoriesConfig = {
3033
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3034
+ };
3035
+ this.brandsConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3036
+ this.listCategoriesConfig = { environment: "https://{{storeUrl}}" /* STOREURL */ };
3037
+ }
3038
+ /**
3039
+ * Sets method-level configuration for productSearch.
3040
+ * @param config - Partial configuration to override service-level defaults
3041
+ * @returns This service instance for method chaining
3042
+ */
3043
+ setProductSearchConfig(config) {
3044
+ this.productSearchConfig = config;
3045
+ return this;
3046
+ }
3047
+ /**
3048
+ * Sets method-level configuration for productDetails.
3049
+ * @param config - Partial configuration to override service-level defaults
3050
+ * @returns This service instance for method chaining
3051
+ */
3052
+ setProductDetailsConfig(config) {
3053
+ this.productDetailsConfig = config;
3054
+ return this;
3055
+ }
3056
+ /**
3057
+ * Sets method-level configuration for productsDatasource.
3058
+ * @param config - Partial configuration to override service-level defaults
3059
+ * @returns This service instance for method chaining
3060
+ */
3061
+ setProductsDatasourceConfig(config) {
3062
+ this.productsDatasourceConfig = config;
3063
+ return this;
3064
+ }
3065
+ /**
3066
+ * Sets method-level configuration for searchCategories.
3067
+ * @param config - Partial configuration to override service-level defaults
3068
+ * @returns This service instance for method chaining
3069
+ */
3070
+ setSearchCategoriesConfig(config) {
3071
+ this.searchCategoriesConfig = config;
3072
+ return this;
3073
+ }
3074
+ /**
3075
+ * Sets method-level configuration for brands.
3076
+ * @param config - Partial configuration to override service-level defaults
3077
+ * @returns This service instance for method chaining
3078
+ */
3079
+ setBrandsConfig(config) {
3080
+ this.brandsConfig = config;
3081
+ return this;
3082
+ }
3083
+ /**
3084
+ * Sets method-level configuration for listCategories.
3085
+ * @param config - Partial configuration to override service-level defaults
3086
+ * @returns This service instance for method chaining
3087
+ */
3088
+ setListCategoriesConfig(config) {
3089
+ this.listCategoriesConfig = config;
3090
+ return this;
3091
+ }
3092
+ /**
3093
+ *
3094
+ * @param {string} [params.id] -
3095
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3096
+ * @returns {Promise<HttpResponse<any>>} - OK
3097
+ */
3098
+ async productSearch(params, requestConfig) {
3099
+ const resolvedConfig = this.getResolvedConfig(this.productSearchConfig, requestConfig);
3100
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Catalog/Products/Search").setRequestSchema(z16.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3101
+ schema: z16.any(),
3102
+ contentType: "json" /* Json */,
3103
+ status: 200
3104
+ }).addQueryParam({
3105
+ key: "id",
3106
+ value: params == null ? void 0 : params.id
3107
+ }).build();
3108
+ return this.client.callDirect(request);
3109
+ }
3110
+ /**
3111
+ *
3112
+ * @param {string} [params.id] -
3113
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3114
+ * @returns {Promise<HttpResponse<any>>} - OK
3115
+ */
3116
+ async productDetails(params, requestConfig) {
3117
+ const resolvedConfig = this.getResolvedConfig(this.productDetailsConfig, requestConfig);
3118
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/Catalog/Products/Get").setRequestSchema(z16.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3119
+ schema: z16.any(),
3120
+ contentType: "json" /* Json */,
3121
+ status: 200
3122
+ }).addQueryParam({
3123
+ key: "id",
3124
+ value: params == null ? void 0 : params.id
3125
+ }).build();
3126
+ return this.client.callDirect(request);
3127
+ }
3128
+ /**
3129
+ *
3130
+ * @param {string} params.authorization -
3131
+ * @param {string} params.accept -
3132
+ * @param {string} params.userAgent -
3133
+ * @param {string} [params.pageIndex] -
3134
+ * @param {string} [params.pageSize] -
3135
+ * @param {string} [params.id] -
3136
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3137
+ * @returns {Promise<HttpResponse<any>>} - OK
3138
+ */
3139
+ async productsDatasource(body, params, requestConfig) {
3140
+ const resolvedConfig = this.getResolvedConfig(this.productsDatasourceConfig, requestConfig);
3141
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Catalog/Products/Datasource").setRequestSchema(productsDatasourceRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3142
+ schema: z16.any(),
3143
+ contentType: "json" /* Json */,
3144
+ status: 200
3145
+ }).addQueryParam({
3146
+ key: "PageIndex",
3147
+ value: params == null ? void 0 : params.pageIndex
3148
+ }).addQueryParam({
3149
+ key: "PageSize",
3150
+ value: params == null ? void 0 : params.pageSize
3151
+ }).addQueryParam({
3152
+ key: "Id",
3153
+ value: params == null ? void 0 : params.id
3154
+ }).addHeaderParam({
3155
+ key: "Authorization",
3156
+ value: params == null ? void 0 : params.authorization
3157
+ }).addHeaderParam({
3158
+ key: "Accept",
3159
+ value: params == null ? void 0 : params.accept
3160
+ }).addHeaderParam({
3161
+ key: "User-Agent",
3162
+ value: params == null ? void 0 : params.userAgent
3163
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3164
+ return this.client.callDirect(request);
3165
+ }
3166
+ /**
3167
+ *
3168
+ * @param {string} params.accept -
3169
+ * @param {string} params.userAgent -
3170
+ * @param {string} [params.id] -
3171
+ * @param {string} [params.catalogId] -
3172
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3173
+ * @returns {Promise<HttpResponse<any>>} - OK
3174
+ */
3175
+ async searchCategories(params, requestConfig) {
3176
+ const resolvedConfig = this.getResolvedConfig(this.searchCategoriesConfig, requestConfig);
3177
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Catalog/Products/Category").setRequestSchema(z16.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3178
+ schema: z16.any(),
3179
+ contentType: "json" /* Json */,
3180
+ status: 200
3181
+ }).addQueryParam({
3182
+ key: "id",
3183
+ value: params == null ? void 0 : params.id
3184
+ }).addQueryParam({
3185
+ key: "catalogID",
3186
+ value: params == null ? void 0 : params.catalogId
3187
+ }).addHeaderParam({
3188
+ key: "Accept",
3189
+ value: params == null ? void 0 : params.accept
3190
+ }).addHeaderParam({
3191
+ key: "User-Agent",
3192
+ value: params == null ? void 0 : params.userAgent
3193
+ }).build();
3194
+ return this.client.callDirect(request);
3195
+ }
3196
+ /**
3197
+ *
3198
+ * @param {string} params.accept -
3199
+ * @param {string} params.userAgent -
3200
+ * @param {string} [params.id] -
3201
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3202
+ * @returns {Promise<HttpResponse<any>>} - OK
3203
+ */
3204
+ async brands(body, params, requestConfig) {
3205
+ const resolvedConfig = this.getResolvedConfig(this.brandsConfig, requestConfig);
3206
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Catalog/Products/Brand").setRequestSchema(brandsRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3207
+ schema: z16.any(),
3208
+ contentType: "json" /* Json */,
3209
+ status: 200
3210
+ }).addQueryParam({
3211
+ key: "id",
3212
+ value: params == null ? void 0 : params.id
3213
+ }).addHeaderParam({
3214
+ key: "Accept",
3215
+ value: params == null ? void 0 : params.accept
3216
+ }).addHeaderParam({
3217
+ key: "User-Agent",
3218
+ value: params == null ? void 0 : params.userAgent
3219
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3220
+ return this.client.callDirect(request);
3221
+ }
3222
+ /**
3223
+ *
3224
+ * @param {string} params.userAgent -
3225
+ * @param {string} params.vary -
3226
+ * @param {string} params.accept -
3227
+ * @param {string} [params.template] -
3228
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3229
+ * @returns {Promise<HttpResponse<any>>} - OK
3230
+ */
3231
+ async listCategories(params, requestConfig) {
3232
+ const resolvedConfig = this.getResolvedConfig(this.listCategoriesConfig, requestConfig);
3233
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/widget/browsing_categorymenu").setRequestSchema(z16.any()).setRequestContentType("json" /* Json */).addResponse({
3234
+ schema: z16.any(),
3235
+ contentType: "json" /* Json */,
3236
+ status: 200
3237
+ }).addQueryParam({
3238
+ key: "template",
3239
+ value: params == null ? void 0 : params.template
3240
+ }).addHeaderParam({
3241
+ key: "User-Agent",
3242
+ value: params == null ? void 0 : params.userAgent
3243
+ }).addHeaderParam({
3244
+ key: "Vary",
3245
+ value: params == null ? void 0 : params.vary
3246
+ }).addHeaderParam({
3247
+ key: "Accept",
3248
+ value: params == null ? void 0 : params.accept
3249
+ }).build();
3250
+ return this.client.callDirect(request);
3251
+ }
3252
+ };
3253
+
3254
+ // src/services/address/address-service.ts
3255
+ import { z as z17 } from "zod";
3256
+ var AddressService = class extends BaseService {
3257
+ constructor() {
3258
+ super(...arguments);
3259
+ this.addressListConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3260
+ this.registerAddressConfig = {
3261
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3262
+ };
3263
+ this.removeAddressConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3264
+ this.getAShippingQuote_Config = {
3265
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3266
+ };
3267
+ }
3268
+ /**
3269
+ * Sets method-level configuration for addressList.
3270
+ * @param config - Partial configuration to override service-level defaults
3271
+ * @returns This service instance for method chaining
3272
+ */
3273
+ setAddressListConfig(config) {
3274
+ this.addressListConfig = config;
3275
+ return this;
3276
+ }
3277
+ /**
3278
+ * Sets method-level configuration for registerAddress.
3279
+ * @param config - Partial configuration to override service-level defaults
3280
+ * @returns This service instance for method chaining
3281
+ */
3282
+ setRegisterAddressConfig(config) {
3283
+ this.registerAddressConfig = config;
3284
+ return this;
3285
+ }
3286
+ /**
3287
+ * Sets method-level configuration for removeAddress.
3288
+ * @param config - Partial configuration to override service-level defaults
3289
+ * @returns This service instance for method chaining
3290
+ */
3291
+ setRemoveAddressConfig(config) {
3292
+ this.removeAddressConfig = config;
3293
+ return this;
3294
+ }
3295
+ /**
3296
+ * Sets method-level configuration for getAShippingQuote_.
3297
+ * @param config - Partial configuration to override service-level defaults
3298
+ * @returns This service instance for method chaining
3299
+ */
3300
+ setGetAShippingQuote_Config(config) {
3301
+ this.getAShippingQuote_Config = config;
3302
+ return this;
3303
+ }
3304
+ /**
3305
+ *
3306
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3307
+ * @returns {Promise<HttpResponse<any>>} - OK
3308
+ */
3309
+ async addressList(body, requestConfig) {
3310
+ const resolvedConfig = this.getResolvedConfig(this.addressListConfig, requestConfig);
3311
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/AccountAddress/List").setRequestSchema(z17.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3312
+ schema: z17.any(),
3313
+ contentType: "json" /* Json */,
3314
+ status: 200
3315
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3316
+ return this.client.callDirect(request);
3317
+ }
3318
+ /**
3319
+ *
3320
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3321
+ * @returns {Promise<HttpResponse<any>>} - OK
3322
+ */
3323
+ async registerAddress(body, requestConfig) {
3324
+ const resolvedConfig = this.getResolvedConfig(this.registerAddressConfig, requestConfig);
3325
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/AccountAddress/Save").setRequestSchema(z17.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3326
+ schema: z17.any(),
3327
+ contentType: "json" /* Json */,
3328
+ status: 200
3329
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3330
+ return this.client.callDirect(request);
3331
+ }
3332
+ /**
3333
+ *
3334
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3335
+ * @returns {Promise<HttpResponse<any>>} - OK
3336
+ */
3337
+ async removeAddress(body, requestConfig) {
3338
+ const resolvedConfig = this.getResolvedConfig(this.removeAddressConfig, requestConfig);
3339
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/AccountAddress/Delete").setRequestSchema(z17.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3340
+ schema: z17.any(),
3341
+ contentType: "json" /* Json */,
3342
+ status: 200
3343
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3344
+ return this.client.callDirect(request);
3345
+ }
3346
+ /**
3347
+ *
3348
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3349
+ * @returns {Promise<HttpResponse<any>>} - OK
3350
+ */
3351
+ async getAShippingQuote_(body, requestConfig) {
3352
+ const resolvedConfig = this.getResolvedConfig(this.getAShippingQuote_Config, requestConfig);
3353
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Delivery/Get").setRequestSchema(z17.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3354
+ schema: z17.any(),
3355
+ contentType: "json" /* Json */,
3356
+ status: 200
3357
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3358
+ return this.client.callDirect(request);
3359
+ }
3360
+ };
3361
+
3362
+ // src/services/delivery/delivery-service.ts
3363
+ import { z as z18 } from "zod";
3364
+ var DeliveryService = class extends BaseService {
3365
+ constructor() {
3366
+ super(...arguments);
3367
+ this.defineDeliveryOptionConfig = {
3368
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3369
+ };
3370
+ this.loadPointsOfSaleConfig = {
3371
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3372
+ };
3373
+ this.carregarSellersConfig = { environment: "https://{{urlStore}}" /* URLSTORE */ };
3374
+ this.quoteViaTemplateConfig = { environment: "https://{{storeUrl}}" /* STOREURL */ };
3375
+ this.returnLocationIdConfig = { environment: "https://{{urlStore}}" /* URLSTORE */ };
3376
+ }
3377
+ /**
3378
+ * Sets method-level configuration for defineDeliveryOption.
3379
+ * @param config - Partial configuration to override service-level defaults
3380
+ * @returns This service instance for method chaining
3381
+ */
3382
+ setDefineDeliveryOptionConfig(config) {
3383
+ this.defineDeliveryOptionConfig = config;
3384
+ return this;
3385
+ }
3386
+ /**
3387
+ * Sets method-level configuration for loadPointsOfSale.
3388
+ * @param config - Partial configuration to override service-level defaults
3389
+ * @returns This service instance for method chaining
3390
+ */
3391
+ setLoadPointsOfSaleConfig(config) {
3392
+ this.loadPointsOfSaleConfig = config;
3393
+ return this;
3394
+ }
3395
+ /**
3396
+ * Sets method-level configuration for carregarSellers.
3397
+ * @param config - Partial configuration to override service-level defaults
3398
+ * @returns This service instance for method chaining
3399
+ */
3400
+ setCarregarSellersConfig(config) {
3401
+ this.carregarSellersConfig = config;
3402
+ return this;
3403
+ }
3404
+ /**
3405
+ * Sets method-level configuration for quoteViaTemplate.
3406
+ * @param config - Partial configuration to override service-level defaults
3407
+ * @returns This service instance for method chaining
3408
+ */
3409
+ setQuoteViaTemplateConfig(config) {
3410
+ this.quoteViaTemplateConfig = config;
3411
+ return this;
3412
+ }
3413
+ /**
3414
+ * Sets method-level configuration for returnLocationId.
3415
+ * @param config - Partial configuration to override service-level defaults
3416
+ * @returns This service instance for method chaining
3417
+ */
3418
+ setReturnLocationIdConfig(config) {
3419
+ this.returnLocationIdConfig = config;
3420
+ return this;
3421
+ }
3422
+ /**
3423
+ *
3424
+ * @param {string} params.accept -
3425
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3426
+ * @returns {Promise<HttpResponse<any>>} - OK
3427
+ */
3428
+ async defineDeliveryOption(body, params, requestConfig) {
3429
+ const resolvedConfig = this.getResolvedConfig(this.defineDeliveryOptionConfig, requestConfig);
3430
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/SetDeliveryOption").setRequestSchema(z18.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3431
+ schema: z18.any(),
3432
+ contentType: "json" /* Json */,
3433
+ status: 200
3434
+ }).addHeaderParam({
3435
+ key: "Accept",
3436
+ value: params == null ? void 0 : params.accept
3437
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3438
+ return this.client.callDirect(request);
3439
+ }
3440
+ /**
3441
+ *
3442
+ * @param {string} params.authorization -
3443
+ * @param {string} params.accept -
3444
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3445
+ * @returns {Promise<HttpResponse<any>>} - OK
3446
+ */
3447
+ async loadPointsOfSale(body, params, requestConfig) {
3448
+ const resolvedConfig = this.getResolvedConfig(this.loadPointsOfSaleConfig, requestConfig);
3449
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/Shopping/Seller/GetAvailablePointOfSales").setRequestSchema(z18.any()).setRequestContentType("json" /* Json */).addResponse({
3450
+ schema: z18.any(),
3451
+ contentType: "json" /* Json */,
3452
+ status: 200
3453
+ }).addHeaderParam({
3454
+ key: "Authorization",
3455
+ value: params == null ? void 0 : params.authorization
3456
+ }).addHeaderParam({
3457
+ key: "Accept",
3458
+ value: params == null ? void 0 : params.accept
3459
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3460
+ return this.client.callDirect(request);
3461
+ }
3462
+ /**
3463
+ *
3464
+ * @param {string} params.accept -
3465
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3466
+ * @returns {Promise<HttpResponse<any>>} - OK
3467
+ */
3468
+ async carregarSellers(body, params, requestConfig) {
3469
+ const resolvedConfig = this.getResolvedConfig(this.carregarSellersConfig, requestConfig);
3470
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/Shopping/Seller/GetAll").setRequestSchema(z18.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3471
+ schema: z18.any(),
3472
+ contentType: "json" /* Json */,
3473
+ status: 200
3474
+ }).addHeaderParam({
3475
+ key: "Accept",
3476
+ value: params == null ? void 0 : params.accept
3477
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3478
+ return this.client.callDirect(request);
3479
+ }
3480
+ /**
3481
+ *
3482
+ * @param {string} params.userAgent -
3483
+ * @param {string} params.accept -
3484
+ * @param {string} [params.productId] -
3485
+ * @param {string} [params.skuId] -
3486
+ * @param {string} [params.postalCode] -
3487
+ * @param {string} [params.template] -
3488
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3489
+ * @returns {Promise<HttpResponse<any>>} - OK
3490
+ */
3491
+ async quoteViaTemplate(params, requestConfig) {
3492
+ const resolvedConfig = this.getResolvedConfig(this.quoteViaTemplateConfig, requestConfig);
3493
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/widget/product_deliveryfee").setRequestSchema(z18.any()).setRequestContentType("json" /* Json */).addResponse({
3494
+ schema: z18.any(),
3495
+ contentType: "json" /* Json */,
3496
+ status: 200
3497
+ }).addQueryParam({
3498
+ key: "ProductID",
3499
+ value: params == null ? void 0 : params.productId
3500
+ }).addQueryParam({
3501
+ key: "SkuID",
3502
+ value: params == null ? void 0 : params.skuId
3503
+ }).addQueryParam({
3504
+ key: "PostalCode",
3505
+ value: params == null ? void 0 : params.postalCode
3506
+ }).addQueryParam({
3507
+ key: "Template",
3508
+ value: params == null ? void 0 : params.template
3509
+ }).addHeaderParam({
3510
+ key: "User-Agent",
3511
+ value: params == null ? void 0 : params.userAgent
3512
+ }).addHeaderParam({
3513
+ key: "Accept",
3514
+ value: params == null ? void 0 : params.accept
3515
+ }).build();
3516
+ return this.client.callDirect(request);
3517
+ }
3518
+ /**
3519
+ *
3520
+ * @param {string} params.userAgent -
3521
+ * @param {string} params.accept -
3522
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3523
+ * @returns {Promise<HttpResponse<any>>} - OK
3524
+ */
3525
+ async returnLocationId(params, requestConfig) {
3526
+ const resolvedConfig = this.getResolvedConfig(this.returnLocationIdConfig, requestConfig);
3527
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/onde-encontrar.json").setRequestSchema(z18.any()).setRequestContentType("json" /* Json */).addResponse({
3528
+ schema: z18.any(),
3529
+ contentType: "json" /* Json */,
3530
+ status: 200
3531
+ }).addHeaderParam({
3532
+ key: "User-Agent",
3533
+ value: params == null ? void 0 : params.userAgent
3534
+ }).addHeaderParam({
3535
+ key: "Accept",
3536
+ value: params == null ? void 0 : params.accept
3537
+ }).build();
3538
+ return this.client.callDirect(request);
3539
+ }
3540
+ };
3541
+
3542
+ // src/services/basket/basket-service.ts
3543
+ import { z as z19 } from "zod";
3544
+ var BasketService = class extends BaseService {
3545
+ constructor() {
3546
+ super(...arguments);
3547
+ this.recoverBasketConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3548
+ this.addProductToBasketConfig = {
3549
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3550
+ };
3551
+ this.addMetadataToBasketItemConfig = {
3552
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3553
+ };
3554
+ this.addCouponConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3555
+ this.removeCouponConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3556
+ this.addKitBasketConfig = { environment: "https://{{urlStore}}Shopping" /* URLSTORESHOPPING */ };
3557
+ this.adicionarServiOAdicionalConfig = {
3558
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3559
+ };
3560
+ this.removerItemDoCarrinhoConfig = {
3561
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3562
+ };
3563
+ this.removerTodosItemsDoCarrinhoConfig = {
3564
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3565
+ };
3566
+ this.defineCepDeEntregaConfig = {
3567
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3568
+ };
3569
+ }
3570
+ /**
3571
+ * Sets method-level configuration for recoverBasket.
3572
+ * @param config - Partial configuration to override service-level defaults
3573
+ * @returns This service instance for method chaining
3574
+ */
3575
+ setRecoverBasketConfig(config) {
3576
+ this.recoverBasketConfig = config;
3577
+ return this;
3578
+ }
3579
+ /**
3580
+ * Sets method-level configuration for addProductToBasket.
3581
+ * @param config - Partial configuration to override service-level defaults
3582
+ * @returns This service instance for method chaining
3583
+ */
3584
+ setAddProductToBasketConfig(config) {
3585
+ this.addProductToBasketConfig = config;
3586
+ return this;
3587
+ }
3588
+ /**
3589
+ * Sets method-level configuration for addMetadataToBasketItem.
3590
+ * @param config - Partial configuration to override service-level defaults
3591
+ * @returns This service instance for method chaining
3592
+ */
3593
+ setAddMetadataToBasketItemConfig(config) {
3594
+ this.addMetadataToBasketItemConfig = config;
3595
+ return this;
3596
+ }
3597
+ /**
3598
+ * Sets method-level configuration for addCoupon.
3599
+ * @param config - Partial configuration to override service-level defaults
3600
+ * @returns This service instance for method chaining
3601
+ */
3602
+ setAddCouponConfig(config) {
3603
+ this.addCouponConfig = config;
3604
+ return this;
3605
+ }
3606
+ /**
3607
+ * Sets method-level configuration for removeCoupon.
3608
+ * @param config - Partial configuration to override service-level defaults
3609
+ * @returns This service instance for method chaining
3610
+ */
3611
+ setRemoveCouponConfig(config) {
3612
+ this.removeCouponConfig = config;
3613
+ return this;
3614
+ }
3615
+ /**
3616
+ * Sets method-level configuration for addKitBasket.
3617
+ * @param config - Partial configuration to override service-level defaults
3618
+ * @returns This service instance for method chaining
3619
+ */
3620
+ setAddKitBasketConfig(config) {
3621
+ this.addKitBasketConfig = config;
3622
+ return this;
3623
+ }
3624
+ /**
3625
+ * Sets method-level configuration for adicionarServiOAdicional.
3626
+ * @param config - Partial configuration to override service-level defaults
3627
+ * @returns This service instance for method chaining
3628
+ */
3629
+ setAdicionarServiOAdicionalConfig(config) {
3630
+ this.adicionarServiOAdicionalConfig = config;
3631
+ return this;
3632
+ }
3633
+ /**
3634
+ * Sets method-level configuration for removerItemDoCarrinho.
3635
+ * @param config - Partial configuration to override service-level defaults
3636
+ * @returns This service instance for method chaining
3637
+ */
3638
+ setRemoverItemDoCarrinhoConfig(config) {
3639
+ this.removerItemDoCarrinhoConfig = config;
3640
+ return this;
3641
+ }
3642
+ /**
3643
+ * Sets method-level configuration for removerTodosItemsDoCarrinho.
3644
+ * @param config - Partial configuration to override service-level defaults
3645
+ * @returns This service instance for method chaining
3646
+ */
3647
+ setRemoverTodosItemsDoCarrinhoConfig(config) {
3648
+ this.removerTodosItemsDoCarrinhoConfig = config;
3649
+ return this;
3650
+ }
3651
+ /**
3652
+ * Sets method-level configuration for defineCepDeEntrega.
3653
+ * @param config - Partial configuration to override service-level defaults
3654
+ * @returns This service instance for method chaining
3655
+ */
3656
+ setDefineCepDeEntregaConfig(config) {
3657
+ this.defineCepDeEntregaConfig = config;
3658
+ return this;
3659
+ }
3660
+ /**
3661
+ *
3662
+ * @param {string} params.authorization -
3663
+ * @param {string} params.accept -
3664
+ * @param {string} params.cacheControl -
3665
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3666
+ * @returns {Promise<HttpResponse<any>>} - OK
3667
+ */
3668
+ async recoverBasket(body, params, requestConfig) {
3669
+ const resolvedConfig = this.getResolvedConfig(this.recoverBasketConfig, requestConfig);
3670
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/Get").setRequestSchema(z19.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3671
+ schema: z19.any(),
3672
+ contentType: "json" /* Json */,
3673
+ status: 200
3674
+ }).addHeaderParam({
3675
+ key: "Authorization",
3676
+ value: params == null ? void 0 : params.authorization
3677
+ }).addHeaderParam({
3678
+ key: "Accept",
3679
+ value: params == null ? void 0 : params.accept
3680
+ }).addHeaderParam({
3681
+ key: "Cache-Control",
3682
+ value: params == null ? void 0 : params.cacheControl
3683
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3684
+ return this.client.callDirect(request);
3685
+ }
3686
+ /**
3687
+ *
3688
+ * @param {string} params.accept -
3689
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3690
+ * @returns {Promise<HttpResponse<any>>} - OK
3691
+ */
3692
+ async addProductToBasket(body, params, requestConfig) {
3693
+ const resolvedConfig = this.getResolvedConfig(this.addProductToBasketConfig, requestConfig);
3694
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/AddProduct").setRequestSchema(z19.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3695
+ schema: z19.any(),
3696
+ contentType: "json" /* Json */,
3697
+ status: 200
3698
+ }).addHeaderParam({
3699
+ key: "Accept",
3700
+ value: params == null ? void 0 : params.accept
3701
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3702
+ return this.client.callDirect(request);
3703
+ }
3704
+ /**
3705
+ *
3706
+ * @param {string} params.authorization -
3707
+ * @param {string} params.accept -
3708
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3709
+ * @returns {Promise<HttpResponse<any>>} - OK
3710
+ */
3711
+ async addMetadataToBasketItem(body, params, requestConfig) {
3712
+ const resolvedConfig = this.getResolvedConfig(
3713
+ this.addMetadataToBasketItemConfig,
3714
+ requestConfig
3715
+ );
3716
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/AddCustomMetadata").setRequestSchema(z19.any()).setRequestContentType("json" /* Json */).addResponse({
3717
+ schema: z19.any(),
3718
+ contentType: "json" /* Json */,
3719
+ status: 200
3720
+ }).addHeaderParam({
3721
+ key: "Authorization",
3722
+ value: params == null ? void 0 : params.authorization
3723
+ }).addHeaderParam({
3724
+ key: "Accept",
3725
+ value: params == null ? void 0 : params.accept
3726
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3727
+ return this.client.callDirect(request);
3728
+ }
3729
+ /**
3730
+ *
3731
+ * @param {string} params.accept -
3732
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3733
+ * @returns {Promise<HttpResponse<any>>} - OK
3734
+ */
3735
+ async addCoupon(body, params, requestConfig) {
3736
+ const resolvedConfig = this.getResolvedConfig(this.addCouponConfig, requestConfig);
3737
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/AddCoupon").setRequestSchema(z19.any()).setRequestContentType("json" /* Json */).addResponse({
3738
+ schema: z19.any(),
3739
+ contentType: "json" /* Json */,
3740
+ status: 200
3741
+ }).addHeaderParam({
3742
+ key: "Accept",
3743
+ value: params == null ? void 0 : params.accept
3744
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3745
+ return this.client.callDirect(request);
3746
+ }
3747
+ /**
3748
+ *
3749
+ * @param {string} params.accept -
3750
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3751
+ * @returns {Promise<HttpResponse<any>>} - OK
3752
+ */
3753
+ async removeCoupon(body, params, requestConfig) {
3754
+ const resolvedConfig = this.getResolvedConfig(this.removeCouponConfig, requestConfig);
3755
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/RemoveCoupon").setRequestSchema(z19.any()).setRequestContentType("json" /* Json */).addResponse({
3756
+ schema: z19.any(),
3757
+ contentType: "json" /* Json */,
3758
+ status: 200
3759
+ }).addHeaderParam({
3760
+ key: "Accept",
3761
+ value: params == null ? void 0 : params.accept
3762
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3763
+ return this.client.callDirect(request);
3764
+ }
3765
+ /**
3766
+ *
3767
+ * @param {string} params.accept -
3768
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3769
+ * @returns {Promise<HttpResponse<any>>} - OK
3770
+ */
3771
+ async addKitBasket(body, params, requestConfig) {
3772
+ const resolvedConfig = this.getResolvedConfig(this.addKitBasketConfig, requestConfig);
3773
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Basket/AddProduct").setRequestSchema(z19.any()).setRequestContentType("json" /* Json */).addResponse({
3774
+ schema: z19.any(),
3775
+ contentType: "json" /* Json */,
3776
+ status: 200
3777
+ }).addHeaderParam({
3778
+ key: "Accept",
3779
+ value: params == null ? void 0 : params.accept
3780
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3781
+ return this.client.callDirect(request);
3782
+ }
3783
+ /**
3784
+ *
3785
+ * @param {string} params.accept -
3786
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3787
+ * @returns {Promise<HttpResponse<any>>} - OK
3788
+ */
3789
+ async adicionarServiOAdicional(body, params, requestConfig) {
3790
+ const resolvedConfig = this.getResolvedConfig(
3791
+ this.adicionarServiOAdicionalConfig,
3792
+ requestConfig
3793
+ );
3794
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/AddProduct").setRequestSchema(z19.any()).setRequestContentType("json" /* Json */).addResponse({
3795
+ schema: z19.any(),
3796
+ contentType: "json" /* Json */,
3797
+ status: 200
3798
+ }).addHeaderParam({
3799
+ key: "Accept",
3800
+ value: params == null ? void 0 : params.accept
3801
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3802
+ return this.client.callDirect(request);
3803
+ }
3804
+ /**
3805
+ *
3806
+ * @param {string} params.accept -
3807
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3808
+ * @returns {Promise<HttpResponse<any>>} - OK
3809
+ */
3810
+ async removerItemDoCarrinho(body, params, requestConfig) {
3811
+ const resolvedConfig = this.getResolvedConfig(this.removerItemDoCarrinhoConfig, requestConfig);
3812
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/RemoveBasketItem").setRequestSchema(z19.any()).setRequestContentType("json" /* Json */).addResponse({
3813
+ schema: z19.any(),
3814
+ contentType: "json" /* Json */,
3815
+ status: 200
3816
+ }).addHeaderParam({
3817
+ key: "Accept",
3818
+ value: params == null ? void 0 : params.accept
3819
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3820
+ return this.client.callDirect(request);
3821
+ }
3822
+ /**
3823
+ * StartFragment
3824
+ Simula a API do parceiro que retorna informações sobre promoções
3825
+
3826
+ EndFragment
3827
+ * @param {string} params.authorization -
3828
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3829
+ * @returns {Promise<HttpResponse<any>>} - OK
3830
+ */
3831
+ async removerTodosItemsDoCarrinho(body, params, requestConfig) {
3832
+ const resolvedConfig = this.getResolvedConfig(
3833
+ this.removerTodosItemsDoCarrinhoConfig,
3834
+ requestConfig
3835
+ );
3836
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/RemoveAll").setRequestSchema(z19.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3837
+ schema: z19.any(),
3838
+ contentType: "json" /* Json */,
3839
+ status: 200
3840
+ }).addHeaderParam({
3841
+ key: "Authorization",
3842
+ value: params == null ? void 0 : params.authorization
3843
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3844
+ return this.client.callDirect(request);
3845
+ }
3846
+ /**
3847
+ *
3848
+ * @param {string} params.accept -
3849
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
3850
+ * @returns {Promise<HttpResponse<any>>} - OK
3851
+ */
3852
+ async defineCepDeEntrega(body, params, requestConfig) {
3853
+ const resolvedConfig = this.getResolvedConfig(this.defineCepDeEntregaConfig, requestConfig);
3854
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Basket/SetPostalCode").setRequestSchema(z19.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
3855
+ schema: z19.any(),
3856
+ contentType: "json" /* Json */,
3857
+ status: 200
3858
+ }).addHeaderParam({
3859
+ key: "Accept",
3860
+ value: params == null ? void 0 : params.accept
3861
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
3862
+ return this.client.callDirect(request);
3863
+ }
3864
+ };
3865
+
3866
+ // src/services/checkout/checkout-service.ts
3867
+ import { z as z21 } from "zod";
3868
+
3869
+ // src/services/checkout/models/retorna-op-o-de-entrega-para-oms-request.ts
3870
+ import { z as z20 } from "zod";
3871
+ var retornaOpODeEntregaParaOmsRequest = z20.lazy(() => {
3872
+ return z20.object({
3873
+ groupKey: z20.string().optional().nullable(),
3874
+ basketId: z20.string().optional().nullable(),
3875
+ customerId: z20.string().optional().nullable(),
3876
+ sessionId: z20.string().optional().nullable(),
3877
+ shopperTicketId: z20.string().optional().nullable(),
3878
+ basketAuthorityToken: z20.string().optional().nullable()
3879
+ });
3880
+ });
3881
+ var retornaOpODeEntregaParaOmsRequestResponse = z20.lazy(() => {
3882
+ return z20.object({
3883
+ GroupKey: z20.string().optional().nullable(),
3884
+ BasketID: z20.string().optional().nullable(),
3885
+ CustomerID: z20.string().optional().nullable(),
3886
+ SessionID: z20.string().optional().nullable(),
3887
+ ShopperTicketID: z20.string().optional().nullable(),
3888
+ BasketAuthorityToken: z20.string().optional().nullable()
3889
+ }).transform((data) => ({
3890
+ groupKey: data["GroupKey"],
3891
+ basketId: data["BasketID"],
3892
+ customerId: data["CustomerID"],
3893
+ sessionId: data["SessionID"],
3894
+ shopperTicketId: data["ShopperTicketID"],
3895
+ basketAuthorityToken: data["BasketAuthorityToken"]
3896
+ }));
3897
+ });
3898
+ var retornaOpODeEntregaParaOmsRequestRequest = z20.lazy(() => {
3899
+ return z20.object({
3900
+ groupKey: z20.string().optional().nullable(),
3901
+ basketId: z20.string().optional().nullable(),
3902
+ customerId: z20.string().optional().nullable(),
3903
+ sessionId: z20.string().optional().nullable(),
3904
+ shopperTicketId: z20.string().optional().nullable(),
3905
+ basketAuthorityToken: z20.string().optional().nullable()
3906
+ }).transform((data) => ({
3907
+ GroupKey: data["groupKey"],
3908
+ BasketID: data["basketId"],
3909
+ CustomerID: data["customerId"],
3910
+ SessionID: data["sessionId"],
3911
+ ShopperTicketID: data["shopperTicketId"],
3912
+ BasketAuthorityToken: data["basketAuthorityToken"]
3913
+ }));
3914
+ });
3915
+
3916
+ // src/services/checkout/checkout-service.ts
3917
+ var CheckoutService = class extends BaseService {
3918
+ constructor() {
3919
+ super(...arguments);
3920
+ this.recuperaCheckoutConfig = {
3921
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3922
+ };
3923
+ this.selecionaEndereODeEntregaConfig = {
3924
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3925
+ };
3926
+ this.setPostalCodeConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
3927
+ this.setaMTodoDeEntregaLocationIdConfig = {
3928
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3929
+ };
3930
+ this.setaMTodoDeEntregaConfig = {
3931
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3932
+ };
3933
+ this.retornaOpODeEntregaParaOmsConfig = {
3934
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3935
+ };
3936
+ this.gruposDePagamentoConfig = {
3937
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3938
+ };
3939
+ this.adicioneCupomNoCheckoutConfig = {
3940
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3941
+ };
3942
+ this.removeCupomNoCheckoutConfig = {
3943
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3944
+ };
3945
+ this.realizaPedidoDeVendaPixConfig = {
3946
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3947
+ };
3948
+ this.realizaPedidoDeVendaCardConfig = {
3949
+ environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */
3950
+ };
3951
+ }
3952
+ /**
3953
+ * Sets method-level configuration for recuperaCheckout.
3954
+ * @param config - Partial configuration to override service-level defaults
3955
+ * @returns This service instance for method chaining
3956
+ */
3957
+ setRecuperaCheckoutConfig(config) {
3958
+ this.recuperaCheckoutConfig = config;
3959
+ return this;
3960
+ }
3961
+ /**
3962
+ * Sets method-level configuration for selecionaEndereODeEntrega.
3963
+ * @param config - Partial configuration to override service-level defaults
3964
+ * @returns This service instance for method chaining
3965
+ */
3966
+ setSelecionaEndereODeEntregaConfig(config) {
3967
+ this.selecionaEndereODeEntregaConfig = config;
3968
+ return this;
3969
+ }
3970
+ /**
3971
+ * Sets method-level configuration for setPostalCode.
3972
+ * @param config - Partial configuration to override service-level defaults
3973
+ * @returns This service instance for method chaining
3974
+ */
3975
+ setSetPostalCodeConfig(config) {
3976
+ this.setPostalCodeConfig = config;
3977
+ return this;
3978
+ }
3979
+ /**
3980
+ * Sets method-level configuration for setaMTodoDeEntregaLocationId.
3981
+ * @param config - Partial configuration to override service-level defaults
3982
+ * @returns This service instance for method chaining
3983
+ */
3984
+ setSetaMTodoDeEntregaLocationIdConfig(config) {
3985
+ this.setaMTodoDeEntregaLocationIdConfig = config;
3986
+ return this;
3987
+ }
3988
+ /**
3989
+ * Sets method-level configuration for setaMTodoDeEntrega.
3990
+ * @param config - Partial configuration to override service-level defaults
3991
+ * @returns This service instance for method chaining
3992
+ */
3993
+ setSetaMTodoDeEntregaConfig(config) {
3994
+ this.setaMTodoDeEntregaConfig = config;
3995
+ return this;
3996
+ }
3997
+ /**
3998
+ * Sets method-level configuration for retornaOpODeEntregaParaOms.
3999
+ * @param config - Partial configuration to override service-level defaults
4000
+ * @returns This service instance for method chaining
4001
+ */
4002
+ setRetornaOpODeEntregaParaOmsConfig(config) {
4003
+ this.retornaOpODeEntregaParaOmsConfig = config;
4004
+ return this;
4005
+ }
4006
+ /**
4007
+ * Sets method-level configuration for gruposDePagamento.
4008
+ * @param config - Partial configuration to override service-level defaults
4009
+ * @returns This service instance for method chaining
4010
+ */
4011
+ setGruposDePagamentoConfig(config) {
4012
+ this.gruposDePagamentoConfig = config;
4013
+ return this;
4014
+ }
4015
+ /**
4016
+ * Sets method-level configuration for adicioneCupomNoCheckout.
4017
+ * @param config - Partial configuration to override service-level defaults
4018
+ * @returns This service instance for method chaining
4019
+ */
4020
+ setAdicioneCupomNoCheckoutConfig(config) {
4021
+ this.adicioneCupomNoCheckoutConfig = config;
4022
+ return this;
4023
+ }
4024
+ /**
4025
+ * Sets method-level configuration for removeCupomNoCheckout.
4026
+ * @param config - Partial configuration to override service-level defaults
4027
+ * @returns This service instance for method chaining
4028
+ */
4029
+ setRemoveCupomNoCheckoutConfig(config) {
4030
+ this.removeCupomNoCheckoutConfig = config;
4031
+ return this;
4032
+ }
4033
+ /**
4034
+ * Sets method-level configuration for realizaPedidoDeVendaPix.
4035
+ * @param config - Partial configuration to override service-level defaults
4036
+ * @returns This service instance for method chaining
4037
+ */
4038
+ setRealizaPedidoDeVendaPixConfig(config) {
4039
+ this.realizaPedidoDeVendaPixConfig = config;
4040
+ return this;
4041
+ }
4042
+ /**
4043
+ * Sets method-level configuration for realizaPedidoDeVendaCard.
4044
+ * @param config - Partial configuration to override service-level defaults
4045
+ * @returns This service instance for method chaining
4046
+ */
4047
+ setRealizaPedidoDeVendaCardConfig(config) {
4048
+ this.realizaPedidoDeVendaCardConfig = config;
4049
+ return this;
4050
+ }
4051
+ /**
4052
+ *
4053
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4054
+ * @returns {Promise<HttpResponse<any>>} - OK
4055
+ */
4056
+ async recuperaCheckout(body, requestConfig) {
4057
+ const resolvedConfig = this.getResolvedConfig(this.recuperaCheckoutConfig, requestConfig);
4058
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/Get").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4059
+ schema: z21.any(),
4060
+ contentType: "json" /* Json */,
4061
+ status: 200
4062
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4063
+ return this.client.callDirect(request);
4064
+ }
4065
+ /**
4066
+ *
4067
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4068
+ * @returns {Promise<HttpResponse<any>>} - OK
4069
+ */
4070
+ async selecionaEndereODeEntrega(body, requestConfig) {
4071
+ const resolvedConfig = this.getResolvedConfig(
4072
+ this.selecionaEndereODeEntregaConfig,
4073
+ requestConfig
4074
+ );
4075
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/SetAddress").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4076
+ schema: z21.any(),
4077
+ contentType: "json" /* Json */,
4078
+ status: 200
4079
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4080
+ return this.client.callDirect(request);
4081
+ }
4082
+ /**
4083
+ *
4084
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4085
+ * @returns {Promise<HttpResponse<any>>} - OK
4086
+ */
4087
+ async setPostalCode(body, requestConfig) {
4088
+ const resolvedConfig = this.getResolvedConfig(this.setPostalCodeConfig, requestConfig);
4089
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/SetAddress").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4090
+ schema: z21.any(),
4091
+ contentType: "json" /* Json */,
4092
+ status: 200
4093
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4094
+ return this.client.callDirect(request);
4095
+ }
4096
+ /**
4097
+ *
4098
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4099
+ * @returns {Promise<HttpResponse<any>>} - OK
4100
+ */
4101
+ async setaMTodoDeEntregaLocationId(body, requestConfig) {
4102
+ const resolvedConfig = this.getResolvedConfig(
4103
+ this.setaMTodoDeEntregaLocationIdConfig,
4104
+ requestConfig
4105
+ );
4106
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/SetDeliveryOption").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4107
+ schema: z21.any(),
4108
+ contentType: "json" /* Json */,
4109
+ status: 200
4110
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4111
+ return this.client.callDirect(request);
4112
+ }
4113
+ /**
4114
+ *
4115
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4116
+ * @returns {Promise<HttpResponse<any>>} - OK
4117
+ */
4118
+ async setaMTodoDeEntrega(body, requestConfig) {
4119
+ const resolvedConfig = this.getResolvedConfig(this.setaMTodoDeEntregaConfig, requestConfig);
4120
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/SetDeliveryOption").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4121
+ schema: z21.any(),
4122
+ contentType: "json" /* Json */,
4123
+ status: 200
4124
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4125
+ return this.client.callDirect(request);
4126
+ }
4127
+ /**
4128
+ *
4129
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4130
+ * @returns {Promise<HttpResponse<any>>} - OK
4131
+ */
4132
+ async retornaOpODeEntregaParaOms(body, requestConfig) {
4133
+ const resolvedConfig = this.getResolvedConfig(
4134
+ this.retornaOpODeEntregaParaOmsConfig,
4135
+ requestConfig
4136
+ );
4137
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/GetOMSLocations").setRequestSchema(retornaOpODeEntregaParaOmsRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4138
+ schema: z21.any(),
4139
+ contentType: "json" /* Json */,
4140
+ status: 200
4141
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4142
+ return this.client.callDirect(request);
4143
+ }
4144
+ /**
4145
+ *
4146
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4147
+ * @returns {Promise<HttpResponse<any>>} - OK
4148
+ */
4149
+ async gruposDePagamento(body, requestConfig) {
4150
+ const resolvedConfig = this.getResolvedConfig(this.gruposDePagamentoConfig, requestConfig);
4151
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/PaymentGroups").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4152
+ schema: z21.any(),
4153
+ contentType: "json" /* Json */,
4154
+ status: 200
4155
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4156
+ return this.client.callDirect(request);
4157
+ }
4158
+ /**
4159
+ *
4160
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4161
+ * @returns {Promise<HttpResponse<any>>} - OK
4162
+ */
4163
+ async adicioneCupomNoCheckout(body, requestConfig) {
4164
+ const resolvedConfig = this.getResolvedConfig(
4165
+ this.adicioneCupomNoCheckoutConfig,
4166
+ requestConfig
4167
+ );
4168
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/AddCoupon").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4169
+ schema: z21.any(),
4170
+ contentType: "json" /* Json */,
4171
+ status: 200
4172
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4173
+ return this.client.callDirect(request);
4174
+ }
4175
+ /**
4176
+ *
4177
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4178
+ * @returns {Promise<HttpResponse<any>>} - OK
4179
+ */
4180
+ async removeCupomNoCheckout(body, requestConfig) {
4181
+ const resolvedConfig = this.getResolvedConfig(this.removeCupomNoCheckoutConfig, requestConfig);
4182
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/RemoveCoupon").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4183
+ schema: z21.any(),
4184
+ contentType: "json" /* Json */,
4185
+ status: 200
4186
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4187
+ return this.client.callDirect(request);
4188
+ }
4189
+ /**
4190
+ *
4191
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4192
+ * @returns {Promise<HttpResponse<any>>} - OK
4193
+ */
4194
+ async realizaPedidoDeVendaPix(body, requestConfig) {
4195
+ const resolvedConfig = this.getResolvedConfig(
4196
+ this.realizaPedidoDeVendaPixConfig,
4197
+ requestConfig
4198
+ );
4199
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/PlaceOrder").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4200
+ schema: z21.any(),
4201
+ contentType: "json" /* Json */,
4202
+ status: 200
4203
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4204
+ return this.client.callDirect(request);
4205
+ }
4206
+ /**
4207
+ *
4208
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4209
+ * @returns {Promise<HttpResponse<any>>} - OK
4210
+ */
4211
+ async realizaPedidoDeVendaCard(body, requestConfig) {
4212
+ const resolvedConfig = this.getResolvedConfig(
4213
+ this.realizaPedidoDeVendaCardConfig,
4214
+ requestConfig
4215
+ );
4216
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Shopping/Checkout/PlaceOrder").setRequestSchema(z21.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4217
+ schema: z21.any(),
4218
+ contentType: "json" /* Json */,
4219
+ status: 200
4220
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4221
+ return this.client.callDirect(request);
4222
+ }
4223
+ };
4224
+
4225
+ // src/services/orders/orders-service.ts
4226
+ import { z as z24 } from "zod";
4227
+
4228
+ // src/services/orders/models/details-order-request.ts
4229
+ import { z as z22 } from "zod";
4230
+ var detailsOrderRequest = z22.lazy(() => {
4231
+ return z22.object({
4232
+ sessionId: z22.string().optional().nullable(),
4233
+ orderNumber: z22.string().optional().nullable(),
4234
+ customerId: z22.number().optional().nullable()
4235
+ });
4236
+ });
4237
+ var detailsOrderRequestResponse = z22.lazy(() => {
4238
+ return z22.object({
4239
+ SessionID: z22.string().optional().nullable(),
4240
+ OrderNumber: z22.string().optional().nullable(),
4241
+ CustomerID: z22.number().optional().nullable()
4242
+ }).transform((data) => ({
4243
+ sessionId: data["SessionID"],
4244
+ orderNumber: data["OrderNumber"],
4245
+ customerId: data["CustomerID"]
4246
+ }));
4247
+ });
4248
+ var detailsOrderRequestRequest = z22.lazy(() => {
4249
+ return z22.object({
4250
+ sessionId: z22.string().optional().nullable(),
4251
+ orderNumber: z22.string().optional().nullable(),
4252
+ customerId: z22.number().optional().nullable()
4253
+ }).transform((data) => ({
4254
+ SessionID: data["sessionId"],
4255
+ OrderNumber: data["orderNumber"],
4256
+ CustomerID: data["customerId"]
4257
+ }));
4258
+ });
4259
+
4260
+ // src/services/orders/models/account-order-request.ts
4261
+ import { z as z23 } from "zod";
4262
+ var accountOrderRequest = z23.lazy(() => {
4263
+ return z23.object({
4264
+ sessionId: z23.string().optional().nullable(),
4265
+ pageSize: z23.number().optional().nullable(),
4266
+ pageIndex: z23.number().optional().nullable(),
4267
+ customerId: z23.number().optional().nullable()
4268
+ });
4269
+ });
4270
+ var accountOrderRequestResponse = z23.lazy(() => {
4271
+ return z23.object({
4272
+ SessionID: z23.string().optional().nullable(),
4273
+ PageSize: z23.number().optional().nullable(),
4274
+ PageIndex: z23.number().optional().nullable(),
4275
+ CustomerID: z23.number().optional().nullable()
4276
+ }).transform((data) => ({
4277
+ sessionId: data["SessionID"],
4278
+ pageSize: data["PageSize"],
4279
+ pageIndex: data["PageIndex"],
4280
+ customerId: data["CustomerID"]
4281
+ }));
4282
+ });
4283
+ var accountOrderRequestRequest = z23.lazy(() => {
4284
+ return z23.object({
4285
+ sessionId: z23.string().optional().nullable(),
4286
+ pageSize: z23.number().optional().nullable(),
4287
+ pageIndex: z23.number().optional().nullable(),
4288
+ customerId: z23.number().optional().nullable()
4289
+ }).transform((data) => ({
4290
+ SessionID: data["sessionId"],
4291
+ PageSize: data["pageSize"],
4292
+ PageIndex: data["pageIndex"],
4293
+ CustomerID: data["customerId"]
4294
+ }));
4295
+ });
4296
+
4297
+ // src/services/orders/orders-service.ts
4298
+ var OrdersService = class extends BaseService {
4299
+ constructor() {
4300
+ super(...arguments);
4301
+ this.orderListConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
4302
+ this.detailsOrderConfig = { environment: "https://{{apiLinxcommerce}}" /* APILINXCOMMERCE */ };
4303
+ this.accountOrderConfig = { environment: "https://{{urlLinx}}" /* URLLINX */ };
4304
+ }
4305
+ /**
4306
+ * Sets method-level configuration for orderList.
4307
+ * @param config - Partial configuration to override service-level defaults
4308
+ * @returns This service instance for method chaining
4309
+ */
4310
+ setOrderListConfig(config) {
4311
+ this.orderListConfig = config;
4312
+ return this;
4313
+ }
4314
+ /**
4315
+ * Sets method-level configuration for detailsOrder.
4316
+ * @param config - Partial configuration to override service-level defaults
4317
+ * @returns This service instance for method chaining
4318
+ */
4319
+ setDetailsOrderConfig(config) {
4320
+ this.detailsOrderConfig = config;
4321
+ return this;
4322
+ }
4323
+ /**
4324
+ * Sets method-level configuration for accountOrder.
4325
+ * @param config - Partial configuration to override service-level defaults
4326
+ * @returns This service instance for method chaining
4327
+ */
4328
+ setAccountOrderConfig(config) {
4329
+ this.accountOrderConfig = config;
4330
+ return this;
4331
+ }
4332
+ /**
4333
+ *
4334
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4335
+ * @returns {Promise<HttpResponse<any>>} - OK
4336
+ */
4337
+ async orderList(body, requestConfig) {
4338
+ const resolvedConfig = this.getResolvedConfig(this.orderListConfig, requestConfig);
4339
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/AccountOrder/List").setRequestSchema(z24.any()).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4340
+ schema: z24.any(),
4341
+ contentType: "json" /* Json */,
4342
+ status: 200
4343
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4344
+ return this.client.callDirect(request);
4345
+ }
4346
+ /**
4347
+ *
4348
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4349
+ * @returns {Promise<HttpResponse<any>>} - OK
4350
+ */
4351
+ async detailsOrder(body, requestConfig) {
4352
+ const resolvedConfig = this.getResolvedConfig(this.detailsOrderConfig, requestConfig);
4353
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/AccountOrder/Get").setRequestSchema(detailsOrderRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4354
+ schema: z24.any(),
4355
+ contentType: "json" /* Json */,
4356
+ status: 200
4357
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4358
+ return this.client.callDirect(request);
4359
+ }
4360
+ /**
4361
+ *
4362
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4363
+ * @returns {Promise<HttpResponse<any>>} - OK
4364
+ */
4365
+ async accountOrder(body, requestConfig) {
4366
+ const resolvedConfig = this.getResolvedConfig(this.accountOrderConfig, requestConfig);
4367
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("POST").setPath("/Profile/AccountOrder/List").setRequestSchema(accountOrderRequestRequest).addBasicAuth(resolvedConfig == null ? void 0 : resolvedConfig.username, resolvedConfig == null ? void 0 : resolvedConfig.password).setRequestContentType("json" /* Json */).addResponse({
4368
+ schema: z24.any(),
4369
+ contentType: "json" /* Json */,
4370
+ status: 200
4371
+ }).addHeaderParam({ key: "Content-Type", value: "application/json" }).addBody(body).build();
4372
+ return this.client.callDirect(request);
4373
+ }
4374
+ };
4375
+
4376
+ // src/services/ws/ws-service.ts
4377
+ import { z as z25 } from "zod";
4378
+ var WsService = class extends BaseService {
4379
+ constructor() {
4380
+ super(...arguments);
4381
+ this.viaccepConfig = { environment: "https://viacep.com.br" /* VIACEP */ };
4382
+ }
4383
+ /**
4384
+ * Sets method-level configuration for viaccep.
4385
+ * @param config - Partial configuration to override service-level defaults
4386
+ * @returns This service instance for method chaining
4387
+ */
4388
+ setViaccepConfig(config) {
4389
+ this.viaccepConfig = config;
4390
+ return this;
4391
+ }
4392
+ /**
4393
+ *
4394
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4395
+ * @returns {Promise<HttpResponse<any>>} - OK
4396
+ */
4397
+ async viaccep(requestConfig) {
4398
+ const resolvedConfig = this.getResolvedConfig(this.viaccepConfig, requestConfig);
4399
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/ws/PR/Cascavel/Domingos+Jose/json/").setRequestSchema(z25.any()).setRequestContentType("json" /* Json */).addResponse({
4400
+ schema: z25.any(),
4401
+ contentType: "json" /* Json */,
4402
+ status: 200
4403
+ }).build();
4404
+ return this.client.callDirect(request);
4405
+ }
4406
+ };
4407
+
4408
+ // src/services/widget/widget-service.ts
4409
+ import { z as z26 } from "zod";
4410
+ var WidgetService = class extends BaseService {
4411
+ constructor() {
4412
+ super(...arguments);
4413
+ this.getBannerConfig = { environment: "https://{{storeUrl}}" /* STOREURL */ };
4414
+ }
4415
+ /**
4416
+ * Sets method-level configuration for getBanner.
4417
+ * @param config - Partial configuration to override service-level defaults
4418
+ * @returns This service instance for method chaining
4419
+ */
4420
+ setGetBannerConfig(config) {
4421
+ this.getBannerConfig = config;
4422
+ return this;
4423
+ }
4424
+ /**
4425
+ *
4426
+ * @param {string} params.userAgent -
4427
+ * @param {string} params.accept -
4428
+ * @param {string} [params.positionId] -
4429
+ * @param {string} [params.template] -
4430
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4431
+ * @returns {Promise<HttpResponse<any>>} - OK
4432
+ */
4433
+ async getBanner(params, requestConfig) {
4434
+ const resolvedConfig = this.getResolvedConfig(this.getBannerConfig, requestConfig);
4435
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/widget/marketing_banner").setRequestSchema(z26.any()).setRequestContentType("json" /* Json */).addResponse({
4436
+ schema: z26.any(),
4437
+ contentType: "json" /* Json */,
4438
+ status: 200
4439
+ }).addQueryParam({
4440
+ key: "PositionId",
4441
+ value: params == null ? void 0 : params.positionId
4442
+ }).addQueryParam({
4443
+ key: "template",
4444
+ value: params == null ? void 0 : params.template
4445
+ }).addHeaderParam({
4446
+ key: "User-Agent",
4447
+ value: params == null ? void 0 : params.userAgent
4448
+ }).addHeaderParam({
4449
+ key: "Accept",
4450
+ value: params == null ? void 0 : params.accept
4451
+ }).build();
4452
+ return this.client.callDirect(request);
4453
+ }
4454
+ };
4455
+
4456
+ // src/services/onde-encontrar-json/onde-encontrar-json-service.ts
4457
+ import { z as z27 } from "zod";
4458
+ var OndeEncontrarJsonService = class extends BaseService {
4459
+ constructor() {
4460
+ super(...arguments);
4461
+ this.ondeEncontrarNossasLojasConfig = {
4462
+ environment: "https://{{storeUrl}}" /* STOREURL */
4463
+ };
4464
+ }
4465
+ /**
4466
+ * Sets method-level configuration for ondeEncontrarNossasLojas.
4467
+ * @param config - Partial configuration to override service-level defaults
4468
+ * @returns This service instance for method chaining
4469
+ */
4470
+ setOndeEncontrarNossasLojasConfig(config) {
4471
+ this.ondeEncontrarNossasLojasConfig = config;
4472
+ return this;
4473
+ }
4474
+ /**
4475
+ *
4476
+ * @param {string} params.userAgent -
4477
+ * @param {Partial<SdkConfig>} [requestConfig] - The request configuration for retry and validation.
4478
+ * @returns {Promise<HttpResponse<any>>} - OK
4479
+ */
4480
+ async ondeEncontrarNossasLojas(params, requestConfig) {
4481
+ const resolvedConfig = this.getResolvedConfig(
4482
+ this.ondeEncontrarNossasLojasConfig,
4483
+ requestConfig
4484
+ );
4485
+ const request = new RequestBuilder().setConfig(resolvedConfig).setBaseUrl(resolvedConfig).setMethod("GET").setPath("/onde-encontrar.json").setRequestSchema(z27.any()).setRequestContentType("json" /* Json */).addResponse({
4486
+ schema: z27.any(),
4487
+ contentType: "json" /* Json */,
4488
+ status: 200
4489
+ }).addHeaderParam({
4490
+ key: "User-Agent",
4491
+ value: params == null ? void 0 : params.userAgent
4492
+ }).build();
4493
+ return this.client.callDirect(request);
4494
+ }
4495
+ };
4496
+
4497
+ // src/index.ts
4498
+ var LinxcommerceWebapiSdk = class {
4499
+ constructor(config) {
4500
+ this.config = config;
4501
+ this.customers = new CustomersService(this.config);
4502
+ this.products = new ProductsService(this.config);
4503
+ this.address = new AddressService(this.config);
4504
+ this.delivery = new DeliveryService(this.config);
4505
+ this.basket = new BasketService(this.config);
4506
+ this.checkout = new CheckoutService(this.config);
4507
+ this.orders = new OrdersService(this.config);
4508
+ this.ws = new WsService(this.config);
4509
+ this.widget = new WidgetService(this.config);
4510
+ this.ondeEncontrarJson = new OndeEncontrarJsonService(this.config);
4511
+ }
4512
+ set baseUrl(baseUrl) {
4513
+ this.customers.baseUrl = baseUrl;
4514
+ this.products.baseUrl = baseUrl;
4515
+ this.address.baseUrl = baseUrl;
4516
+ this.delivery.baseUrl = baseUrl;
4517
+ this.basket.baseUrl = baseUrl;
4518
+ this.checkout.baseUrl = baseUrl;
4519
+ this.orders.baseUrl = baseUrl;
4520
+ this.ws.baseUrl = baseUrl;
4521
+ this.widget.baseUrl = baseUrl;
4522
+ this.ondeEncontrarJson.baseUrl = baseUrl;
4523
+ }
4524
+ set environment(environment) {
4525
+ this.customers.baseUrl = environment;
4526
+ this.products.baseUrl = environment;
4527
+ this.address.baseUrl = environment;
4528
+ this.delivery.baseUrl = environment;
4529
+ this.basket.baseUrl = environment;
4530
+ this.checkout.baseUrl = environment;
4531
+ this.orders.baseUrl = environment;
4532
+ this.ws.baseUrl = environment;
4533
+ this.widget.baseUrl = environment;
4534
+ this.ondeEncontrarJson.baseUrl = environment;
4535
+ }
4536
+ set timeoutMs(timeoutMs) {
4537
+ this.customers.timeoutMs = timeoutMs;
4538
+ this.products.timeoutMs = timeoutMs;
4539
+ this.address.timeoutMs = timeoutMs;
4540
+ this.delivery.timeoutMs = timeoutMs;
4541
+ this.basket.timeoutMs = timeoutMs;
4542
+ this.checkout.timeoutMs = timeoutMs;
4543
+ this.orders.timeoutMs = timeoutMs;
4544
+ this.ws.timeoutMs = timeoutMs;
4545
+ this.widget.timeoutMs = timeoutMs;
4546
+ this.ondeEncontrarJson.timeoutMs = timeoutMs;
4547
+ }
4548
+ set username(username) {
4549
+ this.customers.username = username;
4550
+ this.products.username = username;
4551
+ this.address.username = username;
4552
+ this.delivery.username = username;
4553
+ this.basket.username = username;
4554
+ this.checkout.username = username;
4555
+ this.orders.username = username;
4556
+ this.ws.username = username;
4557
+ this.widget.username = username;
4558
+ this.ondeEncontrarJson.username = username;
4559
+ }
4560
+ set password(password) {
4561
+ this.customers.password = password;
4562
+ this.products.password = password;
4563
+ this.address.password = password;
4564
+ this.delivery.password = password;
4565
+ this.basket.password = password;
4566
+ this.checkout.password = password;
4567
+ this.orders.password = password;
4568
+ this.ws.password = password;
4569
+ this.widget.password = password;
4570
+ this.ondeEncontrarJson.password = password;
4571
+ }
4572
+ };
4573
+ export {
4574
+ AddressService,
4575
+ BasketService,
4576
+ CheckoutService,
4577
+ CustomersService,
4578
+ DeliveryService,
4579
+ Environment,
4580
+ LinxcommerceWebapiSdk,
4581
+ OndeEncontrarJsonService,
4582
+ OrdersService,
4583
+ ProductsService,
4584
+ WidgetService,
4585
+ WsService
4586
+ };