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