@51eat/sdk 0.0.22 → 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 +12 -0
- package/dist/cjs/api/resources/business/client/Client.js +30 -10
- package/dist/cjs/api/resources/business/resources/businesses/client/Client.d.ts +103 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/Client.js +383 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/index.js +17 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.d.ts +10 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.d.ts +10 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.js +3 -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/ListBusinessesRequest.js +3 -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 +5 -0
- package/dist/cjs/api/resources/business/resources/businesses/client/requests/index.js +7 -0
- package/dist/cjs/api/resources/business/resources/businesses/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/businesses/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/businesses/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/businesses/index.js +18 -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 +26 -0
- package/dist/cjs/api/resources/business/resources/categories/client/Client.js +110 -0
- package/dist/cjs/api/resources/business/resources/categories/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/categories/client/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/categories/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/categories/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/categories/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/categories/index.js +18 -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 +26 -0
- package/dist/cjs/api/resources/business/resources/certifications/client/Client.js +110 -0
- package/dist/cjs/api/resources/business/resources/certifications/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/certifications/client/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/certifications/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/certifications/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/certifications/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/certifications/index.js +18 -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 +26 -0
- package/dist/cjs/api/resources/business/resources/cuisines/client/Client.js +110 -0
- package/dist/cjs/api/resources/business/resources/cuisines/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/cuisines/client/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/cuisines/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/cuisines/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/cuisines/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/cuisines/index.js +18 -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 +9 -0
- package/dist/cjs/api/resources/business/resources/index.js +10 -1
- 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 +12 -0
- package/dist/esm/api/resources/business/client/Client.mjs +20 -0
- package/dist/esm/api/resources/business/resources/businesses/client/Client.d.mts +103 -0
- package/dist/esm/api/resources/business/resources/businesses/client/Client.mjs +346 -0
- package/dist/esm/api/resources/business/resources/businesses/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/businesses/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.d.mts +10 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.d.mts +10 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.mjs +2 -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/ListBusinessesRequest.mjs +2 -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 +5 -0
- package/dist/esm/api/resources/business/resources/businesses/client/requests/index.mjs +2 -0
- package/dist/esm/api/resources/business/resources/businesses/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/businesses/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/businesses/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/businesses/index.mjs +2 -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 +26 -0
- package/dist/esm/api/resources/business/resources/categories/client/Client.mjs +73 -0
- package/dist/esm/api/resources/business/resources/categories/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/categories/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/categories/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/categories/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/categories/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/categories/index.mjs +2 -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 +26 -0
- package/dist/esm/api/resources/business/resources/certifications/client/Client.mjs +73 -0
- package/dist/esm/api/resources/business/resources/certifications/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/certifications/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/certifications/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/certifications/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/certifications/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/certifications/index.mjs +2 -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 +26 -0
- package/dist/esm/api/resources/business/resources/cuisines/client/Client.mjs +73 -0
- package/dist/esm/api/resources/business/resources/cuisines/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/cuisines/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/cuisines/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/cuisines/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/cuisines/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/cuisines/index.mjs +2 -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 +9 -0
- package/dist/esm/api/resources/business/resources/index.mjs +9 -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 +45 -1
- package/reference.md +504 -2
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.24",
|
|
47
|
+
"User-Agent": "@51eat/sdk/0.0.24",
|
|
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,10 @@ import type { BaseClientOptions } from "../../../../BaseClient.js";
|
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
|
|
3
3
|
import { AuthClient } from "../resources/auth/client/Client.js";
|
|
4
4
|
import { BulletinsClient } from "../resources/bulletins/client/Client.js";
|
|
5
|
+
import { BusinessesClient } from "../resources/businesses/client/Client.js";
|
|
6
|
+
import { CategoriesClient } from "../resources/categories/client/Client.js";
|
|
7
|
+
import { CertificationsClient } from "../resources/certifications/client/Client.js";
|
|
8
|
+
import { CuisinesClient } from "../resources/cuisines/client/Client.js";
|
|
5
9
|
import { GalleryClient } from "../resources/gallery/client/Client.js";
|
|
6
10
|
import { MenusClient } from "../resources/menus/client/Client.js";
|
|
7
11
|
import { MessagingClient } from "../resources/messaging/client/Client.js";
|
|
@@ -14,17 +18,25 @@ export declare class BusinessClient {
|
|
|
14
18
|
protected readonly _options: NormalizedClientOptionsWithAuth<BusinessClient.Options>;
|
|
15
19
|
protected _auth: AuthClient | undefined;
|
|
16
20
|
protected _bulletins: BulletinsClient | undefined;
|
|
21
|
+
protected _businesses: BusinessesClient | undefined;
|
|
17
22
|
protected _gallery: GalleryClient | undefined;
|
|
18
23
|
protected _menus: MenusClient | undefined;
|
|
19
24
|
protected _messaging: MessagingClient | undefined;
|
|
20
25
|
protected _profile: ProfileClient | undefined;
|
|
21
26
|
protected _pushNotifications: PushNotificationsClient | undefined;
|
|
27
|
+
protected _cuisines: CuisinesClient | undefined;
|
|
28
|
+
protected _certifications: CertificationsClient | undefined;
|
|
29
|
+
protected _categories: CategoriesClient | undefined;
|
|
22
30
|
constructor(options?: BusinessClient.Options);
|
|
23
31
|
get auth(): AuthClient;
|
|
24
32
|
get bulletins(): BulletinsClient;
|
|
33
|
+
get businesses(): BusinessesClient;
|
|
25
34
|
get gallery(): GalleryClient;
|
|
26
35
|
get menus(): MenusClient;
|
|
27
36
|
get messaging(): MessagingClient;
|
|
28
37
|
get profile(): ProfileClient;
|
|
29
38
|
get pushNotifications(): PushNotificationsClient;
|
|
39
|
+
get cuisines(): CuisinesClient;
|
|
40
|
+
get certifications(): CertificationsClient;
|
|
41
|
+
get categories(): CategoriesClient;
|
|
30
42
|
}
|
|
@@ -5,11 +5,15 @@ exports.BusinessClient = void 0;
|
|
|
5
5
|
const BaseClient_js_1 = require("../../../../BaseClient.js");
|
|
6
6
|
const Client_js_1 = require("../resources/auth/client/Client.js");
|
|
7
7
|
const Client_js_2 = require("../resources/bulletins/client/Client.js");
|
|
8
|
-
const Client_js_3 = require("../resources/
|
|
9
|
-
const Client_js_4 = require("../resources/
|
|
10
|
-
const Client_js_5 = require("../resources/
|
|
11
|
-
const Client_js_6 = require("../resources/
|
|
12
|
-
const Client_js_7 = require("../resources/
|
|
8
|
+
const Client_js_3 = require("../resources/businesses/client/Client.js");
|
|
9
|
+
const Client_js_4 = require("../resources/categories/client/Client.js");
|
|
10
|
+
const Client_js_5 = require("../resources/certifications/client/Client.js");
|
|
11
|
+
const Client_js_6 = require("../resources/cuisines/client/Client.js");
|
|
12
|
+
const Client_js_7 = require("../resources/gallery/client/Client.js");
|
|
13
|
+
const Client_js_8 = require("../resources/menus/client/Client.js");
|
|
14
|
+
const Client_js_9 = require("../resources/messaging/client/Client.js");
|
|
15
|
+
const Client_js_10 = require("../resources/profile/client/Client.js");
|
|
16
|
+
const Client_js_11 = require("../resources/pushNotifications/client/Client.js");
|
|
13
17
|
class BusinessClient {
|
|
14
18
|
constructor(options = {}) {
|
|
15
19
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
@@ -22,25 +26,41 @@ class BusinessClient {
|
|
|
22
26
|
var _a;
|
|
23
27
|
return ((_a = this._bulletins) !== null && _a !== void 0 ? _a : (this._bulletins = new Client_js_2.BulletinsClient(this._options)));
|
|
24
28
|
}
|
|
29
|
+
get businesses() {
|
|
30
|
+
var _a;
|
|
31
|
+
return ((_a = this._businesses) !== null && _a !== void 0 ? _a : (this._businesses = new Client_js_3.BusinessesClient(this._options)));
|
|
32
|
+
}
|
|
25
33
|
get gallery() {
|
|
26
34
|
var _a;
|
|
27
|
-
return ((_a = this._gallery) !== null && _a !== void 0 ? _a : (this._gallery = new
|
|
35
|
+
return ((_a = this._gallery) !== null && _a !== void 0 ? _a : (this._gallery = new Client_js_7.GalleryClient(this._options)));
|
|
28
36
|
}
|
|
29
37
|
get menus() {
|
|
30
38
|
var _a;
|
|
31
|
-
return ((_a = this._menus) !== null && _a !== void 0 ? _a : (this._menus = new
|
|
39
|
+
return ((_a = this._menus) !== null && _a !== void 0 ? _a : (this._menus = new Client_js_8.MenusClient(this._options)));
|
|
32
40
|
}
|
|
33
41
|
get messaging() {
|
|
34
42
|
var _a;
|
|
35
|
-
return ((_a = this._messaging) !== null && _a !== void 0 ? _a : (this._messaging = new
|
|
43
|
+
return ((_a = this._messaging) !== null && _a !== void 0 ? _a : (this._messaging = new Client_js_9.MessagingClient(this._options)));
|
|
36
44
|
}
|
|
37
45
|
get profile() {
|
|
38
46
|
var _a;
|
|
39
|
-
return ((_a = this._profile) !== null && _a !== void 0 ? _a : (this._profile = new
|
|
47
|
+
return ((_a = this._profile) !== null && _a !== void 0 ? _a : (this._profile = new Client_js_10.ProfileClient(this._options)));
|
|
40
48
|
}
|
|
41
49
|
get pushNotifications() {
|
|
42
50
|
var _a;
|
|
43
|
-
return ((_a = this._pushNotifications) !== null && _a !== void 0 ? _a : (this._pushNotifications = new
|
|
51
|
+
return ((_a = this._pushNotifications) !== null && _a !== void 0 ? _a : (this._pushNotifications = new Client_js_11.PushNotificationsClient(this._options)));
|
|
52
|
+
}
|
|
53
|
+
get cuisines() {
|
|
54
|
+
var _a;
|
|
55
|
+
return ((_a = this._cuisines) !== null && _a !== void 0 ? _a : (this._cuisines = new Client_js_6.CuisinesClient(this._options)));
|
|
56
|
+
}
|
|
57
|
+
get certifications() {
|
|
58
|
+
var _a;
|
|
59
|
+
return ((_a = this._certifications) !== null && _a !== void 0 ? _a : (this._certifications = new Client_js_5.CertificationsClient(this._options)));
|
|
60
|
+
}
|
|
61
|
+
get categories() {
|
|
62
|
+
var _a;
|
|
63
|
+
return ((_a = this._categories) !== null && _a !== void 0 ? _a : (this._categories = new Client_js_4.CategoriesClient(this._options)));
|
|
44
64
|
}
|
|
45
65
|
}
|
|
46
66
|
exports.BusinessClient = BusinessClient;
|
|
@@ -0,0 +1,103 @@
|
|
|
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 BusinessesClient {
|
|
6
|
+
type Options = BaseClientOptions;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export declare class BusinessesClient {
|
|
11
|
+
protected readonly _options: NormalizedClientOptionsWithAuth<BusinessesClient.Options>;
|
|
12
|
+
constructor(options?: BusinessesClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve a paginated list of all businesses owned by the authenticated user.
|
|
15
|
+
* Useful for rendering a business picker in the companion mobile app.
|
|
16
|
+
*
|
|
17
|
+
* @param {FiveOneEat.business.ListBusinessesRequest} request
|
|
18
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
|
+
*
|
|
20
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
21
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* await client.business.businesses.list()
|
|
25
|
+
*/
|
|
26
|
+
list(request?: FiveOneEat.business.ListBusinessesRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.ListBusinessesResponse>;
|
|
27
|
+
private __list;
|
|
28
|
+
/**
|
|
29
|
+
* Create a new business owned by the authenticated user. The newly created
|
|
30
|
+
* business is automatically set as the user's active business.
|
|
31
|
+
*
|
|
32
|
+
* @param {FiveOneEat.business.StoreBusinessRequest} request
|
|
33
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
34
|
+
*
|
|
35
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
36
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
37
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* await client.business.businesses.create({
|
|
41
|
+
* name: "name",
|
|
42
|
+
* handle: "handle",
|
|
43
|
+
* category_ids: [1]
|
|
44
|
+
* })
|
|
45
|
+
*/
|
|
46
|
+
create(request: FiveOneEat.business.StoreBusinessRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<number>;
|
|
47
|
+
private __create;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve a single business owned by the authenticated user.
|
|
50
|
+
*
|
|
51
|
+
* @param {FiveOneEat.business.GetBusinessesRequest} request
|
|
52
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
|
+
*
|
|
54
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
55
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
56
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* await client.business.businesses.get({
|
|
60
|
+
* business: "business"
|
|
61
|
+
* })
|
|
62
|
+
*/
|
|
63
|
+
get(request: FiveOneEat.business.GetBusinessesRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.GetBusinessesResponse>;
|
|
64
|
+
private __get;
|
|
65
|
+
/**
|
|
66
|
+
* Update core fields for a business owned by the authenticated user.
|
|
67
|
+
*
|
|
68
|
+
* @param {FiveOneEat.business.UpdateBusinessRequest} request
|
|
69
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
70
|
+
*
|
|
71
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
72
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
73
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
74
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* await client.business.businesses.update({
|
|
78
|
+
* business: "business",
|
|
79
|
+
* name: "name",
|
|
80
|
+
* handle: "handle",
|
|
81
|
+
* category_ids: [1]
|
|
82
|
+
* })
|
|
83
|
+
*/
|
|
84
|
+
update(request: FiveOneEat.business.UpdateBusinessRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.UpdateBusinessesResponse>;
|
|
85
|
+
private __update;
|
|
86
|
+
/**
|
|
87
|
+
* Delete a business owned by the authenticated user.
|
|
88
|
+
*
|
|
89
|
+
* @param {FiveOneEat.business.DeleteBusinessesRequest} request
|
|
90
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
91
|
+
*
|
|
92
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
93
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
94
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* await client.business.businesses.delete({
|
|
98
|
+
* business: "business"
|
|
99
|
+
* })
|
|
100
|
+
*/
|
|
101
|
+
delete(request: FiveOneEat.business.DeleteBusinessesRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
102
|
+
private __delete;
|
|
103
|
+
}
|
|
@@ -0,0 +1,383 @@
|
|
|
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
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
+
var t = {};
|
|
47
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
+
t[p] = s[p];
|
|
49
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
+
t[p[i]] = s[p[i]];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.BusinessesClient = void 0;
|
|
58
|
+
const BaseClient_js_1 = require("../../../../../../BaseClient.js");
|
|
59
|
+
const headers_js_1 = require("../../../../../../core/headers.js");
|
|
60
|
+
const core = __importStar(require("../../../../../../core/index.js"));
|
|
61
|
+
const environments = __importStar(require("../../../../../../environments.js"));
|
|
62
|
+
const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
|
|
63
|
+
const errors = __importStar(require("../../../../../../errors/index.js"));
|
|
64
|
+
const FiveOneEat = __importStar(require("../../../../../index.js"));
|
|
65
|
+
class BusinessesClient {
|
|
66
|
+
constructor(options = {}) {
|
|
67
|
+
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Retrieve a paginated list of all businesses owned by the authenticated user.
|
|
71
|
+
* Useful for rendering a business picker in the companion mobile app.
|
|
72
|
+
*
|
|
73
|
+
* @param {FiveOneEat.business.ListBusinessesRequest} request
|
|
74
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
|
+
*
|
|
76
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
77
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* await client.business.businesses.list()
|
|
81
|
+
*/
|
|
82
|
+
list(request = {}, requestOptions) {
|
|
83
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
84
|
+
}
|
|
85
|
+
__list() {
|
|
86
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
88
|
+
const { page, per_page: perPage } = request;
|
|
89
|
+
const _queryParams = {
|
|
90
|
+
page,
|
|
91
|
+
per_page: perPage,
|
|
92
|
+
};
|
|
93
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
94
|
+
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);
|
|
95
|
+
const _response = yield core.fetcher({
|
|
96
|
+
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"),
|
|
97
|
+
method: "GET",
|
|
98
|
+
headers: _headers,
|
|
99
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
100
|
+
queryString: core.url
|
|
101
|
+
.queryBuilder()
|
|
102
|
+
.addMany(_queryParams)
|
|
103
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
104
|
+
.build(),
|
|
105
|
+
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,
|
|
106
|
+
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,
|
|
107
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
108
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
109
|
+
logging: this._options.logging,
|
|
110
|
+
});
|
|
111
|
+
if (_response.ok) {
|
|
112
|
+
return {
|
|
113
|
+
data: _response.body,
|
|
114
|
+
rawResponse: _response.rawResponse,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
if (_response.error.reason === "status-code") {
|
|
118
|
+
switch (_response.error.statusCode) {
|
|
119
|
+
case 401:
|
|
120
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
121
|
+
case 422:
|
|
122
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
123
|
+
default:
|
|
124
|
+
throw new errors.FiveOneEatError({
|
|
125
|
+
statusCode: _response.error.statusCode,
|
|
126
|
+
body: _response.error.body,
|
|
127
|
+
rawResponse: _response.rawResponse,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/businesses");
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a new business owned by the authenticated user. The newly created
|
|
136
|
+
* business is automatically set as the user's active business.
|
|
137
|
+
*
|
|
138
|
+
* @param {FiveOneEat.business.StoreBusinessRequest} request
|
|
139
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
140
|
+
*
|
|
141
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
142
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
143
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* await client.business.businesses.create({
|
|
147
|
+
* name: "name",
|
|
148
|
+
* handle: "handle",
|
|
149
|
+
* category_ids: [1]
|
|
150
|
+
* })
|
|
151
|
+
*/
|
|
152
|
+
create(request, requestOptions) {
|
|
153
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
154
|
+
}
|
|
155
|
+
__create(request, requestOptions) {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
158
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
159
|
+
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);
|
|
160
|
+
const _response = yield core.fetcher({
|
|
161
|
+
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"),
|
|
162
|
+
method: "POST",
|
|
163
|
+
headers: _headers,
|
|
164
|
+
contentType: "application/json",
|
|
165
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
166
|
+
requestType: "json",
|
|
167
|
+
body: request,
|
|
168
|
+
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,
|
|
169
|
+
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,
|
|
170
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
171
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
172
|
+
logging: this._options.logging,
|
|
173
|
+
});
|
|
174
|
+
if (_response.ok) {
|
|
175
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
176
|
+
}
|
|
177
|
+
if (_response.error.reason === "status-code") {
|
|
178
|
+
switch (_response.error.statusCode) {
|
|
179
|
+
case 401:
|
|
180
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
181
|
+
case 403:
|
|
182
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
183
|
+
case 422:
|
|
184
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
185
|
+
default:
|
|
186
|
+
throw new errors.FiveOneEatError({
|
|
187
|
+
statusCode: _response.error.statusCode,
|
|
188
|
+
body: _response.error.body,
|
|
189
|
+
rawResponse: _response.rawResponse,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/businesses");
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Retrieve a single business owned by the authenticated user.
|
|
198
|
+
*
|
|
199
|
+
* @param {FiveOneEat.business.GetBusinessesRequest} request
|
|
200
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
201
|
+
*
|
|
202
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
203
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
204
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* await client.business.businesses.get({
|
|
208
|
+
* business: "business"
|
|
209
|
+
* })
|
|
210
|
+
*/
|
|
211
|
+
get(request, requestOptions) {
|
|
212
|
+
return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions));
|
|
213
|
+
}
|
|
214
|
+
__get(request, requestOptions) {
|
|
215
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
216
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
217
|
+
const { business } = request;
|
|
218
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
219
|
+
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);
|
|
220
|
+
const _response = yield core.fetcher({
|
|
221
|
+
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)}`),
|
|
222
|
+
method: "GET",
|
|
223
|
+
headers: _headers,
|
|
224
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
225
|
+
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,
|
|
226
|
+
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,
|
|
227
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
228
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
229
|
+
logging: this._options.logging,
|
|
230
|
+
});
|
|
231
|
+
if (_response.ok) {
|
|
232
|
+
return {
|
|
233
|
+
data: _response.body,
|
|
234
|
+
rawResponse: _response.rawResponse,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
if (_response.error.reason === "status-code") {
|
|
238
|
+
switch (_response.error.statusCode) {
|
|
239
|
+
case 401:
|
|
240
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
241
|
+
case 403:
|
|
242
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
243
|
+
case 404:
|
|
244
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
245
|
+
default:
|
|
246
|
+
throw new errors.FiveOneEatError({
|
|
247
|
+
statusCode: _response.error.statusCode,
|
|
248
|
+
body: _response.error.body,
|
|
249
|
+
rawResponse: _response.rawResponse,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/businesses/{business}");
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Update core fields for a business owned by the authenticated user.
|
|
258
|
+
*
|
|
259
|
+
* @param {FiveOneEat.business.UpdateBusinessRequest} request
|
|
260
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
261
|
+
*
|
|
262
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
263
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
264
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
265
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* await client.business.businesses.update({
|
|
269
|
+
* business: "business",
|
|
270
|
+
* name: "name",
|
|
271
|
+
* handle: "handle",
|
|
272
|
+
* category_ids: [1]
|
|
273
|
+
* })
|
|
274
|
+
*/
|
|
275
|
+
update(request, requestOptions) {
|
|
276
|
+
return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions));
|
|
277
|
+
}
|
|
278
|
+
__update(request, requestOptions) {
|
|
279
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
281
|
+
const { business } = request, _body = __rest(request, ["business"]);
|
|
282
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
283
|
+
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);
|
|
284
|
+
const _response = yield core.fetcher({
|
|
285
|
+
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)}`),
|
|
286
|
+
method: "PUT",
|
|
287
|
+
headers: _headers,
|
|
288
|
+
contentType: "application/json",
|
|
289
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
290
|
+
requestType: "json",
|
|
291
|
+
body: _body,
|
|
292
|
+
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,
|
|
293
|
+
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,
|
|
294
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
295
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
296
|
+
logging: this._options.logging,
|
|
297
|
+
});
|
|
298
|
+
if (_response.ok) {
|
|
299
|
+
return {
|
|
300
|
+
data: _response.body,
|
|
301
|
+
rawResponse: _response.rawResponse,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
if (_response.error.reason === "status-code") {
|
|
305
|
+
switch (_response.error.statusCode) {
|
|
306
|
+
case 401:
|
|
307
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
308
|
+
case 403:
|
|
309
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
310
|
+
case 404:
|
|
311
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
312
|
+
case 422:
|
|
313
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
314
|
+
default:
|
|
315
|
+
throw new errors.FiveOneEatError({
|
|
316
|
+
statusCode: _response.error.statusCode,
|
|
317
|
+
body: _response.error.body,
|
|
318
|
+
rawResponse: _response.rawResponse,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/business/businesses/{business}");
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Delete a business owned by the authenticated user.
|
|
327
|
+
*
|
|
328
|
+
* @param {FiveOneEat.business.DeleteBusinessesRequest} request
|
|
329
|
+
* @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
330
|
+
*
|
|
331
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
332
|
+
* @throws {@link FiveOneEat.ForbiddenError}
|
|
333
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* await client.business.businesses.delete({
|
|
337
|
+
* business: "business"
|
|
338
|
+
* })
|
|
339
|
+
*/
|
|
340
|
+
delete(request, requestOptions) {
|
|
341
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
|
|
342
|
+
}
|
|
343
|
+
__delete(request, requestOptions) {
|
|
344
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
345
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
346
|
+
const { business } = request;
|
|
347
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
348
|
+
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);
|
|
349
|
+
const _response = yield core.fetcher({
|
|
350
|
+
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)}`),
|
|
351
|
+
method: "DELETE",
|
|
352
|
+
headers: _headers,
|
|
353
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
354
|
+
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,
|
|
355
|
+
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,
|
|
356
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
357
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
358
|
+
logging: this._options.logging,
|
|
359
|
+
});
|
|
360
|
+
if (_response.ok) {
|
|
361
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
362
|
+
}
|
|
363
|
+
if (_response.error.reason === "status-code") {
|
|
364
|
+
switch (_response.error.statusCode) {
|
|
365
|
+
case 401:
|
|
366
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
367
|
+
case 403:
|
|
368
|
+
throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
369
|
+
case 404:
|
|
370
|
+
throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
|
|
371
|
+
default:
|
|
372
|
+
throw new errors.FiveOneEatError({
|
|
373
|
+
statusCode: _response.error.statusCode,
|
|
374
|
+
body: _response.error.body,
|
|
375
|
+
rawResponse: _response.rawResponse,
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/business/businesses/{business}");
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
exports.BusinessesClient = BusinessesClient;
|
|
@@ -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);
|