@51eat/sdk 0.0.21 → 0.0.22

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 (104) hide show
  1. package/README.md +16 -13
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/Client.d.ts +0 -6
  4. package/dist/cjs/Client.js +10 -20
  5. package/dist/cjs/api/resources/business/client/Client.d.ts +5 -2
  6. package/dist/cjs/api/resources/business/client/Client.js +7 -2
  7. package/dist/cjs/api/resources/business/resources/index.d.ts +4 -0
  8. package/dist/cjs/api/resources/business/resources/index.js +5 -1
  9. package/dist/cjs/api/resources/business/resources/messaging/client/Client.d.ts +24 -1
  10. package/dist/cjs/api/resources/business/resources/messaging/client/Client.js +107 -0
  11. package/dist/cjs/api/resources/business/resources/messaging/client/index.d.ts +1 -1
  12. package/dist/cjs/api/resources/business/resources/messaging/client/index.js +15 -0
  13. package/dist/cjs/api/resources/{businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.d.ts → business/resources/messaging/client/requests/ChannelAuthMessagingRequest.d.ts} +1 -1
  14. package/dist/cjs/api/resources/business/resources/messaging/client/requests/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/business/resources/pushNotifications/client/Client.d.ts +47 -0
  16. package/dist/cjs/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/Client.js +22 -22
  17. package/dist/cjs/api/resources/{businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.d.ts → business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.d.ts} +1 -1
  18. package/dist/cjs/api/resources/business/resources/pushNotifications/client/requests/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/business/resources/pushNotifications/exports.d.ts +2 -0
  20. package/dist/cjs/api/resources/{businessMessaging → business/resources/pushNotifications}/exports.js +2 -2
  21. package/dist/cjs/api/resources/{businessPushNotifications/types/RegisterBusinessPushTokenResponse.d.ts → business/resources/pushNotifications/types/RegisterPushNotificationsResponse.d.ts} +1 -1
  22. package/dist/cjs/api/resources/business/resources/pushNotifications/types/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/{businessPushNotifications → business/resources/pushNotifications}/types/index.js +1 -1
  24. package/dist/cjs/api/resources/index.d.ts +0 -5
  25. package/dist/cjs/api/resources/index.js +1 -6
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/BaseClient.mjs +2 -2
  29. package/dist/esm/Client.d.mts +0 -6
  30. package/dist/esm/Client.mjs +0 -10
  31. package/dist/esm/api/resources/business/client/Client.d.mts +5 -2
  32. package/dist/esm/api/resources/business/client/Client.mjs +7 -2
  33. package/dist/esm/api/resources/business/resources/index.d.mts +4 -0
  34. package/dist/esm/api/resources/business/resources/index.mjs +4 -0
  35. package/dist/esm/api/resources/business/resources/messaging/client/Client.d.mts +24 -1
  36. package/dist/esm/api/resources/business/resources/messaging/client/Client.mjs +74 -0
  37. package/dist/esm/api/resources/business/resources/messaging/client/index.d.mts +1 -1
  38. package/dist/esm/api/resources/business/resources/messaging/client/index.mjs +1 -1
  39. package/dist/esm/api/resources/{businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.d.mts → business/resources/messaging/client/requests/ChannelAuthMessagingRequest.d.mts} +1 -1
  40. package/dist/esm/api/resources/business/resources/messaging/client/requests/index.d.mts +1 -0
  41. package/dist/esm/api/resources/business/resources/pushNotifications/client/Client.d.mts +47 -0
  42. package/dist/esm/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/Client.mjs +20 -20
  43. package/dist/esm/api/resources/{businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.d.mts → business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.d.mts} +1 -1
  44. package/dist/esm/api/resources/business/resources/pushNotifications/client/requests/index.d.mts +2 -0
  45. package/dist/esm/api/resources/business/resources/pushNotifications/exports.d.mts +2 -0
  46. package/dist/esm/api/resources/{businessMessaging → business/resources/pushNotifications}/exports.mjs +1 -1
  47. package/dist/esm/api/resources/{businessPushNotifications/types/RegisterBusinessPushTokenResponse.d.mts → business/resources/pushNotifications/types/RegisterPushNotificationsResponse.d.mts} +1 -1
  48. package/dist/esm/api/resources/business/resources/pushNotifications/types/index.d.mts +1 -0
  49. package/dist/esm/api/resources/business/resources/pushNotifications/types/index.mjs +1 -0
  50. package/dist/esm/api/resources/index.d.mts +0 -5
  51. package/dist/esm/api/resources/index.mjs +0 -5
  52. package/dist/esm/version.d.mts +1 -1
  53. package/dist/esm/version.mjs +1 -1
  54. package/package.json +23 -34
  55. package/reference.md +202 -202
  56. package/dist/cjs/api/resources/businessMessaging/client/Client.d.ts +0 -32
  57. package/dist/cjs/api/resources/businessMessaging/client/Client.js +0 -118
  58. package/dist/cjs/api/resources/businessMessaging/client/requests/index.d.ts +0 -1
  59. package/dist/cjs/api/resources/businessMessaging/exports.d.ts +0 -2
  60. package/dist/cjs/api/resources/businessMessaging/index.d.ts +0 -1
  61. package/dist/cjs/api/resources/businessMessaging/index.js +0 -17
  62. package/dist/cjs/api/resources/businessPushNotifications/client/Client.d.ts +0 -47
  63. package/dist/cjs/api/resources/businessPushNotifications/client/index.d.ts +0 -1
  64. package/dist/cjs/api/resources/businessPushNotifications/client/index.js +0 -17
  65. package/dist/cjs/api/resources/businessPushNotifications/client/requests/index.d.ts +0 -2
  66. package/dist/cjs/api/resources/businessPushNotifications/exports.d.ts +0 -2
  67. package/dist/cjs/api/resources/businessPushNotifications/exports.js +0 -21
  68. package/dist/cjs/api/resources/businessPushNotifications/types/index.d.ts +0 -1
  69. package/dist/esm/api/resources/businessMessaging/client/Client.d.mts +0 -32
  70. package/dist/esm/api/resources/businessMessaging/client/Client.mjs +0 -81
  71. package/dist/esm/api/resources/businessMessaging/client/requests/index.d.mts +0 -1
  72. package/dist/esm/api/resources/businessMessaging/exports.d.mts +0 -2
  73. package/dist/esm/api/resources/businessMessaging/index.d.mts +0 -1
  74. package/dist/esm/api/resources/businessMessaging/index.mjs +0 -1
  75. package/dist/esm/api/resources/businessPushNotifications/client/Client.d.mts +0 -47
  76. package/dist/esm/api/resources/businessPushNotifications/client/index.d.mts +0 -1
  77. package/dist/esm/api/resources/businessPushNotifications/client/index.mjs +0 -1
  78. package/dist/esm/api/resources/businessPushNotifications/client/requests/index.d.mts +0 -2
  79. package/dist/esm/api/resources/businessPushNotifications/exports.d.mts +0 -2
  80. package/dist/esm/api/resources/businessPushNotifications/exports.mjs +0 -3
  81. package/dist/esm/api/resources/businessPushNotifications/types/index.d.mts +0 -1
  82. package/dist/esm/api/resources/businessPushNotifications/types/index.mjs +0 -1
  83. /package/dist/cjs/api/resources/{businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.js → business/resources/messaging/client/requests/ChannelAuthMessagingRequest.js} +0 -0
  84. /package/dist/cjs/api/resources/{businessMessaging → business/resources/messaging}/client/requests/index.js +0 -0
  85. /package/dist/cjs/api/resources/{businessMessaging → business/resources/pushNotifications}/client/index.d.ts +0 -0
  86. /package/dist/cjs/api/resources/{businessMessaging → business/resources/pushNotifications}/client/index.js +0 -0
  87. /package/dist/cjs/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/requests/StorePushTokenRequest.d.ts +0 -0
  88. /package/dist/cjs/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/requests/StorePushTokenRequest.js +0 -0
  89. /package/dist/cjs/api/resources/{businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.js → business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.js} +0 -0
  90. /package/dist/cjs/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/requests/index.js +0 -0
  91. /package/dist/cjs/api/resources/{businessPushNotifications → business/resources/pushNotifications}/index.d.ts +0 -0
  92. /package/dist/cjs/api/resources/{businessPushNotifications → business/resources/pushNotifications}/index.js +0 -0
  93. /package/dist/cjs/api/resources/{businessPushNotifications/types/RegisterBusinessPushTokenResponse.js → business/resources/pushNotifications/types/RegisterPushNotificationsResponse.js} +0 -0
  94. /package/dist/esm/api/resources/{businessMessaging/client/requests/BusinessChannelAuthAuthenticateRequest.mjs → business/resources/messaging/client/requests/ChannelAuthMessagingRequest.mjs} +0 -0
  95. /package/dist/esm/api/resources/{businessMessaging → business/resources/messaging}/client/requests/index.mjs +0 -0
  96. /package/dist/esm/api/resources/{businessMessaging → business/resources/pushNotifications}/client/index.d.mts +0 -0
  97. /package/dist/esm/api/resources/{businessMessaging → business/resources/pushNotifications}/client/index.mjs +0 -0
  98. /package/dist/esm/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/requests/StorePushTokenRequest.d.mts +0 -0
  99. /package/dist/esm/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/requests/StorePushTokenRequest.mjs +0 -0
  100. /package/dist/esm/api/resources/{businessPushNotifications/client/requests/UnregisterBusinessPushTokenRequest.mjs → business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.mjs} +0 -0
  101. /package/dist/esm/api/resources/{businessPushNotifications → business/resources/pushNotifications}/client/requests/index.mjs +0 -0
  102. /package/dist/esm/api/resources/{businessPushNotifications → business/resources/pushNotifications}/index.d.mts +0 -0
  103. /package/dist/esm/api/resources/{businessPushNotifications → business/resources/pushNotifications}/index.mjs +0 -0
  104. /package/dist/esm/api/resources/{businessPushNotifications/types/RegisterBusinessPushTokenResponse.mjs → business/resources/pushNotifications/types/RegisterPushNotificationsResponse.mjs} +0 -0
package/README.md CHANGED
@@ -45,9 +45,12 @@ Instantiate and use the client with the following:
45
45
  import { FiveOneEatClient } from "@51eat/sdk";
46
46
 
47
47
  const client = new FiveOneEatClient({ token: "YOUR_TOKEN" });
48
- await client.businessMessaging.businessChannelAuthAuthenticate({
49
- channel_name: "channel_name",
50
- socket_id: "socket_id"
48
+ await client.customerEvents.holdTickets({
49
+ eventId: "eventId",
50
+ tickets: [{
51
+ ticket_type_id: "ticket_type_id",
52
+ quantity: 1
53
+ }]
51
54
  });
52
55
  ```
53
56
 
@@ -71,7 +74,7 @@ following namespace:
71
74
  ```typescript
72
75
  import { FiveOneEat } from "@51eat/sdk";
73
76
 
74
- const request: FiveOneEat.BusinessChannelAuthAuthenticateRequest = {
77
+ const request: FiveOneEat.StoreTicketHoldRequest = {
75
78
  ...
76
79
  };
77
80
  ```
@@ -85,7 +88,7 @@ will be thrown.
85
88
  import { FiveOneEatError } from "@51eat/sdk";
86
89
 
87
90
  try {
88
- await client.businessMessaging.businessChannelAuthAuthenticate(...);
91
+ await client.customerEvents.holdTickets(...);
89
92
  } catch (err) {
90
93
  if (err instanceof FiveOneEatError) {
91
94
  console.log(err.statusCode);
@@ -147,9 +150,9 @@ For example, `fs.ReadStream` has a `path` property which the SDK uses to retriev
147
150
  This SDK supports direct imports of subpackage clients, which allows JavaScript bundlers to tree-shake and include only the imported subpackage code. This results in much smaller bundle sizes.
148
151
 
149
152
  ```typescript
150
- import { BusinessMessagingClient } from '@51eat/sdk/businessMessaging';
153
+ import { CustomerEventsClient } from '@51eat/sdk/customerEvents';
151
154
 
152
- const client = new BusinessMessagingClient({...});
155
+ const client = new CustomerEventsClient({...});
153
156
  ```
154
157
 
155
158
  ### Additional Headers
@@ -166,7 +169,7 @@ const client = new FiveOneEatClient({
166
169
  }
167
170
  });
168
171
 
169
- const response = await client.businessMessaging.businessChannelAuthAuthenticate(..., {
172
+ const response = await client.customerEvents.holdTickets(..., {
170
173
  headers: {
171
174
  'X-Custom-Header': 'custom value'
172
175
  }
@@ -178,7 +181,7 @@ const response = await client.businessMessaging.businessChannelAuthAuthenticate(
178
181
  If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
179
182
 
180
183
  ```typescript
181
- const response = await client.businessMessaging.businessChannelAuthAuthenticate(..., {
184
+ const response = await client.customerEvents.holdTickets(..., {
182
185
  queryParams: {
183
186
  'customQueryParamKey': 'custom query param value'
184
187
  }
@@ -200,7 +203,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
200
203
  Use the `maxRetries` request option to configure this behavior.
201
204
 
202
205
  ```typescript
203
- const response = await client.businessMessaging.businessChannelAuthAuthenticate(..., {
206
+ const response = await client.customerEvents.holdTickets(..., {
204
207
  maxRetries: 0 // override maxRetries at the request level
205
208
  });
206
209
  ```
@@ -210,7 +213,7 @@ const response = await client.businessMessaging.businessChannelAuthAuthenticate(
210
213
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
211
214
 
212
215
  ```typescript
213
- const response = await client.businessMessaging.businessChannelAuthAuthenticate(..., {
216
+ const response = await client.customerEvents.holdTickets(..., {
214
217
  timeoutInSeconds: 30 // override timeout to 30s
215
218
  });
216
219
  ```
@@ -221,7 +224,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
221
224
 
222
225
  ```typescript
223
226
  const controller = new AbortController();
224
- const response = await client.businessMessaging.businessChannelAuthAuthenticate(..., {
227
+ const response = await client.customerEvents.holdTickets(..., {
225
228
  abortSignal: controller.signal
226
229
  });
227
230
  controller.abort(); // aborts the request
@@ -233,7 +236,7 @@ The SDK provides access to raw response data, including headers, through the `.w
233
236
  The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
234
237
 
235
238
  ```typescript
236
- const { data, rawResponse } = await client.businessMessaging.businessChannelAuthAuthenticate(...).withRawResponse();
239
+ const { data, rawResponse } = await client.customerEvents.holdTickets(...).withRawResponse();
237
240
 
238
241
  console.log(data);
239
242
  console.log(rawResponse.headers['X-My-Header']);
@@ -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.21",
47
- "User-Agent": "@51eat/sdk/0.0.21",
46
+ "X-Fern-SDK-Version": "0.0.22",
47
+ "User-Agent": "@51eat/sdk/0.0.22",
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);
@@ -1,6 +1,4 @@
1
1
  import { BusinessClient } from "./api/resources/business/client/Client.js";
2
- import { BusinessMessagingClient } from "./api/resources/businessMessaging/client/Client.js";
3
- import { BusinessPushNotificationsClient } from "./api/resources/businessPushNotifications/client/Client.js";
4
2
  import { CustomerClient } from "./api/resources/customer/client/Client.js";
5
3
  import { CustomerEventsClient } from "./api/resources/customerEvents/client/Client.js";
6
4
  import { CustomerMyAccountClient } from "./api/resources/customerMyAccount/client/Client.js";
@@ -16,8 +14,6 @@ export declare namespace FiveOneEatClient {
16
14
  }
17
15
  export declare class FiveOneEatClient {
18
16
  protected readonly _options: NormalizedClientOptionsWithAuth<FiveOneEatClient.Options>;
19
- protected _businessMessaging: BusinessMessagingClient | undefined;
20
- protected _businessPushNotifications: BusinessPushNotificationsClient | undefined;
21
17
  protected _customerEvents: CustomerEventsClient | undefined;
22
18
  protected _customerMyAccount: CustomerMyAccountClient | undefined;
23
19
  protected _customer: CustomerClient | undefined;
@@ -25,8 +21,6 @@ export declare class FiveOneEatClient {
25
21
  protected _serveAd: ServeAdClient | undefined;
26
22
  protected _business: BusinessClient | undefined;
27
23
  constructor(options?: FiveOneEatClient.Options);
28
- get businessMessaging(): BusinessMessagingClient;
29
- get businessPushNotifications(): BusinessPushNotificationsClient;
30
24
  get customerEvents(): CustomerEventsClient;
31
25
  get customerMyAccount(): CustomerMyAccountClient;
32
26
  get customer(): CustomerClient;
@@ -45,46 +45,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.FiveOneEatClient = void 0;
47
47
  const Client_js_1 = require("./api/resources/business/client/Client.js");
48
- const Client_js_2 = require("./api/resources/businessMessaging/client/Client.js");
49
- const Client_js_3 = require("./api/resources/businessPushNotifications/client/Client.js");
50
- const Client_js_4 = require("./api/resources/customer/client/Client.js");
51
- const Client_js_5 = require("./api/resources/customerEvents/client/Client.js");
52
- const Client_js_6 = require("./api/resources/customerMyAccount/client/Client.js");
53
- const Client_js_7 = require("./api/resources/recordClick/client/Client.js");
54
- const Client_js_8 = require("./api/resources/serveAd/client/Client.js");
48
+ const Client_js_2 = require("./api/resources/customer/client/Client.js");
49
+ const Client_js_3 = require("./api/resources/customerEvents/client/Client.js");
50
+ const Client_js_4 = require("./api/resources/customerMyAccount/client/Client.js");
51
+ const Client_js_5 = require("./api/resources/recordClick/client/Client.js");
52
+ const Client_js_6 = require("./api/resources/serveAd/client/Client.js");
55
53
  const BaseClient_js_1 = require("./BaseClient.js");
56
54
  const core = __importStar(require("./core/index.js"));
57
55
  class FiveOneEatClient {
58
56
  constructor(options = {}) {
59
57
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
60
58
  }
61
- get businessMessaging() {
62
- var _a;
63
- return ((_a = this._businessMessaging) !== null && _a !== void 0 ? _a : (this._businessMessaging = new Client_js_2.BusinessMessagingClient(this._options)));
64
- }
65
- get businessPushNotifications() {
66
- var _a;
67
- return ((_a = this._businessPushNotifications) !== null && _a !== void 0 ? _a : (this._businessPushNotifications = new Client_js_3.BusinessPushNotificationsClient(this._options)));
68
- }
69
59
  get customerEvents() {
70
60
  var _a;
71
- return ((_a = this._customerEvents) !== null && _a !== void 0 ? _a : (this._customerEvents = new Client_js_5.CustomerEventsClient(this._options)));
61
+ return ((_a = this._customerEvents) !== null && _a !== void 0 ? _a : (this._customerEvents = new Client_js_3.CustomerEventsClient(this._options)));
72
62
  }
73
63
  get customerMyAccount() {
74
64
  var _a;
75
- return ((_a = this._customerMyAccount) !== null && _a !== void 0 ? _a : (this._customerMyAccount = new Client_js_6.CustomerMyAccountClient(this._options)));
65
+ return ((_a = this._customerMyAccount) !== null && _a !== void 0 ? _a : (this._customerMyAccount = new Client_js_4.CustomerMyAccountClient(this._options)));
76
66
  }
77
67
  get customer() {
78
68
  var _a;
79
- return ((_a = this._customer) !== null && _a !== void 0 ? _a : (this._customer = new Client_js_4.CustomerClient(this._options)));
69
+ return ((_a = this._customer) !== null && _a !== void 0 ? _a : (this._customer = new Client_js_2.CustomerClient(this._options)));
80
70
  }
81
71
  get recordClick() {
82
72
  var _a;
83
- return ((_a = this._recordClick) !== null && _a !== void 0 ? _a : (this._recordClick = new Client_js_7.RecordClickClient(this._options)));
73
+ return ((_a = this._recordClick) !== null && _a !== void 0 ? _a : (this._recordClick = new Client_js_5.RecordClickClient(this._options)));
84
74
  }
85
75
  get serveAd() {
86
76
  var _a;
87
- return ((_a = this._serveAd) !== null && _a !== void 0 ? _a : (this._serveAd = new Client_js_8.ServeAdClient(this._options)));
77
+ return ((_a = this._serveAd) !== null && _a !== void 0 ? _a : (this._serveAd = new Client_js_6.ServeAdClient(this._options)));
88
78
  }
89
79
  get business() {
90
80
  var _a;
@@ -6,6 +6,7 @@ import { GalleryClient } from "../resources/gallery/client/Client.js";
6
6
  import { MenusClient } from "../resources/menus/client/Client.js";
7
7
  import { MessagingClient } from "../resources/messaging/client/Client.js";
8
8
  import { ProfileClient } from "../resources/profile/client/Client.js";
9
+ import { PushNotificationsClient } from "../resources/pushNotifications/client/Client.js";
9
10
  export declare namespace BusinessClient {
10
11
  type Options = BaseClientOptions;
11
12
  }
@@ -15,13 +16,15 @@ export declare class BusinessClient {
15
16
  protected _bulletins: BulletinsClient | undefined;
16
17
  protected _gallery: GalleryClient | undefined;
17
18
  protected _menus: MenusClient | undefined;
18
- protected _profile: ProfileClient | undefined;
19
19
  protected _messaging: MessagingClient | undefined;
20
+ protected _profile: ProfileClient | undefined;
21
+ protected _pushNotifications: PushNotificationsClient | undefined;
20
22
  constructor(options?: BusinessClient.Options);
21
23
  get auth(): AuthClient;
22
24
  get bulletins(): BulletinsClient;
23
25
  get gallery(): GalleryClient;
24
26
  get menus(): MenusClient;
25
- get profile(): ProfileClient;
26
27
  get messaging(): MessagingClient;
28
+ get profile(): ProfileClient;
29
+ get pushNotifications(): PushNotificationsClient;
27
30
  }
@@ -9,6 +9,7 @@ const Client_js_3 = require("../resources/gallery/client/Client.js");
9
9
  const Client_js_4 = require("../resources/menus/client/Client.js");
10
10
  const Client_js_5 = require("../resources/messaging/client/Client.js");
11
11
  const Client_js_6 = require("../resources/profile/client/Client.js");
12
+ const Client_js_7 = require("../resources/pushNotifications/client/Client.js");
12
13
  class BusinessClient {
13
14
  constructor(options = {}) {
14
15
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
@@ -29,13 +30,17 @@ class BusinessClient {
29
30
  var _a;
30
31
  return ((_a = this._menus) !== null && _a !== void 0 ? _a : (this._menus = new Client_js_4.MenusClient(this._options)));
31
32
  }
33
+ get messaging() {
34
+ var _a;
35
+ return ((_a = this._messaging) !== null && _a !== void 0 ? _a : (this._messaging = new Client_js_5.MessagingClient(this._options)));
36
+ }
32
37
  get profile() {
33
38
  var _a;
34
39
  return ((_a = this._profile) !== null && _a !== void 0 ? _a : (this._profile = new Client_js_6.ProfileClient(this._options)));
35
40
  }
36
- get messaging() {
41
+ get pushNotifications() {
37
42
  var _a;
38
- return ((_a = this._messaging) !== null && _a !== void 0 ? _a : (this._messaging = new Client_js_5.MessagingClient(this._options)));
43
+ return ((_a = this._pushNotifications) !== null && _a !== void 0 ? _a : (this._pushNotifications = new Client_js_7.PushNotificationsClient(this._options)));
39
44
  }
40
45
  }
41
46
  exports.BusinessClient = BusinessClient;
@@ -10,7 +10,11 @@ export * from "./gallery/types/index.js";
10
10
  export * from "./menus/client/requests/index.js";
11
11
  export * as menus from "./menus/index.js";
12
12
  export * from "./menus/types/index.js";
13
+ export * from "./messaging/client/requests/index.js";
13
14
  export * as messaging from "./messaging/index.js";
14
15
  export * from "./profile/client/requests/index.js";
15
16
  export * as profile from "./profile/index.js";
16
17
  export * from "./profile/types/index.js";
18
+ export * from "./pushNotifications/client/requests/index.js";
19
+ export * as pushNotifications from "./pushNotifications/index.js";
20
+ export * from "./pushNotifications/types/index.js";
@@ -36,7 +36,7 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.profile = exports.messaging = exports.menus = exports.gallery = exports.bulletins = exports.auth = void 0;
39
+ exports.pushNotifications = exports.profile = exports.messaging = exports.menus = exports.gallery = exports.bulletins = exports.auth = void 0;
40
40
  __exportStar(require("./auth/client/requests/index.js"), exports);
41
41
  exports.auth = __importStar(require("./auth/index.js"));
42
42
  __exportStar(require("./auth/types/index.js"), exports);
@@ -49,7 +49,11 @@ __exportStar(require("./gallery/types/index.js"), exports);
49
49
  __exportStar(require("./menus/client/requests/index.js"), exports);
50
50
  exports.menus = __importStar(require("./menus/index.js"));
51
51
  __exportStar(require("./menus/types/index.js"), exports);
52
+ __exportStar(require("./messaging/client/requests/index.js"), exports);
52
53
  exports.messaging = __importStar(require("./messaging/index.js"));
53
54
  __exportStar(require("./profile/client/requests/index.js"), exports);
54
55
  exports.profile = __importStar(require("./profile/index.js"));
55
56
  __exportStar(require("./profile/types/index.js"), exports);
57
+ __exportStar(require("./pushNotifications/client/requests/index.js"), exports);
58
+ exports.pushNotifications = __importStar(require("./pushNotifications/index.js"));
59
+ __exportStar(require("./pushNotifications/types/index.js"), exports);
@@ -1,9 +1,13 @@
1
- import type { BaseClientOptions } from "../../../../../../BaseClient.js";
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../core/index.js";
4
+ import * as FiveOneEat from "../../../../../index.js";
3
5
  import { ConversationsClient } from "../resources/conversations/client/Client.js";
4
6
  import { MessagesClient } from "../resources/messages/client/Client.js";
5
7
  export declare namespace MessagingClient {
6
8
  type Options = BaseClientOptions;
9
+ interface RequestOptions extends BaseRequestOptions {
10
+ }
7
11
  }
8
12
  export declare class MessagingClient {
9
13
  protected readonly _options: NormalizedClientOptionsWithAuth<MessagingClient.Options>;
@@ -12,4 +16,23 @@ export declare class MessagingClient {
12
16
  constructor(options?: MessagingClient.Options);
13
17
  get conversations(): ConversationsClient;
14
18
  get messages(): MessagesClient;
19
+ /**
20
+ * This endpoint is used by the business companion mobile app to authenticate with
21
+ * Pusher channels. It validates that the authenticated business user has
22
+ * permission to access the requested channel, scoped to their active business.
23
+ *
24
+ * @param {FiveOneEat.business.ChannelAuthMessagingRequest} request
25
+ * @param {MessagingClient.RequestOptions} requestOptions - Request-specific configuration.
26
+ *
27
+ * @throws {@link FiveOneEat.UnauthorizedError}
28
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
29
+ *
30
+ * @example
31
+ * await client.business.messaging.channelAuth({
32
+ * channel_name: "channel_name",
33
+ * socket_id: "socket_id"
34
+ * })
35
+ */
36
+ channelAuth(request: FiveOneEat.business.ChannelAuthMessagingRequest, requestOptions?: MessagingClient.RequestOptions): core.HttpResponsePromise<number>;
37
+ private __channelAuth;
15
38
  }
@@ -1,8 +1,56 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
3
45
  Object.defineProperty(exports, "__esModule", { value: true });
4
46
  exports.MessagingClient = void 0;
5
47
  const BaseClient_js_1 = require("../../../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../../../errors/index.js"));
53
+ const FiveOneEat = __importStar(require("../../../../../index.js"));
6
54
  const Client_js_1 = require("../resources/conversations/client/Client.js");
7
55
  const Client_js_2 = require("../resources/messages/client/Client.js");
8
56
  class MessagingClient {
@@ -17,5 +65,64 @@ class MessagingClient {
17
65
  var _a;
18
66
  return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new Client_js_2.MessagesClient(this._options)));
19
67
  }
68
+ /**
69
+ * This endpoint is used by the business companion mobile app to authenticate with
70
+ * Pusher channels. It validates that the authenticated business user has
71
+ * permission to access the requested channel, scoped to their active business.
72
+ *
73
+ * @param {FiveOneEat.business.ChannelAuthMessagingRequest} request
74
+ * @param {MessagingClient.RequestOptions} requestOptions - Request-specific configuration.
75
+ *
76
+ * @throws {@link FiveOneEat.UnauthorizedError}
77
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
78
+ *
79
+ * @example
80
+ * await client.business.messaging.channelAuth({
81
+ * channel_name: "channel_name",
82
+ * socket_id: "socket_id"
83
+ * })
84
+ */
85
+ channelAuth(request, requestOptions) {
86
+ return core.HttpResponsePromise.fromPromise(this.__channelAuth(request, requestOptions));
87
+ }
88
+ __channelAuth(request, requestOptions) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
91
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
92
+ 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);
93
+ const _response = yield core.fetcher({
94
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "business/channels/auth"),
95
+ method: "POST",
96
+ headers: _headers,
97
+ contentType: "application/json",
98
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
99
+ requestType: "json",
100
+ body: request,
101
+ 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,
102
+ 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,
103
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
104
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
105
+ logging: this._options.logging,
106
+ });
107
+ if (_response.ok) {
108
+ return { data: _response.body, rawResponse: _response.rawResponse };
109
+ }
110
+ if (_response.error.reason === "status-code") {
111
+ switch (_response.error.statusCode) {
112
+ case 401:
113
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
114
+ case 422:
115
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
116
+ default:
117
+ throw new errors.FiveOneEatError({
118
+ statusCode: _response.error.statusCode,
119
+ body: _response.error.body,
120
+ rawResponse: _response.rawResponse,
121
+ });
122
+ }
123
+ }
124
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/business/channels/auth");
125
+ });
126
+ }
20
127
  }
21
128
  exports.MessagingClient = MessagingClient;
@@ -1 +1 @@
1
- export {};
1
+ export * from "./requests/index.js";
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -5,7 +5,7 @@
5
5
  * socket_id: "socket_id"
6
6
  * }
7
7
  */
8
- export interface BusinessChannelAuthAuthenticateRequest {
8
+ export interface ChannelAuthMessagingRequest {
9
9
  /** string */
10
10
  channel_name: string;
11
11
  /** string */
@@ -0,0 +1 @@
1
+ export type { ChannelAuthMessagingRequest } from "./ChannelAuthMessagingRequest.js";
@@ -0,0 +1,47 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../core/index.js";
4
+ import * as FiveOneEat from "../../../../../index.js";
5
+ export declare namespace PushNotificationsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class PushNotificationsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<PushNotificationsClient.Options>;
12
+ constructor(options?: PushNotificationsClient.Options);
13
+ /**
14
+ * Register (or update) the authenticated business user's Expo push token for a
15
+ * device. If a `device_id` is provided, an existing registration for that device
16
+ * is updated.
17
+ *
18
+ * @param {FiveOneEat.business.StorePushTokenRequest} request
19
+ * @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
20
+ *
21
+ * @throws {@link FiveOneEat.UnauthorizedError}
22
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
23
+ *
24
+ * @example
25
+ * await client.business.pushNotifications.register({
26
+ * token: "token"
27
+ * })
28
+ */
29
+ register(request: FiveOneEat.business.StorePushTokenRequest, requestOptions?: PushNotificationsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.RegisterPushNotificationsResponse>;
30
+ private __register;
31
+ /**
32
+ * Delete the authenticated business user's Expo push token registration.
33
+ *
34
+ * @param {FiveOneEat.business.UnregisterPushNotificationsRequest} request
35
+ * @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link FiveOneEat.UnauthorizedError}
38
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
39
+ *
40
+ * @example
41
+ * await client.business.pushNotifications.unregister({
42
+ * token: "token"
43
+ * })
44
+ */
45
+ unregister(request: FiveOneEat.business.UnregisterPushNotificationsRequest, requestOptions?: PushNotificationsClient.RequestOptions): core.HttpResponsePromise<void>;
46
+ private __unregister;
47
+ }
@@ -43,15 +43,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43
43
  });
44
44
  };
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.BusinessPushNotificationsClient = void 0;
47
- const BaseClient_js_1 = require("../../../../BaseClient.js");
48
- const headers_js_1 = require("../../../../core/headers.js");
49
- const core = __importStar(require("../../../../core/index.js"));
50
- const environments = __importStar(require("../../../../environments.js"));
51
- const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js");
52
- const errors = __importStar(require("../../../../errors/index.js"));
53
- const FiveOneEat = __importStar(require("../../../index.js"));
54
- class BusinessPushNotificationsClient {
46
+ exports.PushNotificationsClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../../../errors/index.js"));
53
+ const FiveOneEat = __importStar(require("../../../../../index.js"));
54
+ class PushNotificationsClient {
55
55
  constructor(options = {}) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
@@ -60,21 +60,21 @@ class BusinessPushNotificationsClient {
60
60
  * device. If a `device_id` is provided, an existing registration for that device
61
61
  * is updated.
62
62
  *
63
- * @param {FiveOneEat.StorePushTokenRequest} request
64
- * @param {BusinessPushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
63
+ * @param {FiveOneEat.business.StorePushTokenRequest} request
64
+ * @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
65
65
  *
66
66
  * @throws {@link FiveOneEat.UnauthorizedError}
67
67
  * @throws {@link FiveOneEat.UnprocessableEntityError}
68
68
  *
69
69
  * @example
70
- * await client.businessPushNotifications.registerBusinessPushToken({
70
+ * await client.business.pushNotifications.register({
71
71
  * token: "token"
72
72
  * })
73
73
  */
74
- registerBusinessPushToken(request, requestOptions) {
75
- return core.HttpResponsePromise.fromPromise(this.__registerBusinessPushToken(request, requestOptions));
74
+ register(request, requestOptions) {
75
+ return core.HttpResponsePromise.fromPromise(this.__register(request, requestOptions));
76
76
  }
77
- __registerBusinessPushToken(request, requestOptions) {
77
+ __register(request, requestOptions) {
78
78
  return __awaiter(this, void 0, void 0, function* () {
79
79
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
80
80
  const _authRequest = yield this._options.authProvider.getAuthRequest();
@@ -119,21 +119,21 @@ class BusinessPushNotificationsClient {
119
119
  /**
120
120
  * Delete the authenticated business user's Expo push token registration.
121
121
  *
122
- * @param {FiveOneEat.UnregisterBusinessPushTokenRequest} request
123
- * @param {BusinessPushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
122
+ * @param {FiveOneEat.business.UnregisterPushNotificationsRequest} request
123
+ * @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
124
124
  *
125
125
  * @throws {@link FiveOneEat.UnauthorizedError}
126
126
  * @throws {@link FiveOneEat.UnprocessableEntityError}
127
127
  *
128
128
  * @example
129
- * await client.businessPushNotifications.unregisterBusinessPushToken({
129
+ * await client.business.pushNotifications.unregister({
130
130
  * token: "token"
131
131
  * })
132
132
  */
133
- unregisterBusinessPushToken(request, requestOptions) {
134
- return core.HttpResponsePromise.fromPromise(this.__unregisterBusinessPushToken(request, requestOptions));
133
+ unregister(request, requestOptions) {
134
+ return core.HttpResponsePromise.fromPromise(this.__unregister(request, requestOptions));
135
135
  }
136
- __unregisterBusinessPushToken(request, requestOptions) {
136
+ __unregister(request, requestOptions) {
137
137
  return __awaiter(this, void 0, void 0, function* () {
138
138
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
139
139
  const { token } = request;
@@ -179,4 +179,4 @@ class BusinessPushNotificationsClient {
179
179
  });
180
180
  }
181
181
  }
182
- exports.BusinessPushNotificationsClient = BusinessPushNotificationsClient;
182
+ exports.PushNotificationsClient = PushNotificationsClient;
@@ -4,6 +4,6 @@
4
4
  * token: "token"
5
5
  * }
6
6
  */
7
- export interface UnregisterBusinessPushTokenRequest {
7
+ export interface UnregisterPushNotificationsRequest {
8
8
  token: string;
9
9
  }
@@ -0,0 +1,2 @@
1
+ export { StorePushTokenRequest } from "./StorePushTokenRequest.js";
2
+ export type { UnregisterPushNotificationsRequest } from "./UnregisterPushNotificationsRequest.js";
@@ -0,0 +1,2 @@
1
+ export { PushNotificationsClient } from "./client/Client.js";
2
+ export * from "./client/index.js";