-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGoogleCalendar.ts
More file actions
86 lines (68 loc) · 2.69 KB
/
Copy pathGoogleCalendar.ts
File metadata and controls
86 lines (68 loc) · 2.69 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
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 { GCCommand } from './Commands/GCCommands';
import { GCGetter } from './helpers/GSGetter';
import { WebhookEndpoint } from './helpers/Webhook';
export class GoogleCalendarApp extends App {
private gcGetter: GCGetter;
// private webhook : WebhookEndpoint;
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {
super(info, logger, accessors);
this.gcGetter = new GCGetter();
}
public getGCGetter(): GCGetter {
return this.gcGetter;
}
protected async extendConfiguration(configuration: IConfigurationExtend, environmentRead: IEnvironmentRead): Promise<void> {
await configuration.api.provideApi({
visibility: ApiVisibility.PUBLIC,
security: ApiSecurity.UNSECURE,
endpoints: [new WebhookEndpoint(this)],
});
await configuration.settings.provideSetting({
id: 'calendar_apikey',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Customize_GoogleCalendar_APIKey',
i18nDescription: 'Customize_GoogleCalendar_APIKey_Description',
});
await configuration.settings.provideSetting({
id: 'calendar_clientid',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Customize_Calendar_ClientID',
i18nDescription: 'Customize_Calendar_ClientID',
});
await configuration.settings.provideSetting({
id: 'calendar_secret_key',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Customize_Calendar_SecretKey',
i18nDescription: 'Customize_Calendar_SecretKey',
});
await configuration.settings.provideSetting({
id: 'redirect_uri',
type: SettingType.STRING,
packageValue: '',
required: true,
public: false,
i18nLabel: 'Customize_Redirect_uri',
i18nDescription: 'Customize_Redirect_URI',
});
await configuration.slashCommands.provideSlashCommand(new GCCommand(this));
}
}