@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.
Files changed (152) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/business/client/Client.d.ts +2 -2
  3. package/dist/cjs/api/resources/business/client/Client.js +4 -4
  4. package/dist/cjs/api/resources/business/resources/businesses/client/Client.d.ts +49 -8
  5. package/dist/cjs/api/resources/business/resources/businesses/client/Client.js +164 -41
  6. package/dist/cjs/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.d.ts +1 -0
  7. package/dist/cjs/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.d.ts +1 -0
  8. package/dist/cjs/api/resources/business/resources/businesses/client/requests/ListBusinessesRequest.d.ts +10 -0
  9. package/dist/cjs/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.d.ts +50 -0
  10. package/dist/cjs/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.js +24 -0
  11. package/dist/cjs/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.d.ts +62 -0
  12. package/dist/cjs/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.js +24 -0
  13. package/dist/cjs/api/resources/business/resources/businesses/client/requests/index.d.ts +3 -1
  14. package/dist/cjs/api/resources/business/resources/businesses/client/requests/index.js +5 -0
  15. package/dist/cjs/api/resources/business/resources/businesses/index.d.ts +1 -0
  16. package/dist/cjs/api/resources/business/resources/businesses/index.js +1 -0
  17. package/dist/cjs/api/resources/business/resources/businesses/types/GetBusinessesResponse.d.ts +4 -0
  18. package/dist/cjs/api/resources/business/resources/businesses/types/GetBusinessesResponse.js +3 -0
  19. package/dist/cjs/api/resources/business/resources/businesses/types/ListBusinessesResponse.d.ts +4 -0
  20. package/dist/cjs/api/resources/business/resources/businesses/types/ListBusinessesResponse.js +3 -0
  21. package/dist/cjs/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.d.ts +4 -0
  22. package/dist/cjs/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.js +3 -0
  23. package/dist/cjs/api/resources/business/resources/businesses/types/index.d.ts +3 -0
  24. package/dist/cjs/api/resources/business/resources/businesses/types/index.js +19 -0
  25. package/dist/cjs/api/resources/business/resources/categories/client/Client.d.ts +7 -1
  26. package/dist/cjs/api/resources/business/resources/categories/client/Client.js +20 -6
  27. package/dist/cjs/api/resources/business/resources/categories/index.d.ts +1 -0
  28. package/dist/cjs/api/resources/business/resources/categories/index.js +1 -0
  29. package/dist/cjs/api/resources/business/resources/categories/types/ListCategoriesResponse.d.ts +4 -0
  30. package/dist/cjs/api/resources/business/resources/categories/types/ListCategoriesResponse.js +3 -0
  31. package/dist/cjs/api/resources/business/resources/categories/types/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/business/resources/categories/types/index.js +17 -0
  33. package/dist/cjs/api/resources/business/resources/certifications/client/Client.d.ts +7 -1
  34. package/dist/cjs/api/resources/business/resources/certifications/client/Client.js +20 -6
  35. package/dist/cjs/api/resources/business/resources/certifications/index.d.ts +1 -0
  36. package/dist/cjs/api/resources/business/resources/certifications/index.js +1 -0
  37. package/dist/cjs/api/resources/business/resources/certifications/types/ListCertificationsResponse.d.ts +4 -0
  38. package/dist/cjs/api/resources/business/resources/certifications/types/ListCertificationsResponse.js +3 -0
  39. package/dist/cjs/api/resources/business/resources/certifications/types/index.d.ts +1 -0
  40. package/dist/cjs/api/resources/business/resources/certifications/types/index.js +17 -0
  41. package/dist/cjs/api/resources/business/resources/cuisines/client/Client.d.ts +7 -1
  42. package/dist/cjs/api/resources/business/resources/cuisines/client/Client.js +20 -6
  43. package/dist/cjs/api/resources/business/resources/cuisines/index.d.ts +1 -0
  44. package/dist/cjs/api/resources/business/resources/cuisines/index.js +1 -0
  45. package/dist/cjs/api/resources/business/resources/cuisines/types/ListCuisinesResponse.d.ts +4 -0
  46. package/dist/cjs/api/resources/business/resources/cuisines/types/ListCuisinesResponse.js +3 -0
  47. package/dist/cjs/api/resources/business/resources/cuisines/types/index.d.ts +1 -0
  48. package/dist/cjs/api/resources/business/resources/cuisines/types/index.js +17 -0
  49. package/dist/cjs/api/resources/business/resources/index.d.ts +4 -0
  50. package/dist/cjs/api/resources/business/resources/index.js +4 -0
  51. package/dist/cjs/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.ts +1 -1
  52. package/dist/cjs/api/resources/customer/client/Client.d.ts +1 -1
  53. package/dist/cjs/api/resources/customer/client/Client.js +3 -3
  54. package/dist/cjs/api/resources/customer/client/requests/SearchCustomerRequest.d.ts +3 -3
  55. package/dist/cjs/api/resources/customer/resources/discovery/client/Client.d.ts +1 -1
  56. package/dist/cjs/api/resources/customer/resources/discovery/client/Client.js +1 -1
  57. package/dist/cjs/api/types/BusinessCategory.d.ts +9 -0
  58. package/dist/cjs/api/types/BusinessCategory.js +3 -0
  59. package/dist/cjs/api/types/BusinessCertification.d.ts +7 -0
  60. package/dist/cjs/api/types/BusinessCertification.js +3 -0
  61. package/dist/cjs/api/types/BusinessCuisine.d.ts +6 -0
  62. package/dist/cjs/api/types/BusinessCuisine.js +3 -0
  63. package/dist/cjs/api/types/BusinessProfile.d.ts +1 -1
  64. package/dist/cjs/api/types/BusinessSearchResult.d.ts +2 -1
  65. package/dist/cjs/api/types/BusinessSummary.d.ts +2 -1
  66. package/dist/cjs/api/types/CustomerBusinessProfile.d.ts +1 -1
  67. package/dist/cjs/api/types/DiscoveryBusiness.d.ts +2 -1
  68. package/dist/cjs/api/types/DiscoveryCategory.d.ts +6 -2
  69. package/dist/cjs/api/types/ExploreBusiness.d.ts +2 -1
  70. package/dist/cjs/api/types/index.d.ts +3 -0
  71. package/dist/cjs/api/types/index.js +3 -0
  72. package/dist/cjs/version.d.ts +1 -1
  73. package/dist/cjs/version.js +1 -1
  74. package/dist/esm/BaseClient.mjs +2 -2
  75. package/dist/esm/api/resources/business/client/Client.d.mts +2 -2
  76. package/dist/esm/api/resources/business/client/Client.mjs +4 -4
  77. package/dist/esm/api/resources/business/resources/businesses/client/Client.d.mts +49 -8
  78. package/dist/esm/api/resources/business/resources/businesses/client/Client.mjs +164 -41
  79. package/dist/esm/api/resources/business/resources/businesses/client/requests/DeleteBusinessesRequest.d.mts +1 -0
  80. package/dist/esm/api/resources/business/resources/businesses/client/requests/GetBusinessesRequest.d.mts +1 -0
  81. package/dist/esm/api/resources/business/resources/businesses/client/requests/ListBusinessesRequest.d.mts +10 -0
  82. package/dist/esm/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.d.mts +50 -0
  83. package/dist/esm/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.mjs +21 -0
  84. package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.d.mts +62 -0
  85. package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.mjs +21 -0
  86. package/dist/esm/api/resources/business/resources/businesses/client/requests/index.d.mts +3 -1
  87. package/dist/esm/api/resources/business/resources/businesses/client/requests/index.mjs +2 -1
  88. package/dist/esm/api/resources/business/resources/businesses/index.d.mts +1 -0
  89. package/dist/esm/api/resources/business/resources/businesses/index.mjs +1 -0
  90. package/dist/esm/api/resources/business/resources/businesses/types/GetBusinessesResponse.d.mts +4 -0
  91. package/dist/esm/api/resources/business/resources/businesses/types/GetBusinessesResponse.mjs +2 -0
  92. package/dist/esm/api/resources/business/resources/businesses/types/ListBusinessesResponse.d.mts +4 -0
  93. package/dist/esm/api/resources/business/resources/businesses/types/ListBusinessesResponse.mjs +2 -0
  94. package/dist/esm/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.d.mts +4 -0
  95. package/dist/esm/api/resources/business/resources/businesses/types/UpdateBusinessesResponse.mjs +2 -0
  96. package/dist/esm/api/resources/business/resources/businesses/types/index.d.mts +3 -0
  97. package/dist/esm/api/resources/business/resources/businesses/types/index.mjs +3 -0
  98. package/dist/esm/api/resources/business/resources/categories/client/Client.d.mts +7 -1
  99. package/dist/esm/api/resources/business/resources/categories/client/Client.mjs +20 -6
  100. package/dist/esm/api/resources/business/resources/categories/index.d.mts +1 -0
  101. package/dist/esm/api/resources/business/resources/categories/index.mjs +1 -0
  102. package/dist/esm/api/resources/business/resources/categories/types/ListCategoriesResponse.d.mts +4 -0
  103. package/dist/esm/api/resources/business/resources/categories/types/ListCategoriesResponse.mjs +2 -0
  104. package/dist/esm/api/resources/business/resources/categories/types/index.d.mts +1 -0
  105. package/dist/esm/api/resources/business/resources/categories/types/index.mjs +1 -0
  106. package/dist/esm/api/resources/business/resources/certifications/client/Client.d.mts +7 -1
  107. package/dist/esm/api/resources/business/resources/certifications/client/Client.mjs +20 -6
  108. package/dist/esm/api/resources/business/resources/certifications/index.d.mts +1 -0
  109. package/dist/esm/api/resources/business/resources/certifications/index.mjs +1 -0
  110. package/dist/esm/api/resources/business/resources/certifications/types/ListCertificationsResponse.d.mts +4 -0
  111. package/dist/esm/api/resources/business/resources/certifications/types/ListCertificationsResponse.mjs +2 -0
  112. package/dist/esm/api/resources/business/resources/certifications/types/index.d.mts +1 -0
  113. package/dist/esm/api/resources/business/resources/certifications/types/index.mjs +1 -0
  114. package/dist/esm/api/resources/business/resources/cuisines/client/Client.d.mts +7 -1
  115. package/dist/esm/api/resources/business/resources/cuisines/client/Client.mjs +20 -6
  116. package/dist/esm/api/resources/business/resources/cuisines/index.d.mts +1 -0
  117. package/dist/esm/api/resources/business/resources/cuisines/index.mjs +1 -0
  118. package/dist/esm/api/resources/business/resources/cuisines/types/ListCuisinesResponse.d.mts +4 -0
  119. package/dist/esm/api/resources/business/resources/cuisines/types/ListCuisinesResponse.mjs +2 -0
  120. package/dist/esm/api/resources/business/resources/cuisines/types/index.d.mts +1 -0
  121. package/dist/esm/api/resources/business/resources/cuisines/types/index.mjs +1 -0
  122. package/dist/esm/api/resources/business/resources/index.d.mts +4 -0
  123. package/dist/esm/api/resources/business/resources/index.mjs +4 -0
  124. package/dist/esm/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.mts +1 -1
  125. package/dist/esm/api/resources/customer/client/Client.d.mts +1 -1
  126. package/dist/esm/api/resources/customer/client/Client.mjs +3 -3
  127. package/dist/esm/api/resources/customer/client/requests/SearchCustomerRequest.d.mts +3 -3
  128. package/dist/esm/api/resources/customer/resources/discovery/client/Client.d.mts +1 -1
  129. package/dist/esm/api/resources/customer/resources/discovery/client/Client.mjs +1 -1
  130. package/dist/esm/api/types/BusinessCategory.d.mts +9 -0
  131. package/dist/esm/api/types/BusinessCategory.mjs +2 -0
  132. package/dist/esm/api/types/BusinessCertification.d.mts +7 -0
  133. package/dist/esm/api/types/BusinessCertification.mjs +2 -0
  134. package/dist/esm/api/types/BusinessCuisine.d.mts +6 -0
  135. package/dist/esm/api/types/BusinessCuisine.mjs +2 -0
  136. package/dist/esm/api/types/BusinessProfile.d.mts +1 -1
  137. package/dist/esm/api/types/BusinessSearchResult.d.mts +2 -1
  138. package/dist/esm/api/types/BusinessSummary.d.mts +2 -1
  139. package/dist/esm/api/types/CustomerBusinessProfile.d.mts +1 -1
  140. package/dist/esm/api/types/DiscoveryBusiness.d.mts +2 -1
  141. package/dist/esm/api/types/DiscoveryCategory.d.mts +6 -2
  142. package/dist/esm/api/types/ExploreBusiness.d.mts +2 -1
  143. package/dist/esm/api/types/index.d.mts +3 -0
  144. package/dist/esm/api/types/index.mjs +3 -0
  145. package/dist/esm/version.d.mts +1 -1
  146. package/dist/esm/version.mjs +1 -1
  147. package/package.json +12 -12
  148. package/reference.md +354 -214
  149. package/dist/cjs/api/resources/business/resources/businesses/client/requests/UpdateBusinessesRequest.d.ts +0 -9
  150. package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessesRequest.d.mts +0 -9
  151. /package/dist/cjs/api/resources/business/resources/businesses/client/requests/{UpdateBusinessesRequest.js → ListBusinessesRequest.js} +0 -0
  152. /package/dist/esm/api/resources/business/resources/businesses/client/requests/{UpdateBusinessesRequest.mjs → ListBusinessesRequest.mjs} +0 -0
@@ -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.23",
47
- "User-Agent": "@51eat/sdk/0.0.23",
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);
@@ -18,24 +18,24 @@ export declare class BusinessClient {
18
18
  protected readonly _options: NormalizedClientOptionsWithAuth<BusinessClient.Options>;
19
19
  protected _auth: AuthClient | undefined;
20
20
  protected _bulletins: BulletinsClient | undefined;
21
+ protected _businesses: BusinessesClient | undefined;
21
22
  protected _gallery: GalleryClient | undefined;
22
23
  protected _menus: MenusClient | undefined;
23
24
  protected _messaging: MessagingClient | undefined;
24
25
  protected _profile: ProfileClient | undefined;
25
26
  protected _pushNotifications: PushNotificationsClient | undefined;
26
- protected _businesses: BusinessesClient | undefined;
27
27
  protected _cuisines: CuisinesClient | undefined;
28
28
  protected _certifications: CertificationsClient | undefined;
29
29
  protected _categories: CategoriesClient | undefined;
30
30
  constructor(options?: BusinessClient.Options);
31
31
  get auth(): AuthClient;
32
32
  get bulletins(): BulletinsClient;
33
+ get businesses(): BusinessesClient;
33
34
  get gallery(): GalleryClient;
34
35
  get menus(): MenusClient;
35
36
  get messaging(): MessagingClient;
36
37
  get profile(): ProfileClient;
37
38
  get pushNotifications(): PushNotificationsClient;
38
- get businesses(): BusinessesClient;
39
39
  get cuisines(): CuisinesClient;
40
40
  get certifications(): CertificationsClient;
41
41
  get categories(): CategoriesClient;
@@ -26,6 +26,10 @@ class BusinessClient {
26
26
  var _a;
27
27
  return ((_a = this._bulletins) !== null && _a !== void 0 ? _a : (this._bulletins = new Client_js_2.BulletinsClient(this._options)));
28
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
+ }
29
33
  get gallery() {
30
34
  var _a;
31
35
  return ((_a = this._gallery) !== null && _a !== void 0 ? _a : (this._gallery = new Client_js_7.GalleryClient(this._options)));
@@ -46,10 +50,6 @@ class BusinessClient {
46
50
  var _a;
47
51
  return ((_a = this._pushNotifications) !== null && _a !== void 0 ? _a : (this._pushNotifications = new Client_js_11.PushNotificationsClient(this._options)));
48
52
  }
49
- get businesses() {
50
- var _a;
51
- return ((_a = this._businesses) !== null && _a !== void 0 ? _a : (this._businesses = new Client_js_3.BusinessesClient(this._options)));
52
- }
53
53
  get cuisines() {
54
54
  var _a;
55
55
  return ((_a = this._cuisines) !== null && _a !== void 0 ? _a : (this._cuisines = new Client_js_6.CuisinesClient(this._options)));
@@ -1,7 +1,7 @@
1
1
  import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
3
  import * as core from "../../../../../../core/index.js";
4
- import type * as FiveOneEat from "../../../../../index.js";
4
+ import * as FiveOneEat from "../../../../../index.js";
5
5
  export declare namespace BusinessesClient {
6
6
  type Options = BaseClientOptions;
7
7
  interface RequestOptions extends BaseRequestOptions {
@@ -11,47 +11,88 @@ export declare class BusinessesClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<BusinessesClient.Options>;
12
12
  constructor(options?: BusinessesClient.Options);
13
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
14
18
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
15
19
  *
20
+ * @throws {@link FiveOneEat.UnauthorizedError}
21
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
22
+ *
16
23
  * @example
17
24
  * await client.business.businesses.list()
18
25
  */
19
- list(requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<void>;
26
+ list(request?: FiveOneEat.business.ListBusinessesRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.ListBusinessesResponse>;
20
27
  private __list;
21
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
22
33
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
23
34
  *
35
+ * @throws {@link FiveOneEat.UnauthorizedError}
36
+ * @throws {@link FiveOneEat.ForbiddenError}
37
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
38
+ *
24
39
  * @example
25
- * await client.business.businesses.create()
40
+ * await client.business.businesses.create({
41
+ * name: "name",
42
+ * handle: "handle",
43
+ * category_ids: [1]
44
+ * })
26
45
  */
27
- create(requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<void>;
46
+ create(request: FiveOneEat.business.StoreBusinessRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<number>;
28
47
  private __create;
29
48
  /**
49
+ * Retrieve a single business owned by the authenticated user.
50
+ *
30
51
  * @param {FiveOneEat.business.GetBusinessesRequest} request
31
52
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
32
53
  *
54
+ * @throws {@link FiveOneEat.UnauthorizedError}
55
+ * @throws {@link FiveOneEat.ForbiddenError}
56
+ * @throws {@link FiveOneEat.NotFoundError}
57
+ *
33
58
  * @example
34
59
  * await client.business.businesses.get({
35
60
  * business: "business"
36
61
  * })
37
62
  */
38
- get(request: FiveOneEat.business.GetBusinessesRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<void>;
63
+ get(request: FiveOneEat.business.GetBusinessesRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.GetBusinessesResponse>;
39
64
  private __get;
40
65
  /**
41
- * @param {FiveOneEat.business.UpdateBusinessesRequest} request
66
+ * Update core fields for a business owned by the authenticated user.
67
+ *
68
+ * @param {FiveOneEat.business.UpdateBusinessRequest} request
42
69
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
43
70
  *
71
+ * @throws {@link FiveOneEat.UnauthorizedError}
72
+ * @throws {@link FiveOneEat.ForbiddenError}
73
+ * @throws {@link FiveOneEat.NotFoundError}
74
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
75
+ *
44
76
  * @example
45
77
  * await client.business.businesses.update({
46
- * business: "business"
78
+ * business: "business",
79
+ * name: "name",
80
+ * handle: "handle",
81
+ * category_ids: [1]
47
82
  * })
48
83
  */
49
- update(request: FiveOneEat.business.UpdateBusinessesRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<void>;
84
+ update(request: FiveOneEat.business.UpdateBusinessRequest, requestOptions?: BusinessesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.UpdateBusinessesResponse>;
50
85
  private __update;
51
86
  /**
87
+ * Delete a business owned by the authenticated user.
88
+ *
52
89
  * @param {FiveOneEat.business.DeleteBusinessesRequest} request
53
90
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
54
91
  *
92
+ * @throws {@link FiveOneEat.UnauthorizedError}
93
+ * @throws {@link FiveOneEat.ForbiddenError}
94
+ * @throws {@link FiveOneEat.NotFoundError}
95
+ *
55
96
  * @example
56
97
  * await client.business.businesses.delete({
57
98
  * business: "business"
@@ -42,6 +42,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
43
43
  });
44
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
+ };
45
56
  Object.defineProperty(exports, "__esModule", { value: true });
46
57
  exports.BusinessesClient = void 0;
47
58
  const BaseClient_js_1 = require("../../../../../../BaseClient.js");
@@ -50,29 +61,47 @@ const core = __importStar(require("../../../../../../core/index.js"));
50
61
  const environments = __importStar(require("../../../../../../environments.js"));
51
62
  const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
52
63
  const errors = __importStar(require("../../../../../../errors/index.js"));
64
+ const FiveOneEat = __importStar(require("../../../../../index.js"));
53
65
  class BusinessesClient {
54
66
  constructor(options = {}) {
55
67
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
56
68
  }
57
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
58
74
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
59
75
  *
76
+ * @throws {@link FiveOneEat.UnauthorizedError}
77
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
78
+ *
60
79
  * @example
61
80
  * await client.business.businesses.list()
62
81
  */
63
- list(requestOptions) {
64
- return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
82
+ list(request = {}, requestOptions) {
83
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
65
84
  }
66
- __list(requestOptions) {
67
- return __awaiter(this, void 0, void 0, function* () {
85
+ __list() {
86
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
68
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
+ };
69
93
  const _authRequest = yield this._options.authProvider.getAuthRequest();
70
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);
71
95
  const _response = yield core.fetcher({
72
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"),
73
97
  method: "GET",
74
98
  headers: _headers,
75
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
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(),
76
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,
77
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,
78
107
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -80,28 +109,50 @@ class BusinessesClient {
80
109
  logging: this._options.logging,
81
110
  });
82
111
  if (_response.ok) {
83
- return { data: undefined, rawResponse: _response.rawResponse };
112
+ return {
113
+ data: _response.body,
114
+ rawResponse: _response.rawResponse,
115
+ };
84
116
  }
85
117
  if (_response.error.reason === "status-code") {
86
- throw new errors.FiveOneEatError({
87
- statusCode: _response.error.statusCode,
88
- body: _response.error.body,
89
- rawResponse: _response.rawResponse,
90
- });
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
+ }
91
130
  }
92
131
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/businesses");
93
132
  });
94
133
  }
95
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
96
139
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
97
140
  *
141
+ * @throws {@link FiveOneEat.UnauthorizedError}
142
+ * @throws {@link FiveOneEat.ForbiddenError}
143
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
144
+ *
98
145
  * @example
99
- * await client.business.businesses.create()
146
+ * await client.business.businesses.create({
147
+ * name: "name",
148
+ * handle: "handle",
149
+ * category_ids: [1]
150
+ * })
100
151
  */
101
- create(requestOptions) {
102
- return core.HttpResponsePromise.fromPromise(this.__create(requestOptions));
152
+ create(request, requestOptions) {
153
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
103
154
  }
104
- __create(requestOptions) {
155
+ __create(request, requestOptions) {
105
156
  return __awaiter(this, void 0, void 0, function* () {
106
157
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
107
158
  const _authRequest = yield this._options.authProvider.getAuthRequest();
@@ -110,7 +161,10 @@ class BusinessesClient {
110
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"),
111
162
  method: "POST",
112
163
  headers: _headers,
164
+ contentType: "application/json",
113
165
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
166
+ requestType: "json",
167
+ body: request,
114
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,
115
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,
116
170
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -118,22 +172,37 @@ class BusinessesClient {
118
172
  logging: this._options.logging,
119
173
  });
120
174
  if (_response.ok) {
121
- return { data: undefined, rawResponse: _response.rawResponse };
175
+ return { data: _response.body, rawResponse: _response.rawResponse };
122
176
  }
123
177
  if (_response.error.reason === "status-code") {
124
- throw new errors.FiveOneEatError({
125
- statusCode: _response.error.statusCode,
126
- body: _response.error.body,
127
- rawResponse: _response.rawResponse,
128
- });
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
+ }
129
192
  }
130
193
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/businesses");
131
194
  });
132
195
  }
133
196
  /**
197
+ * Retrieve a single business owned by the authenticated user.
198
+ *
134
199
  * @param {FiveOneEat.business.GetBusinessesRequest} request
135
200
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
136
201
  *
202
+ * @throws {@link FiveOneEat.UnauthorizedError}
203
+ * @throws {@link FiveOneEat.ForbiddenError}
204
+ * @throws {@link FiveOneEat.NotFoundError}
205
+ *
137
206
  * @example
138
207
  * await client.business.businesses.get({
139
208
  * business: "business"
@@ -160,25 +229,47 @@ class BusinessesClient {
160
229
  logging: this._options.logging,
161
230
  });
162
231
  if (_response.ok) {
163
- return { data: undefined, rawResponse: _response.rawResponse };
232
+ return {
233
+ data: _response.body,
234
+ rawResponse: _response.rawResponse,
235
+ };
164
236
  }
165
237
  if (_response.error.reason === "status-code") {
166
- throw new errors.FiveOneEatError({
167
- statusCode: _response.error.statusCode,
168
- body: _response.error.body,
169
- rawResponse: _response.rawResponse,
170
- });
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
+ }
171
252
  }
172
253
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/businesses/{business}");
173
254
  });
174
255
  }
175
256
  /**
176
- * @param {FiveOneEat.business.UpdateBusinessesRequest} request
257
+ * Update core fields for a business owned by the authenticated user.
258
+ *
259
+ * @param {FiveOneEat.business.UpdateBusinessRequest} request
177
260
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
178
261
  *
262
+ * @throws {@link FiveOneEat.UnauthorizedError}
263
+ * @throws {@link FiveOneEat.ForbiddenError}
264
+ * @throws {@link FiveOneEat.NotFoundError}
265
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
266
+ *
179
267
  * @example
180
268
  * await client.business.businesses.update({
181
- * business: "business"
269
+ * business: "business",
270
+ * name: "name",
271
+ * handle: "handle",
272
+ * category_ids: [1]
182
273
  * })
183
274
  */
184
275
  update(request, requestOptions) {
@@ -187,14 +278,17 @@ class BusinessesClient {
187
278
  __update(request, requestOptions) {
188
279
  return __awaiter(this, void 0, void 0, function* () {
189
280
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
190
- const { business } = request;
281
+ const { business } = request, _body = __rest(request, ["business"]);
191
282
  const _authRequest = yield this._options.authProvider.getAuthRequest();
192
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);
193
284
  const _response = yield core.fetcher({
194
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)}`),
195
286
  method: "PUT",
196
287
  headers: _headers,
288
+ contentType: "application/json",
197
289
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
290
+ requestType: "json",
291
+ body: _body,
198
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,
199
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,
200
294
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -202,22 +296,42 @@ class BusinessesClient {
202
296
  logging: this._options.logging,
203
297
  });
204
298
  if (_response.ok) {
205
- return { data: undefined, rawResponse: _response.rawResponse };
299
+ return {
300
+ data: _response.body,
301
+ rawResponse: _response.rawResponse,
302
+ };
206
303
  }
207
304
  if (_response.error.reason === "status-code") {
208
- throw new errors.FiveOneEatError({
209
- statusCode: _response.error.statusCode,
210
- body: _response.error.body,
211
- rawResponse: _response.rawResponse,
212
- });
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
+ }
213
321
  }
214
322
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/business/businesses/{business}");
215
323
  });
216
324
  }
217
325
  /**
326
+ * Delete a business owned by the authenticated user.
327
+ *
218
328
  * @param {FiveOneEat.business.DeleteBusinessesRequest} request
219
329
  * @param {BusinessesClient.RequestOptions} requestOptions - Request-specific configuration.
220
330
  *
331
+ * @throws {@link FiveOneEat.UnauthorizedError}
332
+ * @throws {@link FiveOneEat.ForbiddenError}
333
+ * @throws {@link FiveOneEat.NotFoundError}
334
+ *
221
335
  * @example
222
336
  * await client.business.businesses.delete({
223
337
  * business: "business"
@@ -247,11 +361,20 @@ class BusinessesClient {
247
361
  return { data: undefined, rawResponse: _response.rawResponse };
248
362
  }
249
363
  if (_response.error.reason === "status-code") {
250
- throw new errors.FiveOneEatError({
251
- statusCode: _response.error.statusCode,
252
- body: _response.error.body,
253
- rawResponse: _response.rawResponse,
254
- });
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
+ }
255
378
  }
256
379
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/business/businesses/{business}");
257
380
  });
@@ -5,5 +5,6 @@
5
5
  * }
6
6
  */
7
7
  export interface DeleteBusinessesRequest {
8
+ /** The business ID */
8
9
  business: string;
9
10
  }
@@ -5,5 +5,6 @@
5
5
  * }
6
6
  */
7
7
  export interface GetBusinessesRequest {
8
+ /** The business ID */
8
9
  business: string;
9
10
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListBusinessesRequest {
6
+ /** Page number for pagination */
7
+ page?: number;
8
+ /** Number of businesses per page */
9
+ per_page?: number;
10
+ }
@@ -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,24 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.StoreBusinessRequest = void 0;
5
+ var StoreBusinessRequest;
6
+ (function (StoreBusinessRequest) {
7
+ let OperatingMonths;
8
+ (function (OperatingMonths) {
9
+ OperatingMonths.Item = {
10
+ January: "january",
11
+ February: "february",
12
+ March: "march",
13
+ April: "april",
14
+ May: "may",
15
+ June: "june",
16
+ July: "july",
17
+ August: "august",
18
+ September: "september",
19
+ October: "october",
20
+ November: "november",
21
+ December: "december",
22
+ };
23
+ })(OperatingMonths = StoreBusinessRequest.OperatingMonths || (StoreBusinessRequest.OperatingMonths = {}));
24
+ })(StoreBusinessRequest || (exports.StoreBusinessRequest = StoreBusinessRequest = {}));