@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,267 @@
|
|
|
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
|
+
import { normalizeClientOptionsWithAuth, } from "../../../../../../../../BaseClient.mjs";
|
|
12
|
+
import { mergeHeaders } from "../../../../../../../../core/headers.mjs";
|
|
13
|
+
import * as core from "../../../../../../../../core/index.mjs";
|
|
14
|
+
import * as environments from "../../../../../../../../environments.mjs";
|
|
15
|
+
import { handleNonStatusCodeError } from "../../../../../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
+
import * as errors from "../../../../../../../../errors/index.mjs";
|
|
17
|
+
import * as FiveOneEat from "../../../../../../../index.mjs";
|
|
18
|
+
export class AddressesClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieve all saved addresses for the authenticated user.
|
|
24
|
+
*
|
|
25
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
26
|
+
*
|
|
27
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* await client.customer.me.addresses.list()
|
|
31
|
+
*/
|
|
32
|
+
list(requestOptions) {
|
|
33
|
+
return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
|
|
34
|
+
}
|
|
35
|
+
__list(requestOptions) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
38
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
39
|
+
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);
|
|
40
|
+
const _response = yield core.fetcher({
|
|
41
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "customer/addresses"),
|
|
42
|
+
method: "GET",
|
|
43
|
+
headers: _headers,
|
|
44
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
45
|
+
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,
|
|
46
|
+
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,
|
|
47
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
48
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
49
|
+
logging: this._options.logging,
|
|
50
|
+
});
|
|
51
|
+
if (_response.ok) {
|
|
52
|
+
return {
|
|
53
|
+
data: _response.body,
|
|
54
|
+
rawResponse: _response.rawResponse,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (_response.error.reason === "status-code") {
|
|
58
|
+
switch (_response.error.statusCode) {
|
|
59
|
+
case 401:
|
|
60
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
61
|
+
default:
|
|
62
|
+
throw new errors.FiveOneEatError({
|
|
63
|
+
statusCode: _response.error.statusCode,
|
|
64
|
+
body: _response.error.body,
|
|
65
|
+
rawResponse: _response.rawResponse,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/customer/addresses");
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Save a new address to the authenticated user's account. If this is the first address,
|
|
74
|
+
* or if `is_default` is true, it will be set as the default (clearing any existing default).
|
|
75
|
+
*
|
|
76
|
+
* @param {FiveOneEat.StoreAddressRequest} request
|
|
77
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
78
|
+
*
|
|
79
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
80
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* await client.customer.me.addresses.create({
|
|
84
|
+
* line1: "line1",
|
|
85
|
+
* city: "city",
|
|
86
|
+
* state: "state",
|
|
87
|
+
* postal_code: "postal_code",
|
|
88
|
+
* country: "country"
|
|
89
|
+
* })
|
|
90
|
+
*/
|
|
91
|
+
create(request, requestOptions) {
|
|
92
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
93
|
+
}
|
|
94
|
+
__create(request, requestOptions) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
97
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
98
|
+
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);
|
|
99
|
+
const _response = yield core.fetcher({
|
|
100
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "customer/addresses"),
|
|
101
|
+
method: "POST",
|
|
102
|
+
headers: _headers,
|
|
103
|
+
contentType: "application/json",
|
|
104
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
105
|
+
requestType: "json",
|
|
106
|
+
body: request,
|
|
107
|
+
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,
|
|
108
|
+
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,
|
|
109
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
110
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
111
|
+
logging: this._options.logging,
|
|
112
|
+
});
|
|
113
|
+
if (_response.ok) {
|
|
114
|
+
return {
|
|
115
|
+
data: _response.body,
|
|
116
|
+
rawResponse: _response.rawResponse,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (_response.error.reason === "status-code") {
|
|
120
|
+
switch (_response.error.statusCode) {
|
|
121
|
+
case 401:
|
|
122
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
123
|
+
case 422:
|
|
124
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
125
|
+
default:
|
|
126
|
+
throw new errors.FiveOneEatError({
|
|
127
|
+
statusCode: _response.error.statusCode,
|
|
128
|
+
body: _response.error.body,
|
|
129
|
+
rawResponse: _response.rawResponse,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/addresses");
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Delete a saved address. If the deleted address was the default,
|
|
138
|
+
* the most recently created remaining address is promoted to default.
|
|
139
|
+
*
|
|
140
|
+
* @param {FiveOneEat.customer.me.DeleteAddressesRequest} request
|
|
141
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
142
|
+
*
|
|
143
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
144
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
145
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* await client.customer.me.addresses.delete({
|
|
149
|
+
* address: 1
|
|
150
|
+
* })
|
|
151
|
+
*/
|
|
152
|
+
delete(request, requestOptions) {
|
|
153
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
|
|
154
|
+
}
|
|
155
|
+
__delete(request, requestOptions) {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
158
|
+
const { address } = request;
|
|
159
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
160
|
+
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);
|
|
161
|
+
const _response = yield core.fetcher({
|
|
162
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/addresses/${core.url.encodePathParam(address)}`),
|
|
163
|
+
method: "DELETE",
|
|
164
|
+
headers: _headers,
|
|
165
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
166
|
+
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,
|
|
167
|
+
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,
|
|
168
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
169
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
170
|
+
logging: this._options.logging,
|
|
171
|
+
});
|
|
172
|
+
if (_response.ok) {
|
|
173
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
174
|
+
}
|
|
175
|
+
if (_response.error.reason === "status-code") {
|
|
176
|
+
switch (_response.error.statusCode) {
|
|
177
|
+
case 401:
|
|
178
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
179
|
+
case 403:
|
|
180
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
181
|
+
case 404:
|
|
182
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
183
|
+
default:
|
|
184
|
+
throw new errors.FiveOneEatError({
|
|
185
|
+
statusCode: _response.error.statusCode,
|
|
186
|
+
body: _response.error.body,
|
|
187
|
+
rawResponse: _response.rawResponse,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/customer/addresses/{address}");
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Update a saved address. If `is_default` is true, the previous default address will be cleared.
|
|
196
|
+
*
|
|
197
|
+
* @param {FiveOneEat.customer.me.UpdateAddressesRequest} request
|
|
198
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
199
|
+
*
|
|
200
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
201
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
202
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
203
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* await client.customer.me.addresses.update({
|
|
207
|
+
* address: 1,
|
|
208
|
+
* body: {
|
|
209
|
+
* line1: "line1",
|
|
210
|
+
* city: "city",
|
|
211
|
+
* state: "state",
|
|
212
|
+
* postal_code: "postal_code",
|
|
213
|
+
* country: "country"
|
|
214
|
+
* }
|
|
215
|
+
* })
|
|
216
|
+
*/
|
|
217
|
+
update(request, requestOptions) {
|
|
218
|
+
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
219
|
+
}
|
|
220
|
+
__update(request, requestOptions) {
|
|
221
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
222
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
223
|
+
const { address, body: _body } = request;
|
|
224
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
225
|
+
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);
|
|
226
|
+
const _response = yield core.fetcher({
|
|
227
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/addresses/${core.url.encodePathParam(address)}`),
|
|
228
|
+
method: "PATCH",
|
|
229
|
+
headers: _headers,
|
|
230
|
+
contentType: "application/json",
|
|
231
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
232
|
+
requestType: "json",
|
|
233
|
+
body: _body,
|
|
234
|
+
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,
|
|
235
|
+
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,
|
|
236
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
237
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
238
|
+
logging: this._options.logging,
|
|
239
|
+
});
|
|
240
|
+
if (_response.ok) {
|
|
241
|
+
return {
|
|
242
|
+
data: _response.body,
|
|
243
|
+
rawResponse: _response.rawResponse,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
if (_response.error.reason === "status-code") {
|
|
247
|
+
switch (_response.error.statusCode) {
|
|
248
|
+
case 401:
|
|
249
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
250
|
+
case 403:
|
|
251
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
252
|
+
case 404:
|
|
253
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
254
|
+
case 422:
|
|
255
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
256
|
+
default:
|
|
257
|
+
throw new errors.FiveOneEatError({
|
|
258
|
+
statusCode: _response.error.statusCode,
|
|
259
|
+
body: _response.error.body,
|
|
260
|
+
rawResponse: _response.rawResponse,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/customer/addresses/{address}");
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as FiveOneEat from "../../../../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* address: 1,
|
|
6
|
+
* body: {
|
|
7
|
+
* line1: "line1",
|
|
8
|
+
* city: "city",
|
|
9
|
+
* state: "state",
|
|
10
|
+
* postal_code: "postal_code",
|
|
11
|
+
* country: "country"
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export interface UpdateAddressesRequest {
|
|
16
|
+
/** The address ID */
|
|
17
|
+
address: number;
|
|
18
|
+
body: FiveOneEat.StoreAddressRequest;
|
|
19
|
+
}
|
package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export * from "./addresses/client/requests/index.mjs";
|
|
2
|
+
export * as addresses from "./addresses/index.mjs";
|
|
3
|
+
export * from "./addresses/types/index.mjs";
|
|
1
4
|
export * from "./ticketOrders/client/requests/index.mjs";
|
|
2
5
|
export * as ticketOrders from "./ticketOrders/index.mjs";
|
|
3
6
|
export * from "./ticketOrders/types/index.mjs";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export * from "./addresses/client/requests/index.mjs";
|
|
2
|
+
export * as addresses from "./addresses/index.mjs";
|
|
3
|
+
export * from "./addresses/types/index.mjs";
|
|
1
4
|
export * from "./ticketOrders/client/requests/index.mjs";
|
|
2
5
|
export * as ticketOrders from "./ticketOrders/index.mjs";
|
|
3
6
|
export * from "./ticketOrders/types/index.mjs";
|
|
@@ -2,6 +2,9 @@ export * as business from "./business/index.mjs";
|
|
|
2
2
|
export * from "./businessMessaging/client/requests/index.mjs";
|
|
3
3
|
export * as businessMessaging from "./businessMessaging/index.mjs";
|
|
4
4
|
export * from "./businessMessaging/types/index.mjs";
|
|
5
|
+
export * from "./businessProducts/client/requests/index.mjs";
|
|
6
|
+
export * as businessProducts from "./businessProducts/index.mjs";
|
|
7
|
+
export * from "./businessProducts/types/index.mjs";
|
|
5
8
|
export * from "./customer/client/requests/index.mjs";
|
|
6
9
|
export * as customer from "./customer/index.mjs";
|
|
7
10
|
export * from "./customer/types/index.mjs";
|
|
@@ -2,6 +2,9 @@ export * as business from "./business/index.mjs";
|
|
|
2
2
|
export * from "./businessMessaging/client/requests/index.mjs";
|
|
3
3
|
export * as businessMessaging from "./businessMessaging/index.mjs";
|
|
4
4
|
export * from "./businessMessaging/types/index.mjs";
|
|
5
|
+
export * from "./businessProducts/client/requests/index.mjs";
|
|
6
|
+
export * as businessProducts from "./businessProducts/index.mjs";
|
|
7
|
+
export * from "./businessProducts/types/index.mjs";
|
|
5
8
|
export * from "./customer/client/requests/index.mjs";
|
|
6
9
|
export * as customer from "./customer/index.mjs";
|
|
7
10
|
export * from "./customer/types/index.mjs";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Address {
|
|
2
|
+
id: number;
|
|
3
|
+
label: string | null;
|
|
4
|
+
line1: string;
|
|
5
|
+
line2: string | null;
|
|
6
|
+
city: string;
|
|
7
|
+
state: string;
|
|
8
|
+
postal_code: string;
|
|
9
|
+
country: string;
|
|
10
|
+
latitude: number | null;
|
|
11
|
+
longitude: number | null;
|
|
12
|
+
is_default: boolean;
|
|
13
|
+
created_at: string | null;
|
|
14
|
+
updated_at: string | null;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface BusinessInventoryLog {
|
|
2
|
+
id: string;
|
|
3
|
+
change_type: string;
|
|
4
|
+
quantity_change: number;
|
|
5
|
+
quantity_after: number;
|
|
6
|
+
notes: string | null;
|
|
7
|
+
created_by?: BusinessInventoryLog.CreatedBy | undefined;
|
|
8
|
+
created_at: string;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace BusinessInventoryLog {
|
|
11
|
+
interface CreatedBy {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -5,11 +5,11 @@ export interface CustomerProductOrder {
|
|
|
5
5
|
status: string;
|
|
6
6
|
fulfillment_status: string;
|
|
7
7
|
fulfillment_method: string;
|
|
8
|
-
subtotal:
|
|
9
|
-
tax_amount:
|
|
10
|
-
shipping_amount:
|
|
11
|
-
discount_amount:
|
|
12
|
-
total_amount:
|
|
8
|
+
subtotal: string;
|
|
9
|
+
tax_amount: string;
|
|
10
|
+
shipping_amount: string;
|
|
11
|
+
discount_amount: string;
|
|
12
|
+
total_amount: string;
|
|
13
13
|
tracking_number: string | null;
|
|
14
14
|
tracking_url: string | null;
|
|
15
15
|
shipping_address: unknown[] | null;
|
|
@@ -3,8 +3,8 @@ export interface CustomerProductOrderItem {
|
|
|
3
3
|
product_id: string;
|
|
4
4
|
variant_id: string | null;
|
|
5
5
|
quantity: number;
|
|
6
|
-
unit_price:
|
|
7
|
-
total_price:
|
|
6
|
+
unit_price: string;
|
|
7
|
+
total_price: string;
|
|
8
8
|
product_snapshot: unknown[] | null;
|
|
9
9
|
product?: CustomerProductOrderItem.Product | undefined;
|
|
10
10
|
variant?: (CustomerProductOrderItem.Variant | null) | undefined;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export interface InternalServerErrorBody {
|
|
2
|
-
message:
|
|
2
|
+
message: InternalServerErrorBody.Message;
|
|
3
|
+
}
|
|
4
|
+
export declare namespace InternalServerErrorBody {
|
|
5
|
+
const Message: {
|
|
6
|
+
readonly UnableToProcessPaymentPleaseTryAgain: "Unable to process payment. Please try again.";
|
|
7
|
+
};
|
|
8
|
+
type Message = (typeof Message)[keyof typeof Message];
|
|
3
9
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
export
|
|
2
|
+
export var InternalServerErrorBody;
|
|
3
|
+
(function (InternalServerErrorBody) {
|
|
4
|
+
InternalServerErrorBody.Message = {
|
|
5
|
+
UnableToProcessPaymentPleaseTryAgain: "Unable to process payment. Please try again.",
|
|
6
|
+
};
|
|
7
|
+
})(InternalServerErrorBody || (InternalServerErrorBody = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface StoreAddressRequest {
|
|
2
|
+
label?: (string | null) | undefined;
|
|
3
|
+
line1: string;
|
|
4
|
+
line2?: (string | null) | undefined;
|
|
5
|
+
city: string;
|
|
6
|
+
state: string;
|
|
7
|
+
postal_code: string;
|
|
8
|
+
country: string;
|
|
9
|
+
latitude?: (number | null) | undefined;
|
|
10
|
+
longitude?: (number | null) | undefined;
|
|
11
|
+
is_default?: boolean | undefined;
|
|
12
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from "./Ad.mjs";
|
|
2
|
+
export * from "./Address.mjs";
|
|
3
|
+
export * from "./AddressCollection.mjs";
|
|
2
4
|
export * from "./Allergen.mjs";
|
|
3
5
|
export * from "./BardBlockquoteNode.mjs";
|
|
4
6
|
export * from "./BardBody.mjs";
|
|
@@ -40,6 +42,7 @@ export * from "./BusinessEventOrderDetail.mjs";
|
|
|
40
42
|
export * from "./BusinessEventRsvp.mjs";
|
|
41
43
|
export * from "./BusinessEventSalesSummary.mjs";
|
|
42
44
|
export * from "./BusinessEventTicketType.mjs";
|
|
45
|
+
export * from "./BusinessInventoryLog.mjs";
|
|
43
46
|
export * from "./BusinessLoginResponse.mjs";
|
|
44
47
|
export * from "./BusinessMe.mjs";
|
|
45
48
|
export * from "./BusinessMenu.mjs";
|
|
@@ -51,6 +54,7 @@ export * from "./BusinessMessage.mjs";
|
|
|
51
54
|
export * from "./BusinessPhoto.mjs";
|
|
52
55
|
export * from "./BusinessProduct.mjs";
|
|
53
56
|
export * from "./BusinessProductCategory.mjs";
|
|
57
|
+
export * from "./BusinessProductInventorySummary.mjs";
|
|
54
58
|
export * from "./BusinessProductOrder.mjs";
|
|
55
59
|
export * from "./BusinessProductOrderItem.mjs";
|
|
56
60
|
export * from "./BusinessProductVariant.mjs";
|
|
@@ -127,6 +131,7 @@ export * from "./RsvpItem.mjs";
|
|
|
127
131
|
export * from "./RsvpResponse.mjs";
|
|
128
132
|
export * from "./SearchResults.mjs";
|
|
129
133
|
export * from "./ServiceUnavailableErrorBody.mjs";
|
|
134
|
+
export * from "./StoreAddressRequest.mjs";
|
|
130
135
|
export * from "./StoreProductImageRequest.mjs";
|
|
131
136
|
export * from "./Ticket.mjs";
|
|
132
137
|
export * from "./TicketOrder.mjs";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from "./Ad.mjs";
|
|
2
|
+
export * from "./Address.mjs";
|
|
3
|
+
export * from "./AddressCollection.mjs";
|
|
2
4
|
export * from "./Allergen.mjs";
|
|
3
5
|
export * from "./BardBlockquoteNode.mjs";
|
|
4
6
|
export * from "./BardBody.mjs";
|
|
@@ -40,6 +42,7 @@ export * from "./BusinessEventOrderDetail.mjs";
|
|
|
40
42
|
export * from "./BusinessEventRsvp.mjs";
|
|
41
43
|
export * from "./BusinessEventSalesSummary.mjs";
|
|
42
44
|
export * from "./BusinessEventTicketType.mjs";
|
|
45
|
+
export * from "./BusinessInventoryLog.mjs";
|
|
43
46
|
export * from "./BusinessLoginResponse.mjs";
|
|
44
47
|
export * from "./BusinessMe.mjs";
|
|
45
48
|
export * from "./BusinessMenu.mjs";
|
|
@@ -51,6 +54,7 @@ export * from "./BusinessMessage.mjs";
|
|
|
51
54
|
export * from "./BusinessPhoto.mjs";
|
|
52
55
|
export * from "./BusinessProduct.mjs";
|
|
53
56
|
export * from "./BusinessProductCategory.mjs";
|
|
57
|
+
export * from "./BusinessProductInventorySummary.mjs";
|
|
54
58
|
export * from "./BusinessProductOrder.mjs";
|
|
55
59
|
export * from "./BusinessProductOrderItem.mjs";
|
|
56
60
|
export * from "./BusinessProductVariant.mjs";
|
|
@@ -127,6 +131,7 @@ export * from "./RsvpItem.mjs";
|
|
|
127
131
|
export * from "./RsvpResponse.mjs";
|
|
128
132
|
export * from "./SearchResults.mjs";
|
|
129
133
|
export * from "./ServiceUnavailableErrorBody.mjs";
|
|
134
|
+
export * from "./StoreAddressRequest.mjs";
|
|
130
135
|
export * from "./StoreProductImageRequest.mjs";
|
|
131
136
|
export * from "./Ticket.mjs";
|
|
132
137
|
export * from "./TicketOrder.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.47";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.0.
|
|
1
|
+
export const SDK_VERSION = "0.0.47";
|