@51eat/sdk 0.0.73 → 0.0.74

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 (26) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/customer/resources/auth/client/Client.d.ts +19 -0
  3. package/dist/cjs/api/resources/customer/resources/auth/client/Client.js +62 -0
  4. package/dist/cjs/api/resources/customer/resources/auth/client/requests/DeleteAccountRequest.d.ts +9 -0
  5. package/dist/cjs/api/resources/customer/resources/auth/client/requests/DeleteAccountRequest.js +3 -0
  6. package/dist/cjs/api/resources/customer/resources/auth/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/customer/resources/auth/types/DeleteAccountAuthResponse.d.ts +3 -0
  8. package/dist/cjs/api/resources/customer/resources/auth/types/DeleteAccountAuthResponse.js +3 -0
  9. package/dist/cjs/api/resources/customer/resources/auth/types/index.d.ts +1 -0
  10. package/dist/cjs/api/resources/customer/resources/auth/types/index.js +1 -0
  11. package/dist/cjs/version.d.ts +1 -1
  12. package/dist/cjs/version.js +1 -1
  13. package/dist/esm/BaseClient.mjs +2 -2
  14. package/dist/esm/api/resources/customer/resources/auth/client/Client.d.mts +19 -0
  15. package/dist/esm/api/resources/customer/resources/auth/client/Client.mjs +62 -0
  16. package/dist/esm/api/resources/customer/resources/auth/client/requests/DeleteAccountRequest.d.mts +9 -0
  17. package/dist/esm/api/resources/customer/resources/auth/client/requests/DeleteAccountRequest.mjs +2 -0
  18. package/dist/esm/api/resources/customer/resources/auth/client/requests/index.d.mts +1 -0
  19. package/dist/esm/api/resources/customer/resources/auth/types/DeleteAccountAuthResponse.d.mts +3 -0
  20. package/dist/esm/api/resources/customer/resources/auth/types/DeleteAccountAuthResponse.mjs +2 -0
  21. package/dist/esm/api/resources/customer/resources/auth/types/index.d.mts +1 -0
  22. package/dist/esm/api/resources/customer/resources/auth/types/index.mjs +1 -0
  23. package/dist/esm/version.d.mts +1 -1
  24. package/dist/esm/version.mjs +1 -1
  25. package/package.json +1 -1
  26. package/reference.md +68 -0
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@51eat/sdk",
46
- "X-Fern-SDK-Version": "0.0.73",
47
- "User-Agent": "@51eat/sdk/0.0.73",
46
+ "X-Fern-SDK-Version": "0.0.74",
47
+ "User-Agent": "@51eat/sdk/0.0.74",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -111,6 +111,25 @@ export declare class AuthClient {
111
111
  */
112
112
  updateProfile(request?: FiveOneEat.customer.UpdateUserRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.UpdateProfileAuthResponse>;
113
113
  private __updateProfile;
114
+ /**
115
+ * Permanently delete the account and its associated data, cancel any billing,
116
+ * and revoke every API token. This cannot be undone. Requires the current
117
+ * password for confirmation. Accounts that manage a business cannot be deleted
118
+ * here and return a 422 explaining how to proceed.
119
+ *
120
+ * @param {FiveOneEat.customer.DeleteAccountRequest} request
121
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
122
+ *
123
+ * @throws {@link FiveOneEat.UnauthorizedError}
124
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
125
+ *
126
+ * @example
127
+ * await client.customer.auth.deleteAccount({
128
+ * password: "password"
129
+ * })
130
+ */
131
+ deleteAccount(request: FiveOneEat.customer.DeleteAccountRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.DeleteAccountAuthResponse>;
132
+ private __deleteAccount;
114
133
  /**
115
134
  * Upload and replace the avatar for the authenticated customer. Any existing avatar file will be deleted.
116
135
  *
@@ -396,6 +396,68 @@ class AuthClient {
396
396
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/customer/user");
397
397
  });
398
398
  }
399
+ /**
400
+ * Permanently delete the account and its associated data, cancel any billing,
401
+ * and revoke every API token. This cannot be undone. Requires the current
402
+ * password for confirmation. Accounts that manage a business cannot be deleted
403
+ * here and return a 422 explaining how to proceed.
404
+ *
405
+ * @param {FiveOneEat.customer.DeleteAccountRequest} request
406
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
407
+ *
408
+ * @throws {@link FiveOneEat.UnauthorizedError}
409
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
410
+ *
411
+ * @example
412
+ * await client.customer.auth.deleteAccount({
413
+ * password: "password"
414
+ * })
415
+ */
416
+ deleteAccount(request, requestOptions) {
417
+ return core.HttpResponsePromise.fromPromise(this.__deleteAccount(request, requestOptions));
418
+ }
419
+ __deleteAccount(request, requestOptions) {
420
+ return __awaiter(this, void 0, void 0, function* () {
421
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
422
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
423
+ 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);
424
+ const _response = yield core.fetcher({
425
+ 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/delete"),
426
+ method: "POST",
427
+ headers: _headers,
428
+ contentType: "application/json",
429
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
430
+ requestType: "json",
431
+ body: request,
432
+ 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,
433
+ 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,
434
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
435
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
436
+ logging: this._options.logging,
437
+ });
438
+ if (_response.ok) {
439
+ return {
440
+ data: _response.body,
441
+ rawResponse: _response.rawResponse,
442
+ };
443
+ }
444
+ if (_response.error.reason === "status-code") {
445
+ switch (_response.error.statusCode) {
446
+ case 401:
447
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
448
+ case 422:
449
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
450
+ default:
451
+ throw new errors.FiveOneEatError({
452
+ statusCode: _response.error.statusCode,
453
+ body: _response.error.body,
454
+ rawResponse: _response.rawResponse,
455
+ });
456
+ }
457
+ }
458
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/customer/user/delete");
459
+ });
460
+ }
399
461
  /**
400
462
  * Upload and replace the avatar for the authenticated customer. Any existing avatar file will be deleted.
401
463
  *
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * password: "password"
5
+ * }
6
+ */
7
+ export interface DeleteAccountRequest {
8
+ password: string;
9
+ }
@@ -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 });
@@ -1,5 +1,6 @@
1
1
  export type { AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest } from "./AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest.js";
2
2
  export type { AppHttpRequestsApiV1CustomerAuthResetPasswordRequest } from "./AppHttpRequestsApiV1CustomerAuthResetPasswordRequest.js";
3
+ export type { DeleteAccountRequest } from "./DeleteAccountRequest.js";
3
4
  export type { LoginCustomerRequest } from "./LoginCustomerRequest.js";
4
5
  export type { LogoutAuthRequest } from "./LogoutAuthRequest.js";
5
6
  export type { RegisterCustomerRequest } from "./RegisterCustomerRequest.js";
@@ -0,0 +1,3 @@
1
+ export interface DeleteAccountAuthResponse {
2
+ message: string;
3
+ }
@@ -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 });
@@ -1,3 +1,4 @@
1
+ export * from "./DeleteAccountAuthResponse.js";
1
2
  export * from "./DeleteAvatarAuthResponse.js";
2
3
  export * from "./ForgotPasswordAuthResponse.js";
3
4
  export * from "./LoginAuthResponse.js";
@@ -14,6 +14,7 @@ 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("./DeleteAccountAuthResponse.js"), exports);
17
18
  __exportStar(require("./DeleteAvatarAuthResponse.js"), exports);
18
19
  __exportStar(require("./ForgotPasswordAuthResponse.js"), exports);
19
20
  __exportStar(require("./LoginAuthResponse.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.73";
1
+ export declare const SDK_VERSION = "0.0.74";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.73";
4
+ exports.SDK_VERSION = "0.0.74";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@51eat/sdk",
9
- "X-Fern-SDK-Version": "0.0.73",
10
- "User-Agent": "@51eat/sdk/0.0.73",
9
+ "X-Fern-SDK-Version": "0.0.74",
10
+ "User-Agent": "@51eat/sdk/0.0.74",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -111,6 +111,25 @@ export declare class AuthClient {
111
111
  */
112
112
  updateProfile(request?: FiveOneEat.customer.UpdateUserRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.UpdateProfileAuthResponse>;
113
113
  private __updateProfile;
114
+ /**
115
+ * Permanently delete the account and its associated data, cancel any billing,
116
+ * and revoke every API token. This cannot be undone. Requires the current
117
+ * password for confirmation. Accounts that manage a business cannot be deleted
118
+ * here and return a 422 explaining how to proceed.
119
+ *
120
+ * @param {FiveOneEat.customer.DeleteAccountRequest} request
121
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
122
+ *
123
+ * @throws {@link FiveOneEat.UnauthorizedError}
124
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
125
+ *
126
+ * @example
127
+ * await client.customer.auth.deleteAccount({
128
+ * password: "password"
129
+ * })
130
+ */
131
+ deleteAccount(request: FiveOneEat.customer.DeleteAccountRequest, requestOptions?: AuthClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.DeleteAccountAuthResponse>;
132
+ private __deleteAccount;
114
133
  /**
115
134
  * Upload and replace the avatar for the authenticated customer. Any existing avatar file will be deleted.
116
135
  *
@@ -360,6 +360,68 @@ export class AuthClient {
360
360
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/customer/user");
361
361
  });
362
362
  }
363
+ /**
364
+ * Permanently delete the account and its associated data, cancel any billing,
365
+ * and revoke every API token. This cannot be undone. Requires the current
366
+ * password for confirmation. Accounts that manage a business cannot be deleted
367
+ * here and return a 422 explaining how to proceed.
368
+ *
369
+ * @param {FiveOneEat.customer.DeleteAccountRequest} request
370
+ * @param {AuthClient.RequestOptions} requestOptions - Request-specific configuration.
371
+ *
372
+ * @throws {@link FiveOneEat.UnauthorizedError}
373
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
374
+ *
375
+ * @example
376
+ * await client.customer.auth.deleteAccount({
377
+ * password: "password"
378
+ * })
379
+ */
380
+ deleteAccount(request, requestOptions) {
381
+ return core.HttpResponsePromise.fromPromise(this.__deleteAccount(request, requestOptions));
382
+ }
383
+ __deleteAccount(request, requestOptions) {
384
+ return __awaiter(this, void 0, void 0, function* () {
385
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
386
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
387
+ 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);
388
+ const _response = yield core.fetcher({
389
+ 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/delete"),
390
+ method: "POST",
391
+ headers: _headers,
392
+ contentType: "application/json",
393
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
394
+ requestType: "json",
395
+ body: request,
396
+ 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,
397
+ 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,
398
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
399
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
400
+ logging: this._options.logging,
401
+ });
402
+ if (_response.ok) {
403
+ return {
404
+ data: _response.body,
405
+ rawResponse: _response.rawResponse,
406
+ };
407
+ }
408
+ if (_response.error.reason === "status-code") {
409
+ switch (_response.error.statusCode) {
410
+ case 401:
411
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
412
+ case 422:
413
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
414
+ default:
415
+ throw new errors.FiveOneEatError({
416
+ statusCode: _response.error.statusCode,
417
+ body: _response.error.body,
418
+ rawResponse: _response.rawResponse,
419
+ });
420
+ }
421
+ }
422
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/user/delete");
423
+ });
424
+ }
363
425
  /**
364
426
  * Upload and replace the avatar for the authenticated customer. Any existing avatar file will be deleted.
365
427
  *
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * password: "password"
5
+ * }
6
+ */
7
+ export interface DeleteAccountRequest {
8
+ password: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,5 +1,6 @@
1
1
  export type { AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest } from "./AppHttpRequestsApiV1CustomerAuthForgotPasswordRequest.mjs";
2
2
  export type { AppHttpRequestsApiV1CustomerAuthResetPasswordRequest } from "./AppHttpRequestsApiV1CustomerAuthResetPasswordRequest.mjs";
3
+ export type { DeleteAccountRequest } from "./DeleteAccountRequest.mjs";
3
4
  export type { LoginCustomerRequest } from "./LoginCustomerRequest.mjs";
4
5
  export type { LogoutAuthRequest } from "./LogoutAuthRequest.mjs";
5
6
  export type { RegisterCustomerRequest } from "./RegisterCustomerRequest.mjs";
@@ -0,0 +1,3 @@
1
+ export interface DeleteAccountAuthResponse {
2
+ message: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from "./DeleteAccountAuthResponse.mjs";
1
2
  export * from "./DeleteAvatarAuthResponse.mjs";
2
3
  export * from "./ForgotPasswordAuthResponse.mjs";
3
4
  export * from "./LoginAuthResponse.mjs";
@@ -1,3 +1,4 @@
1
+ export * from "./DeleteAccountAuthResponse.mjs";
1
2
  export * from "./DeleteAvatarAuthResponse.mjs";
2
3
  export * from "./ForgotPasswordAuthResponse.mjs";
3
4
  export * from "./LoginAuthResponse.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.73";
1
+ export declare const SDK_VERSION = "0.0.74";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.73";
1
+ export const SDK_VERSION = "0.0.74";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@51eat/sdk",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -9743,6 +9743,74 @@ await client.customer.auth.updateProfile();
9743
9743
  </dl>
9744
9744
 
9745
9745
 
9746
+ </dd>
9747
+ </dl>
9748
+ </details>
9749
+
9750
+ <details><summary><code>client.customer.auth.<a href="/src/api/resources/customer/resources/auth/client/Client.ts">deleteAccount</a>({ ...params }) -> FiveOneEat.DeleteAccountAuthResponse</code></summary>
9751
+ <dl>
9752
+ <dd>
9753
+
9754
+ #### 📝 Description
9755
+
9756
+ <dl>
9757
+ <dd>
9758
+
9759
+ <dl>
9760
+ <dd>
9761
+
9762
+ Permanently delete the account and its associated data, cancel any billing,
9763
+ and revoke every API token. This cannot be undone. Requires the current
9764
+ password for confirmation. Accounts that manage a business cannot be deleted
9765
+ here and return a 422 explaining how to proceed.
9766
+ </dd>
9767
+ </dl>
9768
+ </dd>
9769
+ </dl>
9770
+
9771
+ #### 🔌 Usage
9772
+
9773
+ <dl>
9774
+ <dd>
9775
+
9776
+ <dl>
9777
+ <dd>
9778
+
9779
+ ```typescript
9780
+ await client.customer.auth.deleteAccount({
9781
+ password: "password"
9782
+ });
9783
+
9784
+ ```
9785
+ </dd>
9786
+ </dl>
9787
+ </dd>
9788
+ </dl>
9789
+
9790
+ #### ⚙️ Parameters
9791
+
9792
+ <dl>
9793
+ <dd>
9794
+
9795
+ <dl>
9796
+ <dd>
9797
+
9798
+ **request:** `FiveOneEat.customer.DeleteAccountRequest`
9799
+
9800
+ </dd>
9801
+ </dl>
9802
+
9803
+ <dl>
9804
+ <dd>
9805
+
9806
+ **requestOptions:** `AuthClient.RequestOptions`
9807
+
9808
+ </dd>
9809
+ </dl>
9810
+ </dd>
9811
+ </dl>
9812
+
9813
+
9746
9814
  </dd>
9747
9815
  </dl>
9748
9816
  </details>