-
Notifications
You must be signed in to change notification settings - Fork 1
/
DropboxPaperApp.ts
38 lines (31 loc) 路 1.63 KB
/
DropboxPaperApp.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
37
38
import { App } from '@rocket.chat/apps-engine/definition/App';
import { IConfigurationExtend, IEnvironmentRead } from '@rocket.chat/apps-engine/definition/accessors';
import { SettingType } from '@rocket.chat/apps-engine/definition/settings';
import { DropboxPaperCreateCommand } from './commands/DropboxPaperCreateCommand';
import { DropboxPaperSearchCommand } from './commands/DropboxPaperSearchCommand';
import { SettingToHttpHeader } from './handlers/SettingToHttpHeader';
export class DropboxPaperApp extends App {
protected async extendConfiguration(configuration: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
await configuration.settings.provideSetting({
id: 'Dropbox_Paper_Bot',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Dropbox_Paper_Bot',
i18nDescription: 'Dropbox_Paper_Bot_Description',
});
await configuration.settings.provideSetting({
id: 'Dropbox_Paper_Api_Token',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Dropbox_Paper_Api_Token',
i18nDescription: 'Dropbox_Paper_Api_Token_Description',
});
configuration.http.providePreRequestHandler(new SettingToHttpHeader('Dropbox_Paper_Api_Token', 'Authorization'));
await configuration.slashCommands.provideSlashCommand(new DropboxPaperCreateCommand(this));
await configuration.slashCommands.provideSlashCommand(new DropboxPaperSearchCommand(this));
}
}