1 | import { LineClient } from 'messaging-api-line';
|
2 | import { MessengerClient } from 'messaging-api-messenger';
|
3 | import { SlackOAuthClient } from 'messaging-api-slack';
|
4 | import { TelegramClient } from 'messaging-api-telegram';
|
5 | import { ViberClient } from 'messaging-api-viber';
|
6 | import ConsoleEvent, { ConsoleRawEvent } from './console/ConsoleEvent';
|
7 | import Context from './context/Context';
|
8 | import LineEvent from './line/LineEvent';
|
9 | import MessengerEvent from './messenger/MessengerEvent';
|
10 | import SessionStore from './session/SessionStore';
|
11 | import SlackEvent from './slack/SlackEvent';
|
12 | import TelegramEvent from './telegram/TelegramEvent';
|
13 | import TwilioClient from './whatsapp/TwilioClient';
|
14 | import ViberEvent from './viber/ViberEvent';
|
15 | import WhatsappEvent from './whatsapp/WhatsappEvent';
|
16 | import { ConsoleClient } from './console/ConsoleClient';
|
17 | import { LineRequestBody } from './line/LineConnector';
|
18 | import { MessengerRequestBody } from './messenger/MessengerConnector';
|
19 | import { SlackRequestBody } from './slack/SlackConnector';
|
20 | import { TelegramRequestBody } from './telegram/TelegramConnector';
|
21 | import { ViberRequestBody } from './viber/ViberConnector';
|
22 | import { WhatsappRequestBody } from './whatsapp/WhatsappConnector';
|
23 | export declare type Client = ConsoleClient | MessengerClient | LineClient | SlackOAuthClient | TelegramClient | ViberClient | TwilioClient;
|
24 | export declare type Event = ConsoleEvent | MessengerEvent | LineEvent | SlackEvent | TelegramEvent | ViberEvent | WhatsappEvent;
|
25 | export declare type Body = ConsoleRawEvent | MessengerRequestBody | LineRequestBody | SlackRequestBody | TelegramRequestBody | ViberRequestBody | WhatsappRequestBody;
|
26 | export declare type AnyContext = Context<any, any>;
|
27 | export declare type Action<C extends AnyContext, P extends Record<string, any> = {}, RAP extends Record<string, any> = {}> = (context: C, props: Props<C> & P) => void | Action<C, RAP> | Promise<Action<C, RAP> | void>;
|
28 | export declare type Props<C extends AnyContext> = {
|
29 | next?: Action<C, any>;
|
30 | error?: Error;
|
31 | };
|
32 | export declare type Plugin<C extends AnyContext> = (context: C) => void;
|
33 | export declare enum Channel {
|
34 | Messenger = "messenger",
|
35 | Line = "line",
|
36 | Slack = "slack",
|
37 | Telegram = "telegram",
|
38 | Viber = "viber",
|
39 | Whatsapp = "whatsapp"
|
40 | }
|
41 | export declare enum SessionDriver {
|
42 | Memory = "memory",
|
43 | File = "file",
|
44 | Redis = "redis",
|
45 | Mongo = "mongo"
|
46 | }
|
47 | export declare type SessionConfig = {
|
48 | driver: string;
|
49 | expiresIn?: number;
|
50 | stores: {
|
51 | memory?: {
|
52 | maxSize?: number;
|
53 | };
|
54 | file?: {
|
55 | dirname?: string;
|
56 | };
|
57 | redis?: {
|
58 | port?: number;
|
59 | host?: string;
|
60 | password?: string;
|
61 | db?: number;
|
62 | };
|
63 | mongo?: {
|
64 | url?: string;
|
65 | collectionName?: string;
|
66 | };
|
67 | } | {
|
68 | [P in Exclude<string, SessionDriver>]: SessionStore;
|
69 | };
|
70 | };
|
71 | export declare type BottenderConfig = {
|
72 | plugins?: Plugin<any>[];
|
73 | session?: SessionConfig;
|
74 | initialState?: Record<string, any>;
|
75 | channels?: {
|
76 | [Channel.Messenger]: {
|
77 | enabled: boolean;
|
78 | path: string;
|
79 | accessToken: string;
|
80 | verifyToken: string;
|
81 | appId: string;
|
82 | appSecret: string;
|
83 | };
|
84 | [Channel.Line]: {
|
85 | enabled: boolean;
|
86 | path: string;
|
87 | accessToken: string;
|
88 | channelSecret: string;
|
89 | };
|
90 | [Channel.Telegram]: {
|
91 | enabled: boolean;
|
92 | path: string;
|
93 | accessToken: string;
|
94 | };
|
95 | [Channel.Slack]: {
|
96 | enabled: boolean;
|
97 | path: string;
|
98 | accessToken: string;
|
99 | verificationToken?: string;
|
100 | signingSecret?: string;
|
101 | };
|
102 | [Channel.Viber]: {
|
103 | enabled: boolean;
|
104 | path: string;
|
105 | accessToken: string;
|
106 | sender: {
|
107 | name: string;
|
108 | };
|
109 | };
|
110 | [Channel.Whatsapp]: {
|
111 | enabled: boolean;
|
112 | path: string;
|
113 | accountSid: string;
|
114 | authToken: string;
|
115 | };
|
116 | };
|
117 | };
|
118 | export declare type RequestContext = {
|
119 | method: string;
|
120 | path: string;
|
121 | query: Record<string, string>;
|
122 | headers: Record<string, string>;
|
123 | };
|
124 |
|
\ | No newline at end of file |