@51eat/sdk 0.0.23 → 0.0.24
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/business/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/business/client/Client.js +4 -4
- package/dist/cjs/api/resources/business/resources/businesses/client/Client.d.ts +49 -8
- package/dist/cjs/api/resources/business/resources/businesses/client/Client.js +164 -41
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/ListBusinessesRequest.d.ts +10 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.d.ts +50 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.js +24 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.d.ts +62 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.js +24 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/index.d.ts +3 -1
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/index.js +5 -0
- package/dist/cjs/api/resources/business/resources/businesses/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/businesses/index.js +1 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/GetBusinessesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/GetBusinessesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/ListBusinessesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/ListBusinessesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/index.d.ts +3 -0
- package/dist/cjs/api/resources/business/resources/businesses/types/index.js +19 -0
- package/dist/cjs/api/resources/business/resources/categories/client/Client.d.ts +7 -1
- package/dist/cjs/api/resources/business/resources/categories/client/Client.js +20 -6
- package/dist/cjs/api/resources/business/resources/categories/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/categories/index.js +1 -0
- package/dist/cjs/api/resources/business/resources/categories/types/ListCategoriesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/categories/types/ListCategoriesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/categories/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/categories/types/index.js +17 -0
- package/dist/cjs/api/resources/business/resources/certifications/client/Client.d.ts +7 -1
- package/dist/cjs/api/resources/business/resources/certifications/client/Client.js +20 -6
- package/dist/cjs/api/resources/business/resources/certifications/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/certifications/index.js +1 -0
- package/dist/cjs/api/resources/business/resources/certifications/types/ListCertificationsResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/certifications/types/ListCertificationsResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/certifications/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/certifications/types/index.js +17 -0
- package/dist/cjs/api/resources/business/resources/cuisines/client/Client.d.ts +7 -1
- package/dist/cjs/api/resources/business/resources/cuisines/client/Client.js +20 -6
- package/dist/cjs/api/resources/business/resources/cuisines/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/cuisines/index.js +1 -0
- package/dist/cjs/api/resources/business/resources/cuisines/types/ListCuisinesResponse.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/cuisines/types/ListCuisinesResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/cuisines/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/cuisines/types/index.js +17 -0
- package/dist/cjs/api/resources/business/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/index.js +4 -0
- package/dist/cjs/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customer/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/customer/client/Client.js +3 -3
- package/dist/cjs/api/resources/customer/client/requests/SearchCustomerRequest.d.ts +3 -3
- package/dist/cjs/api/resources/customer/resources/discovery/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/customer/resources/discovery/client/Client.js +1 -1
- package/dist/cjs/api/types/BusinessCategory.d.ts +9 -0
- package/dist/cjs/api/types/BusinessCategory.js +3 -0
- package/dist/cjs/api/types/BusinessCertification.d.ts +7 -0
- package/dist/cjs/api/types/BusinessCertification.js +3 -0
- package/dist/cjs/api/types/BusinessCuisine.d.ts +6 -0
- package/dist/cjs/api/types/BusinessCuisine.js +3 -0
- package/dist/cjs/api/types/BusinessProfile.d.ts +1 -1
- package/dist/cjs/api/types/BusinessSearchResult.d.ts +2 -1
- package/dist/cjs/api/types/BusinessSummary.d.ts +2 -1
- package/dist/cjs/api/types/CustomerBusinessProfile.d.ts +1 -1
- package/dist/cjs/api/types/DiscoveryBusiness.d.ts +2 -1
- package/dist/cjs/api/types/DiscoveryCategory.d.ts +6 -2
- package/dist/cjs/api/types/ExploreBusiness.d.ts +2 -1
- 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/business/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/business/client/Client.mjs +4 -4
- package/dist/esm/api/resources/business/resources/businesses/client/Client.d.mts +49 -8
- package/dist/esm/api/resources/business/resources/businesses/client/Client.mjs +164 -41
- package/dist/esm/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/ListBusinessesRequest.d.mts +10 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.d.mts +50 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.mjs +21 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.d.mts +62 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.mjs +21 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/index.d.mts +3 -1
- package/dist/esm/api/resources/business/resources/businesses/client/requests/index.mjs +2 -1
- package/dist/esm/api/resources/business/resources/businesses/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/businesses/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/businesses/types/GetBusinessesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/businesses/types/GetBusinessesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/businesses/types/ListBusinessesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/businesses/types/ListBusinessesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/businesses/types/index.d.mts +3 -0
- package/dist/esm/api/resources/business/resources/businesses/types/index.mjs +3 -0
- package/dist/esm/api/resources/business/resources/categories/client/Client.d.mts +7 -1
- package/dist/esm/api/resources/business/resources/categories/client/Client.mjs +20 -6
- package/dist/esm/api/resources/business/resources/categories/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/categories/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/categories/types/ListCategoriesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/categories/types/ListCategoriesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/categories/types/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/categories/types/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/certifications/client/Client.d.mts +7 -1
- package/dist/esm/api/resources/business/resources/certifications/client/Client.mjs +20 -6
- package/dist/esm/api/resources/business/resources/certifications/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/certifications/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/certifications/types/ListCertificationsResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/certifications/types/ListCertificationsResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/certifications/types/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/certifications/types/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/cuisines/client/Client.d.mts +7 -1
- package/dist/esm/api/resources/business/resources/cuisines/client/Client.mjs +20 -6
- package/dist/esm/api/resources/business/resources/cuisines/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/cuisines/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/cuisines/types/ListCuisinesResponse.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/cuisines/types/ListCuisinesResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/cuisines/types/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/cuisines/types/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/index.mjs +4 -0
- package/dist/esm/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.mts +1 -1
- package/dist/esm/api/resources/customer/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/customer/client/Client.mjs +3 -3
- package/dist/esm/api/resources/customer/client/requests/SearchCustomerRequest.d.mts +3 -3
- package/dist/esm/api/resources/customer/resources/discovery/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/customer/resources/discovery/client/Client.mjs +1 -1
- package/dist/esm/api/types/BusinessCategory.d.mts +9 -0
- package/dist/esm/api/types/BusinessCategory.mjs +2 -0
- package/dist/esm/api/types/BusinessCertification.d.mts +7 -0
- package/dist/esm/api/types/BusinessCertification.mjs +2 -0
- package/dist/esm/api/types/BusinessCuisine.d.mts +6 -0
- package/dist/esm/api/types/BusinessCuisine.mjs +2 -0
- package/dist/esm/api/types/BusinessProfile.d.mts +1 -1
- package/dist/esm/api/types/BusinessSearchResult.d.mts +2 -1
- package/dist/esm/api/types/BusinessSummary.d.mts +2 -1
- package/dist/esm/api/types/CustomerBusinessProfile.d.mts +1 -1
- package/dist/esm/api/types/DiscoveryBusiness.d.mts +2 -1
- package/dist/esm/api/types/DiscoveryCategory.d.mts +6 -2
- package/dist/esm/api/types/ExploreBusiness.d.mts +2 -1
- 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 -12
- package/reference.md +354 -214
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/UpdateBusinessesRequest.d.ts +0 -9
- package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessesRequest.d.mts +0 -9
- /package/dist/cjs/api/resources/business/resources/businesses/client/requests/{UpdateBusinessesRequest.js → ListBusinessesRequest.js} +0 -0
- /package/dist/esm/api/resources/business/resources/businesses/client/requests/{UpdateBusinessesRequest.mjs → ListBusinessesRequest.mjs} +0 -0
|
@@ -8,35 +8,64 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
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
|
+
};
|
|
11
22
|
import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
12
23
|
import { mergeHeaders } from "../../../../../../core/headers.mjs";
|
|
13
24
|
import * as core from "../../../../../../core/index.mjs";
|
|
14
25
|
import * as environments from "../../../../../../environments.mjs";
|
|
15
26
|
import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
27
|
import * as errors from "../../../../../../errors/index.mjs";
|
|
28
|
+
import * as FiveOneEat from "../../../../../index.mjs";
|
|
17
29
|
export class BusinessesClient {
|
|
18
30
|
constructor(options = {}) {
|
|
19
31
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
20
32
|
}
|
|
21
33
|
/**
|
|
34
|
+
* Retrieve a paginated list of all businesses owned by the authenticated user.
|
|
35
|
+
* Useful for rendering a business picker in the companion mobile app.
|
|
36
|
+
*
|
|
37
|
+
* @param {FiveOneEat.business.ListBusinessesRequest} request
|
|
22
38
|
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
23
39
|
*
|
|
40
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
41
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
42
|
+
*
|
|
24
43
|
* @example
|
|
25
44
|
* await client.business.businesses.list()
|
|
26
45
|
*/
|
|
27
|
-
list(requestOptions) {
|
|
28
|
-
return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
|
|
46
|
+
list(request = {}, requestOptions) {
|
|
47
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
29
48
|
}
|
|
30
|
-
__list(
|
|
31
|
-
return __awaiter(this,
|
|
49
|
+
__list() {
|
|
50
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
32
51
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
52
|
+
const { page, per_page: perPage } = request;
|
|
53
|
+
const _queryParams = {
|
|
54
|
+
page,
|
|
55
|
+
per_page: perPage,
|
|
56
|
+
};
|
|
33
57
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
34
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);
|
|
35
59
|
const _response = yield core.fetcher({
|
|
36
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/businesses"),
|
|
37
61
|
method: "GET",
|
|
38
62
|
headers: _headers,
|
|
39
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
63
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
64
|
+
queryString: core.url
|
|
65
|
+
.queryBuilder()
|
|
66
|
+
.addMany(_queryParams)
|
|
67
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
68
|
+
.build(),
|
|
40
69
|
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,
|
|
41
70
|
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,
|
|
42
71
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -44,28 +73,50 @@ export class BusinessesClient {
|
|
|
44
73
|
logging: this._options.logging,
|
|
45
74
|
});
|
|
46
75
|
if (_response.ok) {
|
|
47
|
-
return {
|
|
76
|
+
return {
|
|
77
|
+
data: _response.body,
|
|
78
|
+
rawResponse: _response.rawResponse,
|
|
79
|
+
};
|
|
48
80
|
}
|
|
49
81
|
if (_response.error.reason === "status-code") {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
82
|
+
switch (_response.error.statusCode) {
|
|
83
|
+
case 401:
|
|
84
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
85
|
+
case 422:
|
|
86
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
87
|
+
default:
|
|
88
|
+
throw new errors.FiveOneEatError({
|
|
89
|
+
statusCode: _response.error.statusCode,
|
|
90
|
+
body: _response.error.body,
|
|
91
|
+
rawResponse: _response.rawResponse,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
55
94
|
}
|
|
56
95
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/businesses");
|
|
57
96
|
});
|
|
58
97
|
}
|
|
59
98
|
/**
|
|
99
|
+
* Create a new business owned by the authenticated user. The newly created
|
|
100
|
+
* business is automatically set as the user's active business.
|
|
101
|
+
*
|
|
102
|
+
* @param {FiveOneEat.business.StoreBusinessRequest} request
|
|
60
103
|
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
61
104
|
*
|
|
105
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
106
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
107
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
108
|
+
*
|
|
62
109
|
* @example
|
|
63
|
-
* await client.business.businesses.create(
|
|
110
|
+
* await client.business.businesses.create({
|
|
111
|
+
* name: "name",
|
|
112
|
+
* handle: "handle",
|
|
113
|
+
* category_ids: [1]
|
|
114
|
+
* })
|
|
64
115
|
*/
|
|
65
|
-
create(requestOptions) {
|
|
66
|
-
return core.HttpResponsePromise.fromPromise(this.__create(requestOptions));
|
|
116
|
+
create(request, requestOptions) {
|
|
117
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
67
118
|
}
|
|
68
|
-
__create(requestOptions) {
|
|
119
|
+
__create(request, requestOptions) {
|
|
69
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
121
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
71
122
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -74,7 +125,10 @@ export class BusinessesClient {
|
|
|
74
125
|
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/businesses"),
|
|
75
126
|
method: "POST",
|
|
76
127
|
headers: _headers,
|
|
128
|
+
contentType: "application/json",
|
|
77
129
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
130
|
+
requestType: "json",
|
|
131
|
+
body: request,
|
|
78
132
|
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,
|
|
79
133
|
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,
|
|
80
134
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -82,22 +136,37 @@ export class BusinessesClient {
|
|
|
82
136
|
logging: this._options.logging,
|
|
83
137
|
});
|
|
84
138
|
if (_response.ok) {
|
|
85
|
-
return { data:
|
|
139
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
86
140
|
}
|
|
87
141
|
if (_response.error.reason === "status-code") {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
142
|
+
switch (_response.error.statusCode) {
|
|
143
|
+
case 401:
|
|
144
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
145
|
+
case 403:
|
|
146
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
147
|
+
case 422:
|
|
148
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
149
|
+
default:
|
|
150
|
+
throw new errors.FiveOneEatError({
|
|
151
|
+
statusCode: _response.error.statusCode,
|
|
152
|
+
body: _response.error.body,
|
|
153
|
+
rawResponse: _response.rawResponse,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
93
156
|
}
|
|
94
157
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/businesses");
|
|
95
158
|
});
|
|
96
159
|
}
|
|
97
160
|
/**
|
|
161
|
+
* Retrieve a single business owned by the authenticated user.
|
|
162
|
+
*
|
|
98
163
|
* @param {FiveOneEat.business.GetBusinessesRequest} request
|
|
99
164
|
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
100
165
|
*
|
|
166
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
167
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
168
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
169
|
+
*
|
|
101
170
|
* @example
|
|
102
171
|
* await client.business.businesses.get({
|
|
103
172
|
* business: "business"
|
|
@@ -124,25 +193,47 @@ export class BusinessesClient {
|
|
|
124
193
|
logging: this._options.logging,
|
|
125
194
|
});
|
|
126
195
|
if (_response.ok) {
|
|
127
|
-
return {
|
|
196
|
+
return {
|
|
197
|
+
data: _response.body,
|
|
198
|
+
rawResponse: _response.rawResponse,
|
|
199
|
+
};
|
|
128
200
|
}
|
|
129
201
|
if (_response.error.reason === "status-code") {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
202
|
+
switch (_response.error.statusCode) {
|
|
203
|
+
case 401:
|
|
204
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
205
|
+
case 403:
|
|
206
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
207
|
+
case 404:
|
|
208
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
209
|
+
default:
|
|
210
|
+
throw new errors.FiveOneEatError({
|
|
211
|
+
statusCode: _response.error.statusCode,
|
|
212
|
+
body: _response.error.body,
|
|
213
|
+
rawResponse: _response.rawResponse,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
135
216
|
}
|
|
136
217
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/businesses/{business}");
|
|
137
218
|
});
|
|
138
219
|
}
|
|
139
220
|
/**
|
|
140
|
-
*
|
|
221
|
+
* Update core fields for a business owned by the authenticated user.
|
|
222
|
+
*
|
|
223
|
+
* @param {FiveOneEat.business.UpdateBusinessRequest} request
|
|
141
224
|
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
142
225
|
*
|
|
226
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
227
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
228
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
229
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
230
|
+
*
|
|
143
231
|
* @example
|
|
144
232
|
* await client.business.businesses.update({
|
|
145
|
-
* business: "business"
|
|
233
|
+
* business: "business",
|
|
234
|
+
* name: "name",
|
|
235
|
+
* handle: "handle",
|
|
236
|
+
* category_ids: [1]
|
|
146
237
|
* })
|
|
147
238
|
*/
|
|
148
239
|
update(request, requestOptions) {
|
|
@@ -151,14 +242,17 @@ export class BusinessesClient {
|
|
|
151
242
|
__update(request, requestOptions) {
|
|
152
243
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
244
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
154
|
-
const { business } = request;
|
|
245
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
155
246
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
156
247
|
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
157
248
|
const _response = yield core.fetcher({
|
|
158
249
|
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/businesses/${core.url.encodePathParam(business)}`),
|
|
159
250
|
method: "PUT",
|
|
160
251
|
headers: _headers,
|
|
252
|
+
contentType: "application/json",
|
|
161
253
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
254
|
+
requestType: "json",
|
|
255
|
+
body: _body,
|
|
162
256
|
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,
|
|
163
257
|
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,
|
|
164
258
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -166,22 +260,42 @@ export class BusinessesClient {
|
|
|
166
260
|
logging: this._options.logging,
|
|
167
261
|
});
|
|
168
262
|
if (_response.ok) {
|
|
169
|
-
return {
|
|
263
|
+
return {
|
|
264
|
+
data: _response.body,
|
|
265
|
+
rawResponse: _response.rawResponse,
|
|
266
|
+
};
|
|
170
267
|
}
|
|
171
268
|
if (_response.error.reason === "status-code") {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
269
|
+
switch (_response.error.statusCode) {
|
|
270
|
+
case 401:
|
|
271
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
272
|
+
case 403:
|
|
273
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
274
|
+
case 404:
|
|
275
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
276
|
+
case 422:
|
|
277
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
278
|
+
default:
|
|
279
|
+
throw new errors.FiveOneEatError({
|
|
280
|
+
statusCode: _response.error.statusCode,
|
|
281
|
+
body: _response.error.body,
|
|
282
|
+
rawResponse: _response.rawResponse,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
177
285
|
}
|
|
178
286
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/business/businesses/{business}");
|
|
179
287
|
});
|
|
180
288
|
}
|
|
181
289
|
/**
|
|
290
|
+
* Delete a business owned by the authenticated user.
|
|
291
|
+
*
|
|
182
292
|
* @param {FiveOneEat.business.DeleteBusinessesRequest} request
|
|
183
293
|
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
184
294
|
*
|
|
295
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
296
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
297
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
298
|
+
*
|
|
185
299
|
* @example
|
|
186
300
|
* await client.business.businesses.delete({
|
|
187
301
|
* business: "business"
|
|
@@ -211,11 +325,20 @@ export class BusinessesClient {
|
|
|
211
325
|
return { data: undefined, rawResponse: _response.rawResponse };
|
|
212
326
|
}
|
|
213
327
|
if (_response.error.reason === "status-code") {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
328
|
+
switch (_response.error.statusCode) {
|
|
329
|
+
case 401:
|
|
330
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
331
|
+
case 403:
|
|
332
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
333
|
+
case 404:
|
|
334
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
335
|
+
default:
|
|
336
|
+
throw new errors.FiveOneEatError({
|
|
337
|
+
statusCode: _response.error.statusCode,
|
|
338
|
+
body: _response.error.body,
|
|
339
|
+
rawResponse: _response.rawResponse,
|
|
340
|
+
});
|
|
341
|
+
}
|
|
219
342
|
}
|
|
220
343
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/business/businesses/{business}");
|
|
221
344
|
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* name: "name",
|
|
5
|
+
* handle: "handle",
|
|
6
|
+
* category_ids: [1]
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface StoreBusinessRequest {
|
|
10
|
+
name: string;
|
|
11
|
+
handle: string;
|
|
12
|
+
email?: string | null;
|
|
13
|
+
phone?: string | null;
|
|
14
|
+
website?: string | null;
|
|
15
|
+
description?: string | null;
|
|
16
|
+
address?: string | null;
|
|
17
|
+
city?: string | null;
|
|
18
|
+
state?: string | null;
|
|
19
|
+
zipcode?: string | null;
|
|
20
|
+
country?: string | null;
|
|
21
|
+
latitude?: number | null;
|
|
22
|
+
longitude?: number | null;
|
|
23
|
+
has_location?: boolean;
|
|
24
|
+
metadata?: string[] | null;
|
|
25
|
+
badges?: string[] | null;
|
|
26
|
+
seasonal?: boolean;
|
|
27
|
+
ownership?: string[] | null;
|
|
28
|
+
category_ids: number[];
|
|
29
|
+
operating_months?: StoreBusinessRequest.OperatingMonths.Item[] | null;
|
|
30
|
+
}
|
|
31
|
+
export declare namespace StoreBusinessRequest {
|
|
32
|
+
type OperatingMonths = OperatingMonths.Item[];
|
|
33
|
+
namespace OperatingMonths {
|
|
34
|
+
const Item: {
|
|
35
|
+
readonly January: "january";
|
|
36
|
+
readonly February: "february";
|
|
37
|
+
readonly March: "march";
|
|
38
|
+
readonly April: "april";
|
|
39
|
+
readonly May: "may";
|
|
40
|
+
readonly June: "june";
|
|
41
|
+
readonly July: "july";
|
|
42
|
+
readonly August: "august";
|
|
43
|
+
readonly September: "september";
|
|
44
|
+
readonly October: "october";
|
|
45
|
+
readonly November: "november";
|
|
46
|
+
readonly December: "december";
|
|
47
|
+
};
|
|
48
|
+
type Item = (typeof Item)[keyof typeof Item];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var StoreBusinessRequest;
|
|
3
|
+
(function (StoreBusinessRequest) {
|
|
4
|
+
let OperatingMonths;
|
|
5
|
+
(function (OperatingMonths) {
|
|
6
|
+
OperatingMonths.Item = {
|
|
7
|
+
January: "january",
|
|
8
|
+
February: "february",
|
|
9
|
+
March: "march",
|
|
10
|
+
April: "april",
|
|
11
|
+
May: "may",
|
|
12
|
+
June: "june",
|
|
13
|
+
July: "july",
|
|
14
|
+
August: "august",
|
|
15
|
+
September: "september",
|
|
16
|
+
October: "october",
|
|
17
|
+
November: "november",
|
|
18
|
+
December: "december",
|
|
19
|
+
};
|
|
20
|
+
})(OperatingMonths = StoreBusinessRequest.OperatingMonths || (StoreBusinessRequest.OperatingMonths = {}));
|
|
21
|
+
})(StoreBusinessRequest || (StoreBusinessRequest = {}));
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* business: "business",
|
|
5
|
+
* name: "name",
|
|
6
|
+
* handle: "handle",
|
|
7
|
+
* category_ids: [1]
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface UpdateBusinessRequest {
|
|
11
|
+
/** The business ID */
|
|
12
|
+
business: string;
|
|
13
|
+
name: string;
|
|
14
|
+
handle: string;
|
|
15
|
+
email?: string | null;
|
|
16
|
+
phone?: string | null;
|
|
17
|
+
website?: string | null;
|
|
18
|
+
description?: string | null;
|
|
19
|
+
bio?: string | null;
|
|
20
|
+
facebook_url?: string | null;
|
|
21
|
+
instagram_url?: string | null;
|
|
22
|
+
twitter_url?: string | null;
|
|
23
|
+
tiktok_url?: string | null;
|
|
24
|
+
youtube_url?: string | null;
|
|
25
|
+
linkedin_url?: string | null;
|
|
26
|
+
address?: string | null;
|
|
27
|
+
city?: string | null;
|
|
28
|
+
state?: string | null;
|
|
29
|
+
zipcode?: string | null;
|
|
30
|
+
country?: string | null;
|
|
31
|
+
latitude?: number | null;
|
|
32
|
+
longitude?: number | null;
|
|
33
|
+
has_location?: boolean;
|
|
34
|
+
metadata?: string[] | null;
|
|
35
|
+
badges?: string[] | null;
|
|
36
|
+
seasonal?: boolean;
|
|
37
|
+
ownership?: string[] | null;
|
|
38
|
+
category_ids: number[];
|
|
39
|
+
operating_months?: UpdateBusinessRequest.OperatingMonths.Item[] | null;
|
|
40
|
+
certification_ids?: number[] | null;
|
|
41
|
+
cuisine_ids?: number[] | null;
|
|
42
|
+
}
|
|
43
|
+
export declare namespace UpdateBusinessRequest {
|
|
44
|
+
type OperatingMonths = OperatingMonths.Item[];
|
|
45
|
+
namespace OperatingMonths {
|
|
46
|
+
const Item: {
|
|
47
|
+
readonly January: "january";
|
|
48
|
+
readonly February: "february";
|
|
49
|
+
readonly March: "march";
|
|
50
|
+
readonly April: "april";
|
|
51
|
+
readonly May: "may";
|
|
52
|
+
readonly June: "june";
|
|
53
|
+
readonly July: "july";
|
|
54
|
+
readonly August: "august";
|
|
55
|
+
readonly September: "september";
|
|
56
|
+
readonly October: "october";
|
|
57
|
+
readonly November: "november";
|
|
58
|
+
readonly December: "december";
|
|
59
|
+
};
|
|
60
|
+
type Item = (typeof Item)[keyof typeof Item];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
export var UpdateBusinessRequest;
|
|
3
|
+
(function (UpdateBusinessRequest) {
|
|
4
|
+
let OperatingMonths;
|
|
5
|
+
(function (OperatingMonths) {
|
|
6
|
+
OperatingMonths.Item = {
|
|
7
|
+
January: "january",
|
|
8
|
+
February: "february",
|
|
9
|
+
March: "march",
|
|
10
|
+
April: "april",
|
|
11
|
+
May: "may",
|
|
12
|
+
June: "june",
|
|
13
|
+
July: "july",
|
|
14
|
+
August: "august",
|
|
15
|
+
September: "september",
|
|
16
|
+
October: "october",
|
|
17
|
+
November: "november",
|
|
18
|
+
December: "december",
|
|
19
|
+
};
|
|
20
|
+
})(OperatingMonths = UpdateBusinessRequest.OperatingMonths || (UpdateBusinessRequest.OperatingMonths = {}));
|
|
21
|
+
})(UpdateBusinessRequest || (UpdateBusinessRequest = {}));
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export type { DeleteBusinessesRequest } from "./DeleteBusinessesRequest.mjs";
|
|
2
2
|
export type { GetBusinessesRequest } from "./GetBusinessesRequest.mjs";
|
|
3
|
-
export type {
|
|
3
|
+
export type { ListBusinessesRequest } from "./ListBusinessesRequest.mjs";
|
|
4
|
+
export { StoreBusinessRequest } from "./StoreBusinessRequest.mjs";
|
|
5
|
+
export { UpdateBusinessRequest } from "./UpdateBusinessRequest.mjs";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { StoreBusinessRequest } from "./StoreBusinessRequest.mjs";
|
|
2
|
+
export { UpdateBusinessRequest } from "./UpdateBusinessRequest.mjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
3
|
import * as core from "../../../../../../core/index.mjs";
|
|
4
|
+
import * as FiveOneEat from "../../../../../index.mjs";
|
|
4
5
|
export declare namespace CategoriesClient {
|
|
5
6
|
type Options = BaseClientOptions;
|
|
6
7
|
interface RequestOptions extends BaseRequestOptions {
|
|
@@ -10,11 +11,16 @@ export declare class CategoriesClient {
|
|
|
10
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<CategoriesClient.Options>;
|
|
11
12
|
constructor(options?: CategoriesClient.Options);
|
|
12
13
|
/**
|
|
14
|
+
* Retrieve a list of all business categories, ordered by sort order and name.
|
|
15
|
+
* Use these IDs to populate the `category_ids` field when creating or updating a business.
|
|
16
|
+
*
|
|
13
17
|
* @param {CategoriesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
14
18
|
*
|
|
19
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
20
|
+
*
|
|
15
21
|
* @example
|
|
16
22
|
* await client.business.categories.list()
|
|
17
23
|
*/
|
|
18
|
-
list(requestOptions?: CategoriesClient.RequestOptions): core.HttpResponsePromise<
|
|
24
|
+
list(requestOptions?: CategoriesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.ListCategoriesResponse>;
|
|
19
25
|
private __list;
|
|
20
26
|
}
|