@51eat/sdk 0.0.46 → 0.0.48

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 (132) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/customer/resources/cart/client/requests/CreatePaymentIntentRequest.d.ts +1 -0
  3. package/dist/cjs/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.ts +1 -0
  4. package/dist/cjs/api/resources/customer/resources/me/client/Client.d.ts +6 -0
  5. package/dist/cjs/api/resources/customer/resources/me/client/Client.js +14 -4
  6. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/Client.d.ts +89 -0
  7. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/Client.js +304 -0
  8. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/index.d.ts +1 -0
  9. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/index.js +17 -0
  10. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.d.ts +10 -0
  11. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.js +3 -0
  12. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.d.ts +19 -0
  13. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.js +3 -0
  14. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/index.d.ts +2 -0
  15. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/client/requests/index.js +2 -0
  16. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/exports.d.ts +2 -0
  17. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/exports.js +21 -0
  18. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/index.js +18 -0
  20. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.d.ts +4 -0
  21. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.js +3 -0
  22. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.d.ts +4 -0
  23. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.js +3 -0
  24. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.d.ts +4 -0
  25. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.js +3 -0
  26. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/index.d.ts +3 -0
  27. package/dist/cjs/api/resources/customer/resources/me/resources/addresses/types/index.js +19 -0
  28. package/dist/cjs/api/resources/customer/resources/me/resources/index.d.ts +6 -0
  29. package/dist/cjs/api/resources/customer/resources/me/resources/index.js +7 -1
  30. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/Client.d.ts +88 -0
  31. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/Client.js +329 -0
  32. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/index.js +17 -0
  34. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/DeletePaymentMethodsRequest.d.ts +9 -0
  35. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/DeletePaymentMethodsRequest.js +3 -0
  36. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/SetDefaultPaymentMethodsRequest.d.ts +9 -0
  37. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/SetDefaultPaymentMethodsRequest.js +3 -0
  38. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/StorePaymentMethodRequest.d.ts +10 -0
  39. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/StorePaymentMethodRequest.js +3 -0
  40. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/index.d.ts +3 -0
  41. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/client/requests/index.js +2 -0
  42. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/exports.d.ts +2 -0
  43. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/exports.js +21 -0
  44. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/index.d.ts +2 -0
  45. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/index.js +18 -0
  46. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/AddPaymentMethodsResponse.d.ts +4 -0
  47. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/AddPaymentMethodsResponse.js +3 -0
  48. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/SetDefaultPaymentMethodsResponse.d.ts +4 -0
  49. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/SetDefaultPaymentMethodsResponse.js +3 -0
  50. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/SetupIntentPaymentMethodsResponse.d.ts +3 -0
  51. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/SetupIntentPaymentMethodsResponse.js +3 -0
  52. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/index.d.ts +3 -0
  53. package/dist/cjs/api/resources/customer/resources/me/resources/paymentMethods/types/index.js +19 -0
  54. package/dist/cjs/api/types/Address.d.ts +15 -0
  55. package/dist/cjs/api/types/Address.js +3 -0
  56. package/dist/cjs/api/types/AddressCollection.d.ts +4 -0
  57. package/dist/cjs/api/types/AddressCollection.js +3 -0
  58. package/dist/cjs/api/types/PaymentMethod.d.ts +8 -0
  59. package/dist/cjs/api/types/PaymentMethod.js +3 -0
  60. package/dist/cjs/api/types/StoreAddressRequest.d.ts +12 -0
  61. package/dist/cjs/api/types/StoreAddressRequest.js +3 -0
  62. package/dist/cjs/api/types/index.d.ts +4 -0
  63. package/dist/cjs/api/types/index.js +4 -0
  64. package/dist/cjs/version.d.ts +1 -1
  65. package/dist/cjs/version.js +1 -1
  66. package/dist/esm/BaseClient.mjs +2 -2
  67. package/dist/esm/api/resources/customer/resources/cart/client/requests/CreatePaymentIntentRequest.d.mts +1 -0
  68. package/dist/esm/api/resources/customer/resources/cart/types/CreatePaymentIntentCartResponse.d.mts +1 -0
  69. package/dist/esm/api/resources/customer/resources/me/client/Client.d.mts +6 -0
  70. package/dist/esm/api/resources/customer/resources/me/client/Client.mjs +10 -0
  71. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/Client.d.mts +89 -0
  72. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/Client.mjs +267 -0
  73. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/index.d.mts +1 -0
  74. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/index.mjs +1 -0
  75. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.d.mts +10 -0
  76. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/DeleteAddressesRequest.mjs +2 -0
  77. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.d.mts +19 -0
  78. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/UpdateAddressesRequest.mjs +2 -0
  79. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/index.d.mts +2 -0
  80. package/dist/esm/api/resources/customer/resources/me/resources/addresses/client/requests/index.mjs +1 -0
  81. package/dist/esm/api/resources/customer/resources/me/resources/addresses/exports.d.mts +2 -0
  82. package/dist/esm/api/resources/customer/resources/me/resources/addresses/exports.mjs +3 -0
  83. package/dist/esm/api/resources/customer/resources/me/resources/addresses/index.d.mts +2 -0
  84. package/dist/esm/api/resources/customer/resources/me/resources/addresses/index.mjs +2 -0
  85. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.d.mts +4 -0
  86. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/CreateAddressesResponse.mjs +2 -0
  87. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.d.mts +4 -0
  88. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/ListAddressesResponse.mjs +2 -0
  89. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.d.mts +4 -0
  90. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/UpdateAddressesResponse.mjs +2 -0
  91. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/index.d.mts +3 -0
  92. package/dist/esm/api/resources/customer/resources/me/resources/addresses/types/index.mjs +3 -0
  93. package/dist/esm/api/resources/customer/resources/me/resources/index.d.mts +6 -0
  94. package/dist/esm/api/resources/customer/resources/me/resources/index.mjs +6 -0
  95. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/Client.d.mts +88 -0
  96. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/Client.mjs +292 -0
  97. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/index.d.mts +1 -0
  98. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/index.mjs +1 -0
  99. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/DeletePaymentMethodsRequest.d.mts +9 -0
  100. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/DeletePaymentMethodsRequest.mjs +2 -0
  101. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/SetDefaultPaymentMethodsRequest.d.mts +9 -0
  102. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/SetDefaultPaymentMethodsRequest.mjs +2 -0
  103. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/StorePaymentMethodRequest.d.mts +10 -0
  104. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/StorePaymentMethodRequest.mjs +2 -0
  105. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/index.d.mts +3 -0
  106. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/client/requests/index.mjs +1 -0
  107. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/exports.d.mts +2 -0
  108. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/exports.mjs +3 -0
  109. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/index.d.mts +2 -0
  110. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/index.mjs +2 -0
  111. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/AddPaymentMethodsResponse.d.mts +4 -0
  112. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/AddPaymentMethodsResponse.mjs +2 -0
  113. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/SetDefaultPaymentMethodsResponse.d.mts +4 -0
  114. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/SetDefaultPaymentMethodsResponse.mjs +2 -0
  115. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/SetupIntentPaymentMethodsResponse.d.mts +3 -0
  116. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/SetupIntentPaymentMethodsResponse.mjs +2 -0
  117. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/index.d.mts +3 -0
  118. package/dist/esm/api/resources/customer/resources/me/resources/paymentMethods/types/index.mjs +3 -0
  119. package/dist/esm/api/types/Address.d.mts +15 -0
  120. package/dist/esm/api/types/Address.mjs +2 -0
  121. package/dist/esm/api/types/AddressCollection.d.mts +4 -0
  122. package/dist/esm/api/types/AddressCollection.mjs +2 -0
  123. package/dist/esm/api/types/PaymentMethod.d.mts +8 -0
  124. package/dist/esm/api/types/PaymentMethod.mjs +2 -0
  125. package/dist/esm/api/types/StoreAddressRequest.d.mts +12 -0
  126. package/dist/esm/api/types/StoreAddressRequest.mjs +2 -0
  127. package/dist/esm/api/types/index.d.mts +4 -0
  128. package/dist/esm/api/types/index.mjs +4 -0
  129. package/dist/esm/version.d.mts +1 -1
  130. package/dist/esm/version.mjs +1 -1
  131. package/package.json +23 -1
  132. package/reference.md +573 -0
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../../../index.mjs";
2
+ export interface CreateAddressesResponse {
3
+ data: FiveOneEat.Address;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../../../index.mjs";
2
+ export interface ListAddressesResponse {
3
+ data: FiveOneEat.AddressCollection;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../../../index.mjs";
2
+ export interface UpdateAddressesResponse {
3
+ data: FiveOneEat.Address;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./CreateAddressesResponse.mjs";
2
+ export * from "./ListAddressesResponse.mjs";
3
+ export * from "./UpdateAddressesResponse.mjs";
@@ -0,0 +1,3 @@
1
+ export * from "./CreateAddressesResponse.mjs";
2
+ export * from "./ListAddressesResponse.mjs";
3
+ export * from "./UpdateAddressesResponse.mjs";
@@ -1,3 +1,9 @@
1
+ export * from "./addresses/client/requests/index.mjs";
2
+ export * as addresses from "./addresses/index.mjs";
3
+ export * from "./addresses/types/index.mjs";
4
+ export * from "./paymentMethods/client/requests/index.mjs";
5
+ export * as paymentMethods from "./paymentMethods/index.mjs";
6
+ export * from "./paymentMethods/types/index.mjs";
1
7
  export * from "./ticketOrders/client/requests/index.mjs";
2
8
  export * as ticketOrders from "./ticketOrders/index.mjs";
3
9
  export * from "./ticketOrders/types/index.mjs";
@@ -1,3 +1,9 @@
1
+ export * from "./addresses/client/requests/index.mjs";
2
+ export * as addresses from "./addresses/index.mjs";
3
+ export * from "./addresses/types/index.mjs";
4
+ export * from "./paymentMethods/client/requests/index.mjs";
5
+ export * as paymentMethods from "./paymentMethods/index.mjs";
6
+ export * from "./paymentMethods/types/index.mjs";
1
7
  export * from "./ticketOrders/client/requests/index.mjs";
2
8
  export * as ticketOrders from "./ticketOrders/index.mjs";
3
9
  export * from "./ticketOrders/types/index.mjs";
@@ -0,0 +1,88 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../../../core/index.mjs";
4
+ import * as FiveOneEat from "../../../../../../../index.mjs";
5
+ export declare namespace PaymentMethodsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class PaymentMethodsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<PaymentMethodsClient.Options>;
12
+ constructor(options?: PaymentMethodsClient.Options);
13
+ /**
14
+ * Returns a Stripe SetupIntent client_secret. Use this with the Stripe mobile SDK
15
+ * to present the payment sheet and collect card details. Once confirmed, pass the
16
+ * resulting payment method ID to the store endpoint.
17
+ *
18
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link FiveOneEat.UnauthorizedError}
21
+ *
22
+ * @example
23
+ * await client.customer.me.paymentMethods.setupIntent()
24
+ */
25
+ setupIntent(requestOptions?: PaymentMethodsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.me.SetupIntentPaymentMethodsResponse>;
26
+ private __setupIntent;
27
+ /**
28
+ * Returns all saved cards for the authenticated user.
29
+ *
30
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
31
+ *
32
+ * @throws {@link FiveOneEat.UnauthorizedError}
33
+ *
34
+ * @example
35
+ * await client.customer.me.paymentMethods.list()
36
+ */
37
+ list(requestOptions?: PaymentMethodsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.PaymentMethod[]>;
38
+ private __list;
39
+ /**
40
+ * Attaches a confirmed payment method to the customer's account. If `is_default` is
41
+ * true, or this is the first card saved, it becomes the default payment method.
42
+ *
43
+ * @param {FiveOneEat.customer.me.StorePaymentMethodRequest} request
44
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
45
+ *
46
+ * @throws {@link FiveOneEat.UnauthorizedError}
47
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
48
+ *
49
+ * @example
50
+ * await client.customer.me.paymentMethods.add({
51
+ * payment_method: "payment_method"
52
+ * })
53
+ */
54
+ add(request: FiveOneEat.customer.me.StorePaymentMethodRequest, requestOptions?: PaymentMethodsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.me.AddPaymentMethodsResponse>;
55
+ private __add;
56
+ /**
57
+ * Marks an existing saved payment method as the default.
58
+ *
59
+ * @param {FiveOneEat.customer.me.SetDefaultPaymentMethodsRequest} request
60
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link FiveOneEat.UnauthorizedError}
63
+ * @throws {@link FiveOneEat.NotFoundError}
64
+ *
65
+ * @example
66
+ * await client.customer.me.paymentMethods.setDefault({
67
+ * paymentMethod: "paymentMethod"
68
+ * })
69
+ */
70
+ setDefault(request: FiveOneEat.customer.me.SetDefaultPaymentMethodsRequest, requestOptions?: PaymentMethodsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.me.SetDefaultPaymentMethodsResponse>;
71
+ private __setDefault;
72
+ /**
73
+ * Removes a saved payment method from the customer's account.
74
+ *
75
+ * @param {FiveOneEat.customer.me.DeletePaymentMethodsRequest} request
76
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
77
+ *
78
+ * @throws {@link FiveOneEat.UnauthorizedError}
79
+ * @throws {@link FiveOneEat.NotFoundError}
80
+ *
81
+ * @example
82
+ * await client.customer.me.paymentMethods.delete({
83
+ * paymentMethod: "paymentMethod"
84
+ * })
85
+ */
86
+ delete(request: FiveOneEat.customer.me.DeletePaymentMethodsRequest, requestOptions?: PaymentMethodsClient.RequestOptions): core.HttpResponsePromise<void>;
87
+ private __delete;
88
+ }
@@ -0,0 +1,292 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth, } from "../../../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../../../core/headers.mjs";
13
+ import * as core from "../../../../../../../../core/index.mjs";
14
+ import * as environments from "../../../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../../../errors/index.mjs";
17
+ import * as FiveOneEat from "../../../../../../../index.mjs";
18
+ export class PaymentMethodsClient {
19
+ constructor(options = {}) {
20
+ this._options = normalizeClientOptionsWithAuth(options);
21
+ }
22
+ /**
23
+ * Returns a Stripe SetupIntent client_secret. Use this with the Stripe mobile SDK
24
+ * to present the payment sheet and collect card details. Once confirmed, pass the
25
+ * resulting payment method ID to the store endpoint.
26
+ *
27
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @throws {@link FiveOneEat.UnauthorizedError}
30
+ *
31
+ * @example
32
+ * await client.customer.me.paymentMethods.setupIntent()
33
+ */
34
+ setupIntent(requestOptions) {
35
+ return core.HttpResponsePromise.fromPromise(this.__setupIntent(requestOptions));
36
+ }
37
+ __setupIntent(requestOptions) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
40
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
41
+ 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);
42
+ const _response = yield core.fetcher({
43
+ 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/payment-methods/setup-intent"),
44
+ method: "GET",
45
+ headers: _headers,
46
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
47
+ 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,
48
+ 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,
49
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
50
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
51
+ logging: this._options.logging,
52
+ });
53
+ if (_response.ok) {
54
+ return {
55
+ data: _response.body,
56
+ rawResponse: _response.rawResponse,
57
+ };
58
+ }
59
+ if (_response.error.reason === "status-code") {
60
+ switch (_response.error.statusCode) {
61
+ case 401:
62
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
63
+ default:
64
+ throw new errors.FiveOneEatError({
65
+ statusCode: _response.error.statusCode,
66
+ body: _response.error.body,
67
+ rawResponse: _response.rawResponse,
68
+ });
69
+ }
70
+ }
71
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/customer/payment-methods/setup-intent");
72
+ });
73
+ }
74
+ /**
75
+ * Returns all saved cards for the authenticated user.
76
+ *
77
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
78
+ *
79
+ * @throws {@link FiveOneEat.UnauthorizedError}
80
+ *
81
+ * @example
82
+ * await client.customer.me.paymentMethods.list()
83
+ */
84
+ list(requestOptions) {
85
+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
86
+ }
87
+ __list(requestOptions) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
90
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
91
+ 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);
92
+ const _response = yield core.fetcher({
93
+ 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/payment-methods"),
94
+ method: "GET",
95
+ headers: _headers,
96
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
97
+ 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,
98
+ 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,
99
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
100
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
101
+ logging: this._options.logging,
102
+ });
103
+ if (_response.ok) {
104
+ return { data: _response.body, rawResponse: _response.rawResponse };
105
+ }
106
+ if (_response.error.reason === "status-code") {
107
+ switch (_response.error.statusCode) {
108
+ case 401:
109
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
110
+ default:
111
+ throw new errors.FiveOneEatError({
112
+ statusCode: _response.error.statusCode,
113
+ body: _response.error.body,
114
+ rawResponse: _response.rawResponse,
115
+ });
116
+ }
117
+ }
118
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/customer/payment-methods");
119
+ });
120
+ }
121
+ /**
122
+ * Attaches a confirmed payment method to the customer's account. If `is_default` is
123
+ * true, or this is the first card saved, it becomes the default payment method.
124
+ *
125
+ * @param {FiveOneEat.customer.me.StorePaymentMethodRequest} request
126
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
127
+ *
128
+ * @throws {@link FiveOneEat.UnauthorizedError}
129
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
130
+ *
131
+ * @example
132
+ * await client.customer.me.paymentMethods.add({
133
+ * payment_method: "payment_method"
134
+ * })
135
+ */
136
+ add(request, requestOptions) {
137
+ return core.HttpResponsePromise.fromPromise(this.__add(request, requestOptions));
138
+ }
139
+ __add(request, requestOptions) {
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
142
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
143
+ 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);
144
+ const _response = yield core.fetcher({
145
+ 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/payment-methods"),
146
+ method: "POST",
147
+ headers: _headers,
148
+ contentType: "application/json",
149
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
150
+ requestType: "json",
151
+ body: request,
152
+ 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,
153
+ 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,
154
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
155
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
156
+ logging: this._options.logging,
157
+ });
158
+ if (_response.ok) {
159
+ return {
160
+ data: _response.body,
161
+ rawResponse: _response.rawResponse,
162
+ };
163
+ }
164
+ if (_response.error.reason === "status-code") {
165
+ switch (_response.error.statusCode) {
166
+ case 401:
167
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
168
+ case 422:
169
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
170
+ default:
171
+ throw new errors.FiveOneEatError({
172
+ statusCode: _response.error.statusCode,
173
+ body: _response.error.body,
174
+ rawResponse: _response.rawResponse,
175
+ });
176
+ }
177
+ }
178
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/payment-methods");
179
+ });
180
+ }
181
+ /**
182
+ * Marks an existing saved payment method as the default.
183
+ *
184
+ * @param {FiveOneEat.customer.me.SetDefaultPaymentMethodsRequest} request
185
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
186
+ *
187
+ * @throws {@link FiveOneEat.UnauthorizedError}
188
+ * @throws {@link FiveOneEat.NotFoundError}
189
+ *
190
+ * @example
191
+ * await client.customer.me.paymentMethods.setDefault({
192
+ * paymentMethod: "paymentMethod"
193
+ * })
194
+ */
195
+ setDefault(request, requestOptions) {
196
+ return core.HttpResponsePromise.fromPromise(this.__setDefault(request, requestOptions));
197
+ }
198
+ __setDefault(request, requestOptions) {
199
+ return __awaiter(this, void 0, void 0, function* () {
200
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
201
+ const { paymentMethod } = request;
202
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
203
+ 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);
204
+ const _response = yield core.fetcher({
205
+ 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/payment-methods/${core.url.encodePathParam(paymentMethod)}/default`),
206
+ method: "PUT",
207
+ headers: _headers,
208
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
209
+ 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,
210
+ 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,
211
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
212
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
213
+ logging: this._options.logging,
214
+ });
215
+ if (_response.ok) {
216
+ return {
217
+ data: _response.body,
218
+ rawResponse: _response.rawResponse,
219
+ };
220
+ }
221
+ if (_response.error.reason === "status-code") {
222
+ switch (_response.error.statusCode) {
223
+ case 401:
224
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
225
+ case 404:
226
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
227
+ default:
228
+ throw new errors.FiveOneEatError({
229
+ statusCode: _response.error.statusCode,
230
+ body: _response.error.body,
231
+ rawResponse: _response.rawResponse,
232
+ });
233
+ }
234
+ }
235
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/customer/payment-methods/{paymentMethod}/default");
236
+ });
237
+ }
238
+ /**
239
+ * Removes a saved payment method from the customer's account.
240
+ *
241
+ * @param {FiveOneEat.customer.me.DeletePaymentMethodsRequest} request
242
+ * @param {PaymentMethodsClient.RequestOptions} requestOptions - Request-specific configuration.
243
+ *
244
+ * @throws {@link FiveOneEat.UnauthorizedError}
245
+ * @throws {@link FiveOneEat.NotFoundError}
246
+ *
247
+ * @example
248
+ * await client.customer.me.paymentMethods.delete({
249
+ * paymentMethod: "paymentMethod"
250
+ * })
251
+ */
252
+ delete(request, requestOptions) {
253
+ return core.HttpResponsePromise.fromPromise(this.__delete(request, requestOptions));
254
+ }
255
+ __delete(request, requestOptions) {
256
+ return __awaiter(this, void 0, void 0, function* () {
257
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
258
+ const { paymentMethod } = request;
259
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
260
+ 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);
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, `customer/payment-methods/${core.url.encodePathParam(paymentMethod)}`),
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 404:
280
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
281
+ default:
282
+ throw new errors.FiveOneEatError({
283
+ statusCode: _response.error.statusCode,
284
+ body: _response.error.body,
285
+ rawResponse: _response.rawResponse,
286
+ });
287
+ }
288
+ }
289
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/customer/payment-methods/{paymentMethod}");
290
+ });
291
+ }
292
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * paymentMethod: "paymentMethod"
5
+ * }
6
+ */
7
+ export interface DeletePaymentMethodsRequest {
8
+ paymentMethod: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * paymentMethod: "paymentMethod"
5
+ * }
6
+ */
7
+ export interface SetDefaultPaymentMethodsRequest {
8
+ paymentMethod: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * payment_method: "payment_method"
5
+ * }
6
+ */
7
+ export interface StorePaymentMethodRequest {
8
+ payment_method: string;
9
+ is_default?: boolean;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { DeletePaymentMethodsRequest } from "./DeletePaymentMethodsRequest.mjs";
2
+ export type { SetDefaultPaymentMethodsRequest } from "./SetDefaultPaymentMethodsRequest.mjs";
3
+ export type { StorePaymentMethodRequest } from "./StorePaymentMethodRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { PaymentMethodsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { PaymentMethodsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../../../index.mjs";
2
+ export interface AddPaymentMethodsResponse {
3
+ data: FiveOneEat.PaymentMethod;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../../../index.mjs";
2
+ export interface SetDefaultPaymentMethodsResponse {
3
+ data: FiveOneEat.PaymentMethod;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface SetupIntentPaymentMethodsResponse {
2
+ client_secret: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from "./AddPaymentMethodsResponse.mjs";
2
+ export * from "./SetDefaultPaymentMethodsResponse.mjs";
3
+ export * from "./SetupIntentPaymentMethodsResponse.mjs";
@@ -0,0 +1,3 @@
1
+ export * from "./AddPaymentMethodsResponse.mjs";
2
+ export * from "./SetDefaultPaymentMethodsResponse.mjs";
3
+ export * from "./SetupIntentPaymentMethodsResponse.mjs";
@@ -0,0 +1,15 @@
1
+ export interface Address {
2
+ id: number;
3
+ label: string | null;
4
+ line1: string;
5
+ line2: string | null;
6
+ city: string;
7
+ state: string;
8
+ postal_code: string;
9
+ country: string;
10
+ latitude: number | null;
11
+ longitude: number | null;
12
+ is_default: boolean;
13
+ created_at: string | null;
14
+ updated_at: string | null;
15
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../index.mjs";
2
+ export interface AddressCollection {
3
+ addresses: FiveOneEat.Address[];
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface PaymentMethod {
2
+ id: string;
3
+ brand: string;
4
+ last4: string;
5
+ exp_month: number;
6
+ exp_year: number;
7
+ is_default: boolean;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface StoreAddressRequest {
2
+ label?: (string | null) | undefined;
3
+ line1: string;
4
+ line2?: (string | null) | undefined;
5
+ city: string;
6
+ state: string;
7
+ postal_code: string;
8
+ country: string;
9
+ latitude?: (number | null) | undefined;
10
+ longitude?: (number | null) | undefined;
11
+ is_default?: boolean | undefined;
12
+ }