@51eat/sdk 0.0.51 → 0.0.52
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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/business/resources/productOrders/client/Client.d.ts +33 -0
- package/dist/cjs/api/resources/business/resources/productOrders/client/Client.js +123 -0
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.ts +10 -0
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.d.ts +12 -0
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/productOrders/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/productOrders/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/productOrders/types/index.js +1 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/Client.d.ts +44 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/Client.js +131 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.d.ts +28 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.ts +13 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.ts +6 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/business/resources/productOrders/client/Client.d.mts +33 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/Client.mjs +123 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.mts +10 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.d.mts +12 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/productOrders/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/productOrders/types/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/productOrders/types/index.mjs +1 -0
- package/dist/esm/api/resources/customer/resources/cart/client/Client.d.mts +44 -0
- package/dist/esm/api/resources/customer/resources/cart/client/Client.mjs +131 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.d.mts +28 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.mts +13 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.mts +6 -0
- package/dist/esm/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/cart/types/index.d.mts +1 -0
- package/dist/esm/api/resources/customer/resources/cart/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +244 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@51eat/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "0.0.
|
|
47
|
-
"User-Agent": "@51eat/sdk/0.0.
|
|
46
|
+
"X-Fern-SDK-Version": "0.0.52",
|
|
47
|
+
"User-Agent": "@51eat/sdk/0.0.52",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -106,4 +106,37 @@ export declare class ProductOrdersClient {
|
|
|
106
106
|
*/
|
|
107
107
|
refund(request: FiveOneEat.business.RefundOrderRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.RefundProductOrdersResponse>;
|
|
108
108
|
private __refund;
|
|
109
|
+
/**
|
|
110
|
+
* @param {FiveOneEat.business.GetLabelRatesProductOrdersRequest} request
|
|
111
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
112
|
+
*
|
|
113
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
114
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
115
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
116
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* await client.business.productOrders.getLabelRates({
|
|
120
|
+
* productOrder: "productOrder"
|
|
121
|
+
* })
|
|
122
|
+
*/
|
|
123
|
+
getLabelRates(request: FiveOneEat.business.GetLabelRatesProductOrdersRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<string>;
|
|
124
|
+
private __getLabelRates;
|
|
125
|
+
/**
|
|
126
|
+
* @param {FiveOneEat.business.PurchaseLabelRequest} request
|
|
127
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
128
|
+
*
|
|
129
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
130
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
131
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
132
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* await client.business.productOrders.purchaseLabel({
|
|
136
|
+
* productOrder: "productOrder",
|
|
137
|
+
* provider_rate_id: "provider_rate_id"
|
|
138
|
+
* })
|
|
139
|
+
*/
|
|
140
|
+
purchaseLabel(request: FiveOneEat.business.PurchaseLabelRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.PurchaseLabelProductOrdersResponse>;
|
|
141
|
+
private __purchaseLabel;
|
|
109
142
|
}
|
|
@@ -425,5 +425,128 @@ class ProductOrdersClient {
|
|
|
425
425
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/product-orders/{productOrder}/refund");
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
|
+
/**
|
|
429
|
+
* @param {FiveOneEat.business.GetLabelRatesProductOrdersRequest} request
|
|
430
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
431
|
+
*
|
|
432
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
433
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
434
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
435
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* await client.business.productOrders.getLabelRates({
|
|
439
|
+
* productOrder: "productOrder"
|
|
440
|
+
* })
|
|
441
|
+
*/
|
|
442
|
+
getLabelRates(request, requestOptions) {
|
|
443
|
+
return core.HttpResponsePromise.fromPromise(this.__getLabelRates(request, requestOptions));
|
|
444
|
+
}
|
|
445
|
+
__getLabelRates(request, requestOptions) {
|
|
446
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
447
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
448
|
+
const { productOrder } = request;
|
|
449
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
450
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
451
|
+
const _response = yield core.fetcher({
|
|
452
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/product-orders/${core.url.encodePathParam(productOrder)}/label-rates`),
|
|
453
|
+
method: "GET",
|
|
454
|
+
headers: _headers,
|
|
455
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
456
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
457
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
458
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
459
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
460
|
+
logging: this._options.logging,
|
|
461
|
+
});
|
|
462
|
+
if (_response.ok) {
|
|
463
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
464
|
+
}
|
|
465
|
+
if (_response.error.reason === "status-code") {
|
|
466
|
+
switch (_response.error.statusCode) {
|
|
467
|
+
case 401:
|
|
468
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
469
|
+
case 403:
|
|
470
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
471
|
+
case 404:
|
|
472
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
473
|
+
case 422:
|
|
474
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
475
|
+
default:
|
|
476
|
+
throw new errors.FiveOneEatError({
|
|
477
|
+
statusCode: _response.error.statusCode,
|
|
478
|
+
body: _response.error.body,
|
|
479
|
+
rawResponse: _response.rawResponse,
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/product-orders/{productOrder}/label-rates");
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* @param {FiveOneEat.business.PurchaseLabelRequest} request
|
|
488
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
489
|
+
*
|
|
490
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
491
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
492
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
493
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
494
|
+
*
|
|
495
|
+
* @example
|
|
496
|
+
* await client.business.productOrders.purchaseLabel({
|
|
497
|
+
* productOrder: "productOrder",
|
|
498
|
+
* provider_rate_id: "provider_rate_id"
|
|
499
|
+
* })
|
|
500
|
+
*/
|
|
501
|
+
purchaseLabel(request, requestOptions) {
|
|
502
|
+
return core.HttpResponsePromise.fromPromise(this.__purchaseLabel(request, requestOptions));
|
|
503
|
+
}
|
|
504
|
+
__purchaseLabel(request, requestOptions) {
|
|
505
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
506
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
507
|
+
const { productOrder } = request, _body = __rest(request, ["productOrder"]);
|
|
508
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
509
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
510
|
+
const _response = yield core.fetcher({
|
|
511
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/product-orders/${core.url.encodePathParam(productOrder)}/purchase-label`),
|
|
512
|
+
method: "POST",
|
|
513
|
+
headers: _headers,
|
|
514
|
+
contentType: "application/json",
|
|
515
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
516
|
+
requestType: "json",
|
|
517
|
+
body: _body,
|
|
518
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
519
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
520
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
521
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
522
|
+
logging: this._options.logging,
|
|
523
|
+
});
|
|
524
|
+
if (_response.ok) {
|
|
525
|
+
return {
|
|
526
|
+
data: _response.body,
|
|
527
|
+
rawResponse: _response.rawResponse,
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
if (_response.error.reason === "status-code") {
|
|
531
|
+
switch (_response.error.statusCode) {
|
|
532
|
+
case 401:
|
|
533
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
534
|
+
case 403:
|
|
535
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
536
|
+
case 404:
|
|
537
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
538
|
+
case 422:
|
|
539
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
540
|
+
default:
|
|
541
|
+
throw new errors.FiveOneEatError({
|
|
542
|
+
statusCode: _response.error.statusCode,
|
|
543
|
+
body: _response.error.body,
|
|
544
|
+
rawResponse: _response.rawResponse,
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/product-orders/{productOrder}/purchase-label");
|
|
549
|
+
});
|
|
550
|
+
}
|
|
428
551
|
}
|
|
429
552
|
exports.ProductOrdersClient = ProductOrdersClient;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { FulfillProductOrdersRequest } from "./FulfillProductOrdersRequest.js";
|
|
2
|
+
export type { GetLabelRatesProductOrdersRequest } from "./GetLabelRatesProductOrdersRequest.js";
|
|
2
3
|
export type { GetProductOrdersRequest } from "./GetProductOrdersRequest.js";
|
|
3
4
|
export type { MarkPickedUpProductOrdersRequest } from "./MarkPickedUpProductOrdersRequest.js";
|
|
5
|
+
export type { PurchaseLabelRequest } from "./PurchaseLabelRequest.js";
|
|
4
6
|
export type { RefundOrderRequest } from "./RefundOrderRequest.js";
|
|
5
7
|
export type { StoreTrackingRequest } from "./StoreTrackingRequest.js";
|
|
@@ -3,4 +3,5 @@ export * from "./FulfillProductOrdersResponse.js";
|
|
|
3
3
|
export * from "./GetProductOrdersResponse.js";
|
|
4
4
|
export * from "./ListProductOrdersResponse.js";
|
|
5
5
|
export * from "./MarkPickedUpProductOrdersResponse.js";
|
|
6
|
+
export * from "./PurchaseLabelProductOrdersResponse.js";
|
|
6
7
|
export * from "./RefundProductOrdersResponse.js";
|
|
@@ -19,4 +19,5 @@ __exportStar(require("./FulfillProductOrdersResponse.js"), exports);
|
|
|
19
19
|
__exportStar(require("./GetProductOrdersResponse.js"), exports);
|
|
20
20
|
__exportStar(require("./ListProductOrdersResponse.js"), exports);
|
|
21
21
|
__exportStar(require("./MarkPickedUpProductOrdersResponse.js"), exports);
|
|
22
|
+
__exportStar(require("./PurchaseLabelProductOrdersResponse.js"), exports);
|
|
22
23
|
__exportStar(require("./RefundProductOrdersResponse.js"), exports);
|
|
@@ -132,4 +132,48 @@ export declare class CartClient {
|
|
|
132
132
|
*/
|
|
133
133
|
removeItem(request: FiveOneEat.customer.RemoveItemCartRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.RemoveItemCartResponse>;
|
|
134
134
|
private __removeItem;
|
|
135
|
+
/**
|
|
136
|
+
* Returns available shipping rates for the given address. For calculated rates,
|
|
137
|
+
* fetches live rates from the shipping provider and caches for 10 minutes.
|
|
138
|
+
* Pass the returned `provider_rate_id` to the select shipping option endpoint.
|
|
139
|
+
*
|
|
140
|
+
* @param {FiveOneEat.customer.GetShippingOptionsRequest} request
|
|
141
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
142
|
+
*
|
|
143
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
144
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* await client.customer.cart.getShippingOptions({
|
|
148
|
+
* business: "katzs-deli",
|
|
149
|
+
* shipping_address: {
|
|
150
|
+
* line1: "line1",
|
|
151
|
+
* city: "city",
|
|
152
|
+
* state: "state",
|
|
153
|
+
* postal_code: "postal_code"
|
|
154
|
+
* }
|
|
155
|
+
* })
|
|
156
|
+
*/
|
|
157
|
+
getShippingOptions(request: FiveOneEat.customer.GetShippingOptionsRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<unknown[]>;
|
|
158
|
+
private __getShippingOptions;
|
|
159
|
+
/**
|
|
160
|
+
* Saves the shipping amount and method to the cart server-side.
|
|
161
|
+
* For calculated rates, resolves the amount from cache using the provider_rate_id
|
|
162
|
+
* returned by the shipping options endpoint. The client never submits an amount.
|
|
163
|
+
*
|
|
164
|
+
* @param {FiveOneEat.customer.SelectShippingOptionRequest} request
|
|
165
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
166
|
+
*
|
|
167
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
168
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
169
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* await client.customer.cart.selectShippingOption({
|
|
173
|
+
* business: "katzs-deli",
|
|
174
|
+
* shipping_rate_id: "shipping_rate_id"
|
|
175
|
+
* })
|
|
176
|
+
*/
|
|
177
|
+
selectShippingOption(request: FiveOneEat.customer.SelectShippingOptionRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.SelectShippingOptionCartResponse>;
|
|
178
|
+
private __selectShippingOption;
|
|
135
179
|
}
|
|
@@ -486,5 +486,136 @@ class CartClient {
|
|
|
486
486
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/customer/cart/items/{cartItem}");
|
|
487
487
|
});
|
|
488
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* Returns available shipping rates for the given address. For calculated rates,
|
|
491
|
+
* fetches live rates from the shipping provider and caches for 10 minutes.
|
|
492
|
+
* Pass the returned `provider_rate_id` to the select shipping option endpoint.
|
|
493
|
+
*
|
|
494
|
+
* @param {FiveOneEat.customer.GetShippingOptionsRequest} request
|
|
495
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
496
|
+
*
|
|
497
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
498
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* await client.customer.cart.getShippingOptions({
|
|
502
|
+
* business: "katzs-deli",
|
|
503
|
+
* shipping_address: {
|
|
504
|
+
* line1: "line1",
|
|
505
|
+
* city: "city",
|
|
506
|
+
* state: "state",
|
|
507
|
+
* postal_code: "postal_code"
|
|
508
|
+
* }
|
|
509
|
+
* })
|
|
510
|
+
*/
|
|
511
|
+
getShippingOptions(request, requestOptions) {
|
|
512
|
+
return core.HttpResponsePromise.fromPromise(this.__getShippingOptions(request, requestOptions));
|
|
513
|
+
}
|
|
514
|
+
__getShippingOptions(request, requestOptions) {
|
|
515
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
516
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
517
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
518
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
519
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
520
|
+
const _response = yield core.fetcher({
|
|
521
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/shipping-options`),
|
|
522
|
+
method: "POST",
|
|
523
|
+
headers: _headers,
|
|
524
|
+
contentType: "application/json",
|
|
525
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
526
|
+
requestType: "json",
|
|
527
|
+
body: _body,
|
|
528
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
529
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
530
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
531
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
532
|
+
logging: this._options.logging,
|
|
533
|
+
});
|
|
534
|
+
if (_response.ok) {
|
|
535
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
536
|
+
}
|
|
537
|
+
if (_response.error.reason === "status-code") {
|
|
538
|
+
switch (_response.error.statusCode) {
|
|
539
|
+
case 401:
|
|
540
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
541
|
+
case 422:
|
|
542
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
543
|
+
default:
|
|
544
|
+
throw new errors.FiveOneEatError({
|
|
545
|
+
statusCode: _response.error.statusCode,
|
|
546
|
+
body: _response.error.body,
|
|
547
|
+
rawResponse: _response.rawResponse,
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/businesses/{business}/cart/shipping-options");
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Saves the shipping amount and method to the cart server-side.
|
|
556
|
+
* For calculated rates, resolves the amount from cache using the provider_rate_id
|
|
557
|
+
* returned by the shipping options endpoint. The client never submits an amount.
|
|
558
|
+
*
|
|
559
|
+
* @param {FiveOneEat.customer.SelectShippingOptionRequest} request
|
|
560
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
561
|
+
*
|
|
562
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
563
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
564
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* await client.customer.cart.selectShippingOption({
|
|
568
|
+
* business: "katzs-deli",
|
|
569
|
+
* shipping_rate_id: "shipping_rate_id"
|
|
570
|
+
* })
|
|
571
|
+
*/
|
|
572
|
+
selectShippingOption(request, requestOptions) {
|
|
573
|
+
return core.HttpResponsePromise.fromPromise(this.__selectShippingOption(request, requestOptions));
|
|
574
|
+
}
|
|
575
|
+
__selectShippingOption(request, requestOptions) {
|
|
576
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
577
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
578
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
579
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
580
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
581
|
+
const _response = yield core.fetcher({
|
|
582
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/shipping-option`),
|
|
583
|
+
method: "POST",
|
|
584
|
+
headers: _headers,
|
|
585
|
+
contentType: "application/json",
|
|
586
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
587
|
+
requestType: "json",
|
|
588
|
+
body: _body,
|
|
589
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
590
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
591
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
592
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
593
|
+
logging: this._options.logging,
|
|
594
|
+
});
|
|
595
|
+
if (_response.ok) {
|
|
596
|
+
return {
|
|
597
|
+
data: _response.body,
|
|
598
|
+
rawResponse: _response.rawResponse,
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
if (_response.error.reason === "status-code") {
|
|
602
|
+
switch (_response.error.statusCode) {
|
|
603
|
+
case 401:
|
|
604
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
605
|
+
case 404:
|
|
606
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
607
|
+
case 422:
|
|
608
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
609
|
+
default:
|
|
610
|
+
throw new errors.FiveOneEatError({
|
|
611
|
+
statusCode: _response.error.statusCode,
|
|
612
|
+
body: _response.error.body,
|
|
613
|
+
rawResponse: _response.rawResponse,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/businesses/{business}/cart/shipping-option");
|
|
618
|
+
});
|
|
619
|
+
}
|
|
489
620
|
}
|
|
490
621
|
exports.CartClient = CartClient;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* business: "katzs-deli",
|
|
5
|
+
* shipping_address: {
|
|
6
|
+
* line1: "line1",
|
|
7
|
+
* city: "city",
|
|
8
|
+
* state: "state",
|
|
9
|
+
* postal_code: "postal_code"
|
|
10
|
+
* }
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export interface GetShippingOptionsRequest {
|
|
14
|
+
/** The business handle */
|
|
15
|
+
business: string;
|
|
16
|
+
shipping_address: GetShippingOptionsRequest.ShippingAddress;
|
|
17
|
+
}
|
|
18
|
+
export declare namespace GetShippingOptionsRequest {
|
|
19
|
+
interface ShippingAddress {
|
|
20
|
+
name?: (string | null) | undefined;
|
|
21
|
+
line1: string;
|
|
22
|
+
line2?: (string | null) | undefined;
|
|
23
|
+
city: string;
|
|
24
|
+
state: string;
|
|
25
|
+
postal_code: string;
|
|
26
|
+
country?: (string | null) | undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* business: "katzs-deli",
|
|
5
|
+
* shipping_rate_id: "shipping_rate_id"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface SelectShippingOptionRequest {
|
|
9
|
+
/** The business handle */
|
|
10
|
+
business: string;
|
|
11
|
+
shipping_rate_id: string;
|
|
12
|
+
provider_rate_id?: string | null;
|
|
13
|
+
}
|
|
@@ -3,5 +3,7 @@ export { CheckoutRequest } from "./CheckoutRequest.js";
|
|
|
3
3
|
export type { ClearCartRequest } from "./ClearCartRequest.js";
|
|
4
4
|
export { CreatePaymentIntentRequest } from "./CreatePaymentIntentRequest.js";
|
|
5
5
|
export type { GetCartRequest } from "./GetCartRequest.js";
|
|
6
|
+
export type { GetShippingOptionsRequest } from "./GetShippingOptionsRequest.js";
|
|
6
7
|
export type { RemoveItemCartRequest } from "./RemoveItemCartRequest.js";
|
|
8
|
+
export type { SelectShippingOptionRequest } from "./SelectShippingOptionRequest.js";
|
|
7
9
|
export type { UpdateCartItemRequest } from "./UpdateCartItemRequest.js";
|
|
@@ -4,4 +4,5 @@ export * from "./ClearCartResponse.js";
|
|
|
4
4
|
export * from "./CreatePaymentIntentCartResponse.js";
|
|
5
5
|
export * from "./GetCartResponse.js";
|
|
6
6
|
export * from "./RemoveItemCartResponse.js";
|
|
7
|
+
export * from "./SelectShippingOptionCartResponse.js";
|
|
7
8
|
export * from "./UpdateItemCartResponse.js";
|
|
@@ -20,4 +20,5 @@ __exportStar(require("./ClearCartResponse.js"), exports);
|
|
|
20
20
|
__exportStar(require("./CreatePaymentIntentCartResponse.js"), exports);
|
|
21
21
|
__exportStar(require("./GetCartResponse.js"), exports);
|
|
22
22
|
__exportStar(require("./RemoveItemCartResponse.js"), exports);
|
|
23
|
+
__exportStar(require("./SelectShippingOptionCartResponse.js"), exports);
|
|
23
24
|
__exportStar(require("./UpdateItemCartResponse.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.52";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@51eat/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "0.0.
|
|
10
|
-
"User-Agent": "@51eat/sdk/0.0.
|
|
9
|
+
"X-Fern-SDK-Version": "0.0.52",
|
|
10
|
+
"User-Agent": "@51eat/sdk/0.0.52",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -106,4 +106,37 @@ export declare class ProductOrdersClient {
|
|
|
106
106
|
*/
|
|
107
107
|
refund(request: FiveOneEat.business.RefundOrderRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.RefundProductOrdersResponse>;
|
|
108
108
|
private __refund;
|
|
109
|
+
/**
|
|
110
|
+
* @param {FiveOneEat.business.GetLabelRatesProductOrdersRequest} request
|
|
111
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
112
|
+
*
|
|
113
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
114
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
115
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
116
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* await client.business.productOrders.getLabelRates({
|
|
120
|
+
* productOrder: "productOrder"
|
|
121
|
+
* })
|
|
122
|
+
*/
|
|
123
|
+
getLabelRates(request: FiveOneEat.business.GetLabelRatesProductOrdersRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<string>;
|
|
124
|
+
private __getLabelRates;
|
|
125
|
+
/**
|
|
126
|
+
* @param {FiveOneEat.business.PurchaseLabelRequest} request
|
|
127
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
128
|
+
*
|
|
129
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
130
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
131
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
132
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* await client.business.productOrders.purchaseLabel({
|
|
136
|
+
* productOrder: "productOrder",
|
|
137
|
+
* provider_rate_id: "provider_rate_id"
|
|
138
|
+
* })
|
|
139
|
+
*/
|
|
140
|
+
purchaseLabel(request: FiveOneEat.business.PurchaseLabelRequest, requestOptions?: ProductOrdersClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.PurchaseLabelProductOrdersResponse>;
|
|
141
|
+
private __purchaseLabel;
|
|
109
142
|
}
|