This repository was archived by the owner on Nov 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPushApp.ts
More file actions
119 lines (105 loc) · 3.58 KB
/
PushApp.ts
File metadata and controls
119 lines (105 loc) · 3.58 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import {
IAppAccessors,
IConfigurationExtend,
IEnvironmentRead,
ILogger,
} from '@rocket.chat/apps-engine/definition/accessors';
import { ApiSecurity, ApiVisibility } 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 { SettingType } from '@rocket.chat/apps-engine/definition/settings';
import { CreateRoomEndpoint } from './endpoints/CreateRoomEndpoint';
import { ReceiveMessageEndpoint } from './endpoints/ReceiveMessageEndpoint';
import { RocketEndpoint } from './endpoints/RocketEndpoint';
import {
PUSH_BASE_URL,
PUSH_CLOSED_FLOW,
PUSH_MEDIA_FLOW,
PUSH_QUEUED_FLOW,
PUSH_TAKEN_FLOW,
PUSH_TOKEN,
RC_CRM_URL,
REQUEST_TIMEOUT,
} from './settings/Constants';
export class PushApp extends App {
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
super(info, logger, accessors);
}
public async extendConfiguration(configuration: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
// API
await configuration.api.provideApi({
visibility: ApiVisibility.PUBLIC,
security: ApiSecurity.UNSECURE,
endpoints: [
new ReceiveMessageEndpoint(this),
new CreateRoomEndpoint(this),
new RocketEndpoint(this),
],
});
// Settings
await configuration.settings.provideSetting({
id: RC_CRM_URL,
type: SettingType.STRING,
packageValue: '',
required: false,
public: false,
i18nLabel: 'config_rc_crm_url',
});
await configuration.settings.provideSetting({
id: PUSH_BASE_URL,
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'config_push_base_url',
});
await configuration.settings.provideSetting({
id: PUSH_TOKEN,
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'config_push_token',
});
await configuration.settings.provideSetting({
id: PUSH_TAKEN_FLOW,
type: SettingType.STRING,
packageValue: '',
required: false,
public: false,
i18nLabel: 'config_push_taken_flow',
});
await configuration.settings.provideSetting({
id: PUSH_QUEUED_FLOW,
type: SettingType.STRING,
packageValue: '',
required: false,
public: false,
i18nLabel: 'config_push_queued_flow',
});
await configuration.settings.provideSetting({
id: PUSH_CLOSED_FLOW,
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'config_push_closed_flow',
});
await configuration.settings.provideSetting({
id: PUSH_MEDIA_FLOW,
type: SettingType.STRING,
packageValue: '',
required: false,
public: false,
i18nLabel: 'config_push_media_flow',
});
await configuration.settings.provideSetting({
id: REQUEST_TIMEOUT,
type: SettingType.NUMBER,
packageValue: 30,
required: true,
public: false,
i18nLabel: 'config_push_timeout',
});
}
}