mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
30cfe080ce
TODO: * Provisioning support (IRC API) * Deprovisioning support (IRC API) * Ops query (IRC API) * State update interval
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { Injectable } from "@angular/core";
|
|
import { Integration } from "./models/integration";
|
|
import { RssConfigComponent } from "../configs/rss/rss-config.component";
|
|
import { ContainerContent } from "angular2-modal";
|
|
import { IrcConfigComponent } from "../configs/irc/irc-config.component";
|
|
|
|
@Injectable()
|
|
export class IntegrationService {
|
|
|
|
private static supportedTypeMap = {
|
|
"bot": true,
|
|
"complex-bot": {
|
|
"rss": true
|
|
},
|
|
"bridge": {
|
|
"irc": true
|
|
}
|
|
};
|
|
|
|
private static components = {
|
|
"complex-bot": {
|
|
"rss": RssConfigComponent
|
|
},
|
|
"bridge": {
|
|
"irc": IrcConfigComponent
|
|
}
|
|
};
|
|
|
|
static isSupported(integration: Integration): boolean {
|
|
if (IntegrationService.supportedTypeMap[integration.type] === true) return true;
|
|
if (!IntegrationService.supportedTypeMap[integration.type]) return false;
|
|
return IntegrationService.supportedTypeMap[integration.type][integration.integrationType] === true;
|
|
}
|
|
|
|
static hasConfig(integration: Integration): boolean {
|
|
return integration.type !== "bot";
|
|
}
|
|
|
|
static getConfigComponent(integration: Integration): ContainerContent {
|
|
return IntegrationService.components[integration.type][integration.integrationType];
|
|
}
|
|
|
|
constructor() {
|
|
}
|
|
}
|