@51eat/sdk 0.0.61 → 0.0.62

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 (111) hide show
  1. package/README.md +13 -15
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +3 -0
  4. package/dist/cjs/Client.js +25 -20
  5. package/dist/cjs/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.d.ts +0 -9
  6. package/dist/cjs/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.d.ts +0 -9
  7. package/dist/cjs/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.ts +0 -11
  8. package/dist/cjs/api/resources/businessHours/client/Client.d.ts +91 -0
  9. package/dist/cjs/api/resources/businessHours/client/Client.js +361 -0
  10. package/dist/cjs/api/resources/businessHours/client/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/businessHours/client/index.js +17 -0
  12. package/dist/cjs/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.d.ts +10 -0
  13. package/dist/cjs/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.js +3 -0
  14. package/dist/cjs/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.d.ts +16 -0
  15. package/dist/cjs/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.js +3 -0
  16. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.d.ts +19 -0
  17. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.js +3 -0
  18. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.d.ts +25 -0
  19. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.js +3 -0
  20. package/dist/cjs/api/resources/businessHours/client/requests/index.d.ts +4 -0
  21. package/dist/cjs/api/resources/businessHours/client/requests/index.js +2 -0
  22. package/dist/cjs/api/resources/businessHours/exports.d.ts +2 -0
  23. package/dist/cjs/api/resources/businessHours/exports.js +21 -0
  24. package/dist/cjs/api/resources/businessHours/index.d.ts +2 -0
  25. package/dist/cjs/api/resources/businessHours/index.js +18 -0
  26. package/dist/cjs/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.d.ts +4 -0
  27. package/dist/cjs/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.js +3 -0
  28. package/dist/cjs/api/resources/businessHours/types/GetBusinessHoursResponse.d.ts +4 -0
  29. package/dist/cjs/api/resources/businessHours/types/GetBusinessHoursResponse.js +3 -0
  30. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.d.ts +4 -0
  31. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.js +3 -0
  32. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHoursResponse.d.ts +4 -0
  33. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHoursResponse.js +3 -0
  34. package/dist/cjs/api/resources/businessHours/types/index.d.ts +4 -0
  35. package/dist/cjs/api/resources/businessHours/types/index.js +20 -0
  36. package/dist/cjs/api/resources/index.d.ts +3 -0
  37. package/dist/cjs/api/resources/index.js +4 -1
  38. package/dist/cjs/api/types/BusinessHourExceptionResource.d.ts +10 -0
  39. package/dist/cjs/api/types/BusinessHourExceptionResource.js +3 -0
  40. package/dist/cjs/api/types/BusinessHourSlotResource.d.ts +6 -0
  41. package/dist/cjs/api/types/BusinessHourSlotResource.js +3 -0
  42. package/dist/cjs/api/types/BusinessHoursResource.d.ts +7 -0
  43. package/dist/cjs/api/types/BusinessHoursResource.js +3 -0
  44. package/dist/cjs/api/types/BusinessInventoryLog.d.ts +2 -2
  45. package/dist/cjs/api/types/BusinessProfile.d.ts +6 -7
  46. package/dist/cjs/api/types/BusinessScheduleDayResource.d.ts +5 -0
  47. package/dist/cjs/api/types/BusinessScheduleDayResource.js +3 -0
  48. package/dist/cjs/api/types/CustomerBusinessProfile.d.ts +6 -7
  49. package/dist/cjs/api/types/CustomerCartItem.d.ts +1 -1
  50. package/dist/cjs/api/types/CustomerEventDetail.d.ts +1 -1
  51. package/dist/cjs/api/types/EventFeedItem.d.ts +1 -1
  52. package/dist/cjs/api/types/index.d.ts +4 -0
  53. package/dist/cjs/api/types/index.js +4 -0
  54. package/dist/cjs/version.d.ts +1 -1
  55. package/dist/cjs/version.js +1 -1
  56. package/dist/esm/BaseClient.mjs +2 -2
  57. package/dist/esm/Client.d.mts +3 -0
  58. package/dist/esm/Client.mjs +5 -0
  59. package/dist/esm/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.d.mts +0 -9
  60. package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.d.mts +0 -9
  61. package/dist/esm/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.mts +0 -11
  62. package/dist/esm/api/resources/businessHours/client/Client.d.mts +91 -0
  63. package/dist/esm/api/resources/businessHours/client/Client.mjs +324 -0
  64. package/dist/esm/api/resources/businessHours/client/index.d.mts +1 -0
  65. package/dist/esm/api/resources/businessHours/client/index.mjs +1 -0
  66. package/dist/esm/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.d.mts +10 -0
  67. package/dist/esm/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.mjs +2 -0
  68. package/dist/esm/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.d.mts +16 -0
  69. package/dist/esm/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.mjs +2 -0
  70. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.d.mts +19 -0
  71. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.mjs +2 -0
  72. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.d.mts +25 -0
  73. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.mjs +2 -0
  74. package/dist/esm/api/resources/businessHours/client/requests/index.d.mts +4 -0
  75. package/dist/esm/api/resources/businessHours/client/requests/index.mjs +1 -0
  76. package/dist/esm/api/resources/businessHours/exports.d.mts +2 -0
  77. package/dist/esm/api/resources/businessHours/exports.mjs +3 -0
  78. package/dist/esm/api/resources/businessHours/index.d.mts +2 -0
  79. package/dist/esm/api/resources/businessHours/index.mjs +2 -0
  80. package/dist/esm/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.d.mts +4 -0
  81. package/dist/esm/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.mjs +2 -0
  82. package/dist/esm/api/resources/businessHours/types/GetBusinessHoursResponse.d.mts +4 -0
  83. package/dist/esm/api/resources/businessHours/types/GetBusinessHoursResponse.mjs +2 -0
  84. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.d.mts +4 -0
  85. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.mjs +2 -0
  86. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHoursResponse.d.mts +4 -0
  87. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHoursResponse.mjs +2 -0
  88. package/dist/esm/api/resources/businessHours/types/index.d.mts +4 -0
  89. package/dist/esm/api/resources/businessHours/types/index.mjs +4 -0
  90. package/dist/esm/api/resources/index.d.mts +3 -0
  91. package/dist/esm/api/resources/index.mjs +3 -0
  92. package/dist/esm/api/types/BusinessHourExceptionResource.d.mts +10 -0
  93. package/dist/esm/api/types/BusinessHourExceptionResource.mjs +2 -0
  94. package/dist/esm/api/types/BusinessHourSlotResource.d.mts +6 -0
  95. package/dist/esm/api/types/BusinessHourSlotResource.mjs +2 -0
  96. package/dist/esm/api/types/BusinessHoursResource.d.mts +7 -0
  97. package/dist/esm/api/types/BusinessHoursResource.mjs +2 -0
  98. package/dist/esm/api/types/BusinessInventoryLog.d.mts +2 -2
  99. package/dist/esm/api/types/BusinessProfile.d.mts +6 -7
  100. package/dist/esm/api/types/BusinessScheduleDayResource.d.mts +5 -0
  101. package/dist/esm/api/types/BusinessScheduleDayResource.mjs +2 -0
  102. package/dist/esm/api/types/CustomerBusinessProfile.d.mts +6 -7
  103. package/dist/esm/api/types/CustomerCartItem.d.mts +1 -1
  104. package/dist/esm/api/types/CustomerEventDetail.d.mts +1 -1
  105. package/dist/esm/api/types/EventFeedItem.d.mts +1 -1
  106. package/dist/esm/api/types/index.d.mts +4 -0
  107. package/dist/esm/api/types/index.mjs +4 -0
  108. package/dist/esm/version.d.mts +1 -1
  109. package/dist/esm/version.mjs +1 -1
  110. package/package.json +12 -1
  111. package/reference.md +253 -0
@@ -0,0 +1,324 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
23
+ import { mergeHeaders } from "../../../../core/headers.mjs";
24
+ import * as core from "../../../../core/index.mjs";
25
+ import * as environments from "../../../../environments.mjs";
26
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
27
+ import * as errors from "../../../../errors/index.mjs";
28
+ import * as FiveOneEat from "../../../index.mjs";
29
+ export class BusinessHoursClient {
30
+ constructor(options = {}) {
31
+ this._options = normalizeClientOptionsWithAuth(options);
32
+ }
33
+ /**
34
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @throws {@link FiveOneEat.UnauthorizedError}
37
+ *
38
+ * @example
39
+ * await client.businessHours.getBusinessHours()
40
+ */
41
+ getBusinessHours(requestOptions) {
42
+ return core.HttpResponsePromise.fromPromise(this.__getBusinessHours(requestOptions));
43
+ }
44
+ __getBusinessHours(requestOptions) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
47
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
48
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
49
+ const _response = yield core.fetcher({
50
+ 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/hours"),
51
+ method: "GET",
52
+ headers: _headers,
53
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
54
+ 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,
55
+ 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,
56
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
57
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
58
+ logging: this._options.logging,
59
+ });
60
+ if (_response.ok) {
61
+ return { data: _response.body, rawResponse: _response.rawResponse };
62
+ }
63
+ if (_response.error.reason === "status-code") {
64
+ switch (_response.error.statusCode) {
65
+ case 401:
66
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
67
+ default:
68
+ throw new errors.FiveOneEatError({
69
+ statusCode: _response.error.statusCode,
70
+ body: _response.error.body,
71
+ rawResponse: _response.rawResponse,
72
+ });
73
+ }
74
+ }
75
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/hours");
76
+ });
77
+ }
78
+ /**
79
+ * @param {FiveOneEat.UpdateBusinessHoursRequest} request
80
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
81
+ *
82
+ * @throws {@link FiveOneEat.UnauthorizedError}
83
+ * @throws {@link FiveOneEat.ForbiddenError}
84
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
85
+ *
86
+ * @example
87
+ * await client.businessHours.updateBusinessHours({
88
+ * slots: [{
89
+ * day_of_week: 1,
90
+ * opens_at: "opens_at",
91
+ * closes_at: "closes_at"
92
+ * }]
93
+ * })
94
+ */
95
+ updateBusinessHours(request, requestOptions) {
96
+ return core.HttpResponsePromise.fromPromise(this.__updateBusinessHours(request, requestOptions));
97
+ }
98
+ __updateBusinessHours(request, requestOptions) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
101
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
102
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
103
+ const _response = yield core.fetcher({
104
+ 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/hours"),
105
+ method: "PUT",
106
+ headers: _headers,
107
+ contentType: "application/json",
108
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
109
+ requestType: "json",
110
+ body: request,
111
+ 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,
112
+ 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,
113
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
114
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
115
+ logging: this._options.logging,
116
+ });
117
+ if (_response.ok) {
118
+ return {
119
+ data: _response.body,
120
+ rawResponse: _response.rawResponse,
121
+ };
122
+ }
123
+ if (_response.error.reason === "status-code") {
124
+ switch (_response.error.statusCode) {
125
+ case 401:
126
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
127
+ case 403:
128
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
129
+ case 422:
130
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
131
+ default:
132
+ throw new errors.FiveOneEatError({
133
+ statusCode: _response.error.statusCode,
134
+ body: _response.error.body,
135
+ rawResponse: _response.rawResponse,
136
+ });
137
+ }
138
+ }
139
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/business/hours");
140
+ });
141
+ }
142
+ /**
143
+ * @param {FiveOneEat.StoreBusinessHourExceptionRequest} request
144
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
145
+ *
146
+ * @throws {@link FiveOneEat.UnauthorizedError}
147
+ * @throws {@link FiveOneEat.ForbiddenError}
148
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
149
+ *
150
+ * @example
151
+ * await client.businessHours.createBusinessHourException({
152
+ * starts_on: "2024-01-15T09:30:00Z",
153
+ * is_closed: true
154
+ * })
155
+ */
156
+ createBusinessHourException(request, requestOptions) {
157
+ return core.HttpResponsePromise.fromPromise(this.__createBusinessHourException(request, requestOptions));
158
+ }
159
+ __createBusinessHourException(request, requestOptions) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
162
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
163
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
164
+ const _response = yield core.fetcher({
165
+ 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/hours/exceptions"),
166
+ method: "POST",
167
+ headers: _headers,
168
+ contentType: "application/json",
169
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
170
+ requestType: "json",
171
+ body: request,
172
+ 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,
173
+ 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,
174
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
175
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
176
+ logging: this._options.logging,
177
+ });
178
+ if (_response.ok) {
179
+ return {
180
+ data: _response.body,
181
+ rawResponse: _response.rawResponse,
182
+ };
183
+ }
184
+ if (_response.error.reason === "status-code") {
185
+ switch (_response.error.statusCode) {
186
+ case 401:
187
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
188
+ case 403:
189
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
190
+ case 422:
191
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
192
+ default:
193
+ throw new errors.FiveOneEatError({
194
+ statusCode: _response.error.statusCode,
195
+ body: _response.error.body,
196
+ rawResponse: _response.rawResponse,
197
+ });
198
+ }
199
+ }
200
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/hours/exceptions");
201
+ });
202
+ }
203
+ /**
204
+ * @param {FiveOneEat.DeleteBusinessHourExceptionRequest} request
205
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
206
+ *
207
+ * @throws {@link FiveOneEat.UnauthorizedError}
208
+ * @throws {@link FiveOneEat.ForbiddenError}
209
+ * @throws {@link FiveOneEat.NotFoundError}
210
+ *
211
+ * @example
212
+ * await client.businessHours.deleteBusinessHourException({
213
+ * exception: "exception"
214
+ * })
215
+ */
216
+ deleteBusinessHourException(request, requestOptions) {
217
+ return core.HttpResponsePromise.fromPromise(this.__deleteBusinessHourException(request, requestOptions));
218
+ }
219
+ __deleteBusinessHourException(request, requestOptions) {
220
+ return __awaiter(this, void 0, void 0, function* () {
221
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
222
+ const { exception } = request;
223
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
224
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
225
+ const _response = yield core.fetcher({
226
+ 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/hours/exceptions/${core.url.encodePathParam(exception)}`),
227
+ method: "DELETE",
228
+ headers: _headers,
229
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
230
+ 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,
231
+ 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,
232
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
233
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
234
+ logging: this._options.logging,
235
+ });
236
+ if (_response.ok) {
237
+ return { data: undefined, rawResponse: _response.rawResponse };
238
+ }
239
+ if (_response.error.reason === "status-code") {
240
+ switch (_response.error.statusCode) {
241
+ case 401:
242
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
243
+ case 403:
244
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
245
+ case 404:
246
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
247
+ default:
248
+ throw new errors.FiveOneEatError({
249
+ statusCode: _response.error.statusCode,
250
+ body: _response.error.body,
251
+ rawResponse: _response.rawResponse,
252
+ });
253
+ }
254
+ }
255
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/business/hours/exceptions/{exception}");
256
+ });
257
+ }
258
+ /**
259
+ * @param {FiveOneEat.UpdateBusinessHourExceptionRequest} request
260
+ * @param {BusinessHoursClient.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.businessHours.updateBusinessHourException({
269
+ * exception: "exception",
270
+ * starts_on: "2024-01-15T09:30:00Z",
271
+ * is_closed: true
272
+ * })
273
+ */
274
+ updateBusinessHourException(request, requestOptions) {
275
+ return core.HttpResponsePromise.fromPromise(this.__updateBusinessHourException(request, requestOptions));
276
+ }
277
+ __updateBusinessHourException(request, requestOptions) {
278
+ return __awaiter(this, void 0, void 0, function* () {
279
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
280
+ const { exception } = request, _body = __rest(request, ["exception"]);
281
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
282
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
283
+ const _response = yield core.fetcher({
284
+ 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/hours/exceptions/${core.url.encodePathParam(exception)}`),
285
+ method: "PATCH",
286
+ headers: _headers,
287
+ contentType: "application/json",
288
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
289
+ requestType: "json",
290
+ body: _body,
291
+ 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,
292
+ 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,
293
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
294
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
295
+ logging: this._options.logging,
296
+ });
297
+ if (_response.ok) {
298
+ return {
299
+ data: _response.body,
300
+ rawResponse: _response.rawResponse,
301
+ };
302
+ }
303
+ if (_response.error.reason === "status-code") {
304
+ switch (_response.error.statusCode) {
305
+ case 401:
306
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
307
+ case 403:
308
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
309
+ case 404:
310
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
311
+ case 422:
312
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
313
+ default:
314
+ throw new errors.FiveOneEatError({
315
+ statusCode: _response.error.statusCode,
316
+ body: _response.error.body,
317
+ rawResponse: _response.rawResponse,
318
+ });
319
+ }
320
+ }
321
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/business/hours/exceptions/{exception}");
322
+ });
323
+ }
324
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * exception: "exception"
5
+ * }
6
+ */
7
+ export interface DeleteBusinessHourExceptionRequest {
8
+ /** The exception ID */
9
+ exception: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * starts_on: "2024-01-15T09:30:00Z",
5
+ * is_closed: true
6
+ * }
7
+ */
8
+ export interface StoreBusinessHourExceptionRequest {
9
+ starts_on: string;
10
+ ends_on?: string | null;
11
+ is_closed: boolean;
12
+ opens_at?: string | null;
13
+ closes_at?: string | null;
14
+ label?: string | null;
15
+ message?: string | null;
16
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * exception: "exception",
5
+ * starts_on: "2024-01-15T09:30:00Z",
6
+ * is_closed: true
7
+ * }
8
+ */
9
+ export interface UpdateBusinessHourExceptionRequest {
10
+ /** The exception ID */
11
+ exception: string;
12
+ starts_on: string;
13
+ ends_on?: string | null;
14
+ is_closed: boolean;
15
+ opens_at?: string | null;
16
+ closes_at?: string | null;
17
+ label?: string | null;
18
+ message?: string | null;
19
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * slots: [{
5
+ * day_of_week: 1,
6
+ * opens_at: "opens_at",
7
+ * closes_at: "closes_at"
8
+ * }]
9
+ * }
10
+ */
11
+ export interface UpdateBusinessHoursRequest {
12
+ slots: UpdateBusinessHoursRequest.Slots.Item[];
13
+ }
14
+ export declare namespace UpdateBusinessHoursRequest {
15
+ type Slots = Slots.Item[];
16
+ namespace Slots {
17
+ interface Item {
18
+ day_of_week: number;
19
+ opens_at: string;
20
+ closes_at: string;
21
+ label?: (string | null) | undefined;
22
+ sort_order?: (number | null) | undefined;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export type { DeleteBusinessHourExceptionRequest } from "./DeleteBusinessHourExceptionRequest.mjs";
2
+ export type { StoreBusinessHourExceptionRequest } from "./StoreBusinessHourExceptionRequest.mjs";
3
+ export type { UpdateBusinessHourExceptionRequest } from "./UpdateBusinessHourExceptionRequest.mjs";
4
+ export type { UpdateBusinessHoursRequest } from "./UpdateBusinessHoursRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { BusinessHoursClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { BusinessHoursClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface CreateBusinessHourExceptionResponse {
3
+ data: FiveOneEat.BusinessHourExceptionResource;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface GetBusinessHoursResponse {
3
+ data: FiveOneEat.BusinessHoursResource;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface UpdateBusinessHourExceptionResponse {
3
+ data: FiveOneEat.BusinessHourExceptionResource;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface UpdateBusinessHoursResponse {
3
+ data: FiveOneEat.BusinessHoursResource;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from "./CreateBusinessHourExceptionResponse.mjs";
2
+ export * from "./GetBusinessHoursResponse.mjs";
3
+ export * from "./UpdateBusinessHourExceptionResponse.mjs";
4
+ export * from "./UpdateBusinessHoursResponse.mjs";
@@ -0,0 +1,4 @@
1
+ export * from "./CreateBusinessHourExceptionResponse.mjs";
2
+ export * from "./GetBusinessHoursResponse.mjs";
3
+ export * from "./UpdateBusinessHourExceptionResponse.mjs";
4
+ export * from "./UpdateBusinessHoursResponse.mjs";
@@ -1,4 +1,7 @@
1
1
  export * as business from "./business/index.mjs";
2
+ export * from "./businessHours/client/requests/index.mjs";
3
+ export * as businessHours from "./businessHours/index.mjs";
4
+ export * from "./businessHours/types/index.mjs";
2
5
  export * from "./businessMessaging/client/requests/index.mjs";
3
6
  export * as businessMessaging from "./businessMessaging/index.mjs";
4
7
  export * from "./businessMessaging/types/index.mjs";
@@ -1,4 +1,7 @@
1
1
  export * as business from "./business/index.mjs";
2
+ export * from "./businessHours/client/requests/index.mjs";
3
+ export * as businessHours from "./businessHours/index.mjs";
4
+ export * from "./businessHours/types/index.mjs";
2
5
  export * from "./businessMessaging/client/requests/index.mjs";
3
6
  export * as businessMessaging from "./businessMessaging/index.mjs";
4
7
  export * from "./businessMessaging/types/index.mjs";
@@ -0,0 +1,10 @@
1
+ export interface BusinessHourExceptionResource {
2
+ id: string;
3
+ starts_on: string;
4
+ ends_on: string | null;
5
+ is_closed: boolean;
6
+ opens_at: string | null;
7
+ closes_at: string | null;
8
+ label: string | null;
9
+ message: string | null;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface BusinessHourSlotResource {
2
+ opens_at: string;
3
+ closes_at: string;
4
+ label: string | null;
5
+ sort_order: number;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ import type * as FiveOneEat from "../index.mjs";
2
+ export interface BusinessHoursResource {
3
+ is_open_now: boolean;
4
+ next_open_at: string | null;
5
+ schedule: FiveOneEat.BusinessScheduleDayResource[];
6
+ exceptions: FiveOneEat.BusinessHourExceptionResource[];
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -9,7 +9,7 @@ export interface BusinessInventoryLog {
9
9
  }
10
10
  export declare namespace BusinessInventoryLog {
11
11
  interface CreatedBy {
12
- id: string;
13
- name: string;
12
+ id: string | null;
13
+ name: string | null;
14
14
  }
15
15
  }
@@ -24,7 +24,7 @@ export interface BusinessProfile {
24
24
  has_location: boolean;
25
25
  logo: string | null;
26
26
  logo_url: string | null;
27
- hours: Record<string, BusinessProfile.Hours.Value>;
27
+ hours: BusinessProfile.Hours;
28
28
  seasonal: boolean;
29
29
  operating_months: number[];
30
30
  pickup_enabled: boolean;
@@ -42,12 +42,11 @@ export interface BusinessProfile {
42
42
  active_temporary_locations?: FiveOneEat.CustomerTemporaryLocation[] | undefined;
43
43
  }
44
44
  export declare namespace BusinessProfile {
45
- namespace Hours {
46
- interface Value {
47
- isOpen: boolean;
48
- openTime: string;
49
- closeTime: string;
50
- }
45
+ interface Hours {
46
+ is_open_now: string;
47
+ next_open_at: string | null;
48
+ schedule: FiveOneEat.BusinessScheduleDayResource[];
49
+ exceptions: FiveOneEat.BusinessHourExceptionResource[];
51
50
  }
52
51
  type Cuisines = Cuisines.Item[];
53
52
  namespace Cuisines {
@@ -0,0 +1,5 @@
1
+ import type * as FiveOneEat from "../index.mjs";
2
+ export interface BusinessScheduleDayResource {
3
+ day: string;
4
+ slots: FiveOneEat.BusinessHourSlotResource[];
5
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};