@51eat/sdk 0.0.46 → 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/dist/cjs/BaseClient.js +2 -2
- 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/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/StoreAddressRequest.d.ts +12 -0
- package/dist/cjs/api/types/StoreAddressRequest.js +3 -0
- package/dist/cjs/api/types/index.d.ts +3 -0
- package/dist/cjs/api/types/index.js +3 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/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/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/StoreAddressRequest.d.mts +12 -0
- package/dist/esm/api/types/StoreAddressRequest.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +3 -0
- package/dist/esm/api/types/index.mjs +3 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +12 -1
- package/reference.md +264 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@51eat/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "0.0.
|
|
47
|
-
"User-Agent": "@51eat/sdk/0.0.
|
|
46
|
+
"X-Fern-SDK-Version": "0.0.47",
|
|
47
|
+
"User-Agent": "@51eat/sdk/0.0.47",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -2,6 +2,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
|
|
3
3
|
import * as core from "../../../../../../core/index.js";
|
|
4
4
|
import * as FiveOneEat from "../../../../../index.js";
|
|
5
|
+
import { AddressesClient } from "../resources/addresses/client/Client.js";
|
|
5
6
|
import { TicketOrdersClient } from "../resources/ticketOrders/client/Client.js";
|
|
6
7
|
import { TicketsClient } from "../resources/tickets/client/Client.js";
|
|
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
|
*
|
|
@@ -51,19 +51,24 @@ const environments = __importStar(require("../../../../../../environments.js"));
|
|
|
51
51
|
const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
|
|
52
52
|
const errors = __importStar(require("../../../../../../errors/index.js"));
|
|
53
53
|
const FiveOneEat = __importStar(require("../../../../../index.js"));
|
|
54
|
-
const Client_js_1 = require("../resources/
|
|
55
|
-
const Client_js_2 = require("../resources/
|
|
54
|
+
const Client_js_1 = require("../resources/addresses/client/Client.js");
|
|
55
|
+
const Client_js_2 = require("../resources/ticketOrders/client/Client.js");
|
|
56
|
+
const Client_js_3 = require("../resources/tickets/client/Client.js");
|
|
56
57
|
class MeClient {
|
|
57
58
|
constructor(options = {}) {
|
|
58
59
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
59
60
|
}
|
|
60
61
|
get tickets() {
|
|
61
62
|
var _a;
|
|
62
|
-
return ((_a = this._tickets) !== null && _a !== void 0 ? _a : (this._tickets = new
|
|
63
|
+
return ((_a = this._tickets) !== null && _a !== void 0 ? _a : (this._tickets = new Client_js_3.TicketsClient(this._options)));
|
|
63
64
|
}
|
|
64
65
|
get ticketOrders() {
|
|
65
66
|
var _a;
|
|
66
|
-
return ((_a = this._ticketOrders) !== null && _a !== void 0 ? _a : (this._ticketOrders = new
|
|
67
|
+
return ((_a = this._ticketOrders) !== null && _a !== void 0 ? _a : (this._ticketOrders = new Client_js_2.TicketOrdersClient(this._options)));
|
|
68
|
+
}
|
|
69
|
+
get addresses() {
|
|
70
|
+
var _a;
|
|
71
|
+
return ((_a = this._addresses) !== null && _a !== void 0 ? _a : (this._addresses = new Client_js_1.AddressesClient(this._options)));
|
|
67
72
|
}
|
|
68
73
|
/**
|
|
69
74
|
* Retrieve the authenticated user's favorited businesses with pagination.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.js";
|
|
2
|
+
import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../BaseClient.js";
|
|
3
|
+
import * as core from "../../../../../../../../core/index.js";
|
|
4
|
+
import * as FiveOneEat from "../../../../../../../index.js";
|
|
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
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.AddressesClient = void 0;
|
|
47
|
+
const BaseClient_js_1 = require("../../../../../../../../BaseClient.js");
|
|
48
|
+
const headers_js_1 = require("../../../../../../../../core/headers.js");
|
|
49
|
+
const core = __importStar(require("../../../../../../../../core/index.js"));
|
|
50
|
+
const environments = __importStar(require("../../../../../../../../environments.js"));
|
|
51
|
+
const handleNonStatusCodeError_js_1 = require("../../../../../../../../errors/handleNonStatusCodeError.js");
|
|
52
|
+
const errors = __importStar(require("../../../../../../../../errors/index.js"));
|
|
53
|
+
const FiveOneEat = __importStar(require("../../../../../../../index.js"));
|
|
54
|
+
class AddressesClient {
|
|
55
|
+
constructor(options = {}) {
|
|
56
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Retrieve all saved addresses for the authenticated user.
|
|
60
|
+
*
|
|
61
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
62
|
+
*
|
|
63
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* await client.customer.me.addresses.list()
|
|
67
|
+
*/
|
|
68
|
+
list(requestOptions) {
|
|
69
|
+
return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
|
|
70
|
+
}
|
|
71
|
+
__list(requestOptions) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
74
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
75
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
76
|
+
const _response = yield core.fetcher({
|
|
77
|
+
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"),
|
|
78
|
+
method: "GET",
|
|
79
|
+
headers: _headers,
|
|
80
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
81
|
+
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,
|
|
82
|
+
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,
|
|
83
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
84
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
85
|
+
logging: this._options.logging,
|
|
86
|
+
});
|
|
87
|
+
if (_response.ok) {
|
|
88
|
+
return {
|
|
89
|
+
data: _response.body,
|
|
90
|
+
rawResponse: _response.rawResponse,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (_response.error.reason === "status-code") {
|
|
94
|
+
switch (_response.error.statusCode) {
|
|
95
|
+
case 401:
|
|
96
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
97
|
+
default:
|
|
98
|
+
throw new errors.FiveOneEatError({
|
|
99
|
+
statusCode: _response.error.statusCode,
|
|
100
|
+
body: _response.error.body,
|
|
101
|
+
rawResponse: _response.rawResponse,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/customer/addresses");
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Save a new address to the authenticated user's account. If this is the first address,
|
|
110
|
+
* or if `is_default` is true, it will be set as the default (clearing any existing default).
|
|
111
|
+
*
|
|
112
|
+
* @param {FiveOneEat.StoreAddressRequest} request
|
|
113
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
114
|
+
*
|
|
115
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
116
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* await client.customer.me.addresses.create({
|
|
120
|
+
* line1: "line1",
|
|
121
|
+
* city: "city",
|
|
122
|
+
* state: "state",
|
|
123
|
+
* postal_code: "postal_code",
|
|
124
|
+
* country: "country"
|
|
125
|
+
* })
|
|
126
|
+
*/
|
|
127
|
+
create(request, requestOptions) {
|
|
128
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
129
|
+
}
|
|
130
|
+
__create(request, requestOptions) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
133
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
134
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
135
|
+
const _response = yield core.fetcher({
|
|
136
|
+
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"),
|
|
137
|
+
method: "POST",
|
|
138
|
+
headers: _headers,
|
|
139
|
+
contentType: "application/json",
|
|
140
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
141
|
+
requestType: "json",
|
|
142
|
+
body: request,
|
|
143
|
+
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,
|
|
144
|
+
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,
|
|
145
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
146
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
147
|
+
logging: this._options.logging,
|
|
148
|
+
});
|
|
149
|
+
if (_response.ok) {
|
|
150
|
+
return {
|
|
151
|
+
data: _response.body,
|
|
152
|
+
rawResponse: _response.rawResponse,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (_response.error.reason === "status-code") {
|
|
156
|
+
switch (_response.error.statusCode) {
|
|
157
|
+
case 401:
|
|
158
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
159
|
+
case 422:
|
|
160
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
161
|
+
default:
|
|
162
|
+
throw new errors.FiveOneEatError({
|
|
163
|
+
statusCode: _response.error.statusCode,
|
|
164
|
+
body: _response.error.body,
|
|
165
|
+
rawResponse: _response.rawResponse,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/addresses");
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Delete a saved address. If the deleted address was the default,
|
|
174
|
+
* the most recently created remaining address is promoted to default.
|
|
175
|
+
*
|
|
176
|
+
* @param {FiveOneEat.customer.me.DeleteAddressesRequest} request
|
|
177
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
178
|
+
*
|
|
179
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
180
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
181
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* await client.customer.me.addresses.delete({
|
|
185
|
+
* address: 1
|
|
186
|
+
* })
|
|
187
|
+
*/
|
|
188
|
+
delete(request, requestOptions) {
|
|
189
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
|
|
190
|
+
}
|
|
191
|
+
__delete(request, requestOptions) {
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
194
|
+
const { address } = request;
|
|
195
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
196
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
197
|
+
const _response = yield core.fetcher({
|
|
198
|
+
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)}`),
|
|
199
|
+
method: "DELETE",
|
|
200
|
+
headers: _headers,
|
|
201
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
202
|
+
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,
|
|
203
|
+
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,
|
|
204
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
205
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
206
|
+
logging: this._options.logging,
|
|
207
|
+
});
|
|
208
|
+
if (_response.ok) {
|
|
209
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
210
|
+
}
|
|
211
|
+
if (_response.error.reason === "status-code") {
|
|
212
|
+
switch (_response.error.statusCode) {
|
|
213
|
+
case 401:
|
|
214
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
215
|
+
case 403:
|
|
216
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
217
|
+
case 404:
|
|
218
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
219
|
+
default:
|
|
220
|
+
throw new errors.FiveOneEatError({
|
|
221
|
+
statusCode: _response.error.statusCode,
|
|
222
|
+
body: _response.error.body,
|
|
223
|
+
rawResponse: _response.rawResponse,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/customer/addresses/{address}");
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Update a saved address. If `is_default` is true, the previous default address will be cleared.
|
|
232
|
+
*
|
|
233
|
+
* @param {FiveOneEat.customer.me.UpdateAddressesRequest} request
|
|
234
|
+
* @param {AddressesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
235
|
+
*
|
|
236
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
237
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
238
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
239
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* await client.customer.me.addresses.update({
|
|
243
|
+
* address: 1,
|
|
244
|
+
* body: {
|
|
245
|
+
* line1: "line1",
|
|
246
|
+
* city: "city",
|
|
247
|
+
* state: "state",
|
|
248
|
+
* postal_code: "postal_code",
|
|
249
|
+
* country: "country"
|
|
250
|
+
* }
|
|
251
|
+
* })
|
|
252
|
+
*/
|
|
253
|
+
update(request, requestOptions) {
|
|
254
|
+
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
255
|
+
}
|
|
256
|
+
__update(request, requestOptions) {
|
|
257
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
259
|
+
const { address, body: _body } = request;
|
|
260
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
261
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
262
|
+
const _response = yield core.fetcher({
|
|
263
|
+
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)}`),
|
|
264
|
+
method: "PATCH",
|
|
265
|
+
headers: _headers,
|
|
266
|
+
contentType: "application/json",
|
|
267
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
268
|
+
requestType: "json",
|
|
269
|
+
body: _body,
|
|
270
|
+
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,
|
|
271
|
+
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,
|
|
272
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
273
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
274
|
+
logging: this._options.logging,
|
|
275
|
+
});
|
|
276
|
+
if (_response.ok) {
|
|
277
|
+
return {
|
|
278
|
+
data: _response.body,
|
|
279
|
+
rawResponse: _response.rawResponse,
|
|
280
|
+
};
|
|
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 403:
|
|
287
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
288
|
+
case 404:
|
|
289
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
290
|
+
case 422:
|
|
291
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
292
|
+
default:
|
|
293
|
+
throw new errors.FiveOneEatError({
|
|
294
|
+
statusCode: _response.error.statusCode,
|
|
295
|
+
body: _response.error.body,
|
|
296
|
+
rawResponse: _response.rawResponse,
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/customer/addresses/{address}");
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
exports.AddressesClient = AddressesClient;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests/index.js"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as FiveOneEat from "../../../../../../../../index.js";
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AddressesClient = void 0;
|
|
19
|
+
var Client_js_1 = require("./client/Client.js");
|
|
20
|
+
Object.defineProperty(exports, "AddressesClient", { enumerable: true, get: function () { return Client_js_1.AddressesClient; } });
|
|
21
|
+
__exportStar(require("./client/index.js"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client/index.js"), exports);
|
|
18
|
+
__exportStar(require("./types/index.js"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./CreateAddressesResponse.js"), exports);
|
|
18
|
+
__exportStar(require("./ListAddressesResponse.js"), exports);
|
|
19
|
+
__exportStar(require("./UpdateAddressesResponse.js"), exports);
|