@51eat/sdk 0.0.51 → 0.0.53
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/Client.d.ts +3 -0
- package/dist/cjs/Client.js +17 -12
- 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/businessShipping/client/Client.d.ts +138 -0
- package/dist/cjs/api/resources/businessShipping/client/Client.js +566 -0
- package/dist/cjs/api/resources/businessShipping/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/businessShipping/client/index.js +17 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.d.ts +10 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.js +3 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.d.ts +12 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.js +3 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/StoreShippingRateRequest.d.ts +23 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/StoreShippingRateRequest.js +11 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.d.ts +9 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.js +3 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.d.ts +26 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.js +11 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/index.d.ts +5 -0
- package/dist/cjs/api/resources/businessShipping/client/requests/index.js +7 -0
- package/dist/cjs/api/resources/businessShipping/exports.d.ts +2 -0
- package/dist/cjs/api/resources/businessShipping/exports.js +21 -0
- package/dist/cjs/api/resources/businessShipping/index.d.ts +2 -0
- package/dist/cjs/api/resources/businessShipping/index.js +18 -0
- package/dist/cjs/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.d.ts +4 -0
- package/dist/cjs/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.js +3 -0
- package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.d.ts +6 -0
- package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.js +3 -0
- package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.d.ts +3 -0
- package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.js +3 -0
- package/dist/cjs/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.js +3 -0
- package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.d.ts +4 -0
- package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.js +3 -0
- package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.d.ts +4 -0
- package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.js +3 -0
- package/dist/cjs/api/resources/businessShipping/types/index.d.ts +6 -0
- package/dist/cjs/api/resources/businessShipping/types/index.js +22 -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 +12 -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 +11 -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/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/types/ShippingAccountResource.d.ts +10 -0
- package/dist/cjs/api/types/ShippingAccountResource.js +3 -0
- package/dist/cjs/api/types/ShippingRateResource.d.ts +12 -0
- package/dist/cjs/api/types/ShippingRateResource.js +3 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -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/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +5 -0
- 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/businessShipping/client/Client.d.mts +138 -0
- package/dist/esm/api/resources/businessShipping/client/Client.mjs +529 -0
- package/dist/esm/api/resources/businessShipping/client/index.d.mts +1 -0
- package/dist/esm/api/resources/businessShipping/client/index.mjs +1 -0
- package/dist/esm/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.d.mts +10 -0
- package/dist/esm/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.d.mts +12 -0
- package/dist/esm/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/client/requests/StoreShippingRateRequest.d.mts +23 -0
- package/dist/esm/api/resources/businessShipping/client/requests/StoreShippingRateRequest.mjs +8 -0
- package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.d.mts +9 -0
- package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.d.mts +26 -0
- package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.mjs +8 -0
- package/dist/esm/api/resources/businessShipping/client/requests/index.d.mts +5 -0
- package/dist/esm/api/resources/businessShipping/client/requests/index.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/exports.d.mts +2 -0
- package/dist/esm/api/resources/businessShipping/exports.mjs +3 -0
- package/dist/esm/api/resources/businessShipping/index.d.mts +2 -0
- package/dist/esm/api/resources/businessShipping/index.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.d.mts +4 -0
- package/dist/esm/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.d.mts +6 -0
- package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.d.mts +3 -0
- package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.d.mts +4 -0
- package/dist/esm/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.d.mts +4 -0
- package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.d.mts +4 -0
- package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.mjs +2 -0
- package/dist/esm/api/resources/businessShipping/types/index.d.mts +6 -0
- package/dist/esm/api/resources/businessShipping/types/index.mjs +6 -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 +12 -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 +11 -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/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/index.mjs +3 -0
- package/dist/esm/api/types/ShippingAccountResource.d.mts +10 -0
- package/dist/esm/api/types/ShippingAccountResource.mjs +2 -0
- package/dist/esm/api/types/ShippingRateResource.d.mts +12 -0
- package/dist/esm/api/types/ShippingRateResource.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +12 -1
- package/reference.md +696 -0
package/dist/esm/Client.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BusinessClient } from "./api/resources/business/client/Client.mjs";
|
|
2
2
|
import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
|
|
3
3
|
import { BusinessProductsClient } from "./api/resources/businessProducts/client/Client.mjs";
|
|
4
|
+
import { BusinessShippingClient } from "./api/resources/businessShipping/client/Client.mjs";
|
|
4
5
|
import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
|
|
5
6
|
import { CustomerEventsClient } from "./api/resources/customerEvents/client/Client.mjs";
|
|
6
7
|
import { CustomerMessagingClient } from "./api/resources/customerMessaging/client/Client.mjs";
|
|
@@ -19,6 +20,7 @@ export declare class FiveOneEatClient {
|
|
|
19
20
|
protected readonly _options: NormalizedClientOptionsWithAuth<FiveOneEatClient.Options>;
|
|
20
21
|
protected _businessMessaging: BusinessMessagingClient | undefined;
|
|
21
22
|
protected _businessProducts: BusinessProductsClient | undefined;
|
|
23
|
+
protected _businessShipping: BusinessShippingClient | undefined;
|
|
22
24
|
protected _customerEvents: CustomerEventsClient | undefined;
|
|
23
25
|
protected _customerMessaging: CustomerMessagingClient | undefined;
|
|
24
26
|
protected _customerMyAccount: CustomerMyAccountClient | undefined;
|
|
@@ -29,6 +31,7 @@ export declare class FiveOneEatClient {
|
|
|
29
31
|
constructor(options?: FiveOneEatClient.Options);
|
|
30
32
|
get businessMessaging(): BusinessMessagingClient;
|
|
31
33
|
get businessProducts(): BusinessProductsClient;
|
|
34
|
+
get businessShipping(): BusinessShippingClient;
|
|
32
35
|
get customerEvents(): CustomerEventsClient;
|
|
33
36
|
get customerMessaging(): CustomerMessagingClient;
|
|
34
37
|
get customerMyAccount(): CustomerMyAccountClient;
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
import { BusinessClient } from "./api/resources/business/client/Client.mjs";
|
|
12
12
|
import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.mjs";
|
|
13
13
|
import { BusinessProductsClient } from "./api/resources/businessProducts/client/Client.mjs";
|
|
14
|
+
import { BusinessShippingClient } from "./api/resources/businessShipping/client/Client.mjs";
|
|
14
15
|
import { CustomerClient } from "./api/resources/customer/client/Client.mjs";
|
|
15
16
|
import { CustomerEventsClient } from "./api/resources/customerEvents/client/Client.mjs";
|
|
16
17
|
import { CustomerMessagingClient } from "./api/resources/customerMessaging/client/Client.mjs";
|
|
@@ -31,6 +32,10 @@ export class FiveOneEatClient {
|
|
|
31
32
|
var _a;
|
|
32
33
|
return ((_a = this._businessProducts) !== null && _a !== void 0 ? _a : (this._businessProducts = new BusinessProductsClient(this._options)));
|
|
33
34
|
}
|
|
35
|
+
get businessShipping() {
|
|
36
|
+
var _a;
|
|
37
|
+
return ((_a = this._businessShipping) !== null && _a !== void 0 ? _a : (this._businessShipping = new BusinessShippingClient(this._options)));
|
|
38
|
+
}
|
|
34
39
|
get customerEvents() {
|
|
35
40
|
var _a;
|
|
36
41
|
return ((_a = this._customerEvents) !== null && _a !== void 0 ? _a : (this._customerEvents = new CustomerEventsClient(this._options)));
|
|
@@ -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
|
}
|
|
@@ -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";
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../core/index.mjs";
|
|
4
|
+
import * as FiveOneEat from "../../../index.mjs";
|
|
5
|
+
export declare namespace BusinessShippingClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class BusinessShippingClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<BusinessShippingClient.Options>;
|
|
12
|
+
constructor(options?: BusinessShippingClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
15
|
+
*
|
|
16
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* await client.businessShipping.getBusinessShippingAccount()
|
|
20
|
+
*/
|
|
21
|
+
getBusinessShippingAccount(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.GetBusinessShippingAccountResponse>;
|
|
22
|
+
private __getBusinessShippingAccount;
|
|
23
|
+
/**
|
|
24
|
+
* Use the returned client_secret with the Stripe mobile SDK to collect
|
|
25
|
+
* a payment method for label billing. Pass the resulting pm_* ID to
|
|
26
|
+
* POST /shipping/account.
|
|
27
|
+
*
|
|
28
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* await client.businessShipping.getBusinessShippingSetupIntent()
|
|
34
|
+
*/
|
|
35
|
+
getBusinessShippingSetupIntent(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.GetBusinessShippingSetupIntentResponse>;
|
|
36
|
+
private __getBusinessShippingSetupIntent;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a Stripe Customer for label billing, attaches the provided
|
|
39
|
+
* payment method, and upserts the ShippingAccount record.
|
|
40
|
+
*
|
|
41
|
+
* @param {FiveOneEat.SetupShippingAccountRequest} request
|
|
42
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
43
|
+
*
|
|
44
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
45
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
46
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* await client.businessShipping.setupBusinessShippingAccount({
|
|
50
|
+
* payment_method_id: "payment_method_id"
|
|
51
|
+
* })
|
|
52
|
+
*/
|
|
53
|
+
setupBusinessShippingAccount(request: FiveOneEat.SetupShippingAccountRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<string>;
|
|
54
|
+
private __setupBusinessShippingAccount;
|
|
55
|
+
/**
|
|
56
|
+
* @param {FiveOneEat.UpdateShippingAccountRequest} request
|
|
57
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
58
|
+
*
|
|
59
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
60
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
61
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* await client.businessShipping.updateBusinessShippingAccount()
|
|
65
|
+
*/
|
|
66
|
+
updateBusinessShippingAccount(request?: FiveOneEat.UpdateShippingAccountRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.UpdateBusinessShippingAccountResponse>;
|
|
67
|
+
private __updateBusinessShippingAccount;
|
|
68
|
+
/**
|
|
69
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
70
|
+
*
|
|
71
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
72
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* await client.businessShipping.deleteBusinessShippingAccount()
|
|
76
|
+
*/
|
|
77
|
+
deleteBusinessShippingAccount(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
78
|
+
private __deleteBusinessShippingAccount;
|
|
79
|
+
/**
|
|
80
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
81
|
+
*
|
|
82
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* await client.businessShipping.listBusinessShippingRates()
|
|
86
|
+
*/
|
|
87
|
+
listBusinessShippingRates(requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.ListBusinessShippingRatesResponse>;
|
|
88
|
+
private __listBusinessShippingRates;
|
|
89
|
+
/**
|
|
90
|
+
* @param {FiveOneEat.StoreShippingRateRequest} request
|
|
91
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
92
|
+
*
|
|
93
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
94
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
95
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* await client.businessShipping.createBusinessShippingRate({
|
|
99
|
+
* name: "name",
|
|
100
|
+
* rate_type: "flat"
|
|
101
|
+
* })
|
|
102
|
+
*/
|
|
103
|
+
createBusinessShippingRate(request: FiveOneEat.StoreShippingRateRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.CreateBusinessShippingRateResponse>;
|
|
104
|
+
private __createBusinessShippingRate;
|
|
105
|
+
/**
|
|
106
|
+
* @param {FiveOneEat.UpdateShippingRateRequest} request
|
|
107
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
|
+
*
|
|
109
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
110
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
111
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
112
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* await client.businessShipping.updateBusinessShippingRate({
|
|
116
|
+
* shippingRate: "shippingRate",
|
|
117
|
+
* name: "name",
|
|
118
|
+
* rate_type: "flat"
|
|
119
|
+
* })
|
|
120
|
+
*/
|
|
121
|
+
updateBusinessShippingRate(request: FiveOneEat.UpdateShippingRateRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.UpdateBusinessShippingRateResponse>;
|
|
122
|
+
private __updateBusinessShippingRate;
|
|
123
|
+
/**
|
|
124
|
+
* @param {FiveOneEat.DeleteBusinessShippingRateRequest} request
|
|
125
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
126
|
+
*
|
|
127
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
128
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
129
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* await client.businessShipping.deleteBusinessShippingRate({
|
|
133
|
+
* shippingRate: "shippingRate"
|
|
134
|
+
* })
|
|
135
|
+
*/
|
|
136
|
+
deleteBusinessShippingRate(request: FiveOneEat.DeleteBusinessShippingRateRequest, requestOptions?: BusinessShippingClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
137
|
+
private __deleteBusinessShippingRate;
|
|
138
|
+
}
|