2017-12-18 23:44:01 -05:00
|
|
|
import { IntegrationRecord } from "../db/models/IntegrationRecord";
|
|
|
|
|
|
|
|
export class Integration {
|
|
|
|
// These are meant to be set by the underlying integration
|
|
|
|
public category: "bot" | "complex-bot" | "bridge" | "widget";
|
|
|
|
public type: string;
|
|
|
|
public requirements: IntegrationRequirement[];
|
2017-12-20 23:28:43 -05:00
|
|
|
public isEncryptionSupported = false;
|
2017-12-18 23:44:01 -05:00
|
|
|
|
|
|
|
// These are meant to be set by us
|
|
|
|
public displayName: string;
|
|
|
|
public avatarUrl: string;
|
|
|
|
public description: string;
|
|
|
|
public isEnabled: boolean;
|
|
|
|
public isPublic: boolean;
|
|
|
|
|
|
|
|
constructor(record: IntegrationRecord) {
|
|
|
|
this.type = record.type;
|
|
|
|
this.displayName = record.name;
|
|
|
|
this.avatarUrl = record.avatarUrl;
|
|
|
|
this.description = record.description;
|
|
|
|
this.isEnabled = record.isEnabled;
|
|
|
|
this.isPublic = record.isPublic;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface IntegrationRequirement {
|
|
|
|
condition: "publicRoom" | "canSendEventTypes";
|
|
|
|
argument: any;
|
2017-12-20 23:28:43 -05:00
|
|
|
|
|
|
|
// For publicRoom this is true or false (boolean)
|
|
|
|
// For canSendEventTypes this is an array of {isState: boolean, type: string}
|
|
|
|
// For userInRoom this is the user ID
|
2017-12-18 23:44:01 -05:00
|
|
|
expectedValue: any;
|
|
|
|
}
|