@51eat/sdk 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/business/resources/auth/client/Client.d.ts +35 -0
- package/dist/cjs/api/resources/business/resources/auth/client/Client.js +115 -0
- package/dist/cjs/api/resources/business/resources/auth/client/requests/ForgotPasswordRequest.d.ts +9 -0
- package/dist/cjs/api/resources/business/resources/auth/client/requests/ForgotPasswordRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/auth/client/requests/ResetPasswordRequest.d.ts +15 -0
- package/dist/cjs/api/resources/business/resources/auth/client/requests/ResetPasswordRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/auth/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/auth/types/ForgotPasswordAuthResponse.d.ts +9 -0
- package/dist/cjs/api/resources/business/resources/auth/types/ForgotPasswordAuthResponse.js +10 -0
- package/dist/cjs/api/resources/business/resources/auth/types/ResetPasswordAuthResponse.d.ts +9 -0
- package/dist/cjs/api/resources/business/resources/auth/types/ResetPasswordAuthResponse.js +10 -0
- package/dist/cjs/api/resources/business/resources/auth/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/auth/types/index.js +2 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/Client.d.ts +79 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/Client.js +286 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest.d.ts +9 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthResetPasswordRequest.d.ts +15 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthResetPasswordRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/UpdateUserRequest.d.ts +11 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/UpdateUserRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/UploadAvatarRequest.d.ts +10 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/UploadAvatarRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/auth/client/requests/index.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/DeleteAvatarAuthResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/DeleteAvatarAuthResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/ForgotPasswordAuthResponse.d.ts +9 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/ForgotPasswordAuthResponse.js +10 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/ResetPasswordAuthResponse.d.ts +9 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/ResetPasswordAuthResponse.js +10 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/UpdateProfileAuthResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/UpdateProfileAuthResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/UploadAvatarAuthResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/UploadAvatarAuthResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/index.d.ts +5 -0
- package/dist/cjs/api/resources/customer/resources/auth/types/index.js +5 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.d.ts +39 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.js +137 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/ListRepliesCommentsRequest.d.ts +20 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/ListRepliesCommentsRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/StoreBulletinCommentReplyRequest.d.ts +18 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/StoreBulletinCommentReplyRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ListRepliesCommentsResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ListRepliesCommentsResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ReplyCommentsResponse.d.ts +4 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ReplyCommentsResponse.js +3 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/index.js +2 -0
- package/dist/cjs/api/resources/customer/resources/discovery/client/Client.d.ts +2 -1
- package/dist/cjs/api/resources/customer/resources/discovery/client/Client.js +15 -5
- package/dist/cjs/api/resources/customer/resources/discovery/client/requests/CategoriesDiscoveryRequest.d.ts +8 -0
- package/dist/cjs/api/resources/customer/resources/discovery/client/requests/CategoriesDiscoveryRequest.js +3 -0
- package/dist/cjs/api/resources/customer/resources/discovery/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/CustomerReplyResponse.d.ts +5 -0
- package/dist/cjs/api/types/CustomerReplyResponse.js +3 -0
- package/dist/cjs/api/types/CustomerUser.d.ts +1 -0
- package/dist/cjs/api/types/index.d.ts +1 -0
- package/dist/cjs/api/types/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/business/resources/auth/client/Client.d.mts +35 -0
- package/dist/esm/api/resources/business/resources/auth/client/Client.mjs +115 -0
- package/dist/esm/api/resources/business/resources/auth/client/requests/ForgotPasswordRequest.d.mts +9 -0
- package/dist/esm/api/resources/business/resources/auth/client/requests/ForgotPasswordRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/auth/client/requests/ResetPasswordRequest.d.mts +15 -0
- package/dist/esm/api/resources/business/resources/auth/client/requests/ResetPasswordRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/auth/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/auth/types/ForgotPasswordAuthResponse.d.mts +9 -0
- package/dist/esm/api/resources/business/resources/auth/types/ForgotPasswordAuthResponse.mjs +7 -0
- package/dist/esm/api/resources/business/resources/auth/types/ResetPasswordAuthResponse.d.mts +9 -0
- package/dist/esm/api/resources/business/resources/auth/types/ResetPasswordAuthResponse.mjs +7 -0
- package/dist/esm/api/resources/business/resources/auth/types/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/auth/types/index.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/client/Client.d.mts +79 -0
- package/dist/esm/api/resources/customer/resources/auth/client/Client.mjs +287 -1
- package/dist/esm/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest.d.mts +9 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthResetPasswordRequest.d.mts +15 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/AppHttpRequestsApiV1CustomerAuthResetPasswordRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/UpdateUserRequest.d.mts +11 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/UpdateUserRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/UploadAvatarRequest.d.mts +10 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/UploadAvatarRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/client/requests/index.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/auth/types/DeleteAvatarAuthResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/auth/types/DeleteAvatarAuthResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/types/ForgotPasswordAuthResponse.d.mts +9 -0
- package/dist/esm/api/resources/customer/resources/auth/types/ForgotPasswordAuthResponse.mjs +7 -0
- package/dist/esm/api/resources/customer/resources/auth/types/ResetPasswordAuthResponse.d.mts +9 -0
- package/dist/esm/api/resources/customer/resources/auth/types/ResetPasswordAuthResponse.mjs +7 -0
- package/dist/esm/api/resources/customer/resources/auth/types/UpdateProfileAuthResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/auth/types/UpdateProfileAuthResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/types/UploadAvatarAuthResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/auth/types/UploadAvatarAuthResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/auth/types/index.d.mts +5 -0
- package/dist/esm/api/resources/customer/resources/auth/types/index.mjs +5 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.d.mts +39 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/Client.mjs +137 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/ListRepliesCommentsRequest.d.mts +20 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/ListRepliesCommentsRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/StoreBulletinCommentReplyRequest.d.mts +18 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/StoreBulletinCommentReplyRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ListRepliesCommentsResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ListRepliesCommentsResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ReplyCommentsResponse.d.mts +4 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/ReplyCommentsResponse.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/index.d.mts +2 -0
- package/dist/esm/api/resources/customer/resources/businesses/resources/bulletins/resources/comments/types/index.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/discovery/client/Client.d.mts +2 -1
- package/dist/esm/api/resources/customer/resources/discovery/client/Client.mjs +15 -5
- package/dist/esm/api/resources/customer/resources/discovery/client/requests/CategoriesDiscoveryRequest.d.mts +8 -0
- package/dist/esm/api/resources/customer/resources/discovery/client/requests/CategoriesDiscoveryRequest.mjs +2 -0
- package/dist/esm/api/resources/customer/resources/discovery/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/CustomerReplyResponse.d.mts +5 -0
- package/dist/esm/api/types/CustomerReplyResponse.mjs +2 -0
- package/dist/esm/api/types/CustomerUser.d.mts +1 -0
- package/dist/esm/api/types/index.d.mts +1 -0
- package/dist/esm/api/types/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +683 -86
|
@@ -176,6 +176,121 @@ class AuthClient {
|
|
|
176
176
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/login");
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Sends a password reset link to the provided email address if an account exists.
|
|
181
|
+
* Always returns a 200 response to prevent email enumeration.
|
|
182
|
+
*
|
|
183
|
+
* @param {FiveOneEat.customer.AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest} request
|
|
184
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
185
|
+
*
|
|
186
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* await client.customer.auth.forgotPassword({
|
|
190
|
+
* email: "email"
|
|
191
|
+
* })
|
|
192
|
+
*/
|
|
193
|
+
forgotPassword(request, requestOptions) {
|
|
194
|
+
return core.HttpResponsePromise.fromPromise(this.__forgotPassword(request, requestOptions));
|
|
195
|
+
}
|
|
196
|
+
__forgotPassword(request, requestOptions) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
199
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_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, "customer/forgot-password"),
|
|
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 422:
|
|
223
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
224
|
+
default:
|
|
225
|
+
throw new errors.FiveOneEatError({
|
|
226
|
+
statusCode: _response.error.statusCode,
|
|
227
|
+
body: _response.error.body,
|
|
228
|
+
rawResponse: _response.rawResponse,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/forgot-password");
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Validates the reset token and updates the user's password. All existing API tokens
|
|
237
|
+
* are revoked after a successful reset, requiring re-authentication on all devices.
|
|
238
|
+
*
|
|
239
|
+
* @param {FiveOneEat.customer.AppHttpRequestsApiV1CustomerAuthResetPasswordRequest} request
|
|
240
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
241
|
+
*
|
|
242
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* await client.customer.auth.resetPassword({
|
|
246
|
+
* token: "token",
|
|
247
|
+
* email: "email",
|
|
248
|
+
* password: "password",
|
|
249
|
+
* password_confirmation: "password_confirmation"
|
|
250
|
+
* })
|
|
251
|
+
*/
|
|
252
|
+
resetPassword(request, requestOptions) {
|
|
253
|
+
return core.HttpResponsePromise.fromPromise(this.__resetPassword(request, requestOptions));
|
|
254
|
+
}
|
|
255
|
+
__resetPassword(request, requestOptions) {
|
|
256
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
257
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
258
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
259
|
+
const _response = yield core.fetcher({
|
|
260
|
+
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, "customer/reset-password"),
|
|
261
|
+
method: "POST",
|
|
262
|
+
headers: _headers,
|
|
263
|
+
contentType: "application/json",
|
|
264
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
265
|
+
requestType: "json",
|
|
266
|
+
body: request,
|
|
267
|
+
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,
|
|
268
|
+
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,
|
|
269
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
270
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
271
|
+
logging: this._options.logging,
|
|
272
|
+
});
|
|
273
|
+
if (_response.ok) {
|
|
274
|
+
return {
|
|
275
|
+
data: _response.body,
|
|
276
|
+
rawResponse: _response.rawResponse,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
if (_response.error.reason === "status-code") {
|
|
280
|
+
switch (_response.error.statusCode) {
|
|
281
|
+
case 422:
|
|
282
|
+
throw new FiveOneEat.UnprocessableEntityError(_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, "POST", "/customer/reset-password");
|
|
292
|
+
});
|
|
293
|
+
}
|
|
179
294
|
/**
|
|
180
295
|
* Retrieve the current authenticated user's profile information.
|
|
181
296
|
*
|
|
@@ -223,6 +338,177 @@ class AuthClient {
|
|
|
223
338
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/customer/user");
|
|
224
339
|
});
|
|
225
340
|
}
|
|
341
|
+
/**
|
|
342
|
+
* Update name, email, and/or password. All fields are optional. To change the
|
|
343
|
+
* password, `current_password` must be provided alongside `password` and `password_confirmation`.
|
|
344
|
+
*
|
|
345
|
+
* @param {FiveOneEat.customer.UpdateUserRequest} request
|
|
346
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
347
|
+
*
|
|
348
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
349
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* await client.customer.auth.updateProfile()
|
|
353
|
+
*/
|
|
354
|
+
updateProfile(request = {}, requestOptions) {
|
|
355
|
+
return core.HttpResponsePromise.fromPromise(this.__updateProfile(request, requestOptions));
|
|
356
|
+
}
|
|
357
|
+
__updateProfile() {
|
|
358
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
359
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
360
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
361
|
+
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);
|
|
362
|
+
const _response = yield core.fetcher({
|
|
363
|
+
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, "customer/user"),
|
|
364
|
+
method: "PUT",
|
|
365
|
+
headers: _headers,
|
|
366
|
+
contentType: "application/json",
|
|
367
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
368
|
+
requestType: "json",
|
|
369
|
+
body: request,
|
|
370
|
+
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,
|
|
371
|
+
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,
|
|
372
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
373
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
374
|
+
logging: this._options.logging,
|
|
375
|
+
});
|
|
376
|
+
if (_response.ok) {
|
|
377
|
+
return {
|
|
378
|
+
data: _response.body,
|
|
379
|
+
rawResponse: _response.rawResponse,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
if (_response.error.reason === "status-code") {
|
|
383
|
+
switch (_response.error.statusCode) {
|
|
384
|
+
case 401:
|
|
385
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
386
|
+
case 422:
|
|
387
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
388
|
+
default:
|
|
389
|
+
throw new errors.FiveOneEatError({
|
|
390
|
+
statusCode: _response.error.statusCode,
|
|
391
|
+
body: _response.error.body,
|
|
392
|
+
rawResponse: _response.rawResponse,
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/customer/user");
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Upload and replace the avatar for the authenticated customer. Any existing avatar file will be deleted.
|
|
401
|
+
*
|
|
402
|
+
* @param {FiveOneEat.customer.UploadAvatarRequest} request
|
|
403
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
404
|
+
*
|
|
405
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
406
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* import { createReadStream } from "fs";
|
|
410
|
+
* await client.customer.auth.uploadAvatar({
|
|
411
|
+
* avatar: fs.createReadStream("/path/to/your/file")
|
|
412
|
+
* })
|
|
413
|
+
*/
|
|
414
|
+
uploadAvatar(request, requestOptions) {
|
|
415
|
+
return core.HttpResponsePromise.fromPromise(this.__uploadAvatar(request, requestOptions));
|
|
416
|
+
}
|
|
417
|
+
__uploadAvatar(request, requestOptions) {
|
|
418
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
419
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
420
|
+
const _body = yield core.newFormData();
|
|
421
|
+
yield _body.appendFile("avatar", request.avatar);
|
|
422
|
+
const _maybeEncodedRequest = yield _body.getRequest();
|
|
423
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
424
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
425
|
+
const _response = yield core.fetcher({
|
|
426
|
+
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, "customer/user/avatar"),
|
|
427
|
+
method: "POST",
|
|
428
|
+
headers: _headers,
|
|
429
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
430
|
+
requestType: "file",
|
|
431
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
432
|
+
body: _maybeEncodedRequest.body,
|
|
433
|
+
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,
|
|
434
|
+
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,
|
|
435
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
436
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
437
|
+
logging: this._options.logging,
|
|
438
|
+
});
|
|
439
|
+
if (_response.ok) {
|
|
440
|
+
return {
|
|
441
|
+
data: _response.body,
|
|
442
|
+
rawResponse: _response.rawResponse,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
if (_response.error.reason === "status-code") {
|
|
446
|
+
switch (_response.error.statusCode) {
|
|
447
|
+
case 401:
|
|
448
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
449
|
+
case 422:
|
|
450
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
451
|
+
default:
|
|
452
|
+
throw new errors.FiveOneEatError({
|
|
453
|
+
statusCode: _response.error.statusCode,
|
|
454
|
+
body: _response.error.body,
|
|
455
|
+
rawResponse: _response.rawResponse,
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/user/avatar");
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Remove the avatar for the authenticated customer. Returns the updated user with a null avatar_url.
|
|
464
|
+
*
|
|
465
|
+
* @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
466
|
+
*
|
|
467
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* await client.customer.auth.deleteAvatar()
|
|
471
|
+
*/
|
|
472
|
+
deleteAvatar(requestOptions) {
|
|
473
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteAvatar(requestOptions));
|
|
474
|
+
}
|
|
475
|
+
__deleteAvatar(requestOptions) {
|
|
476
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
477
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
478
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
479
|
+
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);
|
|
480
|
+
const _response = yield core.fetcher({
|
|
481
|
+
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, "customer/user/avatar"),
|
|
482
|
+
method: "DELETE",
|
|
483
|
+
headers: _headers,
|
|
484
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
485
|
+
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,
|
|
486
|
+
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,
|
|
487
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
488
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
489
|
+
logging: this._options.logging,
|
|
490
|
+
});
|
|
491
|
+
if (_response.ok) {
|
|
492
|
+
return {
|
|
493
|
+
data: _response.body,
|
|
494
|
+
rawResponse: _response.rawResponse,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
if (_response.error.reason === "status-code") {
|
|
498
|
+
switch (_response.error.statusCode) {
|
|
499
|
+
case 401:
|
|
500
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
501
|
+
default:
|
|
502
|
+
throw new errors.FiveOneEatError({
|
|
503
|
+
statusCode: _response.error.statusCode,
|
|
504
|
+
body: _response.error.body,
|
|
505
|
+
rawResponse: _response.rawResponse,
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/customer/user/avatar");
|
|
510
|
+
});
|
|
511
|
+
}
|
|
226
512
|
/**
|
|
227
513
|
* Revoke the current API token and log out the user.
|
|
228
514
|
*
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* token: "token",
|
|
5
|
+
* email: "email",
|
|
6
|
+
* password: "password",
|
|
7
|
+
* password_confirmation: "password_confirmation"
|
|
8
|
+
* }
|
|
9
|
+
*/
|
|
10
|
+
export interface AppHttpRequestsApiV1CustomerAuthResetPasswordRequest {
|
|
11
|
+
token: string;
|
|
12
|
+
email: string;
|
|
13
|
+
password: string;
|
|
14
|
+
password_confirmation: string;
|
|
15
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export type { AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest } from "./AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest.js";
|
|
2
|
+
export type { AppHttpRequestsApiV1CustomerAuthResetPasswordRequest } from "./AppHttpRequestsApiV1CustomerAuthResetPasswordRequest.js";
|
|
1
3
|
export type { LoginCustomerRequest } from "./LoginCustomerRequest.js";
|
|
2
4
|
export type { LogoutAuthRequest } from "./LogoutAuthRequest.js";
|
|
3
5
|
export type { RegisterCustomerRequest } from "./RegisterCustomerRequest.js";
|
|
6
|
+
export type { UpdateUserRequest } from "./UpdateUserRequest.js";
|
|
7
|
+
export type { UploadAvatarRequest } from "./UploadAvatarRequest.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ForgotPasswordAuthResponse {
|
|
2
|
+
message: ForgotPasswordAuthResponse.Message;
|
|
3
|
+
}
|
|
4
|
+
export declare namespace ForgotPasswordAuthResponse {
|
|
5
|
+
const Message: {
|
|
6
|
+
readonly AResetLinkWillBeSentIfTheAccountExists: "A reset link will be sent if the account exists.";
|
|
7
|
+
};
|
|
8
|
+
type Message = (typeof Message)[keyof typeof Message];
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ForgotPasswordAuthResponse = void 0;
|
|
5
|
+
var ForgotPasswordAuthResponse;
|
|
6
|
+
(function (ForgotPasswordAuthResponse) {
|
|
7
|
+
ForgotPasswordAuthResponse.Message = {
|
|
8
|
+
AResetLinkWillBeSentIfTheAccountExists: "A reset link will be sent if the account exists.",
|
|
9
|
+
};
|
|
10
|
+
})(ForgotPasswordAuthResponse || (exports.ForgotPasswordAuthResponse = ForgotPasswordAuthResponse = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ResetPasswordAuthResponse {
|
|
2
|
+
message: ResetPasswordAuthResponse.Message;
|
|
3
|
+
}
|
|
4
|
+
export declare namespace ResetPasswordAuthResponse {
|
|
5
|
+
const Message: {
|
|
6
|
+
readonly YourPasswordHasBeenReset: "Your password has been reset.";
|
|
7
|
+
};
|
|
8
|
+
type Message = (typeof Message)[keyof typeof Message];
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ResetPasswordAuthResponse = void 0;
|
|
5
|
+
var ResetPasswordAuthResponse;
|
|
6
|
+
(function (ResetPasswordAuthResponse) {
|
|
7
|
+
ResetPasswordAuthResponse.Message = {
|
|
8
|
+
YourPasswordHasBeenReset: "Your password has been reset.",
|
|
9
|
+
};
|
|
10
|
+
})(ResetPasswordAuthResponse || (exports.ResetPasswordAuthResponse = ResetPasswordAuthResponse = {}));
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export * from "./DeleteAvatarAuthResponse.js";
|
|
2
|
+
export * from "./ForgotPasswordAuthResponse.js";
|
|
1
3
|
export * from "./LoginAuthResponse.js";
|
|
2
4
|
export * from "./LogoutAllAuthResponse.js";
|
|
3
5
|
export * from "./LogoutAuthResponse.js";
|
|
4
6
|
export * from "./MeAuthResponse.js";
|
|
5
7
|
export * from "./RegisterAuthResponse.js";
|
|
8
|
+
export * from "./ResetPasswordAuthResponse.js";
|
|
9
|
+
export * from "./UpdateProfileAuthResponse.js";
|
|
10
|
+
export * from "./UploadAvatarAuthResponse.js";
|
|
@@ -14,8 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DeleteAvatarAuthResponse.js"), exports);
|
|
18
|
+
__exportStar(require("./ForgotPasswordAuthResponse.js"), exports);
|
|
17
19
|
__exportStar(require("./LoginAuthResponse.js"), exports);
|
|
18
20
|
__exportStar(require("./LogoutAllAuthResponse.js"), exports);
|
|
19
21
|
__exportStar(require("./LogoutAuthResponse.js"), exports);
|
|
20
22
|
__exportStar(require("./MeAuthResponse.js"), exports);
|
|
21
23
|
__exportStar(require("./RegisterAuthResponse.js"), exports);
|
|
24
|
+
__exportStar(require("./ResetPasswordAuthResponse.js"), exports);
|
|
25
|
+
__exportStar(require("./UpdateProfileAuthResponse.js"), exports);
|
|
26
|
+
__exportStar(require("./UploadAvatarAuthResponse.js"), exports);
|
|
@@ -47,4 +47,43 @@ export declare class CommentsClient {
|
|
|
47
47
|
*/
|
|
48
48
|
create(request: FiveOneEat.customer.businesses.bulletins.AppHttpRequestsApiV1CustomerBusinessesStoreBulletinCommentRequest, requestOptions?: CommentsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.businesses.bulletins.CreateCommentsResponse>;
|
|
49
49
|
private __create;
|
|
50
|
+
/**
|
|
51
|
+
* Retrieve paginated replies for a top-level comment on a published bulletin.
|
|
52
|
+
*
|
|
53
|
+
* @param {FiveOneEat.customer.businesses.bulletins.ListRepliesCommentsRequest} request
|
|
54
|
+
* @param {CommentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
55
|
+
*
|
|
56
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
57
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
58
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* await client.customer.businesses.bulletins.comments.listReplies({
|
|
62
|
+
* handle: "katzs-deli",
|
|
63
|
+
* bulletin: "01950e7d-1234-7000-abcd-ef0123456789",
|
|
64
|
+
* comment: "01950e7d-5678-7000-abcd-ef0123456789"
|
|
65
|
+
* })
|
|
66
|
+
*/
|
|
67
|
+
listReplies(request: FiveOneEat.customer.businesses.bulletins.ListRepliesCommentsRequest, requestOptions?: CommentsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.businesses.bulletins.ListRepliesCommentsResponse>;
|
|
68
|
+
private __listReplies;
|
|
69
|
+
/**
|
|
70
|
+
* Post a reply to a top-level comment on a published bulletin. Requires authentication.
|
|
71
|
+
*
|
|
72
|
+
* @param {FiveOneEat.customer.businesses.bulletins.StoreBulletinCommentReplyRequest} request
|
|
73
|
+
* @param {CommentsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
74
|
+
*
|
|
75
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
76
|
+
* @throws {@link FiveOneEat.NotFoundError}
|
|
77
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* await client.customer.businesses.bulletins.comments.reply({
|
|
81
|
+
* handle: "katzs-deli",
|
|
82
|
+
* bulletin: "01950e7d-1234-7000-abcd-ef0123456789",
|
|
83
|
+
* comment: "01950e7d-5678-7000-abcd-ef0123456789",
|
|
84
|
+
* body: "body"
|
|
85
|
+
* })
|
|
86
|
+
*/
|
|
87
|
+
reply(request: FiveOneEat.customer.businesses.bulletins.StoreBulletinCommentReplyRequest, requestOptions?: CommentsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.businesses.bulletins.ReplyCommentsResponse>;
|
|
88
|
+
private __reply;
|
|
50
89
|
}
|