ce-storefront 0.15.7 → 0.15.8
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 +2 -21
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/index.d.ts +0 -2
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +0 -2
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/operations/index.d.ts +0 -8
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +0 -8
- package/esm/models/operations/index.js.map +1 -1
- package/esm/sdk/sdk.d.ts +0 -3
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +0 -4
- package/esm/sdk/sdk.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/models/components/index.ts +0 -2
- package/src/models/operations/index.ts +0 -8
- package/src/sdk/sdk.ts +0 -6
- package/docs/sdks/pos/README.md +0 -610
- package/esm/funcs/posCreatePosCart.d.ts +0 -17
- package/esm/funcs/posCreatePosCart.d.ts.map +0 -1
- package/esm/funcs/posCreatePosCart.js +0 -80
- package/esm/funcs/posCreatePosCart.js.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithEmail.d.ts +0 -17
- package/esm/funcs/posLoginPosDeviceWithEmail.d.ts.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithEmail.js +0 -85
- package/esm/funcs/posLoginPosDeviceWithEmail.js.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithPhone.d.ts +0 -17
- package/esm/funcs/posLoginPosDeviceWithPhone.d.ts.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithPhone.js +0 -85
- package/esm/funcs/posLoginPosDeviceWithPhone.js.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.d.ts +0 -17
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.d.ts.map +0 -1
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.js +0 -85
- package/esm/funcs/posLoginPosDeviceWithWhatsapp.js.map +0 -1
- package/esm/funcs/posPairPosDevice.d.ts +0 -17
- package/esm/funcs/posPairPosDevice.d.ts.map +0 -1
- package/esm/funcs/posPairPosDevice.js +0 -84
- package/esm/funcs/posPairPosDevice.js.map +0 -1
- package/esm/funcs/posRefreshPosAccessToken.d.ts +0 -17
- package/esm/funcs/posRefreshPosAccessToken.d.ts.map +0 -1
- package/esm/funcs/posRefreshPosAccessToken.js +0 -81
- package/esm/funcs/posRefreshPosAccessToken.js.map +0 -1
- package/esm/funcs/posUpdatePosCart.d.ts +0 -17
- package/esm/funcs/posUpdatePosCart.d.ts.map +0 -1
- package/esm/funcs/posUpdatePosCart.js +0 -84
- package/esm/funcs/posUpdatePosCart.js.map +0 -1
- package/esm/funcs/posVerifyPosLoginOtp.d.ts +0 -17
- package/esm/funcs/posVerifyPosLoginOtp.d.ts.map +0 -1
- package/esm/funcs/posVerifyPosLoginOtp.js +0 -84
- package/esm/funcs/posVerifyPosLoginOtp.js.map +0 -1
- package/esm/models/components/posdevice.d.ts +0 -71
- package/esm/models/components/posdevice.d.ts.map +0 -1
- package/esm/models/components/posdevice.js +0 -85
- package/esm/models/components/posdevice.js.map +0 -1
- package/esm/models/components/posuser.d.ts +0 -124
- package/esm/models/components/posuser.d.ts.map +0 -1
- package/esm/models/components/posuser.js +0 -139
- package/esm/models/components/posuser.js.map +0 -1
- package/esm/models/operations/createposcart.d.ts +0 -90
- package/esm/models/operations/createposcart.d.ts.map +0 -1
- package/esm/models/operations/createposcart.js +0 -86
- package/esm/models/operations/createposcart.js.map +0 -1
- package/esm/models/operations/loginposdevicewithemail.d.ts +0 -138
- package/esm/models/operations/loginposdevicewithemail.d.ts.map +0 -1
- package/esm/models/operations/loginposdevicewithemail.js +0 -159
- package/esm/models/operations/loginposdevicewithemail.js.map +0 -1
- package/esm/models/operations/loginposdevicewithphone.d.ts +0 -146
- package/esm/models/operations/loginposdevicewithphone.d.ts.map +0 -1
- package/esm/models/operations/loginposdevicewithphone.js +0 -163
- package/esm/models/operations/loginposdevicewithphone.js.map +0 -1
- package/esm/models/operations/loginposdevicewithwhatsapp.d.ts +0 -146
- package/esm/models/operations/loginposdevicewithwhatsapp.d.ts.map +0 -1
- package/esm/models/operations/loginposdevicewithwhatsapp.js +0 -163
- package/esm/models/operations/loginposdevicewithwhatsapp.js.map +0 -1
- package/esm/models/operations/pairposdevice.d.ts +0 -112
- package/esm/models/operations/pairposdevice.d.ts.map +0 -1
- package/esm/models/operations/pairposdevice.js +0 -128
- package/esm/models/operations/pairposdevice.js.map +0 -1
- package/esm/models/operations/refreshposaccesstoken.d.ts +0 -88
- package/esm/models/operations/refreshposaccesstoken.d.ts.map +0 -1
- package/esm/models/operations/refreshposaccesstoken.js +0 -106
- package/esm/models/operations/refreshposaccesstoken.js.map +0 -1
- package/esm/models/operations/updateposcart.d.ts +0 -120
- package/esm/models/operations/updateposcart.d.ts.map +0 -1
- package/esm/models/operations/updateposcart.js +0 -122
- package/esm/models/operations/updateposcart.js.map +0 -1
- package/esm/models/operations/verifyposloginotp.d.ts +0 -158
- package/esm/models/operations/verifyposloginotp.d.ts.map +0 -1
- package/esm/models/operations/verifyposloginotp.js +0 -169
- package/esm/models/operations/verifyposloginotp.js.map +0 -1
- package/esm/sdk/pos.d.ts +0 -61
- package/esm/sdk/pos.d.ts.map +0 -1
- package/esm/sdk/pos.js +0 -88
- package/esm/sdk/pos.js.map +0 -1
- package/src/funcs/posCreatePosCart.ts +0 -165
- package/src/funcs/posLoginPosDeviceWithEmail.ts +0 -173
- package/src/funcs/posLoginPosDeviceWithPhone.ts +0 -173
- package/src/funcs/posLoginPosDeviceWithWhatsapp.ts +0 -176
- package/src/funcs/posPairPosDevice.ts +0 -174
- package/src/funcs/posRefreshPosAccessToken.ts +0 -164
- package/src/funcs/posUpdatePosCart.ts +0 -167
- package/src/funcs/posVerifyPosLoginOtp.ts +0 -174
- package/src/models/components/posdevice.ts +0 -141
- package/src/models/components/posuser.ts +0 -263
- package/src/models/operations/createposcart.ts +0 -197
- package/src/models/operations/loginposdevicewithemail.ts +0 -328
- package/src/models/operations/loginposdevicewithphone.ts +0 -340
- package/src/models/operations/loginposdevicewithwhatsapp.ts +0 -347
- package/src/models/operations/pairposdevice.ts +0 -269
- package/src/models/operations/refreshposaccesstoken.ts +0 -223
- package/src/models/operations/updateposcart.ts +0 -271
- package/src/models/operations/verifyposloginotp.ts +0 -345
- package/src/sdk/pos.ts +0 -163
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { CeStorefrontCore } from "../core.js";
|
|
6
|
-
import { encodeJSON } 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 { resolveSecurity } 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
|
-
* Login with whatsapp
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Login to POS device using whatsapp.
|
|
32
|
-
*/
|
|
33
|
-
export function posLoginPosDeviceWithWhatsapp(
|
|
34
|
-
client: CeStorefrontCore,
|
|
35
|
-
security: operations.LoginPosDeviceWithWhatsappSecurity,
|
|
36
|
-
request?: operations.LoginPosDeviceWithWhatsappRequestBody | undefined,
|
|
37
|
-
options?: RequestOptions,
|
|
38
|
-
): APIPromise<
|
|
39
|
-
Result<
|
|
40
|
-
operations.LoginPosDeviceWithWhatsappResponseBody,
|
|
41
|
-
| CeStorefrontError
|
|
42
|
-
| ResponseValidationError
|
|
43
|
-
| ConnectionError
|
|
44
|
-
| RequestAbortedError
|
|
45
|
-
| RequestTimeoutError
|
|
46
|
-
| InvalidRequestError
|
|
47
|
-
| UnexpectedClientError
|
|
48
|
-
| SDKValidationError
|
|
49
|
-
>
|
|
50
|
-
> {
|
|
51
|
-
return new APIPromise($do(
|
|
52
|
-
client,
|
|
53
|
-
security,
|
|
54
|
-
request,
|
|
55
|
-
options,
|
|
56
|
-
));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function $do(
|
|
60
|
-
client: CeStorefrontCore,
|
|
61
|
-
security: operations.LoginPosDeviceWithWhatsappSecurity,
|
|
62
|
-
request?: operations.LoginPosDeviceWithWhatsappRequestBody | undefined,
|
|
63
|
-
options?: RequestOptions,
|
|
64
|
-
): Promise<
|
|
65
|
-
[
|
|
66
|
-
Result<
|
|
67
|
-
operations.LoginPosDeviceWithWhatsappResponseBody,
|
|
68
|
-
| CeStorefrontError
|
|
69
|
-
| ResponseValidationError
|
|
70
|
-
| ConnectionError
|
|
71
|
-
| RequestAbortedError
|
|
72
|
-
| RequestTimeoutError
|
|
73
|
-
| InvalidRequestError
|
|
74
|
-
| UnexpectedClientError
|
|
75
|
-
| SDKValidationError
|
|
76
|
-
>,
|
|
77
|
-
APICall,
|
|
78
|
-
]
|
|
79
|
-
> {
|
|
80
|
-
const parsed = safeParse(
|
|
81
|
-
request,
|
|
82
|
-
(value) =>
|
|
83
|
-
operations.LoginPosDeviceWithWhatsappRequestBody$outboundSchema.optional()
|
|
84
|
-
.parse(value),
|
|
85
|
-
"Input validation failed",
|
|
86
|
-
);
|
|
87
|
-
if (!parsed.ok) {
|
|
88
|
-
return [parsed, { status: "invalid" }];
|
|
89
|
-
}
|
|
90
|
-
const payload = parsed.value;
|
|
91
|
-
const body = payload === undefined
|
|
92
|
-
? null
|
|
93
|
-
: encodeJSON("body", payload, { explode: true });
|
|
94
|
-
|
|
95
|
-
const path = pathToFunc("/pos/auth/login/whatsapp")();
|
|
96
|
-
|
|
97
|
-
const headers = new Headers(compactMap({
|
|
98
|
-
"Content-Type": "application/json",
|
|
99
|
-
Accept: "application/json",
|
|
100
|
-
}));
|
|
101
|
-
|
|
102
|
-
const requestSecurity = resolveSecurity(
|
|
103
|
-
[
|
|
104
|
-
{
|
|
105
|
-
fieldName: "X-Api-Key",
|
|
106
|
-
type: "apiKey:header",
|
|
107
|
-
value: security?.xApiKey,
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
const context = {
|
|
113
|
-
options: client._options,
|
|
114
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
115
|
-
operationID: "login-pos-device-with-whatsapp",
|
|
116
|
-
oAuth2Scopes: null,
|
|
117
|
-
|
|
118
|
-
resolvedSecurity: requestSecurity,
|
|
119
|
-
|
|
120
|
-
securitySource: security,
|
|
121
|
-
retryConfig: options?.retries
|
|
122
|
-
|| client._options.retryConfig
|
|
123
|
-
|| { strategy: "none" },
|
|
124
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const requestRes = client._createRequest(context, {
|
|
128
|
-
security: requestSecurity,
|
|
129
|
-
method: "POST",
|
|
130
|
-
baseURL: options?.serverURL,
|
|
131
|
-
path: path,
|
|
132
|
-
headers: headers,
|
|
133
|
-
body: body,
|
|
134
|
-
userAgent: client._options.userAgent,
|
|
135
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
136
|
-
}, options);
|
|
137
|
-
if (!requestRes.ok) {
|
|
138
|
-
return [requestRes, { status: "invalid" }];
|
|
139
|
-
}
|
|
140
|
-
const req = requestRes.value;
|
|
141
|
-
|
|
142
|
-
const doResult = await client._do(req, {
|
|
143
|
-
context,
|
|
144
|
-
errorCodes: ["4XX", "5XX"],
|
|
145
|
-
retryConfig: context.retryConfig,
|
|
146
|
-
retryCodes: context.retryCodes,
|
|
147
|
-
});
|
|
148
|
-
if (!doResult.ok) {
|
|
149
|
-
return [doResult, { status: "request-error", request: req }];
|
|
150
|
-
}
|
|
151
|
-
const response = doResult.value;
|
|
152
|
-
|
|
153
|
-
const [result] = await M.match<
|
|
154
|
-
operations.LoginPosDeviceWithWhatsappResponseBody,
|
|
155
|
-
| CeStorefrontError
|
|
156
|
-
| ResponseValidationError
|
|
157
|
-
| ConnectionError
|
|
158
|
-
| RequestAbortedError
|
|
159
|
-
| RequestTimeoutError
|
|
160
|
-
| InvalidRequestError
|
|
161
|
-
| UnexpectedClientError
|
|
162
|
-
| SDKValidationError
|
|
163
|
-
>(
|
|
164
|
-
M.json(
|
|
165
|
-
200,
|
|
166
|
-
operations.LoginPosDeviceWithWhatsappResponseBody$inboundSchema,
|
|
167
|
-
),
|
|
168
|
-
M.fail("4XX"),
|
|
169
|
-
M.fail("5XX"),
|
|
170
|
-
)(response, req);
|
|
171
|
-
if (!result.ok) {
|
|
172
|
-
return [result, { status: "complete", request: req, response }];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return [result, { status: "complete", request: req, response }];
|
|
176
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { CeStorefrontCore } from "../core.js";
|
|
6
|
-
import { encodeJSON } 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 { resolveSecurity } 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
|
-
* Pair POS device
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Pair POS device
|
|
32
|
-
*/
|
|
33
|
-
export function posPairPosDevice(
|
|
34
|
-
client: CeStorefrontCore,
|
|
35
|
-
security: operations.PairPosDeviceSecurity,
|
|
36
|
-
request?: operations.PairPosDeviceRequestBody | undefined,
|
|
37
|
-
options?: RequestOptions,
|
|
38
|
-
): APIPromise<
|
|
39
|
-
Result<
|
|
40
|
-
operations.PairPosDeviceResponseBody,
|
|
41
|
-
| CeStorefrontError
|
|
42
|
-
| ResponseValidationError
|
|
43
|
-
| ConnectionError
|
|
44
|
-
| RequestAbortedError
|
|
45
|
-
| RequestTimeoutError
|
|
46
|
-
| InvalidRequestError
|
|
47
|
-
| UnexpectedClientError
|
|
48
|
-
| SDKValidationError
|
|
49
|
-
>
|
|
50
|
-
> {
|
|
51
|
-
return new APIPromise($do(
|
|
52
|
-
client,
|
|
53
|
-
security,
|
|
54
|
-
request,
|
|
55
|
-
options,
|
|
56
|
-
));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function $do(
|
|
60
|
-
client: CeStorefrontCore,
|
|
61
|
-
security: operations.PairPosDeviceSecurity,
|
|
62
|
-
request?: operations.PairPosDeviceRequestBody | undefined,
|
|
63
|
-
options?: RequestOptions,
|
|
64
|
-
): Promise<
|
|
65
|
-
[
|
|
66
|
-
Result<
|
|
67
|
-
operations.PairPosDeviceResponseBody,
|
|
68
|
-
| CeStorefrontError
|
|
69
|
-
| ResponseValidationError
|
|
70
|
-
| ConnectionError
|
|
71
|
-
| RequestAbortedError
|
|
72
|
-
| RequestTimeoutError
|
|
73
|
-
| InvalidRequestError
|
|
74
|
-
| UnexpectedClientError
|
|
75
|
-
| SDKValidationError
|
|
76
|
-
>,
|
|
77
|
-
APICall,
|
|
78
|
-
]
|
|
79
|
-
> {
|
|
80
|
-
const parsed = safeParse(
|
|
81
|
-
request,
|
|
82
|
-
(value) =>
|
|
83
|
-
operations.PairPosDeviceRequestBody$outboundSchema.optional().parse(
|
|
84
|
-
value,
|
|
85
|
-
),
|
|
86
|
-
"Input validation failed",
|
|
87
|
-
);
|
|
88
|
-
if (!parsed.ok) {
|
|
89
|
-
return [parsed, { status: "invalid" }];
|
|
90
|
-
}
|
|
91
|
-
const payload = parsed.value;
|
|
92
|
-
const body = payload === undefined
|
|
93
|
-
? null
|
|
94
|
-
: encodeJSON("body", payload, { explode: true });
|
|
95
|
-
|
|
96
|
-
const path = pathToFunc("/pos/auth/pair-device")();
|
|
97
|
-
|
|
98
|
-
const headers = new Headers(compactMap({
|
|
99
|
-
"Content-Type": "application/json",
|
|
100
|
-
Accept: "application/json",
|
|
101
|
-
}));
|
|
102
|
-
|
|
103
|
-
const requestSecurity = resolveSecurity(
|
|
104
|
-
[
|
|
105
|
-
{
|
|
106
|
-
fieldName: "X-Api-Key",
|
|
107
|
-
type: "apiKey:header",
|
|
108
|
-
value: security?.xApiKey,
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
const context = {
|
|
114
|
-
options: client._options,
|
|
115
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
116
|
-
operationID: "pair-pos-device",
|
|
117
|
-
oAuth2Scopes: null,
|
|
118
|
-
|
|
119
|
-
resolvedSecurity: requestSecurity,
|
|
120
|
-
|
|
121
|
-
securitySource: security,
|
|
122
|
-
retryConfig: options?.retries
|
|
123
|
-
|| client._options.retryConfig
|
|
124
|
-
|| { strategy: "none" },
|
|
125
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const requestRes = client._createRequest(context, {
|
|
129
|
-
security: requestSecurity,
|
|
130
|
-
method: "POST",
|
|
131
|
-
baseURL: options?.serverURL,
|
|
132
|
-
path: path,
|
|
133
|
-
headers: headers,
|
|
134
|
-
body: body,
|
|
135
|
-
userAgent: client._options.userAgent,
|
|
136
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
137
|
-
}, options);
|
|
138
|
-
if (!requestRes.ok) {
|
|
139
|
-
return [requestRes, { status: "invalid" }];
|
|
140
|
-
}
|
|
141
|
-
const req = requestRes.value;
|
|
142
|
-
|
|
143
|
-
const doResult = await client._do(req, {
|
|
144
|
-
context,
|
|
145
|
-
errorCodes: ["4XX", "5XX"],
|
|
146
|
-
retryConfig: context.retryConfig,
|
|
147
|
-
retryCodes: context.retryCodes,
|
|
148
|
-
});
|
|
149
|
-
if (!doResult.ok) {
|
|
150
|
-
return [doResult, { status: "request-error", request: req }];
|
|
151
|
-
}
|
|
152
|
-
const response = doResult.value;
|
|
153
|
-
|
|
154
|
-
const [result] = await M.match<
|
|
155
|
-
operations.PairPosDeviceResponseBody,
|
|
156
|
-
| CeStorefrontError
|
|
157
|
-
| ResponseValidationError
|
|
158
|
-
| ConnectionError
|
|
159
|
-
| RequestAbortedError
|
|
160
|
-
| RequestTimeoutError
|
|
161
|
-
| InvalidRequestError
|
|
162
|
-
| UnexpectedClientError
|
|
163
|
-
| SDKValidationError
|
|
164
|
-
>(
|
|
165
|
-
M.json(200, operations.PairPosDeviceResponseBody$inboundSchema),
|
|
166
|
-
M.fail("4XX"),
|
|
167
|
-
M.fail("5XX"),
|
|
168
|
-
)(response, req);
|
|
169
|
-
if (!result.ok) {
|
|
170
|
-
return [result, { status: "complete", request: req, response }];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return [result, { status: "complete", request: req, response }];
|
|
174
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { CeStorefrontCore } from "../core.js";
|
|
6
|
-
import { encodeJSON } 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
|
-
* Refresh POS access token
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* Refresh POS access token
|
|
32
|
-
*/
|
|
33
|
-
export function posRefreshPosAccessToken(
|
|
34
|
-
client: CeStorefrontCore,
|
|
35
|
-
request?: operations.RefreshPosAccessTokenRequestBody | undefined,
|
|
36
|
-
options?: RequestOptions,
|
|
37
|
-
): APIPromise<
|
|
38
|
-
Result<
|
|
39
|
-
operations.RefreshPosAccessTokenResponseBody,
|
|
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.RefreshPosAccessTokenRequestBody | undefined,
|
|
60
|
-
options?: RequestOptions,
|
|
61
|
-
): Promise<
|
|
62
|
-
[
|
|
63
|
-
Result<
|
|
64
|
-
operations.RefreshPosAccessTokenResponseBody,
|
|
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) =>
|
|
80
|
-
operations.RefreshPosAccessTokenRequestBody$outboundSchema.optional()
|
|
81
|
-
.parse(value),
|
|
82
|
-
"Input validation failed",
|
|
83
|
-
);
|
|
84
|
-
if (!parsed.ok) {
|
|
85
|
-
return [parsed, { status: "invalid" }];
|
|
86
|
-
}
|
|
87
|
-
const payload = parsed.value;
|
|
88
|
-
const body = payload === undefined
|
|
89
|
-
? null
|
|
90
|
-
: encodeJSON("body", payload, { explode: true });
|
|
91
|
-
|
|
92
|
-
const path = pathToFunc("/pos/auth/refresh-token")();
|
|
93
|
-
|
|
94
|
-
const headers = new Headers(compactMap({
|
|
95
|
-
"Content-Type": "application/json",
|
|
96
|
-
Accept: "application/json",
|
|
97
|
-
}));
|
|
98
|
-
|
|
99
|
-
const secConfig = await extractSecurity(client._options.authorization);
|
|
100
|
-
const securityInput = secConfig == null ? {} : { authorization: secConfig };
|
|
101
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
102
|
-
|
|
103
|
-
const context = {
|
|
104
|
-
options: client._options,
|
|
105
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
106
|
-
operationID: "refresh-pos-access-token",
|
|
107
|
-
oAuth2Scopes: [],
|
|
108
|
-
|
|
109
|
-
resolvedSecurity: requestSecurity,
|
|
110
|
-
|
|
111
|
-
securitySource: client._options.authorization,
|
|
112
|
-
retryConfig: options?.retries
|
|
113
|
-
|| client._options.retryConfig
|
|
114
|
-
|| { strategy: "none" },
|
|
115
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const requestRes = client._createRequest(context, {
|
|
119
|
-
security: requestSecurity,
|
|
120
|
-
method: "POST",
|
|
121
|
-
baseURL: options?.serverURL,
|
|
122
|
-
path: path,
|
|
123
|
-
headers: headers,
|
|
124
|
-
body: body,
|
|
125
|
-
userAgent: client._options.userAgent,
|
|
126
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
127
|
-
}, options);
|
|
128
|
-
if (!requestRes.ok) {
|
|
129
|
-
return [requestRes, { status: "invalid" }];
|
|
130
|
-
}
|
|
131
|
-
const req = requestRes.value;
|
|
132
|
-
|
|
133
|
-
const doResult = await client._do(req, {
|
|
134
|
-
context,
|
|
135
|
-
errorCodes: ["4XX", "5XX"],
|
|
136
|
-
retryConfig: context.retryConfig,
|
|
137
|
-
retryCodes: context.retryCodes,
|
|
138
|
-
});
|
|
139
|
-
if (!doResult.ok) {
|
|
140
|
-
return [doResult, { status: "request-error", request: req }];
|
|
141
|
-
}
|
|
142
|
-
const response = doResult.value;
|
|
143
|
-
|
|
144
|
-
const [result] = await M.match<
|
|
145
|
-
operations.RefreshPosAccessTokenResponseBody,
|
|
146
|
-
| CeStorefrontError
|
|
147
|
-
| ResponseValidationError
|
|
148
|
-
| ConnectionError
|
|
149
|
-
| RequestAbortedError
|
|
150
|
-
| RequestTimeoutError
|
|
151
|
-
| InvalidRequestError
|
|
152
|
-
| UnexpectedClientError
|
|
153
|
-
| SDKValidationError
|
|
154
|
-
>(
|
|
155
|
-
M.json(200, operations.RefreshPosAccessTokenResponseBody$inboundSchema),
|
|
156
|
-
M.fail("4XX"),
|
|
157
|
-
M.fail("5XX"),
|
|
158
|
-
)(response, req);
|
|
159
|
-
if (!result.ok) {
|
|
160
|
-
return [result, { status: "complete", request: req, response }];
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return [result, { status: "complete", request: req, response }];
|
|
164
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
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
|
-
}
|