@51eat/sdk 0.0.50 → 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/api/types/TicketOrder.d.ts +18 -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/api/types/TicketOrder.d.mts +18 -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
|
@@ -389,4 +389,127 @@ export class ProductOrdersClient {
|
|
|
389
389
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/product-orders/{productOrder}/refund");
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
|
+
/**
|
|
393
|
+
* @param {FiveOneEat.business.GetLabelRatesProductOrdersRequest} request
|
|
394
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
395
|
+
*
|
|
396
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
397
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
398
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
399
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* await client.business.productOrders.getLabelRates({
|
|
403
|
+
* productOrder: "productOrder"
|
|
404
|
+
* })
|
|
405
|
+
*/
|
|
406
|
+
getLabelRates(request, requestOptions) {
|
|
407
|
+
return core.HttpResponsePromise.fromPromise(this.__getLabelRates(request, requestOptions));
|
|
408
|
+
}
|
|
409
|
+
__getLabelRates(request, requestOptions) {
|
|
410
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
411
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
412
|
+
const { productOrder } = request;
|
|
413
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
414
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
415
|
+
const _response = yield core.fetcher({
|
|
416
|
+
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`),
|
|
417
|
+
method: "GET",
|
|
418
|
+
headers: _headers,
|
|
419
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
420
|
+
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,
|
|
421
|
+
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,
|
|
422
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
423
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
424
|
+
logging: this._options.logging,
|
|
425
|
+
});
|
|
426
|
+
if (_response.ok) {
|
|
427
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
428
|
+
}
|
|
429
|
+
if (_response.error.reason === "status-code") {
|
|
430
|
+
switch (_response.error.statusCode) {
|
|
431
|
+
case 401:
|
|
432
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
433
|
+
case 403:
|
|
434
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
435
|
+
case 404:
|
|
436
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
437
|
+
case 422:
|
|
438
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
439
|
+
default:
|
|
440
|
+
throw new errors.FiveOneEatError({
|
|
441
|
+
statusCode: _response.error.statusCode,
|
|
442
|
+
body: _response.error.body,
|
|
443
|
+
rawResponse: _response.rawResponse,
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/product-orders/{productOrder}/label-rates");
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* @param {FiveOneEat.business.PurchaseLabelRequest} request
|
|
452
|
+
* @param {ProductOrdersClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
453
|
+
*
|
|
454
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
455
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
456
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
457
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* await client.business.productOrders.purchaseLabel({
|
|
461
|
+
* productOrder: "productOrder",
|
|
462
|
+
* provider_rate_id: "provider_rate_id"
|
|
463
|
+
* })
|
|
464
|
+
*/
|
|
465
|
+
purchaseLabel(request, requestOptions) {
|
|
466
|
+
return core.HttpResponsePromise.fromPromise(this.__purchaseLabel(request, requestOptions));
|
|
467
|
+
}
|
|
468
|
+
__purchaseLabel(request, requestOptions) {
|
|
469
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
470
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
471
|
+
const { productOrder } = request, _body = __rest(request, ["productOrder"]);
|
|
472
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
473
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
474
|
+
const _response = yield core.fetcher({
|
|
475
|
+
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`),
|
|
476
|
+
method: "POST",
|
|
477
|
+
headers: _headers,
|
|
478
|
+
contentType: "application/json",
|
|
479
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
480
|
+
requestType: "json",
|
|
481
|
+
body: _body,
|
|
482
|
+
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,
|
|
483
|
+
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,
|
|
484
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
485
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
486
|
+
logging: this._options.logging,
|
|
487
|
+
});
|
|
488
|
+
if (_response.ok) {
|
|
489
|
+
return {
|
|
490
|
+
data: _response.body,
|
|
491
|
+
rawResponse: _response.rawResponse,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
if (_response.error.reason === "status-code") {
|
|
495
|
+
switch (_response.error.statusCode) {
|
|
496
|
+
case 401:
|
|
497
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
498
|
+
case 403:
|
|
499
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
500
|
+
case 404:
|
|
501
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
502
|
+
case 422:
|
|
503
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
504
|
+
default:
|
|
505
|
+
throw new errors.FiveOneEatError({
|
|
506
|
+
statusCode: _response.error.statusCode,
|
|
507
|
+
body: _response.error.body,
|
|
508
|
+
rawResponse: _response.rawResponse,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/product-orders/{productOrder}/purchase-label");
|
|
513
|
+
});
|
|
514
|
+
}
|
|
392
515
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { FulfillProductOrdersRequest } from "./FulfillProductOrdersRequest.mjs";
|
|
2
|
+
export type { GetLabelRatesProductOrdersRequest } from "./GetLabelRatesProductOrdersRequest.mjs";
|
|
2
3
|
export type { GetProductOrdersRequest } from "./GetProductOrdersRequest.mjs";
|
|
3
4
|
export type { MarkPickedUpProductOrdersRequest } from "./MarkPickedUpProductOrdersRequest.mjs";
|
|
5
|
+
export type { PurchaseLabelRequest } from "./PurchaseLabelRequest.mjs";
|
|
4
6
|
export type { RefundOrderRequest } from "./RefundOrderRequest.mjs";
|
|
5
7
|
export type { StoreTrackingRequest } from "./StoreTrackingRequest.mjs";
|
|
@@ -3,4 +3,5 @@ export * from "./FulfillProductOrdersResponse.mjs";
|
|
|
3
3
|
export * from "./GetProductOrdersResponse.mjs";
|
|
4
4
|
export * from "./ListProductOrdersResponse.mjs";
|
|
5
5
|
export * from "./MarkPickedUpProductOrdersResponse.mjs";
|
|
6
|
+
export * from "./PurchaseLabelProductOrdersResponse.mjs";
|
|
6
7
|
export * from "./RefundProductOrdersResponse.mjs";
|
|
@@ -3,4 +3,5 @@ export * from "./FulfillProductOrdersResponse.mjs";
|
|
|
3
3
|
export * from "./GetProductOrdersResponse.mjs";
|
|
4
4
|
export * from "./ListProductOrdersResponse.mjs";
|
|
5
5
|
export * from "./MarkPickedUpProductOrdersResponse.mjs";
|
|
6
|
+
export * from "./PurchaseLabelProductOrdersResponse.mjs";
|
|
6
7
|
export * from "./RefundProductOrdersResponse.mjs";
|
|
@@ -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
|
}
|
|
@@ -450,4 +450,135 @@ export class CartClient {
|
|
|
450
450
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/customer/cart/items/{cartItem}");
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Returns available shipping rates for the given address. For calculated rates,
|
|
455
|
+
* fetches live rates from the shipping provider and caches for 10 minutes.
|
|
456
|
+
* Pass the returned `provider_rate_id` to the select shipping option endpoint.
|
|
457
|
+
*
|
|
458
|
+
* @param {FiveOneEat.customer.GetShippingOptionsRequest} request
|
|
459
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
460
|
+
*
|
|
461
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
462
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* await client.customer.cart.getShippingOptions({
|
|
466
|
+
* business: "katzs-deli",
|
|
467
|
+
* shipping_address: {
|
|
468
|
+
* line1: "line1",
|
|
469
|
+
* city: "city",
|
|
470
|
+
* state: "state",
|
|
471
|
+
* postal_code: "postal_code"
|
|
472
|
+
* }
|
|
473
|
+
* })
|
|
474
|
+
*/
|
|
475
|
+
getShippingOptions(request, requestOptions) {
|
|
476
|
+
return core.HttpResponsePromise.fromPromise(this.__getShippingOptions(request, requestOptions));
|
|
477
|
+
}
|
|
478
|
+
__getShippingOptions(request, requestOptions) {
|
|
479
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
480
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
481
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
482
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
483
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
484
|
+
const _response = yield core.fetcher({
|
|
485
|
+
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`),
|
|
486
|
+
method: "POST",
|
|
487
|
+
headers: _headers,
|
|
488
|
+
contentType: "application/json",
|
|
489
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
490
|
+
requestType: "json",
|
|
491
|
+
body: _body,
|
|
492
|
+
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,
|
|
493
|
+
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,
|
|
494
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
495
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
496
|
+
logging: this._options.logging,
|
|
497
|
+
});
|
|
498
|
+
if (_response.ok) {
|
|
499
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
500
|
+
}
|
|
501
|
+
if (_response.error.reason === "status-code") {
|
|
502
|
+
switch (_response.error.statusCode) {
|
|
503
|
+
case 401:
|
|
504
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
505
|
+
case 422:
|
|
506
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
507
|
+
default:
|
|
508
|
+
throw new errors.FiveOneEatError({
|
|
509
|
+
statusCode: _response.error.statusCode,
|
|
510
|
+
body: _response.error.body,
|
|
511
|
+
rawResponse: _response.rawResponse,
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/businesses/{business}/cart/shipping-options");
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Saves the shipping amount and method to the cart server-side.
|
|
520
|
+
* For calculated rates, resolves the amount from cache using the provider_rate_id
|
|
521
|
+
* returned by the shipping options endpoint. The client never submits an amount.
|
|
522
|
+
*
|
|
523
|
+
* @param {FiveOneEat.customer.SelectShippingOptionRequest} request
|
|
524
|
+
* @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
525
|
+
*
|
|
526
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
527
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
528
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* await client.customer.cart.selectShippingOption({
|
|
532
|
+
* business: "katzs-deli",
|
|
533
|
+
* shipping_rate_id: "shipping_rate_id"
|
|
534
|
+
* })
|
|
535
|
+
*/
|
|
536
|
+
selectShippingOption(request, requestOptions) {
|
|
537
|
+
return core.HttpResponsePromise.fromPromise(this.__selectShippingOption(request, requestOptions));
|
|
538
|
+
}
|
|
539
|
+
__selectShippingOption(request, requestOptions) {
|
|
540
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
541
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
542
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
543
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
544
|
+
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
545
|
+
const _response = yield core.fetcher({
|
|
546
|
+
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`),
|
|
547
|
+
method: "POST",
|
|
548
|
+
headers: _headers,
|
|
549
|
+
contentType: "application/json",
|
|
550
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
551
|
+
requestType: "json",
|
|
552
|
+
body: _body,
|
|
553
|
+
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,
|
|
554
|
+
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,
|
|
555
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
556
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
557
|
+
logging: this._options.logging,
|
|
558
|
+
});
|
|
559
|
+
if (_response.ok) {
|
|
560
|
+
return {
|
|
561
|
+
data: _response.body,
|
|
562
|
+
rawResponse: _response.rawResponse,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
if (_response.error.reason === "status-code") {
|
|
566
|
+
switch (_response.error.statusCode) {
|
|
567
|
+
case 401:
|
|
568
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
569
|
+
case 404:
|
|
570
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
571
|
+
case 422:
|
|
572
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
573
|
+
default:
|
|
574
|
+
throw new errors.FiveOneEatError({
|
|
575
|
+
statusCode: _response.error.statusCode,
|
|
576
|
+
body: _response.error.body,
|
|
577
|
+
rawResponse: _response.rawResponse,
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/businesses/{business}/cart/shipping-option");
|
|
582
|
+
});
|
|
583
|
+
}
|
|
453
584
|
}
|
|
@@ -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.mjs";
|
|
|
3
3
|
export type { ClearCartRequest } from "./ClearCartRequest.mjs";
|
|
4
4
|
export { CreatePaymentIntentRequest } from "./CreatePaymentIntentRequest.mjs";
|
|
5
5
|
export type { GetCartRequest } from "./GetCartRequest.mjs";
|
|
6
|
+
export type { GetShippingOptionsRequest } from "./GetShippingOptionsRequest.mjs";
|
|
6
7
|
export type { RemoveItemCartRequest } from "./RemoveItemCartRequest.mjs";
|
|
8
|
+
export type { SelectShippingOptionRequest } from "./SelectShippingOptionRequest.mjs";
|
|
7
9
|
export type { UpdateCartItemRequest } from "./UpdateCartItemRequest.mjs";
|
|
@@ -4,4 +4,5 @@ export * from "./ClearCartResponse.mjs";
|
|
|
4
4
|
export * from "./CreatePaymentIntentCartResponse.mjs";
|
|
5
5
|
export * from "./GetCartResponse.mjs";
|
|
6
6
|
export * from "./RemoveItemCartResponse.mjs";
|
|
7
|
+
export * from "./SelectShippingOptionCartResponse.mjs";
|
|
7
8
|
export * from "./UpdateItemCartResponse.mjs";
|
|
@@ -4,4 +4,5 @@ export * from "./ClearCartResponse.mjs";
|
|
|
4
4
|
export * from "./CreatePaymentIntentCartResponse.mjs";
|
|
5
5
|
export * from "./GetCartResponse.mjs";
|
|
6
6
|
export * from "./RemoveItemCartResponse.mjs";
|
|
7
|
+
export * from "./SelectShippingOptionCartResponse.mjs";
|
|
7
8
|
export * from "./UpdateItemCartResponse.mjs";
|
|
@@ -2,6 +2,24 @@ import type * as FiveOneEat from "../index.mjs";
|
|
|
2
2
|
export interface TicketOrder {
|
|
3
3
|
id: string;
|
|
4
4
|
order_number: string;
|
|
5
|
+
event?: TicketOrder.Event | undefined;
|
|
5
6
|
transaction?: FiveOneEat.Transaction | undefined;
|
|
6
7
|
tickets?: FiveOneEat.Ticket[] | undefined;
|
|
7
8
|
}
|
|
9
|
+
export declare namespace TicketOrder {
|
|
10
|
+
interface Event {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
starts_at: string;
|
|
14
|
+
ends_at: string;
|
|
15
|
+
location: string;
|
|
16
|
+
business: Event.Business | null;
|
|
17
|
+
}
|
|
18
|
+
namespace Event {
|
|
19
|
+
interface Business {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
handle: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.52";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.
|
|
1
|
+
export const SDK_VERSION = "0.0.52";
|