@51eat/sdk 0.0.52 → 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/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 +8 -8
- package/dist/cjs/api/resources/customer/resources/cart/client/Client.js +8 -8
- package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.ts +2 -3
- package/dist/cjs/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.ts +7 -2
- 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/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 +8 -8
- package/dist/esm/api/resources/customer/resources/cart/client/Client.mjs +8 -8
- package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.mts +2 -3
- package/dist/esm/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.mts +7 -2
- 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 +460 -8
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
23
|
+
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
24
|
+
import * as core from "../../../../core/index.mjs";
|
|
25
|
+
import * as environments from "../../../../environments.mjs";
|
|
26
|
+
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
27
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
28
|
+
import * as FiveOneEat from "../../../index.mjs";
|
|
29
|
+
export class BusinessShippingClient {
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
35
|
+
*
|
|
36
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* await client.businessShipping.getBusinessShippingAccount()
|
|
40
|
+
*/
|
|
41
|
+
getBusinessShippingAccount(requestOptions) {
|
|
42
|
+
return core.HttpResponsePromise.fromPromise(this.__getBusinessShippingAccount(requestOptions));
|
|
43
|
+
}
|
|
44
|
+
__getBusinessShippingAccount(requestOptions) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
47
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
48
|
+
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);
|
|
49
|
+
const _response = yield core.fetcher({
|
|
50
|
+
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/shipping"),
|
|
51
|
+
method: "GET",
|
|
52
|
+
headers: _headers,
|
|
53
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
54
|
+
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,
|
|
55
|
+
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,
|
|
56
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
57
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
58
|
+
logging: this._options.logging,
|
|
59
|
+
});
|
|
60
|
+
if (_response.ok) {
|
|
61
|
+
return {
|
|
62
|
+
data: _response.body,
|
|
63
|
+
rawResponse: _response.rawResponse,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (_response.error.reason === "status-code") {
|
|
67
|
+
switch (_response.error.statusCode) {
|
|
68
|
+
case 401:
|
|
69
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
70
|
+
default:
|
|
71
|
+
throw new errors.FiveOneEatError({
|
|
72
|
+
statusCode: _response.error.statusCode,
|
|
73
|
+
body: _response.error.body,
|
|
74
|
+
rawResponse: _response.rawResponse,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/shipping");
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Use the returned client_secret with the Stripe mobile SDK to collect
|
|
83
|
+
* a payment method for label billing. Pass the resulting pm_* ID to
|
|
84
|
+
* POST /shipping/account.
|
|
85
|
+
*
|
|
86
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
87
|
+
*
|
|
88
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* await client.businessShipping.getBusinessShippingSetupIntent()
|
|
92
|
+
*/
|
|
93
|
+
getBusinessShippingSetupIntent(requestOptions) {
|
|
94
|
+
return core.HttpResponsePromise.fromPromise(this.__getBusinessShippingSetupIntent(requestOptions));
|
|
95
|
+
}
|
|
96
|
+
__getBusinessShippingSetupIntent(requestOptions) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
99
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
100
|
+
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);
|
|
101
|
+
const _response = yield core.fetcher({
|
|
102
|
+
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/shipping/setup-intent"),
|
|
103
|
+
method: "GET",
|
|
104
|
+
headers: _headers,
|
|
105
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
106
|
+
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,
|
|
107
|
+
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,
|
|
108
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
109
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
110
|
+
logging: this._options.logging,
|
|
111
|
+
});
|
|
112
|
+
if (_response.ok) {
|
|
113
|
+
return {
|
|
114
|
+
data: _response.body,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (_response.error.reason === "status-code") {
|
|
119
|
+
switch (_response.error.statusCode) {
|
|
120
|
+
case 401:
|
|
121
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
122
|
+
default:
|
|
123
|
+
throw new errors.FiveOneEatError({
|
|
124
|
+
statusCode: _response.error.statusCode,
|
|
125
|
+
body: _response.error.body,
|
|
126
|
+
rawResponse: _response.rawResponse,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/shipping/setup-intent");
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Creates a Stripe Customer for label billing, attaches the provided
|
|
135
|
+
* payment method, and upserts the ShippingAccount record.
|
|
136
|
+
*
|
|
137
|
+
* @param {FiveOneEat.SetupShippingAccountRequest} request
|
|
138
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
139
|
+
*
|
|
140
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
141
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
142
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* await client.businessShipping.setupBusinessShippingAccount({
|
|
146
|
+
* payment_method_id: "payment_method_id"
|
|
147
|
+
* })
|
|
148
|
+
*/
|
|
149
|
+
setupBusinessShippingAccount(request, requestOptions) {
|
|
150
|
+
return core.HttpResponsePromise.fromPromise(this.__setupBusinessShippingAccount(request, requestOptions));
|
|
151
|
+
}
|
|
152
|
+
__setupBusinessShippingAccount(request, requestOptions) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
155
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
156
|
+
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);
|
|
157
|
+
const _response = yield core.fetcher({
|
|
158
|
+
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/shipping/account"),
|
|
159
|
+
method: "POST",
|
|
160
|
+
headers: _headers,
|
|
161
|
+
contentType: "application/json",
|
|
162
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
163
|
+
requestType: "json",
|
|
164
|
+
body: request,
|
|
165
|
+
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,
|
|
166
|
+
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,
|
|
167
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
168
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
169
|
+
logging: this._options.logging,
|
|
170
|
+
});
|
|
171
|
+
if (_response.ok) {
|
|
172
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
173
|
+
}
|
|
174
|
+
if (_response.error.reason === "status-code") {
|
|
175
|
+
switch (_response.error.statusCode) {
|
|
176
|
+
case 401:
|
|
177
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
178
|
+
case 403:
|
|
179
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
180
|
+
case 422:
|
|
181
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
182
|
+
default:
|
|
183
|
+
throw new errors.FiveOneEatError({
|
|
184
|
+
statusCode: _response.error.statusCode,
|
|
185
|
+
body: _response.error.body,
|
|
186
|
+
rawResponse: _response.rawResponse,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/shipping/account");
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @param {FiveOneEat.UpdateShippingAccountRequest} request
|
|
195
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
196
|
+
*
|
|
197
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
198
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
199
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* await client.businessShipping.updateBusinessShippingAccount()
|
|
203
|
+
*/
|
|
204
|
+
updateBusinessShippingAccount(request = {}, requestOptions) {
|
|
205
|
+
return core.HttpResponsePromise.fromPromise(this.__updateBusinessShippingAccount(request, requestOptions));
|
|
206
|
+
}
|
|
207
|
+
__updateBusinessShippingAccount() {
|
|
208
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
209
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
210
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
211
|
+
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);
|
|
212
|
+
const _response = yield core.fetcher({
|
|
213
|
+
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/shipping/account"),
|
|
214
|
+
method: "PUT",
|
|
215
|
+
headers: _headers,
|
|
216
|
+
contentType: "application/json",
|
|
217
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
218
|
+
requestType: "json",
|
|
219
|
+
body: request,
|
|
220
|
+
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,
|
|
221
|
+
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,
|
|
222
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
223
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
224
|
+
logging: this._options.logging,
|
|
225
|
+
});
|
|
226
|
+
if (_response.ok) {
|
|
227
|
+
return {
|
|
228
|
+
data: _response.body,
|
|
229
|
+
rawResponse: _response.rawResponse,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (_response.error.reason === "status-code") {
|
|
233
|
+
switch (_response.error.statusCode) {
|
|
234
|
+
case 401:
|
|
235
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
236
|
+
case 403:
|
|
237
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
238
|
+
case 422:
|
|
239
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
240
|
+
default:
|
|
241
|
+
throw new errors.FiveOneEatError({
|
|
242
|
+
statusCode: _response.error.statusCode,
|
|
243
|
+
body: _response.error.body,
|
|
244
|
+
rawResponse: _response.rawResponse,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/business/shipping/account");
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
253
|
+
*
|
|
254
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
255
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* await client.businessShipping.deleteBusinessShippingAccount()
|
|
259
|
+
*/
|
|
260
|
+
deleteBusinessShippingAccount(requestOptions) {
|
|
261
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteBusinessShippingAccount(requestOptions));
|
|
262
|
+
}
|
|
263
|
+
__deleteBusinessShippingAccount(requestOptions) {
|
|
264
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
265
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
266
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
267
|
+
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);
|
|
268
|
+
const _response = yield core.fetcher({
|
|
269
|
+
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/shipping/account"),
|
|
270
|
+
method: "DELETE",
|
|
271
|
+
headers: _headers,
|
|
272
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
273
|
+
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,
|
|
274
|
+
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,
|
|
275
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
276
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
277
|
+
logging: this._options.logging,
|
|
278
|
+
});
|
|
279
|
+
if (_response.ok) {
|
|
280
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
281
|
+
}
|
|
282
|
+
if (_response.error.reason === "status-code") {
|
|
283
|
+
switch (_response.error.statusCode) {
|
|
284
|
+
case 401:
|
|
285
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
286
|
+
case 422:
|
|
287
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
288
|
+
default:
|
|
289
|
+
throw new errors.FiveOneEatError({
|
|
290
|
+
statusCode: _response.error.statusCode,
|
|
291
|
+
body: _response.error.body,
|
|
292
|
+
rawResponse: _response.rawResponse,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/business/shipping/account");
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
301
|
+
*
|
|
302
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* await client.businessShipping.listBusinessShippingRates()
|
|
306
|
+
*/
|
|
307
|
+
listBusinessShippingRates(requestOptions) {
|
|
308
|
+
return core.HttpResponsePromise.fromPromise(this.__listBusinessShippingRates(requestOptions));
|
|
309
|
+
}
|
|
310
|
+
__listBusinessShippingRates(requestOptions) {
|
|
311
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
312
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
313
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
314
|
+
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);
|
|
315
|
+
const _response = yield core.fetcher({
|
|
316
|
+
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/shipping/rates"),
|
|
317
|
+
method: "GET",
|
|
318
|
+
headers: _headers,
|
|
319
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
320
|
+
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,
|
|
321
|
+
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,
|
|
322
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
323
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
324
|
+
logging: this._options.logging,
|
|
325
|
+
});
|
|
326
|
+
if (_response.ok) {
|
|
327
|
+
return {
|
|
328
|
+
data: _response.body,
|
|
329
|
+
rawResponse: _response.rawResponse,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
if (_response.error.reason === "status-code") {
|
|
333
|
+
switch (_response.error.statusCode) {
|
|
334
|
+
case 401:
|
|
335
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
336
|
+
default:
|
|
337
|
+
throw new errors.FiveOneEatError({
|
|
338
|
+
statusCode: _response.error.statusCode,
|
|
339
|
+
body: _response.error.body,
|
|
340
|
+
rawResponse: _response.rawResponse,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/shipping/rates");
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* @param {FiveOneEat.StoreShippingRateRequest} request
|
|
349
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
350
|
+
*
|
|
351
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
352
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
353
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
354
|
+
*
|
|
355
|
+
* @example
|
|
356
|
+
* await client.businessShipping.createBusinessShippingRate({
|
|
357
|
+
* name: "name",
|
|
358
|
+
* rate_type: "flat"
|
|
359
|
+
* })
|
|
360
|
+
*/
|
|
361
|
+
createBusinessShippingRate(request, requestOptions) {
|
|
362
|
+
return core.HttpResponsePromise.fromPromise(this.__createBusinessShippingRate(request, requestOptions));
|
|
363
|
+
}
|
|
364
|
+
__createBusinessShippingRate(request, requestOptions) {
|
|
365
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
366
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
367
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
368
|
+
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);
|
|
369
|
+
const _response = yield core.fetcher({
|
|
370
|
+
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/shipping/rates"),
|
|
371
|
+
method: "POST",
|
|
372
|
+
headers: _headers,
|
|
373
|
+
contentType: "application/json",
|
|
374
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
375
|
+
requestType: "json",
|
|
376
|
+
body: request,
|
|
377
|
+
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,
|
|
378
|
+
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,
|
|
379
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
380
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
381
|
+
logging: this._options.logging,
|
|
382
|
+
});
|
|
383
|
+
if (_response.ok) {
|
|
384
|
+
return {
|
|
385
|
+
data: _response.body,
|
|
386
|
+
rawResponse: _response.rawResponse,
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
if (_response.error.reason === "status-code") {
|
|
390
|
+
switch (_response.error.statusCode) {
|
|
391
|
+
case 401:
|
|
392
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
393
|
+
case 403:
|
|
394
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
395
|
+
case 422:
|
|
396
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
397
|
+
default:
|
|
398
|
+
throw new errors.FiveOneEatError({
|
|
399
|
+
statusCode: _response.error.statusCode,
|
|
400
|
+
body: _response.error.body,
|
|
401
|
+
rawResponse: _response.rawResponse,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/shipping/rates");
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* @param {FiveOneEat.UpdateShippingRateRequest} request
|
|
410
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
411
|
+
*
|
|
412
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
413
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
414
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
415
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* await client.businessShipping.updateBusinessShippingRate({
|
|
419
|
+
* shippingRate: "shippingRate",
|
|
420
|
+
* name: "name",
|
|
421
|
+
* rate_type: "flat"
|
|
422
|
+
* })
|
|
423
|
+
*/
|
|
424
|
+
updateBusinessShippingRate(request, requestOptions) {
|
|
425
|
+
return core.HttpResponsePromise.fromPromise(this.__updateBusinessShippingRate(request, requestOptions));
|
|
426
|
+
}
|
|
427
|
+
__updateBusinessShippingRate(request, requestOptions) {
|
|
428
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
429
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
430
|
+
const { shippingRate } = request, _body = __rest(request, ["shippingRate"]);
|
|
431
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
432
|
+
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);
|
|
433
|
+
const _response = yield core.fetcher({
|
|
434
|
+
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/shipping/rates/${core.url.encodePathParam(shippingRate)}`),
|
|
435
|
+
method: "PUT",
|
|
436
|
+
headers: _headers,
|
|
437
|
+
contentType: "application/json",
|
|
438
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
439
|
+
requestType: "json",
|
|
440
|
+
body: _body,
|
|
441
|
+
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,
|
|
442
|
+
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,
|
|
443
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
444
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
445
|
+
logging: this._options.logging,
|
|
446
|
+
});
|
|
447
|
+
if (_response.ok) {
|
|
448
|
+
return {
|
|
449
|
+
data: _response.body,
|
|
450
|
+
rawResponse: _response.rawResponse,
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
if (_response.error.reason === "status-code") {
|
|
454
|
+
switch (_response.error.statusCode) {
|
|
455
|
+
case 401:
|
|
456
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
457
|
+
case 403:
|
|
458
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
459
|
+
case 404:
|
|
460
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
461
|
+
case 422:
|
|
462
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
463
|
+
default:
|
|
464
|
+
throw new errors.FiveOneEatError({
|
|
465
|
+
statusCode: _response.error.statusCode,
|
|
466
|
+
body: _response.error.body,
|
|
467
|
+
rawResponse: _response.rawResponse,
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/business/shipping/rates/{shippingRate}");
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* @param {FiveOneEat.DeleteBusinessShippingRateRequest} request
|
|
476
|
+
* @param {BusinessShippingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
477
|
+
*
|
|
478
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
479
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
480
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* await client.businessShipping.deleteBusinessShippingRate({
|
|
484
|
+
* shippingRate: "shippingRate"
|
|
485
|
+
* })
|
|
486
|
+
*/
|
|
487
|
+
deleteBusinessShippingRate(request, requestOptions) {
|
|
488
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteBusinessShippingRate(request, requestOptions));
|
|
489
|
+
}
|
|
490
|
+
__deleteBusinessShippingRate(request, requestOptions) {
|
|
491
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
492
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
493
|
+
const { shippingRate } = request;
|
|
494
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
495
|
+
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);
|
|
496
|
+
const _response = yield core.fetcher({
|
|
497
|
+
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/shipping/rates/${core.url.encodePathParam(shippingRate)}`),
|
|
498
|
+
method: "DELETE",
|
|
499
|
+
headers: _headers,
|
|
500
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
501
|
+
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,
|
|
502
|
+
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,
|
|
503
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
504
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
505
|
+
logging: this._options.logging,
|
|
506
|
+
});
|
|
507
|
+
if (_response.ok) {
|
|
508
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
509
|
+
}
|
|
510
|
+
if (_response.error.reason === "status-code") {
|
|
511
|
+
switch (_response.error.statusCode) {
|
|
512
|
+
case 401:
|
|
513
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
514
|
+
case 403:
|
|
515
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
516
|
+
case 404:
|
|
517
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
518
|
+
default:
|
|
519
|
+
throw new errors.FiveOneEatError({
|
|
520
|
+
statusCode: _response.error.statusCode,
|
|
521
|
+
body: _response.error.body,
|
|
522
|
+
rawResponse: _response.rawResponse,
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/business/shipping/rates/{shippingRate}");
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
package/dist/esm/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* payment_method_id: "payment_method_id"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface SetupShippingAccountRequest {
|
|
8
|
+
payment_method_id: string;
|
|
9
|
+
ship_from_name?: string | null;
|
|
10
|
+
ship_from_phone?: string | null;
|
|
11
|
+
live_rates_enabled?: boolean;
|
|
12
|
+
}
|
package/dist/esm/api/resources/businessShipping/client/requests/StoreShippingRateRequest.d.mts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* name: "name",
|
|
5
|
+
* rate_type: "flat"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface StoreShippingRateRequest {
|
|
9
|
+
name: string;
|
|
10
|
+
rate_type: StoreShippingRateRequest.RateType;
|
|
11
|
+
flat_rate?: number | null;
|
|
12
|
+
free_shipping_threshold?: number | null;
|
|
13
|
+
estimated_days_min?: number | null;
|
|
14
|
+
estimated_days_max?: number | null;
|
|
15
|
+
is_active?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare namespace StoreShippingRateRequest {
|
|
18
|
+
const RateType: {
|
|
19
|
+
readonly Flat: "flat";
|
|
20
|
+
readonly Free: "free";
|
|
21
|
+
};
|
|
22
|
+
type RateType = (typeof RateType)[keyof typeof RateType];
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var StoreShippingRateRequest;
|
|
3
|
+
(function (StoreShippingRateRequest) {
|
|
4
|
+
StoreShippingRateRequest.RateType = {
|
|
5
|
+
Flat: "flat",
|
|
6
|
+
Free: "free",
|
|
7
|
+
};
|
|
8
|
+
})(StoreShippingRateRequest || (StoreShippingRateRequest = {}));
|
package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.d.mts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* shippingRate: "shippingRate",
|
|
5
|
+
* name: "name",
|
|
6
|
+
* rate_type: "flat"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface UpdateShippingRateRequest {
|
|
10
|
+
/** The shipping rate ID */
|
|
11
|
+
shippingRate: string;
|
|
12
|
+
name: string;
|
|
13
|
+
rate_type: UpdateShippingRateRequest.RateType;
|
|
14
|
+
flat_rate?: number | null;
|
|
15
|
+
free_shipping_threshold?: number | null;
|
|
16
|
+
estimated_days_min?: number | null;
|
|
17
|
+
estimated_days_max?: number | null;
|
|
18
|
+
is_active?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare namespace UpdateShippingRateRequest {
|
|
21
|
+
const RateType: {
|
|
22
|
+
readonly Flat: "flat";
|
|
23
|
+
readonly Free: "free";
|
|
24
|
+
};
|
|
25
|
+
type RateType = (typeof RateType)[keyof typeof RateType];
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var UpdateShippingRateRequest;
|
|
3
|
+
(function (UpdateShippingRateRequest) {
|
|
4
|
+
UpdateShippingRateRequest.RateType = {
|
|
5
|
+
Flat: "flat",
|
|
6
|
+
Free: "free",
|
|
7
|
+
};
|
|
8
|
+
})(UpdateShippingRateRequest || (UpdateShippingRateRequest = {}));
|