@51eat/sdk 0.0.60 → 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 (115) 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/products/client/requests/StoreProductRequest.d.ts +1 -0
  8. package/dist/cjs/api/resources/business/resources/products/client/requests/UpdateProductRequest.d.ts +1 -0
  9. package/dist/cjs/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.ts +0 -11
  10. package/dist/cjs/api/resources/businessHours/client/Client.d.ts +91 -0
  11. package/dist/cjs/api/resources/businessHours/client/Client.js +361 -0
  12. package/dist/cjs/api/resources/businessHours/client/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/businessHours/client/index.js +17 -0
  14. package/dist/cjs/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.d.ts +10 -0
  15. package/dist/cjs/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.js +3 -0
  16. package/dist/cjs/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.d.ts +16 -0
  17. package/dist/cjs/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.js +3 -0
  18. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.d.ts +19 -0
  19. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.js +3 -0
  20. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.d.ts +25 -0
  21. package/dist/cjs/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.js +3 -0
  22. package/dist/cjs/api/resources/businessHours/client/requests/index.d.ts +4 -0
  23. package/dist/cjs/api/resources/businessHours/client/requests/index.js +2 -0
  24. package/dist/cjs/api/resources/businessHours/exports.d.ts +2 -0
  25. package/dist/cjs/api/resources/businessHours/exports.js +21 -0
  26. package/dist/cjs/api/resources/businessHours/index.d.ts +2 -0
  27. package/dist/cjs/api/resources/businessHours/index.js +18 -0
  28. package/dist/cjs/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.d.ts +4 -0
  29. package/dist/cjs/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.js +3 -0
  30. package/dist/cjs/api/resources/businessHours/types/GetBusinessHoursResponse.d.ts +4 -0
  31. package/dist/cjs/api/resources/businessHours/types/GetBusinessHoursResponse.js +3 -0
  32. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.d.ts +4 -0
  33. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.js +3 -0
  34. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHoursResponse.d.ts +4 -0
  35. package/dist/cjs/api/resources/businessHours/types/UpdateBusinessHoursResponse.js +3 -0
  36. package/dist/cjs/api/resources/businessHours/types/index.d.ts +4 -0
  37. package/dist/cjs/api/resources/businessHours/types/index.js +20 -0
  38. package/dist/cjs/api/resources/index.d.ts +3 -0
  39. package/dist/cjs/api/resources/index.js +4 -1
  40. package/dist/cjs/api/types/BusinessHourExceptionResource.d.ts +10 -0
  41. package/dist/cjs/api/types/BusinessHourExceptionResource.js +3 -0
  42. package/dist/cjs/api/types/BusinessHourSlotResource.d.ts +6 -0
  43. package/dist/cjs/api/types/BusinessHourSlotResource.js +3 -0
  44. package/dist/cjs/api/types/BusinessHoursResource.d.ts +7 -0
  45. package/dist/cjs/api/types/BusinessHoursResource.js +3 -0
  46. package/dist/cjs/api/types/BusinessInventoryLog.d.ts +2 -2
  47. package/dist/cjs/api/types/BusinessProfile.d.ts +6 -7
  48. package/dist/cjs/api/types/BusinessScheduleDayResource.d.ts +5 -0
  49. package/dist/cjs/api/types/BusinessScheduleDayResource.js +3 -0
  50. package/dist/cjs/api/types/CustomerBusinessProfile.d.ts +6 -7
  51. package/dist/cjs/api/types/CustomerCartItem.d.ts +1 -1
  52. package/dist/cjs/api/types/CustomerEventDetail.d.ts +1 -1
  53. package/dist/cjs/api/types/EventFeedItem.d.ts +1 -1
  54. package/dist/cjs/api/types/index.d.ts +4 -0
  55. package/dist/cjs/api/types/index.js +4 -0
  56. package/dist/cjs/version.d.ts +1 -1
  57. package/dist/cjs/version.js +1 -1
  58. package/dist/esm/BaseClient.mjs +2 -2
  59. package/dist/esm/Client.d.mts +3 -0
  60. package/dist/esm/Client.mjs +5 -0
  61. package/dist/esm/api/resources/business/resources/businesses/client/requests/StoreBusinessRequest.d.mts +0 -9
  62. package/dist/esm/api/resources/business/resources/businesses/client/requests/UpdateBusinessRequest.d.mts +0 -9
  63. package/dist/esm/api/resources/business/resources/products/client/requests/StoreProductRequest.d.mts +1 -0
  64. package/dist/esm/api/resources/business/resources/products/client/requests/UpdateProductRequest.d.mts +1 -0
  65. package/dist/esm/api/resources/business/resources/profile/client/requests/UpdateBusinessProfileRequest.d.mts +0 -11
  66. package/dist/esm/api/resources/businessHours/client/Client.d.mts +91 -0
  67. package/dist/esm/api/resources/businessHours/client/Client.mjs +324 -0
  68. package/dist/esm/api/resources/businessHours/client/index.d.mts +1 -0
  69. package/dist/esm/api/resources/businessHours/client/index.mjs +1 -0
  70. package/dist/esm/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.d.mts +10 -0
  71. package/dist/esm/api/resources/businessHours/client/requests/DeleteBusinessHourExceptionRequest.mjs +2 -0
  72. package/dist/esm/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.d.mts +16 -0
  73. package/dist/esm/api/resources/businessHours/client/requests/StoreBusinessHourExceptionRequest.mjs +2 -0
  74. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.d.mts +19 -0
  75. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHourExceptionRequest.mjs +2 -0
  76. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.d.mts +25 -0
  77. package/dist/esm/api/resources/businessHours/client/requests/UpdateBusinessHoursRequest.mjs +2 -0
  78. package/dist/esm/api/resources/businessHours/client/requests/index.d.mts +4 -0
  79. package/dist/esm/api/resources/businessHours/client/requests/index.mjs +1 -0
  80. package/dist/esm/api/resources/businessHours/exports.d.mts +2 -0
  81. package/dist/esm/api/resources/businessHours/exports.mjs +3 -0
  82. package/dist/esm/api/resources/businessHours/index.d.mts +2 -0
  83. package/dist/esm/api/resources/businessHours/index.mjs +2 -0
  84. package/dist/esm/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.d.mts +4 -0
  85. package/dist/esm/api/resources/businessHours/types/CreateBusinessHourExceptionResponse.mjs +2 -0
  86. package/dist/esm/api/resources/businessHours/types/GetBusinessHoursResponse.d.mts +4 -0
  87. package/dist/esm/api/resources/businessHours/types/GetBusinessHoursResponse.mjs +2 -0
  88. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.d.mts +4 -0
  89. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHourExceptionResponse.mjs +2 -0
  90. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHoursResponse.d.mts +4 -0
  91. package/dist/esm/api/resources/businessHours/types/UpdateBusinessHoursResponse.mjs +2 -0
  92. package/dist/esm/api/resources/businessHours/types/index.d.mts +4 -0
  93. package/dist/esm/api/resources/businessHours/types/index.mjs +4 -0
  94. package/dist/esm/api/resources/index.d.mts +3 -0
  95. package/dist/esm/api/resources/index.mjs +3 -0
  96. package/dist/esm/api/types/BusinessHourExceptionResource.d.mts +10 -0
  97. package/dist/esm/api/types/BusinessHourExceptionResource.mjs +2 -0
  98. package/dist/esm/api/types/BusinessHourSlotResource.d.mts +6 -0
  99. package/dist/esm/api/types/BusinessHourSlotResource.mjs +2 -0
  100. package/dist/esm/api/types/BusinessHoursResource.d.mts +7 -0
  101. package/dist/esm/api/types/BusinessHoursResource.mjs +2 -0
  102. package/dist/esm/api/types/BusinessInventoryLog.d.mts +2 -2
  103. package/dist/esm/api/types/BusinessProfile.d.mts +6 -7
  104. package/dist/esm/api/types/BusinessScheduleDayResource.d.mts +5 -0
  105. package/dist/esm/api/types/BusinessScheduleDayResource.mjs +2 -0
  106. package/dist/esm/api/types/CustomerBusinessProfile.d.mts +6 -7
  107. package/dist/esm/api/types/CustomerCartItem.d.mts +1 -1
  108. package/dist/esm/api/types/CustomerEventDetail.d.mts +1 -1
  109. package/dist/esm/api/types/EventFeedItem.d.mts +1 -1
  110. package/dist/esm/api/types/index.d.mts +4 -0
  111. package/dist/esm/api/types/index.mjs +4 -0
  112. package/dist/esm/version.d.mts +1 -1
  113. package/dist/esm/version.mjs +1 -1
  114. package/package.json +12 -1
  115. package/reference.md +253 -0
@@ -0,0 +1,361 @@
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.BusinessHoursClient = 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 BusinessHoursClient {
66
+ constructor(options = {}) {
67
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
68
+ }
69
+ /**
70
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
71
+ *
72
+ * @throws {@link FiveOneEat.UnauthorizedError}
73
+ *
74
+ * @example
75
+ * await client.businessHours.getBusinessHours()
76
+ */
77
+ getBusinessHours(requestOptions) {
78
+ return core.HttpResponsePromise.fromPromise(this.__getBusinessHours(requestOptions));
79
+ }
80
+ __getBusinessHours(requestOptions) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
83
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
84
+ 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);
85
+ const _response = yield core.fetcher({
86
+ 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"),
87
+ method: "GET",
88
+ headers: _headers,
89
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
90
+ 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,
91
+ 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,
92
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
93
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
94
+ logging: this._options.logging,
95
+ });
96
+ if (_response.ok) {
97
+ return { data: _response.body, rawResponse: _response.rawResponse };
98
+ }
99
+ if (_response.error.reason === "status-code") {
100
+ switch (_response.error.statusCode) {
101
+ case 401:
102
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
103
+ default:
104
+ throw new errors.FiveOneEatError({
105
+ statusCode: _response.error.statusCode,
106
+ body: _response.error.body,
107
+ rawResponse: _response.rawResponse,
108
+ });
109
+ }
110
+ }
111
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/business/hours");
112
+ });
113
+ }
114
+ /**
115
+ * @param {FiveOneEat.UpdateBusinessHoursRequest} request
116
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
117
+ *
118
+ * @throws {@link FiveOneEat.UnauthorizedError}
119
+ * @throws {@link FiveOneEat.ForbiddenError}
120
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
121
+ *
122
+ * @example
123
+ * await client.businessHours.updateBusinessHours({
124
+ * slots: [{
125
+ * day_of_week: 1,
126
+ * opens_at: "opens_at",
127
+ * closes_at: "closes_at"
128
+ * }]
129
+ * })
130
+ */
131
+ updateBusinessHours(request, requestOptions) {
132
+ return core.HttpResponsePromise.fromPromise(this.__updateBusinessHours(request, requestOptions));
133
+ }
134
+ __updateBusinessHours(request, requestOptions) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
137
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
138
+ 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);
139
+ const _response = yield core.fetcher({
140
+ 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"),
141
+ method: "PUT",
142
+ headers: _headers,
143
+ contentType: "application/json",
144
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
145
+ requestType: "json",
146
+ body: request,
147
+ 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,
148
+ 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,
149
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
150
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
151
+ logging: this._options.logging,
152
+ });
153
+ if (_response.ok) {
154
+ return {
155
+ data: _response.body,
156
+ rawResponse: _response.rawResponse,
157
+ };
158
+ }
159
+ if (_response.error.reason === "status-code") {
160
+ switch (_response.error.statusCode) {
161
+ case 401:
162
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
163
+ case 403:
164
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
165
+ case 422:
166
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
167
+ default:
168
+ throw new errors.FiveOneEatError({
169
+ statusCode: _response.error.statusCode,
170
+ body: _response.error.body,
171
+ rawResponse: _response.rawResponse,
172
+ });
173
+ }
174
+ }
175
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/business/hours");
176
+ });
177
+ }
178
+ /**
179
+ * @param {FiveOneEat.StoreBusinessHourExceptionRequest} request
180
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
181
+ *
182
+ * @throws {@link FiveOneEat.UnauthorizedError}
183
+ * @throws {@link FiveOneEat.ForbiddenError}
184
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
185
+ *
186
+ * @example
187
+ * await client.businessHours.createBusinessHourException({
188
+ * starts_on: "2024-01-15T09:30:00Z",
189
+ * is_closed: true
190
+ * })
191
+ */
192
+ createBusinessHourException(request, requestOptions) {
193
+ return core.HttpResponsePromise.fromPromise(this.__createBusinessHourException(request, requestOptions));
194
+ }
195
+ __createBusinessHourException(request, requestOptions) {
196
+ return __awaiter(this, void 0, void 0, function* () {
197
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
198
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
199
+ 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);
200
+ const _response = yield core.fetcher({
201
+ 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"),
202
+ method: "POST",
203
+ headers: _headers,
204
+ contentType: "application/json",
205
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
206
+ requestType: "json",
207
+ body: request,
208
+ 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,
209
+ 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,
210
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
211
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
212
+ logging: this._options.logging,
213
+ });
214
+ if (_response.ok) {
215
+ return {
216
+ data: _response.body,
217
+ rawResponse: _response.rawResponse,
218
+ };
219
+ }
220
+ if (_response.error.reason === "status-code") {
221
+ switch (_response.error.statusCode) {
222
+ case 401:
223
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
224
+ case 403:
225
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
226
+ case 422:
227
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
228
+ default:
229
+ throw new errors.FiveOneEatError({
230
+ statusCode: _response.error.statusCode,
231
+ body: _response.error.body,
232
+ rawResponse: _response.rawResponse,
233
+ });
234
+ }
235
+ }
236
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/hours/exceptions");
237
+ });
238
+ }
239
+ /**
240
+ * @param {FiveOneEat.DeleteBusinessHourExceptionRequest} request
241
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
242
+ *
243
+ * @throws {@link FiveOneEat.UnauthorizedError}
244
+ * @throws {@link FiveOneEat.ForbiddenError}
245
+ * @throws {@link FiveOneEat.NotFoundError}
246
+ *
247
+ * @example
248
+ * await client.businessHours.deleteBusinessHourException({
249
+ * exception: "exception"
250
+ * })
251
+ */
252
+ deleteBusinessHourException(request, requestOptions) {
253
+ return core.HttpResponsePromise.fromPromise(this.__deleteBusinessHourException(request, requestOptions));
254
+ }
255
+ __deleteBusinessHourException(request, requestOptions) {
256
+ return __awaiter(this, void 0, void 0, function* () {
257
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
258
+ const { exception } = request;
259
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
260
+ 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);
261
+ const _response = yield core.fetcher({
262
+ 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)}`),
263
+ method: "DELETE",
264
+ headers: _headers,
265
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
266
+ 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,
267
+ 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,
268
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
269
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
270
+ logging: this._options.logging,
271
+ });
272
+ if (_response.ok) {
273
+ return { data: undefined, rawResponse: _response.rawResponse };
274
+ }
275
+ if (_response.error.reason === "status-code") {
276
+ switch (_response.error.statusCode) {
277
+ case 401:
278
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
279
+ case 403:
280
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
281
+ case 404:
282
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
283
+ default:
284
+ throw new errors.FiveOneEatError({
285
+ statusCode: _response.error.statusCode,
286
+ body: _response.error.body,
287
+ rawResponse: _response.rawResponse,
288
+ });
289
+ }
290
+ }
291
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/business/hours/exceptions/{exception}");
292
+ });
293
+ }
294
+ /**
295
+ * @param {FiveOneEat.UpdateBusinessHourExceptionRequest} request
296
+ * @param {BusinessHoursClient.RequestOptions} requestOptions - Request-specific configuration.
297
+ *
298
+ * @throws {@link FiveOneEat.UnauthorizedError}
299
+ * @throws {@link FiveOneEat.ForbiddenError}
300
+ * @throws {@link FiveOneEat.NotFoundError}
301
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
302
+ *
303
+ * @example
304
+ * await client.businessHours.updateBusinessHourException({
305
+ * exception: "exception",
306
+ * starts_on: "2024-01-15T09:30:00Z",
307
+ * is_closed: true
308
+ * })
309
+ */
310
+ updateBusinessHourException(request, requestOptions) {
311
+ return core.HttpResponsePromise.fromPromise(this.__updateBusinessHourException(request, requestOptions));
312
+ }
313
+ __updateBusinessHourException(request, requestOptions) {
314
+ return __awaiter(this, void 0, void 0, function* () {
315
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
316
+ const { exception } = request, _body = __rest(request, ["exception"]);
317
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
318
+ 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);
319
+ const _response = yield core.fetcher({
320
+ 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)}`),
321
+ method: "PATCH",
322
+ headers: _headers,
323
+ contentType: "application/json",
324
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
325
+ requestType: "json",
326
+ body: _body,
327
+ 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,
328
+ 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,
329
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
330
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
331
+ logging: this._options.logging,
332
+ });
333
+ if (_response.ok) {
334
+ return {
335
+ data: _response.body,
336
+ rawResponse: _response.rawResponse,
337
+ };
338
+ }
339
+ if (_response.error.reason === "status-code") {
340
+ switch (_response.error.statusCode) {
341
+ case 401:
342
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
343
+ case 403:
344
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
345
+ case 404:
346
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
347
+ case 422:
348
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
349
+ default:
350
+ throw new errors.FiveOneEatError({
351
+ statusCode: _response.error.statusCode,
352
+ body: _response.error.body,
353
+ rawResponse: _response.rawResponse,
354
+ });
355
+ }
356
+ }
357
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/business/hours/exceptions/{exception}");
358
+ });
359
+ }
360
+ }
361
+ exports.BusinessHoursClient = BusinessHoursClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type { DeleteBusinessHourExceptionRequest } from "./DeleteBusinessHourExceptionRequest.js";
2
+ export type { StoreBusinessHourExceptionRequest } from "./StoreBusinessHourExceptionRequest.js";
3
+ export type { UpdateBusinessHourExceptionRequest } from "./UpdateBusinessHourExceptionRequest.js";
4
+ export type { UpdateBusinessHoursRequest } from "./UpdateBusinessHoursRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { BusinessHoursClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.BusinessHoursClient = void 0;
19
+ var Client_js_1 = require("./client/Client.js");
20
+ Object.defineProperty(exports, "BusinessHoursClient", { enumerable: true, get: function () { return Client_js_1.BusinessHoursClient; } });
21
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./types/index.js";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
18
+ __exportStar(require("./types/index.js"), exports);
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface CreateBusinessHourExceptionResponse {
3
+ data: FiveOneEat.BusinessHourExceptionResource;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface GetBusinessHoursResponse {
3
+ data: FiveOneEat.BusinessHoursResource;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface UpdateBusinessHourExceptionResponse {
3
+ data: FiveOneEat.BusinessHourExceptionResource;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.js";
2
+ export interface UpdateBusinessHoursResponse {
3
+ data: FiveOneEat.BusinessHoursResource;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export * from "./CreateBusinessHourExceptionResponse.js";
2
+ export * from "./GetBusinessHoursResponse.js";
3
+ export * from "./UpdateBusinessHourExceptionResponse.js";
4
+ export * from "./UpdateBusinessHoursResponse.js";
@@ -0,0 +1,20 @@
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("./CreateBusinessHourExceptionResponse.js"), exports);
18
+ __exportStar(require("./GetBusinessHoursResponse.js"), exports);
19
+ __exportStar(require("./UpdateBusinessHourExceptionResponse.js"), exports);
20
+ __exportStar(require("./UpdateBusinessHoursResponse.js"), exports);
@@ -1,4 +1,7 @@
1
1
  export * as business from "./business/index.js";
2
+ export * from "./businessHours/client/requests/index.js";
3
+ export * as businessHours from "./businessHours/index.js";
4
+ export * from "./businessHours/types/index.js";
2
5
  export * from "./businessMessaging/client/requests/index.js";
3
6
  export * as businessMessaging from "./businessMessaging/index.js";
4
7
  export * from "./businessMessaging/types/index.js";
@@ -36,8 +36,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.serveAd = exports.recordClick = exports.customerMyAccount = exports.customerMessaging = exports.customerEvents = exports.customerBusinesses = exports.customer = exports.businessShipping = exports.businessProducts = exports.businessMessaging = exports.business = void 0;
39
+ exports.serveAd = exports.recordClick = exports.customerMyAccount = exports.customerMessaging = exports.customerEvents = exports.customerBusinesses = exports.customer = exports.businessShipping = exports.businessProducts = exports.businessMessaging = exports.businessHours = exports.business = void 0;
40
40
  exports.business = __importStar(require("./business/index.js"));
41
+ __exportStar(require("./businessHours/client/requests/index.js"), exports);
42
+ exports.businessHours = __importStar(require("./businessHours/index.js"));
43
+ __exportStar(require("./businessHours/types/index.js"), exports);
41
44
  __exportStar(require("./businessMessaging/client/requests/index.js"), exports);
42
45
  exports.businessMessaging = __importStar(require("./businessMessaging/index.js"));
43
46
  __exportStar(require("./businessMessaging/types/index.js"), exports);