@51eat/sdk 0.0.20 → 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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/business/client/Client.d.ts +5 -2
- package/dist/cjs/api/resources/business/client/Client.js +7 -2
- package/dist/cjs/api/resources/business/resources/index.d.ts +4 -0
- package/dist/cjs/api/resources/business/resources/index.js +5 -1
- package/dist/cjs/api/resources/business/resources/messaging/client/Client.d.ts +24 -1
- package/dist/cjs/api/resources/business/resources/messaging/client/Client.js +107 -0
- package/dist/cjs/api/resources/business/resources/messaging/client/index.d.ts +1 -1
- package/dist/cjs/api/resources/business/resources/messaging/client/index.js +15 -0
- package/dist/cjs/api/resources/business/resources/messaging/client/requests/ChannelAuthMessagingRequest.d.ts +13 -0
- package/dist/cjs/api/resources/business/resources/messaging/client/requests/ChannelAuthMessagingRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/messaging/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/messaging/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/Client.d.ts +47 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/Client.js +182 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/index.js +17 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.d.ts +9 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.js +3 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/client/requests/index.js +5 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/exports.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/exports.js +21 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/index.d.ts +2 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/index.js +18 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/types/RegisterPushNotificationsResponse.d.ts +7 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/types/RegisterPushNotificationsResponse.js +3 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/business/resources/pushNotifications/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/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/business/client/Client.d.mts +5 -2
- package/dist/esm/api/resources/business/client/Client.mjs +7 -2
- package/dist/esm/api/resources/business/resources/index.d.mts +4 -0
- package/dist/esm/api/resources/business/resources/index.mjs +4 -0
- package/dist/esm/api/resources/business/resources/messaging/client/Client.d.mts +24 -1
- package/dist/esm/api/resources/business/resources/messaging/client/Client.mjs +74 -0
- package/dist/esm/api/resources/business/resources/messaging/client/index.d.mts +1 -1
- package/dist/esm/api/resources/business/resources/messaging/client/index.mjs +1 -1
- package/dist/esm/api/resources/business/resources/messaging/client/requests/ChannelAuthMessagingRequest.d.mts +13 -0
- package/dist/esm/api/resources/business/resources/messaging/client/requests/ChannelAuthMessagingRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/messaging/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/messaging/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/Client.d.mts +47 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/Client.mjs +145 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.d.mts +9 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/requests/UnregisterPushNotificationsRequest.mjs +2 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/requests/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/exports.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/exports.mjs +3 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/index.d.mts +2 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/index.mjs +2 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/types/RegisterPushNotificationsResponse.d.mts +7 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/types/RegisterPushNotificationsResponse.mjs +2 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/types/index.d.mts +1 -0
- package/dist/esm/api/resources/business/resources/pushNotifications/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/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +23 -12
- package/reference.md +203 -1
- /package/dist/cjs/api/resources/{customer → business}/resources/pushNotifications/client/requests/StorePushTokenRequest.d.ts +0 -0
- /package/dist/cjs/api/resources/{customer → business}/resources/pushNotifications/client/requests/StorePushTokenRequest.js +0 -0
- /package/dist/esm/api/resources/{customer → business}/resources/pushNotifications/client/requests/StorePushTokenRequest.d.mts +0 -0
- /package/dist/esm/api/resources/{customer → business}/resources/pushNotifications/client/requests/StorePushTokenRequest.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./RegisterPushNotificationsResponse.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("./RegisterPushNotificationsResponse.js"), exports);
|
|
@@ -14,7 +14,7 @@ export declare class PushNotificationsClient {
|
|
|
14
14
|
* Register (or update) the authenticated user's Expo push token for a device. If
|
|
15
15
|
* a `device_id` is provided, an existing registration for that device is updated.
|
|
16
16
|
*
|
|
17
|
-
* @param {FiveOneEat.customer.
|
|
17
|
+
* @param {FiveOneEat.customer.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest} request
|
|
18
18
|
* @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
19
19
|
*
|
|
20
20
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -25,7 +25,7 @@ export declare class PushNotificationsClient {
|
|
|
25
25
|
* token: "token"
|
|
26
26
|
* })
|
|
27
27
|
*/
|
|
28
|
-
register(request: FiveOneEat.customer.
|
|
28
|
+
register(request: FiveOneEat.customer.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest, requestOptions?: PushNotificationsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.RegisterPushNotificationsResponse>;
|
|
29
29
|
private __register;
|
|
30
30
|
/**
|
|
31
31
|
* Delete the authenticated user's Expo push token registration.
|
|
@@ -59,7 +59,7 @@ class PushNotificationsClient {
|
|
|
59
59
|
* Register (or update) the authenticated user's Expo push token for a device. If
|
|
60
60
|
* a `device_id` is provided, an existing registration for that device is updated.
|
|
61
61
|
*
|
|
62
|
-
* @param {FiveOneEat.customer.
|
|
62
|
+
* @param {FiveOneEat.customer.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest} request
|
|
63
63
|
* @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
64
64
|
*
|
|
65
65
|
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* token: "token"
|
|
5
|
+
* }
|
|
6
|
+
*/
|
|
7
|
+
export interface AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest {
|
|
8
|
+
token: string;
|
|
9
|
+
device_id?: string | null;
|
|
10
|
+
device_name?: string | null;
|
|
11
|
+
platform?: AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.Platform | null;
|
|
12
|
+
}
|
|
13
|
+
export declare namespace AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest {
|
|
14
|
+
const Platform: {
|
|
15
|
+
readonly Ios: "ios";
|
|
16
|
+
readonly Android: "android";
|
|
17
|
+
};
|
|
18
|
+
type Platform = (typeof Platform)[keyof typeof Platform];
|
|
19
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = void 0;
|
|
5
|
+
var AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest;
|
|
6
|
+
(function (AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest) {
|
|
7
|
+
AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.Platform = {
|
|
8
|
+
Ios: "ios",
|
|
9
|
+
Android: "android",
|
|
10
|
+
};
|
|
11
|
+
})(AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest || (exports.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = {}));
|
package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest } from "./AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.js";
|
|
2
2
|
export type { UnregisterPushNotificationsRequest } from "./UnregisterPushNotificationsRequest.js";
|
package/dist/cjs/api/resources/customer/resources/pushNotifications/client/requests/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest = void 0;
|
|
4
|
+
var AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest_js_1 = require("./AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest.js");
|
|
5
|
+
Object.defineProperty(exports, "AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest", { enumerable: true, get: function () { return AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest_js_1.AppHttpRequestsApiV1CustomerPushTokensStorePushTokenRequest; } });
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.22";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@51eat/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "0.0.
|
|
10
|
-
"User-Agent": "@51eat/sdk/0.0.
|
|
9
|
+
"X-Fern-SDK-Version": "0.0.22",
|
|
10
|
+
"User-Agent": "@51eat/sdk/0.0.22",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -6,6 +6,7 @@ import { GalleryClient } from "../resources/gallery/client/Client.mjs";
|
|
|
6
6
|
import { MenusClient } from "../resources/menus/client/Client.mjs";
|
|
7
7
|
import { MessagingClient } from "../resources/messaging/client/Client.mjs";
|
|
8
8
|
import { ProfileClient } from "../resources/profile/client/Client.mjs";
|
|
9
|
+
import { PushNotificationsClient } from "../resources/pushNotifications/client/Client.mjs";
|
|
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
|
}
|
|
@@ -6,6 +6,7 @@ import { GalleryClient } from "../resources/gallery/client/Client.mjs";
|
|
|
6
6
|
import { MenusClient } from "../resources/menus/client/Client.mjs";
|
|
7
7
|
import { MessagingClient } from "../resources/messaging/client/Client.mjs";
|
|
8
8
|
import { ProfileClient } from "../resources/profile/client/Client.mjs";
|
|
9
|
+
import { PushNotificationsClient } from "../resources/pushNotifications/client/Client.mjs";
|
|
9
10
|
export class BusinessClient {
|
|
10
11
|
constructor(options = {}) {
|
|
11
12
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
@@ -26,12 +27,16 @@ export class BusinessClient {
|
|
|
26
27
|
var _a;
|
|
27
28
|
return ((_a = this._menus) !== null && _a !== void 0 ? _a : (this._menus = new MenusClient(this._options)));
|
|
28
29
|
}
|
|
30
|
+
get messaging() {
|
|
31
|
+
var _a;
|
|
32
|
+
return ((_a = this._messaging) !== null && _a !== void 0 ? _a : (this._messaging = new MessagingClient(this._options)));
|
|
33
|
+
}
|
|
29
34
|
get profile() {
|
|
30
35
|
var _a;
|
|
31
36
|
return ((_a = this._profile) !== null && _a !== void 0 ? _a : (this._profile = new ProfileClient(this._options)));
|
|
32
37
|
}
|
|
33
|
-
get
|
|
38
|
+
get pushNotifications() {
|
|
34
39
|
var _a;
|
|
35
|
-
return ((_a = this.
|
|
40
|
+
return ((_a = this._pushNotifications) !== null && _a !== void 0 ? _a : (this._pushNotifications = new PushNotificationsClient(this._options)));
|
|
36
41
|
}
|
|
37
42
|
}
|
|
@@ -10,7 +10,11 @@ export * from "./gallery/types/index.mjs";
|
|
|
10
10
|
export * from "./menus/client/requests/index.mjs";
|
|
11
11
|
export * as menus from "./menus/index.mjs";
|
|
12
12
|
export * from "./menus/types/index.mjs";
|
|
13
|
+
export * from "./messaging/client/requests/index.mjs";
|
|
13
14
|
export * as messaging from "./messaging/index.mjs";
|
|
14
15
|
export * from "./profile/client/requests/index.mjs";
|
|
15
16
|
export * as profile from "./profile/index.mjs";
|
|
16
17
|
export * from "./profile/types/index.mjs";
|
|
18
|
+
export * from "./pushNotifications/client/requests/index.mjs";
|
|
19
|
+
export * as pushNotifications from "./pushNotifications/index.mjs";
|
|
20
|
+
export * from "./pushNotifications/types/index.mjs";
|
|
@@ -10,7 +10,11 @@ export * from "./gallery/types/index.mjs";
|
|
|
10
10
|
export * from "./menus/client/requests/index.mjs";
|
|
11
11
|
export * as menus from "./menus/index.mjs";
|
|
12
12
|
export * from "./menus/types/index.mjs";
|
|
13
|
+
export * from "./messaging/client/requests/index.mjs";
|
|
13
14
|
export * as messaging from "./messaging/index.mjs";
|
|
14
15
|
export * from "./profile/client/requests/index.mjs";
|
|
15
16
|
export * as profile from "./profile/index.mjs";
|
|
16
17
|
export * from "./profile/types/index.mjs";
|
|
18
|
+
export * from "./pushNotifications/client/requests/index.mjs";
|
|
19
|
+
export * as pushNotifications from "./pushNotifications/index.mjs";
|
|
20
|
+
export * from "./pushNotifications/types/index.mjs";
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { BaseClientOptions } from "../../../../../../BaseClient.mjs";
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
|
|
2
2
|
import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
|
|
3
|
+
import * as core from "../../../../../../core/index.mjs";
|
|
4
|
+
import * as FiveOneEat from "../../../../../index.mjs";
|
|
3
5
|
import { ConversationsClient } from "../resources/conversations/client/Client.mjs";
|
|
4
6
|
import { MessagesClient } from "../resources/messages/client/Client.mjs";
|
|
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,5 +1,20 @@
|
|
|
1
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
|
+
};
|
|
2
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";
|
|
3
18
|
import { ConversationsClient } from "../resources/conversations/client/Client.mjs";
|
|
4
19
|
import { MessagesClient } from "../resources/messages/client/Client.mjs";
|
|
5
20
|
export class MessagingClient {
|
|
@@ -14,4 +29,63 @@ export class MessagingClient {
|
|
|
14
29
|
var _a;
|
|
15
30
|
return ((_a = this._messages) !== null && _a !== void 0 ? _a : (this._messages = new MessagesClient(this._options)));
|
|
16
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* This endpoint is used by the business companion mobile app to authenticate with
|
|
34
|
+
* Pusher channels. It validates that the authenticated business user has
|
|
35
|
+
* permission to access the requested channel, scoped to their active business.
|
|
36
|
+
*
|
|
37
|
+
* @param {FiveOneEat.business.ChannelAuthMessagingRequest} request
|
|
38
|
+
* @param {MessagingClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
39
|
+
*
|
|
40
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
41
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* await client.business.messaging.channelAuth({
|
|
45
|
+
* channel_name: "channel_name",
|
|
46
|
+
* socket_id: "socket_id"
|
|
47
|
+
* })
|
|
48
|
+
*/
|
|
49
|
+
channelAuth(request, requestOptions) {
|
|
50
|
+
return core.HttpResponsePromise.fromPromise(this.__channelAuth(request, requestOptions));
|
|
51
|
+
}
|
|
52
|
+
__channelAuth(request, requestOptions) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
55
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
56
|
+
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);
|
|
57
|
+
const _response = yield core.fetcher({
|
|
58
|
+
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"),
|
|
59
|
+
method: "POST",
|
|
60
|
+
headers: _headers,
|
|
61
|
+
contentType: "application/json",
|
|
62
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
63
|
+
requestType: "json",
|
|
64
|
+
body: request,
|
|
65
|
+
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,
|
|
66
|
+
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,
|
|
67
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
68
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
69
|
+
logging: this._options.logging,
|
|
70
|
+
});
|
|
71
|
+
if (_response.ok) {
|
|
72
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
73
|
+
}
|
|
74
|
+
if (_response.error.reason === "status-code") {
|
|
75
|
+
switch (_response.error.statusCode) {
|
|
76
|
+
case 401:
|
|
77
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
78
|
+
case 422:
|
|
79
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
80
|
+
default:
|
|
81
|
+
throw new errors.FiveOneEatError({
|
|
82
|
+
statusCode: _response.error.statusCode,
|
|
83
|
+
body: _response.error.body,
|
|
84
|
+
rawResponse: _response.rawResponse,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/channels/auth");
|
|
89
|
+
});
|
|
90
|
+
}
|
|
17
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ChannelAuthMessagingRequest } from "./ChannelAuthMessagingRequest.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
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 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
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
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 PushNotificationsClient {
|
|
19
|
+
constructor(options = {}) {
|
|
20
|
+
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register (or update) the authenticated business user's Expo push token for a
|
|
24
|
+
* device. If a `device_id` is provided, an existing registration for that device
|
|
25
|
+
* is updated.
|
|
26
|
+
*
|
|
27
|
+
* @param {FiveOneEat.business.StorePushTokenRequest} request
|
|
28
|
+
* @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
31
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* await client.business.pushNotifications.register({
|
|
35
|
+
* token: "token"
|
|
36
|
+
* })
|
|
37
|
+
*/
|
|
38
|
+
register(request, requestOptions) {
|
|
39
|
+
return core.HttpResponsePromise.fromPromise(this.__register(request, requestOptions));
|
|
40
|
+
}
|
|
41
|
+
__register(request, requestOptions) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
44
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
45
|
+
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);
|
|
46
|
+
const _response = yield core.fetcher({
|
|
47
|
+
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/push-tokens"),
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: _headers,
|
|
50
|
+
contentType: "application/json",
|
|
51
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
52
|
+
requestType: "json",
|
|
53
|
+
body: request,
|
|
54
|
+
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,
|
|
55
|
+
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,
|
|
56
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
57
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
58
|
+
logging: this._options.logging,
|
|
59
|
+
});
|
|
60
|
+
if (_response.ok) {
|
|
61
|
+
return {
|
|
62
|
+
data: _response.body,
|
|
63
|
+
rawResponse: _response.rawResponse,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (_response.error.reason === "status-code") {
|
|
67
|
+
switch (_response.error.statusCode) {
|
|
68
|
+
case 401:
|
|
69
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
70
|
+
case 422:
|
|
71
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
72
|
+
default:
|
|
73
|
+
throw new errors.FiveOneEatError({
|
|
74
|
+
statusCode: _response.error.statusCode,
|
|
75
|
+
body: _response.error.body,
|
|
76
|
+
rawResponse: _response.rawResponse,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/business/push-tokens");
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Delete the authenticated business user's Expo push token registration.
|
|
85
|
+
*
|
|
86
|
+
* @param {FiveOneEat.business.UnregisterPushNotificationsRequest} request
|
|
87
|
+
* @param {PushNotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
88
|
+
*
|
|
89
|
+
* @throws {@link FiveOneEat.UnauthorizedError}
|
|
90
|
+
* @throws {@link FiveOneEat.UnprocessableEntityError}
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await client.business.pushNotifications.unregister({
|
|
94
|
+
* token: "token"
|
|
95
|
+
* })
|
|
96
|
+
*/
|
|
97
|
+
unregister(request, requestOptions) {
|
|
98
|
+
return core.HttpResponsePromise.fromPromise(this.__unregister(request, requestOptions));
|
|
99
|
+
}
|
|
100
|
+
__unregister(request, requestOptions) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
103
|
+
const { token } = request;
|
|
104
|
+
const _queryParams = {
|
|
105
|
+
token,
|
|
106
|
+
};
|
|
107
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
108
|
+
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);
|
|
109
|
+
const _response = yield core.fetcher({
|
|
110
|
+
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/push-tokens"),
|
|
111
|
+
method: "DELETE",
|
|
112
|
+
headers: _headers,
|
|
113
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
114
|
+
queryString: core.url
|
|
115
|
+
.queryBuilder()
|
|
116
|
+
.addMany(_queryParams)
|
|
117
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
118
|
+
.build(),
|
|
119
|
+
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,
|
|
120
|
+
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,
|
|
121
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
122
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
123
|
+
logging: this._options.logging,
|
|
124
|
+
});
|
|
125
|
+
if (_response.ok) {
|
|
126
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
127
|
+
}
|
|
128
|
+
if (_response.error.reason === "status-code") {
|
|
129
|
+
switch (_response.error.statusCode) {
|
|
130
|
+
case 401:
|
|
131
|
+
throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
132
|
+
case 422:
|
|
133
|
+
throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
134
|
+
default:
|
|
135
|
+
throw new errors.FiveOneEatError({
|
|
136
|
+
statusCode: _response.error.statusCode,
|
|
137
|
+
body: _response.error.body,
|
|
138
|
+
rawResponse: _response.rawResponse,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/business/push-tokens");
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StorePushTokenRequest } from "./StorePushTokenRequest.mjs";
|