@51eat/sdk 0.0.45 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +15 -10
- package/dist/cjs/api/resources/businessProducts/client/Client.d.ts +62 -0
- package/dist/cjs/api/resources/businessProducts/client/Client.js +261 -0
- package/dist/cjs/api/resources/businessProducts/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/businessProducts/client/index.js +17 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/AdjustInventoryRequest.d.ts +34 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/AdjustInventoryRequest.js +20 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.d.ts +10 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.js +3 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.d.ts +11 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.js +3 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/resources/businessProducts/client/requests/index.js +5 -0
- package/dist/cjs/api/resources/businessProducts/exports.d.ts +2 -0
- package/dist/cjs/api/resources/businessProducts/exports.js +21 -0
- package/dist/cjs/api/resources/businessProducts/index.d.ts +2 -0
- package/dist/cjs/api/resources/businessProducts/index.js +18 -0
- package/dist/cjs/api/resources/businessProducts/types/AdjustVariantInventoryResponse.d.ts +4 -0
- package/dist/cjs/api/resources/businessProducts/types/AdjustVariantInventoryResponse.js +3 -0
- package/dist/cjs/api/resources/businessProducts/types/GetProductInventorySummaryResponse.d.ts +4 -0
- package/dist/cjs/api/resources/businessProducts/types/GetProductInventorySummaryResponse.js +3 -0
- package/dist/cjs/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.d.ts +4 -0
- package/dist/cjs/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.js +3 -0
- package/dist/cjs/api/resources/businessProducts/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/businessProducts/types/index.js +19 -0
- package/dist/cjs/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/me/client/Client.d.ts +3 -0
- package/dist/cjs/api/resources/customer/resources/me/client/Client.js +9 -4
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/Client.d.ts +89 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/Client.js +304 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/index.js +17 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.d.ts +10 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.d.ts +19 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/exports.d.ts +2 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/exports.js +21 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/index.d.ts +2 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/index.js +18 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/index.js +19 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/customer/resources/me/resources/index.js +4 -1
- package/dist/cjs/api/resources/index.d.ts +3 -0
- package/dist/cjs/api/resources/index.js +4 -1
- package/dist/cjs/api/types/Address.d.ts +15 -0
- package/dist/cjs/api/types/Address.js +3 -0
- package/dist/cjs/api/types/AddressCollection.d.ts +4 -0
- package/dist/cjs/api/types/AddressCollection.js +3 -0
- package/dist/cjs/api/types/BusinessInventoryLog.d.ts +15 -0
- package/dist/cjs/api/types/BusinessInventoryLog.js +3 -0
- package/dist/cjs/api/types/BusinessProductInventorySummary.d.ts +7 -0
- package/dist/cjs/api/types/BusinessProductInventorySummary.js +3 -0
- package/dist/cjs/api/types/CustomerCartItem.d.ts +1 -1
- package/dist/cjs/api/types/CustomerProductOrder.d.ts +5 -5
- package/dist/cjs/api/types/CustomerProductOrderItem.d.ts +2 -2
- package/dist/cjs/api/types/InternalServerErrorBody.d.ts +7 -1
- package/dist/cjs/api/types/InternalServerErrorBody.js +7 -0
- package/dist/cjs/api/types/StoreAddressRequest.d.ts +12 -0
- package/dist/cjs/api/types/StoreAddressRequest.js +3 -0
- package/dist/cjs/api/types/index.d.ts +5 -0
- package/dist/cjs/api/types/index.js +5 -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/businessProducts/client/Client.d.mts +62 -0
- package/dist/esm/api/resources/businessProducts/client/Client.mjs +224 -0
- package/dist/esm/api/resources/businessProducts/client/index.d.mts +1 -0
- package/dist/esm/api/resources/businessProducts/client/index.mjs +1 -0
- package/dist/esm/api/resources/businessProducts/client/requests/AdjustInventoryRequest.d.mts +34 -0
- package/dist/esm/api/resources/businessProducts/client/requests/AdjustInventoryRequest.mjs +17 -0
- package/dist/esm/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.d.mts +10 -0
- package/dist/esm/api/resources/businessProducts/client/requests/GetProductInventorySummaryRequest.mjs +2 -0
- package/dist/esm/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.d.mts +11 -0
- package/dist/esm/api/resources/businessProducts/client/requests/ListVariantInventoryHistoryRequest.mjs +2 -0
- package/dist/esm/api/resources/businessProducts/client/requests/index.d.mts +3 -0
- package/dist/esm/api/resources/businessProducts/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/businessProducts/exports.d.mts +2 -0
- package/dist/esm/api/resources/businessProducts/exports.mjs +3 -0
- package/dist/esm/api/resources/businessProducts/index.d.mts +2 -0
- package/dist/esm/api/resources/businessProducts/index.mjs +2 -0
- package/dist/esm/api/resources/businessProducts/types/AdjustVariantInventoryResponse.d.mts +4 -0
- package/dist/esm/api/resources/businessProducts/types/AdjustVariantInventoryResponse.mjs +2 -0
- package/dist/esm/api/resources/businessProducts/types/GetProductInventorySummaryResponse.d.mts +4 -0
- package/dist/esm/api/resources/businessProducts/types/GetProductInventorySummaryResponse.mjs +2 -0
- package/dist/esm/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.d.mts +4 -0
- package/dist/esm/api/resources/businessProducts/types/ListVariantInventoryHistoryResponse.mjs +2 -0
- package/dist/esm/api/resources/businessProducts/types/index.d.mts +3 -0
- package/dist/esm/api/resources/businessProducts/types/index.mjs +3 -0
- package/dist/esm/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/me/client/Client.d.mts +3 -0
- package/dist/esm/api/resources/customer/resources/me/client/Client.mjs +5 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/Client.d.mts +89 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/Client.mjs +267 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/index.d.mts +1 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/index.mjs +1 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.d.mts +10 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.d.mts +19 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/exports.d.mts +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/exports.mjs +3 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/index.d.mts +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/index.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/index.d.mts +3 -0
- package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/index.mjs +3 -0
- package/dist/esm/api/resources/customer/resources/me/resources/index.d.mts +3 -0
- package/dist/esm/api/resources/customer/resources/me/resources/index.mjs +3 -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/Address.d.mts +15 -0
- package/dist/esm/api/types/Address.mjs +2 -0
- package/dist/esm/api/types/AddressCollection.d.mts +4 -0
- package/dist/esm/api/types/AddressCollection.mjs +2 -0
- package/dist/esm/api/types/BusinessInventoryLog.d.mts +15 -0
- package/dist/esm/api/types/BusinessInventoryLog.mjs +2 -0
- package/dist/esm/api/types/BusinessProductInventorySummary.d.mts +7 -0
- package/dist/esm/api/types/BusinessProductInventorySummary.mjs +2 -0
- package/dist/esm/api/types/CustomerCartItem.d.mts +1 -1
- package/dist/esm/api/types/CustomerProductOrder.d.mts +5 -5
- package/dist/esm/api/types/CustomerProductOrderItem.d.mts +2 -2
- package/dist/esm/api/types/InternalServerErrorBody.d.mts +7 -1
- package/dist/esm/api/types/InternalServerErrorBody.mjs +6 -1
- package/dist/esm/api/types/StoreAddressRequest.d.mts +12 -0
- package/dist/esm/api/types/StoreAddressRequest.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +5 -0
- package/dist/esm/api/types/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +23 -1
- package/reference.md +421 -0
|
@@ -0,0 +1,224 @@
|
|
|
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 BusinessProductsClient {
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @param {FiveOneEat.AdjustInventoryRequest} request
|
|
35
|
+
* @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
36
|
+
*
|
|
37
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
38
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
39
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
40
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* await client.businessProducts.adjustVariantInventory({
|
|
44
|
+
* variant: "variant",
|
|
45
|
+
* type: "add",
|
|
46
|
+
* quantity: 1,
|
|
47
|
+
* reason: "restock"
|
|
48
|
+
* })
|
|
49
|
+
*/
|
|
50
|
+
adjustVariantInventory(request, requestOptions) {
|
|
51
|
+
return core.HttpResponsePromise.fromPromise(this.__adjustVariantInventory(request, requestOptions));
|
|
52
|
+
}
|
|
53
|
+
__adjustVariantInventory(request, requestOptions) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
56
|
+
const { variant } = request, _body = __rest(request, ["variant"]);
|
|
57
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
58
|
+
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);
|
|
59
|
+
const _response = yield core.fetcher({
|
|
60
|
+
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/products/variants/${core.url.encodePathParam(variant)}/inventory/adjust`),
|
|
61
|
+
method: "POST",
|
|
62
|
+
headers: _headers,
|
|
63
|
+
contentType: "application/json",
|
|
64
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
65
|
+
requestType: "json",
|
|
66
|
+
body: _body,
|
|
67
|
+
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,
|
|
68
|
+
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,
|
|
69
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
70
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
71
|
+
logging: this._options.logging,
|
|
72
|
+
});
|
|
73
|
+
if (_response.ok) {
|
|
74
|
+
return {
|
|
75
|
+
data: _response.body,
|
|
76
|
+
rawResponse: _response.rawResponse,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (_response.error.reason === "status-code") {
|
|
80
|
+
switch (_response.error.statusCode) {
|
|
81
|
+
case 401:
|
|
82
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
83
|
+
case 403:
|
|
84
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
85
|
+
case 404:
|
|
86
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
87
|
+
case 422:
|
|
88
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
89
|
+
default:
|
|
90
|
+
throw new errors.FiveOneEatError({
|
|
91
|
+
statusCode: _response.error.statusCode,
|
|
92
|
+
body: _response.error.body,
|
|
93
|
+
rawResponse: _response.rawResponse,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/products/variants/{variant}/inventory/adjust");
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @param {FiveOneEat.ListVariantInventoryHistoryRequest} request
|
|
102
|
+
* @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
103
|
+
*
|
|
104
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
105
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
106
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* await client.businessProducts.listVariantInventoryHistory({
|
|
110
|
+
* variant: "variant"
|
|
111
|
+
* })
|
|
112
|
+
*/
|
|
113
|
+
listVariantInventoryHistory(request, requestOptions) {
|
|
114
|
+
return core.HttpResponsePromise.fromPromise(this.__listVariantInventoryHistory(request, requestOptions));
|
|
115
|
+
}
|
|
116
|
+
__listVariantInventoryHistory(request, requestOptions) {
|
|
117
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
119
|
+
const { variant, per_page: perPage } = request;
|
|
120
|
+
const _queryParams = {
|
|
121
|
+
per_page: perPage,
|
|
122
|
+
};
|
|
123
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
124
|
+
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);
|
|
125
|
+
const _response = yield core.fetcher({
|
|
126
|
+
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/products/variants/${core.url.encodePathParam(variant)}/inventory/history`),
|
|
127
|
+
method: "GET",
|
|
128
|
+
headers: _headers,
|
|
129
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
130
|
+
queryString: core.url
|
|
131
|
+
.queryBuilder()
|
|
132
|
+
.addMany(_queryParams)
|
|
133
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
134
|
+
.build(),
|
|
135
|
+
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,
|
|
136
|
+
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,
|
|
137
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
138
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
139
|
+
logging: this._options.logging,
|
|
140
|
+
});
|
|
141
|
+
if (_response.ok) {
|
|
142
|
+
return {
|
|
143
|
+
data: _response.body,
|
|
144
|
+
rawResponse: _response.rawResponse,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (_response.error.reason === "status-code") {
|
|
148
|
+
switch (_response.error.statusCode) {
|
|
149
|
+
case 401:
|
|
150
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
151
|
+
case 403:
|
|
152
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
153
|
+
case 404:
|
|
154
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
155
|
+
default:
|
|
156
|
+
throw new errors.FiveOneEatError({
|
|
157
|
+
statusCode: _response.error.statusCode,
|
|
158
|
+
body: _response.error.body,
|
|
159
|
+
rawResponse: _response.rawResponse,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/products/variants/{variant}/inventory/history");
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @param {FiveOneEat.GetProductInventorySummaryRequest} request
|
|
168
|
+
* @param {BusinessProductsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
169
|
+
*
|
|
170
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
171
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
172
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* await client.businessProducts.getProductInventorySummary({
|
|
176
|
+
* product: "product"
|
|
177
|
+
* })
|
|
178
|
+
*/
|
|
179
|
+
getProductInventorySummary(request, requestOptions) {
|
|
180
|
+
return core.HttpResponsePromise.fromPromise(this.__getProductInventorySummary(request, requestOptions));
|
|
181
|
+
}
|
|
182
|
+
__getProductInventorySummary(request, requestOptions) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
185
|
+
const { product } = request;
|
|
186
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
187
|
+
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);
|
|
188
|
+
const _response = yield core.fetcher({
|
|
189
|
+
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/products/${core.url.encodePathParam(product)}/inventory`),
|
|
190
|
+
method: "GET",
|
|
191
|
+
headers: _headers,
|
|
192
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
193
|
+
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,
|
|
194
|
+
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,
|
|
195
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
196
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
197
|
+
logging: this._options.logging,
|
|
198
|
+
});
|
|
199
|
+
if (_response.ok) {
|
|
200
|
+
return {
|
|
201
|
+
data: _response.body,
|
|
202
|
+
rawResponse: _response.rawResponse,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
if (_response.error.reason === "status-code") {
|
|
206
|
+
switch (_response.error.statusCode) {
|
|
207
|
+
case 401:
|
|
208
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
209
|
+
case 403:
|
|
210
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
211
|
+
case 404:
|
|
212
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
213
|
+
default:
|
|
214
|
+
throw new errors.FiveOneEatError({
|
|
215
|
+
statusCode: _response.error.statusCode,
|
|
216
|
+
body: _response.error.body,
|
|
217
|
+
rawResponse: _response.rawResponse,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/products/{product}/inventory");
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* variant: "variant",
|
|
5
|
+
* type: "add",
|
|
6
|
+
* quantity: 1,
|
|
7
|
+
* reason: "restock"
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface AdjustInventoryRequest {
|
|
11
|
+
/** The variant ID */
|
|
12
|
+
variant: string;
|
|
13
|
+
type: AdjustInventoryRequest.Type;
|
|
14
|
+
quantity: number;
|
|
15
|
+
reason: AdjustInventoryRequest.Reason;
|
|
16
|
+
notes?: string | null;
|
|
17
|
+
}
|
|
18
|
+
export declare namespace AdjustInventoryRequest {
|
|
19
|
+
const Type: {
|
|
20
|
+
readonly Add: "add";
|
|
21
|
+
readonly Subtract: "subtract";
|
|
22
|
+
readonly Set: "set";
|
|
23
|
+
};
|
|
24
|
+
type Type = (typeof Type)[keyof typeof Type];
|
|
25
|
+
const Reason: {
|
|
26
|
+
readonly Restock: "restock";
|
|
27
|
+
readonly Damaged: "damaged";
|
|
28
|
+
readonly Shrinkage: "shrinkage";
|
|
29
|
+
readonly Returned: "returned";
|
|
30
|
+
readonly Correction: "correction";
|
|
31
|
+
readonly Other: "other";
|
|
32
|
+
};
|
|
33
|
+
type Reason = (typeof Reason)[keyof typeof Reason];
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var AdjustInventoryRequest;
|
|
3
|
+
(function (AdjustInventoryRequest) {
|
|
4
|
+
AdjustInventoryRequest.Type = {
|
|
5
|
+
Add: "add",
|
|
6
|
+
Subtract: "subtract",
|
|
7
|
+
Set: "set",
|
|
8
|
+
};
|
|
9
|
+
AdjustInventoryRequest.Reason = {
|
|
10
|
+
Restock: "restock",
|
|
11
|
+
Damaged: "damaged",
|
|
12
|
+
Shrinkage: "shrinkage",
|
|
13
|
+
Returned: "returned",
|
|
14
|
+
Correction: "correction",
|
|
15
|
+
Other: "other",
|
|
16
|
+
};
|
|
17
|
+
})(AdjustInventoryRequest || (AdjustInventoryRequest = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AdjustInventoryRequest } from "./AdjustInventoryRequest.mjs";
|
package/dist/esm/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface CreatePaymentIntentCartResponse {
|
|
2
2
|
client_secret: string;
|
|
3
3
|
payment_intent_id: string;
|
|
4
|
-
subtotal:
|
|
4
|
+
subtotal: string;
|
|
5
5
|
tax_amount: string;
|
|
6
6
|
tax_calculation: CreatePaymentIntentCartResponse.TaxCalculation | null;
|
|
7
7
|
shipping_amount: string;
|
|
@@ -2,6 +2,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
3
|
import * as core from "../../../../../../core/index.mjs";
|
|
4
4
|
import * as FiveOneEat from "../../../../../index.mjs";
|
|
5
|
+
import { AddressesClient } from "../resources/addresses/client/Client.mjs";
|
|
5
6
|
import { TicketOrdersClient } from "../resources/ticketOrders/client/Client.mjs";
|
|
6
7
|
import { TicketsClient } from "../resources/tickets/client/Client.mjs";
|
|
7
8
|
export declare namespace MeClient {
|
|
@@ -13,9 +14,11 @@ export declare class MeClient {
|
|
|
13
14
|
protected readonly _options: NormalizedClientOptionsWithAuth<MeClient.Options>;
|
|
14
15
|
protected _tickets: TicketsClient | undefined;
|
|
15
16
|
protected _ticketOrders: TicketOrdersClient | undefined;
|
|
17
|
+
protected _addresses: AddressesClient | undefined;
|
|
16
18
|
constructor(options?: MeClient.Options);
|
|
17
19
|
get tickets(): TicketsClient;
|
|
18
20
|
get ticketOrders(): TicketOrdersClient;
|
|
21
|
+
get addresses(): AddressesClient;
|
|
19
22
|
/**
|
|
20
23
|
* Retrieve the authenticated user's favorited businesses with pagination.
|
|
21
24
|
*
|
|
@@ -15,6 +15,7 @@ import * as environments from "../../../../../../environments.mjs";
|
|
|
15
15
|
import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
16
|
import * as errors from "../../../../../../errors/index.mjs";
|
|
17
17
|
import * as FiveOneEat from "../../../../../index.mjs";
|
|
18
|
+
import { AddressesClient } from "../resources/addresses/client/Client.mjs";
|
|
18
19
|
import { TicketOrdersClient } from "../resources/ticketOrders/client/Client.mjs";
|
|
19
20
|
import { TicketsClient } from "../resources/tickets/client/Client.mjs";
|
|
20
21
|
export class MeClient {
|
|
@@ -29,6 +30,10 @@ export class MeClient {
|
|
|
29
30
|
var _a;
|
|
30
31
|
return ((_a = this._ticketOrders) !== null && _a !== void 0 ? _a : (this._ticketOrders = new TicketOrdersClient(this._options)));
|
|
31
32
|
}
|
|
33
|
+
get addresses() {
|
|
34
|
+
var _a;
|
|
35
|
+
return ((_a = this._addresses) !== null && _a !== void 0 ? _a : (this._addresses = new AddressesClient(this._options)));
|
|
36
|
+
}
|
|
32
37
|
/**
|
|
33
38
|
* Retrieve the authenticated user's favorited businesses with pagination.
|
|
34
39
|
*
|
|
@@ -0,0 +1,89 @@
|
|
|
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 AddressesClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class AddressesClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<AddressesClient.Options>;
|
|
12
|
+
constructor(options?: AddressesClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve all saved addresses for the authenticated user.
|
|
15
|
+
*
|
|
16
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
17
|
+
*
|
|
18
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* await client.customer.me.addresses.list()
|
|
22
|
+
*/
|
|
23
|
+
list(requestOptions?: AddressesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.me.ListAddressesResponse>;
|
|
24
|
+
private __list;
|
|
25
|
+
/**
|
|
26
|
+
* Save a new address to the authenticated user's account. If this is the first address,
|
|
27
|
+
* or if `is_default` is true, it will be set as the default (clearing any existing default).
|
|
28
|
+
*
|
|
29
|
+
* @param {FiveOneEat.StoreAddressRequest} request
|
|
30
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
31
|
+
*
|
|
32
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
33
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* await client.customer.me.addresses.create({
|
|
37
|
+
* line1: "line1",
|
|
38
|
+
* city: "city",
|
|
39
|
+
* state: "state",
|
|
40
|
+
* postal_code: "postal_code",
|
|
41
|
+
* country: "country"
|
|
42
|
+
* })
|
|
43
|
+
*/
|
|
44
|
+
create(request: FiveOneEat.StoreAddressRequest, requestOptions?: AddressesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.me.CreateAddressesResponse>;
|
|
45
|
+
private __create;
|
|
46
|
+
/**
|
|
47
|
+
* Delete a saved address. If the deleted address was the default,
|
|
48
|
+
* the most recently created remaining address is promoted to default.
|
|
49
|
+
*
|
|
50
|
+
* @param {FiveOneEat.customer.me.DeleteAddressesRequest} request
|
|
51
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
52
|
+
*
|
|
53
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
54
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
55
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* await client.customer.me.addresses.delete({
|
|
59
|
+
* address: 1
|
|
60
|
+
* })
|
|
61
|
+
*/
|
|
62
|
+
delete(request: FiveOneEat.customer.me.DeleteAddressesRequest, requestOptions?: AddressesClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
63
|
+
private __delete;
|
|
64
|
+
/**
|
|
65
|
+
* Update a saved address. If `is_default` is true, the previous default address will be cleared.
|
|
66
|
+
*
|
|
67
|
+
* @param {FiveOneEat.customer.me.UpdateAddressesRequest} request
|
|
68
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
69
|
+
*
|
|
70
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
71
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
72
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
73
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* await client.customer.me.addresses.update({
|
|
77
|
+
* address: 1,
|
|
78
|
+
* body: {
|
|
79
|
+
* line1: "line1",
|
|
80
|
+
* city: "city",
|
|
81
|
+
* state: "state",
|
|
82
|
+
* postal_code: "postal_code",
|
|
83
|
+
* country: "country"
|
|
84
|
+
* }
|
|
85
|
+
* })
|
|
86
|
+
*/
|
|
87
|
+
update(request: FiveOneEat.customer.me.UpdateAddressesRequest, requestOptions?: AddressesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.me.UpdateAddressesResponse>;
|
|
88
|
+
private __update;
|
|
89
|
+
}
|