Punch webhook name through to bridge

This commit is contained in:
Travis Ralston 2021-12-03 13:49:02 -07:00
parent 87b4c98509
commit ba51f0db1b
3 changed files with 5 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import { HookshotGithubBridge } from "../../bridges/HookshotGithubBridge";
import { HookshotWebhookBridge } from "../../bridges/HookshotWebhookBridge";
interface BridgeRoomRequest {
name?: string;
}
/**
@ -31,7 +32,7 @@ export class DimensionHookshotWebhookService {
try {
const hookshot = new HookshotWebhookBridge(userId);
return hookshot.newConnection(roomId);
return hookshot.newConnection(roomId, request.name);
} catch (e) {
LogService.error("DimensionHookshotWebhookService", e);
throw new ApiError(400, "Error bridging room");

View File

@ -34,10 +34,11 @@ export class HookshotWebhookBridge extends HookshotBridge {
return (await this.getAllRoomConfigurations(inRoomId)).filter(c => c.eventType === HookshotTypes.Webhook);
}
public async newConnection(roomId: string): Promise<HookshotWebhookRoomConfig> {
public async newConnection(roomId: string, name: string): Promise<HookshotWebhookRoomConfig> {
const bridge = await this.getDefaultBridge();
const body = {
name,
};
return await this.doProvisionRequest<HookshotWebhookRoomConfig>(bridge, "PUT", `/v1/${roomId}/connections/${HookshotTypes.Webhook}`, null, body);
}

View File

@ -9,7 +9,7 @@ export interface FE_HookshotWebhookBridge {
export interface FE_HookshotWebhookConnection {
id: string;
config: {
name?: string; // TODO: Update according to bridge support
name?: string;
url: string;
};
}