-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStartPushLivechatApp.ts
36 lines (31 loc) · 1.43 KB
/
StartPushLivechatApp.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import {
IAppAccessors,
IConfigurationExtend,
IEnvironmentRead,
ILogger,
} from '@rocket.chat/apps-engine/definition/accessors';
import { ApiSecurity, ApiVisibility, IApi } from '@rocket.chat/apps-engine/definition/api';
import { App } from '@rocket.chat/apps-engine/definition/App';
import { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
import { StartFlowCommand } from './src/command/StartFlowCommand';
import { StartFlowEndpoint } from './src/endpoint/StartFlowEndpoint';
import { APP_SETTINGS } from './src/settings/Constants';
export class StartPushLivechatApp extends App {
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
super(info, logger, accessors);
}
public async initialize(configurationExtend: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
await this.extendConfiguration(configurationExtend);
await configurationExtend.api.provideApi({
visibility: ApiVisibility.PUBLIC,
security: ApiSecurity.UNSECURE,
endpoints: [
new StartFlowEndpoint(this),
],
} as IApi);
}
public async extendConfiguration(configuration: IConfigurationExtend): Promise<void> {
APP_SETTINGS.forEach((setting) => configuration.settings.provideSetting(setting));
await configuration.slashCommands.provideSlashCommand(new StartFlowCommand(this));
}
}