ce-storefront 0.15.3 → 0.15.6
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/README.md +15 -2
- package/docs/sdks/auth/README.md +10 -0
- package/docs/sdks/carts/README.md +12 -0
- package/docs/sdks/catalog/README.md +11 -0
- package/docs/sdks/common/README.md +1 -0
- package/docs/sdks/customers/README.md +7 -0
- package/docs/sdks/orders/README.md +7 -0
- package/docs/sdks/pos/README.md +397 -0
- package/docs/sdks/shipping/README.md +1 -0
- package/esm/funcs/posCreatePosCart.d.ts +17 -0
- package/esm/funcs/posCreatePosCart.d.ts.map +1 -0
- package/esm/funcs/posCreatePosCart.js +80 -0
- package/esm/funcs/posCreatePosCart.js.map +1 -0
- package/esm/funcs/posLoginToPosDevice.d.ts +17 -0
- package/esm/funcs/posLoginToPosDevice.d.ts.map +1 -0
- package/esm/funcs/posLoginToPosDevice.js +84 -0
- package/esm/funcs/posLoginToPosDevice.js.map +1 -0
- package/esm/funcs/posPairPosDevice.d.ts +17 -0
- package/esm/funcs/posPairPosDevice.d.ts.map +1 -0
- package/esm/funcs/posPairPosDevice.js +84 -0
- package/esm/funcs/posPairPosDevice.js.map +1 -0
- package/esm/funcs/posRefreshPosAccessToken.d.ts +17 -0
- package/esm/funcs/posRefreshPosAccessToken.d.ts.map +1 -0
- package/esm/funcs/posRefreshPosAccessToken.js +81 -0
- package/esm/funcs/posRefreshPosAccessToken.js.map +1 -0
- package/esm/funcs/posUpdatePosCart.d.ts +17 -0
- package/esm/funcs/posUpdatePosCart.d.ts.map +1 -0
- package/esm/funcs/posUpdatePosCart.js +84 -0
- package/esm/funcs/posUpdatePosCart.js.map +1 -0
- package/esm/lib/base64.d.ts +2 -2
- package/esm/lib/base64.d.ts.map +1 -1
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/encodings.d.ts.map +1 -1
- package/esm/models/components/index.d.ts +1 -0
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +1 -0
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/posuser.d.ts +124 -0
- package/esm/models/components/posuser.d.ts.map +1 -0
- package/esm/models/components/posuser.js +139 -0
- package/esm/models/components/posuser.js.map +1 -0
- package/esm/models/operations/createposcart.d.ts +90 -0
- package/esm/models/operations/createposcart.d.ts.map +1 -0
- package/esm/models/operations/createposcart.js +86 -0
- package/esm/models/operations/createposcart.js.map +1 -0
- package/esm/models/operations/index.d.ts +5 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +5 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/logintoposdevice.d.ts +118 -0
- package/esm/models/operations/logintoposdevice.d.ts.map +1 -0
- package/esm/models/operations/logintoposdevice.js +146 -0
- package/esm/models/operations/logintoposdevice.js.map +1 -0
- package/esm/models/operations/pairposdevice.d.ts +115 -0
- package/esm/models/operations/pairposdevice.d.ts.map +1 -0
- package/esm/models/operations/pairposdevice.js +141 -0
- package/esm/models/operations/pairposdevice.js.map +1 -0
- package/esm/models/operations/refreshposaccesstoken.d.ts +88 -0
- package/esm/models/operations/refreshposaccesstoken.d.ts.map +1 -0
- package/esm/models/operations/refreshposaccesstoken.js +106 -0
- package/esm/models/operations/refreshposaccesstoken.js.map +1 -0
- package/esm/models/operations/updateposcart.d.ts +120 -0
- package/esm/models/operations/updateposcart.d.ts.map +1 -0
- package/esm/models/operations/updateposcart.js +122 -0
- package/esm/models/operations/updateposcart.js.map +1 -0
- package/esm/sdk/pos.d.ts +40 -0
- package/esm/sdk/pos.d.ts.map +1 -0
- package/esm/sdk/pos.js +58 -0
- package/esm/sdk/pos.js.map +1 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +4 -0
- package/esm/sdk/sdk.js.map +1 -1
- package/examples/README.md +5 -0
- package/examples/catalogListProducts.example.ts +2 -0
- package/examples/package-lock.json +6 -7
- package/jsr.json +1 -1
- package/package.json +5 -6
- package/src/funcs/posCreatePosCart.ts +165 -0
- package/src/funcs/posLoginToPosDevice.ts +174 -0
- package/src/funcs/posPairPosDevice.ts +174 -0
- package/src/funcs/posRefreshPosAccessToken.ts +164 -0
- package/src/funcs/posUpdatePosCart.ts +167 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/index.ts +1 -0
- package/src/models/components/posuser.ts +263 -0
- package/src/models/operations/createposcart.ts +197 -0
- package/src/models/operations/index.ts +5 -0
- package/src/models/operations/logintoposdevice.ts +297 -0
- package/src/models/operations/pairposdevice.ts +286 -0
- package/src/models/operations/refreshposaccesstoken.ts +223 -0
- package/src/models/operations/updateposcart.ts +271 -0
- package/src/sdk/pos.ts +103 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CeStorefrontCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { CeStorefrontError } from "../models/errors/cestorefronterror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
25
|
+
import { Result } from "../types/fp.js";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Add/update/delete cart item
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Add/update item to cart. To delete item from cart, pass quantity = 0
|
|
32
|
+
*/
|
|
33
|
+
export function posUpdatePosCart(
|
|
34
|
+
client: CeStorefrontCore,
|
|
35
|
+
request: operations.UpdatePosCartRequest,
|
|
36
|
+
options?: RequestOptions,
|
|
37
|
+
): APIPromise<
|
|
38
|
+
Result<
|
|
39
|
+
operations.UpdatePosCartResponseBody,
|
|
40
|
+
| CeStorefrontError
|
|
41
|
+
| ResponseValidationError
|
|
42
|
+
| ConnectionError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| UnexpectedClientError
|
|
47
|
+
| SDKValidationError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
return new APIPromise($do(
|
|
51
|
+
client,
|
|
52
|
+
request,
|
|
53
|
+
options,
|
|
54
|
+
));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function $do(
|
|
58
|
+
client: CeStorefrontCore,
|
|
59
|
+
request: operations.UpdatePosCartRequest,
|
|
60
|
+
options?: RequestOptions,
|
|
61
|
+
): Promise<
|
|
62
|
+
[
|
|
63
|
+
Result<
|
|
64
|
+
operations.UpdatePosCartResponseBody,
|
|
65
|
+
| CeStorefrontError
|
|
66
|
+
| ResponseValidationError
|
|
67
|
+
| ConnectionError
|
|
68
|
+
| RequestAbortedError
|
|
69
|
+
| RequestTimeoutError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| UnexpectedClientError
|
|
72
|
+
| SDKValidationError
|
|
73
|
+
>,
|
|
74
|
+
APICall,
|
|
75
|
+
]
|
|
76
|
+
> {
|
|
77
|
+
const parsed = safeParse(
|
|
78
|
+
request,
|
|
79
|
+
(value) => operations.UpdatePosCartRequest$outboundSchema.parse(value),
|
|
80
|
+
"Input validation failed",
|
|
81
|
+
);
|
|
82
|
+
if (!parsed.ok) {
|
|
83
|
+
return [parsed, { status: "invalid" }];
|
|
84
|
+
}
|
|
85
|
+
const payload = parsed.value;
|
|
86
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
87
|
+
|
|
88
|
+
const pathParams = {
|
|
89
|
+
id: encodeSimple("id", payload.id, {
|
|
90
|
+
explode: false,
|
|
91
|
+
charEncoding: "percent",
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const path = pathToFunc("/pos/carts/{id}/items")(pathParams);
|
|
96
|
+
|
|
97
|
+
const headers = new Headers(compactMap({
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
Accept: "application/json",
|
|
100
|
+
}));
|
|
101
|
+
|
|
102
|
+
const secConfig = await extractSecurity(client._options.authorization);
|
|
103
|
+
const securityInput = secConfig == null ? {} : { authorization: secConfig };
|
|
104
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
105
|
+
|
|
106
|
+
const context = {
|
|
107
|
+
options: client._options,
|
|
108
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
109
|
+
operationID: "update-pos-cart",
|
|
110
|
+
oAuth2Scopes: [],
|
|
111
|
+
|
|
112
|
+
resolvedSecurity: requestSecurity,
|
|
113
|
+
|
|
114
|
+
securitySource: client._options.authorization,
|
|
115
|
+
retryConfig: options?.retries
|
|
116
|
+
|| client._options.retryConfig
|
|
117
|
+
|| { strategy: "none" },
|
|
118
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const requestRes = client._createRequest(context, {
|
|
122
|
+
security: requestSecurity,
|
|
123
|
+
method: "POST",
|
|
124
|
+
baseURL: options?.serverURL,
|
|
125
|
+
path: path,
|
|
126
|
+
headers: headers,
|
|
127
|
+
body: body,
|
|
128
|
+
userAgent: client._options.userAgent,
|
|
129
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
130
|
+
}, options);
|
|
131
|
+
if (!requestRes.ok) {
|
|
132
|
+
return [requestRes, { status: "invalid" }];
|
|
133
|
+
}
|
|
134
|
+
const req = requestRes.value;
|
|
135
|
+
|
|
136
|
+
const doResult = await client._do(req, {
|
|
137
|
+
context,
|
|
138
|
+
errorCodes: ["4XX", "5XX"],
|
|
139
|
+
retryConfig: context.retryConfig,
|
|
140
|
+
retryCodes: context.retryCodes,
|
|
141
|
+
});
|
|
142
|
+
if (!doResult.ok) {
|
|
143
|
+
return [doResult, { status: "request-error", request: req }];
|
|
144
|
+
}
|
|
145
|
+
const response = doResult.value;
|
|
146
|
+
|
|
147
|
+
const [result] = await M.match<
|
|
148
|
+
operations.UpdatePosCartResponseBody,
|
|
149
|
+
| CeStorefrontError
|
|
150
|
+
| ResponseValidationError
|
|
151
|
+
| ConnectionError
|
|
152
|
+
| RequestAbortedError
|
|
153
|
+
| RequestTimeoutError
|
|
154
|
+
| InvalidRequestError
|
|
155
|
+
| UnexpectedClientError
|
|
156
|
+
| SDKValidationError
|
|
157
|
+
>(
|
|
158
|
+
M.json(200, operations.UpdatePosCartResponseBody$inboundSchema),
|
|
159
|
+
M.fail("4XX"),
|
|
160
|
+
M.fail("5XX"),
|
|
161
|
+
)(response, req);
|
|
162
|
+
if (!result.ok) {
|
|
163
|
+
return [result, { status: "complete", request: req, response }];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return [result, { status: "complete", request: req, response }];
|
|
167
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -80,7 +80,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
80
80
|
export const SDK_METADATA = {
|
|
81
81
|
language: "typescript",
|
|
82
82
|
openapiDocVersion: "1.0",
|
|
83
|
-
sdkVersion: "0.15.
|
|
84
|
-
genVersion: "2.
|
|
85
|
-
userAgent: "speakeasy-sdk/typescript 0.15.
|
|
83
|
+
sdkVersion: "0.15.6",
|
|
84
|
+
genVersion: "2.675.0",
|
|
85
|
+
userAgent: "speakeasy-sdk/typescript 0.15.6 2.675.0 1.0 ce-storefront",
|
|
86
86
|
} as const;
|
|
@@ -46,6 +46,7 @@ export * from "./payupaymentgatewayparams.js";
|
|
|
46
46
|
export * from "./payupaymentinfo.js";
|
|
47
47
|
export * from "./pincode.js";
|
|
48
48
|
export * from "./pincodeserviceability.js";
|
|
49
|
+
export * from "./posuser.js";
|
|
49
50
|
export * from "./product.js";
|
|
50
51
|
export * from "./productattribute.js";
|
|
51
52
|
export * from "./productbundleitem.js";
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type Device = {
|
|
12
|
+
id?: string | undefined;
|
|
13
|
+
name?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type Location = {
|
|
17
|
+
id?: string | undefined;
|
|
18
|
+
name?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type Role = {
|
|
22
|
+
id?: string | undefined;
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type PosUser = {
|
|
27
|
+
id?: string | undefined;
|
|
28
|
+
firstName?: string | undefined;
|
|
29
|
+
lastName?: string | null | undefined;
|
|
30
|
+
phone?: string | undefined;
|
|
31
|
+
email?: string | undefined;
|
|
32
|
+
device?: Device | undefined;
|
|
33
|
+
location?: Location | undefined;
|
|
34
|
+
role?: Role | undefined;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const Device$inboundSchema: z.ZodType<Device, z.ZodTypeDef, unknown> = z
|
|
39
|
+
.object({
|
|
40
|
+
id: z.string().optional(),
|
|
41
|
+
name: z.string().optional(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/** @internal */
|
|
45
|
+
export type Device$Outbound = {
|
|
46
|
+
id?: string | undefined;
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const Device$outboundSchema: z.ZodType<
|
|
52
|
+
Device$Outbound,
|
|
53
|
+
z.ZodTypeDef,
|
|
54
|
+
Device
|
|
55
|
+
> = z.object({
|
|
56
|
+
id: z.string().optional(),
|
|
57
|
+
name: z.string().optional(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
63
|
+
*/
|
|
64
|
+
export namespace Device$ {
|
|
65
|
+
/** @deprecated use `Device$inboundSchema` instead. */
|
|
66
|
+
export const inboundSchema = Device$inboundSchema;
|
|
67
|
+
/** @deprecated use `Device$outboundSchema` instead. */
|
|
68
|
+
export const outboundSchema = Device$outboundSchema;
|
|
69
|
+
/** @deprecated use `Device$Outbound` instead. */
|
|
70
|
+
export type Outbound = Device$Outbound;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function deviceToJSON(device: Device): string {
|
|
74
|
+
return JSON.stringify(Device$outboundSchema.parse(device));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function deviceFromJSON(
|
|
78
|
+
jsonString: string,
|
|
79
|
+
): SafeParseResult<Device, SDKValidationError> {
|
|
80
|
+
return safeParse(
|
|
81
|
+
jsonString,
|
|
82
|
+
(x) => Device$inboundSchema.parse(JSON.parse(x)),
|
|
83
|
+
`Failed to parse 'Device' from JSON`,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** @internal */
|
|
88
|
+
export const Location$inboundSchema: z.ZodType<
|
|
89
|
+
Location,
|
|
90
|
+
z.ZodTypeDef,
|
|
91
|
+
unknown
|
|
92
|
+
> = z.object({
|
|
93
|
+
id: z.string().optional(),
|
|
94
|
+
name: z.string().optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/** @internal */
|
|
98
|
+
export type Location$Outbound = {
|
|
99
|
+
id?: string | undefined;
|
|
100
|
+
name?: string | undefined;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/** @internal */
|
|
104
|
+
export const Location$outboundSchema: z.ZodType<
|
|
105
|
+
Location$Outbound,
|
|
106
|
+
z.ZodTypeDef,
|
|
107
|
+
Location
|
|
108
|
+
> = z.object({
|
|
109
|
+
id: z.string().optional(),
|
|
110
|
+
name: z.string().optional(),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
116
|
+
*/
|
|
117
|
+
export namespace Location$ {
|
|
118
|
+
/** @deprecated use `Location$inboundSchema` instead. */
|
|
119
|
+
export const inboundSchema = Location$inboundSchema;
|
|
120
|
+
/** @deprecated use `Location$outboundSchema` instead. */
|
|
121
|
+
export const outboundSchema = Location$outboundSchema;
|
|
122
|
+
/** @deprecated use `Location$Outbound` instead. */
|
|
123
|
+
export type Outbound = Location$Outbound;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function locationToJSON(location: Location): string {
|
|
127
|
+
return JSON.stringify(Location$outboundSchema.parse(location));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function locationFromJSON(
|
|
131
|
+
jsonString: string,
|
|
132
|
+
): SafeParseResult<Location, SDKValidationError> {
|
|
133
|
+
return safeParse(
|
|
134
|
+
jsonString,
|
|
135
|
+
(x) => Location$inboundSchema.parse(JSON.parse(x)),
|
|
136
|
+
`Failed to parse 'Location' from JSON`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** @internal */
|
|
141
|
+
export const Role$inboundSchema: z.ZodType<Role, z.ZodTypeDef, unknown> = z
|
|
142
|
+
.object({
|
|
143
|
+
id: z.string().optional(),
|
|
144
|
+
name: z.string().optional(),
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
/** @internal */
|
|
148
|
+
export type Role$Outbound = {
|
|
149
|
+
id?: string | undefined;
|
|
150
|
+
name?: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** @internal */
|
|
154
|
+
export const Role$outboundSchema: z.ZodType<Role$Outbound, z.ZodTypeDef, Role> =
|
|
155
|
+
z.object({
|
|
156
|
+
id: z.string().optional(),
|
|
157
|
+
name: z.string().optional(),
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @internal
|
|
162
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
163
|
+
*/
|
|
164
|
+
export namespace Role$ {
|
|
165
|
+
/** @deprecated use `Role$inboundSchema` instead. */
|
|
166
|
+
export const inboundSchema = Role$inboundSchema;
|
|
167
|
+
/** @deprecated use `Role$outboundSchema` instead. */
|
|
168
|
+
export const outboundSchema = Role$outboundSchema;
|
|
169
|
+
/** @deprecated use `Role$Outbound` instead. */
|
|
170
|
+
export type Outbound = Role$Outbound;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function roleToJSON(role: Role): string {
|
|
174
|
+
return JSON.stringify(Role$outboundSchema.parse(role));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function roleFromJSON(
|
|
178
|
+
jsonString: string,
|
|
179
|
+
): SafeParseResult<Role, SDKValidationError> {
|
|
180
|
+
return safeParse(
|
|
181
|
+
jsonString,
|
|
182
|
+
(x) => Role$inboundSchema.parse(JSON.parse(x)),
|
|
183
|
+
`Failed to parse 'Role' from JSON`,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** @internal */
|
|
188
|
+
export const PosUser$inboundSchema: z.ZodType<PosUser, z.ZodTypeDef, unknown> =
|
|
189
|
+
z.object({
|
|
190
|
+
id: z.string().optional(),
|
|
191
|
+
first_name: z.string().optional(),
|
|
192
|
+
last_name: z.nullable(z.string()).optional(),
|
|
193
|
+
phone: z.string().optional(),
|
|
194
|
+
email: z.string().optional(),
|
|
195
|
+
device: z.lazy(() => Device$inboundSchema).optional(),
|
|
196
|
+
location: z.lazy(() => Location$inboundSchema).optional(),
|
|
197
|
+
role: z.lazy(() => Role$inboundSchema).optional(),
|
|
198
|
+
}).transform((v) => {
|
|
199
|
+
return remap$(v, {
|
|
200
|
+
"first_name": "firstName",
|
|
201
|
+
"last_name": "lastName",
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
/** @internal */
|
|
206
|
+
export type PosUser$Outbound = {
|
|
207
|
+
id?: string | undefined;
|
|
208
|
+
first_name?: string | undefined;
|
|
209
|
+
last_name?: string | null | undefined;
|
|
210
|
+
phone?: string | undefined;
|
|
211
|
+
email?: string | undefined;
|
|
212
|
+
device?: Device$Outbound | undefined;
|
|
213
|
+
location?: Location$Outbound | undefined;
|
|
214
|
+
role?: Role$Outbound | undefined;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/** @internal */
|
|
218
|
+
export const PosUser$outboundSchema: z.ZodType<
|
|
219
|
+
PosUser$Outbound,
|
|
220
|
+
z.ZodTypeDef,
|
|
221
|
+
PosUser
|
|
222
|
+
> = z.object({
|
|
223
|
+
id: z.string().optional(),
|
|
224
|
+
firstName: z.string().optional(),
|
|
225
|
+
lastName: z.nullable(z.string()).optional(),
|
|
226
|
+
phone: z.string().optional(),
|
|
227
|
+
email: z.string().optional(),
|
|
228
|
+
device: z.lazy(() => Device$outboundSchema).optional(),
|
|
229
|
+
location: z.lazy(() => Location$outboundSchema).optional(),
|
|
230
|
+
role: z.lazy(() => Role$outboundSchema).optional(),
|
|
231
|
+
}).transform((v) => {
|
|
232
|
+
return remap$(v, {
|
|
233
|
+
firstName: "first_name",
|
|
234
|
+
lastName: "last_name",
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @internal
|
|
240
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
241
|
+
*/
|
|
242
|
+
export namespace PosUser$ {
|
|
243
|
+
/** @deprecated use `PosUser$inboundSchema` instead. */
|
|
244
|
+
export const inboundSchema = PosUser$inboundSchema;
|
|
245
|
+
/** @deprecated use `PosUser$outboundSchema` instead. */
|
|
246
|
+
export const outboundSchema = PosUser$outboundSchema;
|
|
247
|
+
/** @deprecated use `PosUser$Outbound` instead. */
|
|
248
|
+
export type Outbound = PosUser$Outbound;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function posUserToJSON(posUser: PosUser): string {
|
|
252
|
+
return JSON.stringify(PosUser$outboundSchema.parse(posUser));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function posUserFromJSON(
|
|
256
|
+
jsonString: string,
|
|
257
|
+
): SafeParseResult<PosUser, SDKValidationError> {
|
|
258
|
+
return safeParse(
|
|
259
|
+
jsonString,
|
|
260
|
+
(x) => PosUser$inboundSchema.parse(JSON.parse(x)),
|
|
261
|
+
`Failed to parse 'PosUser' from JSON`,
|
|
262
|
+
);
|
|
263
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import * as components from "../components/index.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type CreatePosCartRequestBody = {
|
|
12
|
+
items?: Array<components.UpdateCartItem> | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type CreatePosCartContent = {
|
|
16
|
+
/**
|
|
17
|
+
* This cart model is structured to capture a wide range of details, facilitating accurate representation and management of user shopping carts in an e-commerce platform.
|
|
18
|
+
*/
|
|
19
|
+
cart?: components.Cart | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* OK
|
|
24
|
+
*/
|
|
25
|
+
export type CreatePosCartResponseBody = {
|
|
26
|
+
message?: string | undefined;
|
|
27
|
+
success?: string | undefined;
|
|
28
|
+
content?: CreatePosCartContent | undefined;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const CreatePosCartRequestBody$inboundSchema: z.ZodType<
|
|
33
|
+
CreatePosCartRequestBody,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
unknown
|
|
36
|
+
> = z.object({
|
|
37
|
+
items: z.array(components.UpdateCartItem$inboundSchema).optional(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type CreatePosCartRequestBody$Outbound = {
|
|
42
|
+
items?: Array<components.UpdateCartItem$Outbound> | undefined;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const CreatePosCartRequestBody$outboundSchema: z.ZodType<
|
|
47
|
+
CreatePosCartRequestBody$Outbound,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
CreatePosCartRequestBody
|
|
50
|
+
> = z.object({
|
|
51
|
+
items: z.array(components.UpdateCartItem$outboundSchema).optional(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
57
|
+
*/
|
|
58
|
+
export namespace CreatePosCartRequestBody$ {
|
|
59
|
+
/** @deprecated use `CreatePosCartRequestBody$inboundSchema` instead. */
|
|
60
|
+
export const inboundSchema = CreatePosCartRequestBody$inboundSchema;
|
|
61
|
+
/** @deprecated use `CreatePosCartRequestBody$outboundSchema` instead. */
|
|
62
|
+
export const outboundSchema = CreatePosCartRequestBody$outboundSchema;
|
|
63
|
+
/** @deprecated use `CreatePosCartRequestBody$Outbound` instead. */
|
|
64
|
+
export type Outbound = CreatePosCartRequestBody$Outbound;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function createPosCartRequestBodyToJSON(
|
|
68
|
+
createPosCartRequestBody: CreatePosCartRequestBody,
|
|
69
|
+
): string {
|
|
70
|
+
return JSON.stringify(
|
|
71
|
+
CreatePosCartRequestBody$outboundSchema.parse(createPosCartRequestBody),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function createPosCartRequestBodyFromJSON(
|
|
76
|
+
jsonString: string,
|
|
77
|
+
): SafeParseResult<CreatePosCartRequestBody, SDKValidationError> {
|
|
78
|
+
return safeParse(
|
|
79
|
+
jsonString,
|
|
80
|
+
(x) => CreatePosCartRequestBody$inboundSchema.parse(JSON.parse(x)),
|
|
81
|
+
`Failed to parse 'CreatePosCartRequestBody' from JSON`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** @internal */
|
|
86
|
+
export const CreatePosCartContent$inboundSchema: z.ZodType<
|
|
87
|
+
CreatePosCartContent,
|
|
88
|
+
z.ZodTypeDef,
|
|
89
|
+
unknown
|
|
90
|
+
> = z.object({
|
|
91
|
+
cart: components.Cart$inboundSchema.optional(),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
/** @internal */
|
|
95
|
+
export type CreatePosCartContent$Outbound = {
|
|
96
|
+
cart?: components.Cart$Outbound | undefined;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** @internal */
|
|
100
|
+
export const CreatePosCartContent$outboundSchema: z.ZodType<
|
|
101
|
+
CreatePosCartContent$Outbound,
|
|
102
|
+
z.ZodTypeDef,
|
|
103
|
+
CreatePosCartContent
|
|
104
|
+
> = z.object({
|
|
105
|
+
cart: components.Cart$outboundSchema.optional(),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
111
|
+
*/
|
|
112
|
+
export namespace CreatePosCartContent$ {
|
|
113
|
+
/** @deprecated use `CreatePosCartContent$inboundSchema` instead. */
|
|
114
|
+
export const inboundSchema = CreatePosCartContent$inboundSchema;
|
|
115
|
+
/** @deprecated use `CreatePosCartContent$outboundSchema` instead. */
|
|
116
|
+
export const outboundSchema = CreatePosCartContent$outboundSchema;
|
|
117
|
+
/** @deprecated use `CreatePosCartContent$Outbound` instead. */
|
|
118
|
+
export type Outbound = CreatePosCartContent$Outbound;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function createPosCartContentToJSON(
|
|
122
|
+
createPosCartContent: CreatePosCartContent,
|
|
123
|
+
): string {
|
|
124
|
+
return JSON.stringify(
|
|
125
|
+
CreatePosCartContent$outboundSchema.parse(createPosCartContent),
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function createPosCartContentFromJSON(
|
|
130
|
+
jsonString: string,
|
|
131
|
+
): SafeParseResult<CreatePosCartContent, SDKValidationError> {
|
|
132
|
+
return safeParse(
|
|
133
|
+
jsonString,
|
|
134
|
+
(x) => CreatePosCartContent$inboundSchema.parse(JSON.parse(x)),
|
|
135
|
+
`Failed to parse 'CreatePosCartContent' from JSON`,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** @internal */
|
|
140
|
+
export const CreatePosCartResponseBody$inboundSchema: z.ZodType<
|
|
141
|
+
CreatePosCartResponseBody,
|
|
142
|
+
z.ZodTypeDef,
|
|
143
|
+
unknown
|
|
144
|
+
> = z.object({
|
|
145
|
+
message: z.string().optional(),
|
|
146
|
+
success: z.string().optional(),
|
|
147
|
+
content: z.lazy(() => CreatePosCartContent$inboundSchema).optional(),
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
/** @internal */
|
|
151
|
+
export type CreatePosCartResponseBody$Outbound = {
|
|
152
|
+
message?: string | undefined;
|
|
153
|
+
success?: string | undefined;
|
|
154
|
+
content?: CreatePosCartContent$Outbound | undefined;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/** @internal */
|
|
158
|
+
export const CreatePosCartResponseBody$outboundSchema: z.ZodType<
|
|
159
|
+
CreatePosCartResponseBody$Outbound,
|
|
160
|
+
z.ZodTypeDef,
|
|
161
|
+
CreatePosCartResponseBody
|
|
162
|
+
> = z.object({
|
|
163
|
+
message: z.string().optional(),
|
|
164
|
+
success: z.string().optional(),
|
|
165
|
+
content: z.lazy(() => CreatePosCartContent$outboundSchema).optional(),
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @internal
|
|
170
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
171
|
+
*/
|
|
172
|
+
export namespace CreatePosCartResponseBody$ {
|
|
173
|
+
/** @deprecated use `CreatePosCartResponseBody$inboundSchema` instead. */
|
|
174
|
+
export const inboundSchema = CreatePosCartResponseBody$inboundSchema;
|
|
175
|
+
/** @deprecated use `CreatePosCartResponseBody$outboundSchema` instead. */
|
|
176
|
+
export const outboundSchema = CreatePosCartResponseBody$outboundSchema;
|
|
177
|
+
/** @deprecated use `CreatePosCartResponseBody$Outbound` instead. */
|
|
178
|
+
export type Outbound = CreatePosCartResponseBody$Outbound;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export function createPosCartResponseBodyToJSON(
|
|
182
|
+
createPosCartResponseBody: CreatePosCartResponseBody,
|
|
183
|
+
): string {
|
|
184
|
+
return JSON.stringify(
|
|
185
|
+
CreatePosCartResponseBody$outboundSchema.parse(createPosCartResponseBody),
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function createPosCartResponseBodyFromJSON(
|
|
190
|
+
jsonString: string,
|
|
191
|
+
): SafeParseResult<CreatePosCartResponseBody, SDKValidationError> {
|
|
192
|
+
return safeParse(
|
|
193
|
+
jsonString,
|
|
194
|
+
(x) => CreatePosCartResponseBody$inboundSchema.parse(JSON.parse(x)),
|
|
195
|
+
`Failed to parse 'CreatePosCartResponseBody' from JSON`,
|
|
196
|
+
);
|
|
197
|
+
}
|
|
@@ -8,6 +8,7 @@ export * from "./createaddress.js";
|
|
|
8
8
|
export * from "./createcart.js";
|
|
9
9
|
export * from "./createcartaddress.js";
|
|
10
10
|
export * from "./createorder.js";
|
|
11
|
+
export * from "./createposcart.js";
|
|
11
12
|
export * from "./deleteaddress.js";
|
|
12
13
|
export * from "./deletecart.js";
|
|
13
14
|
export * from "./deleteusercart.js";
|
|
@@ -36,11 +37,14 @@ export * from "./listsimilarproducts.js";
|
|
|
36
37
|
export * from "./listskus.js";
|
|
37
38
|
export * from "./listupsellproducts.js";
|
|
38
39
|
export * from "./listuserreviews.js";
|
|
40
|
+
export * from "./logintoposdevice.js";
|
|
39
41
|
export * from "./loginwithemail.js";
|
|
40
42
|
export * from "./loginwithphone.js";
|
|
41
43
|
export * from "./loginwithwhatsapp.js";
|
|
42
44
|
export * from "./logout.js";
|
|
45
|
+
export * from "./pairposdevice.js";
|
|
43
46
|
export * from "./redeemloyaltypoints.js";
|
|
47
|
+
export * from "./refreshposaccesstoken.js";
|
|
44
48
|
export * from "./refreshtoken.js";
|
|
45
49
|
export * from "./removecoupon.js";
|
|
46
50
|
export * from "./removeloyaltypoints.js";
|
|
@@ -48,6 +52,7 @@ export * from "./retryorderpayment.js";
|
|
|
48
52
|
export * from "./searchproducts.js";
|
|
49
53
|
export * from "./updateaddressdetail.js";
|
|
50
54
|
export * from "./updatecart.js";
|
|
55
|
+
export * from "./updateposcart.js";
|
|
51
56
|
export * from "./updateshippingmethod.js";
|
|
52
57
|
export * from "./updateuser.js";
|
|
53
58
|
export * from "./verifyotp.js";
|