Skip to content

Commit

Permalink
Added initial controller route for #12
Browse files Browse the repository at this point in the history
  • Loading branch information
thejhh committed Apr 24, 2022
1 parent 28e2696 commit 3772277
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/controllers/HgHsBackendController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {
GetMapping,
PathVariable,
PostMapping,
PostMapping, PutMapping,
RequestHeader,
RequestMapping,
RequestParam
Expand Down Expand Up @@ -374,4 +374,36 @@ export class HgHsBackendController {
}
}

@PutMapping("/_matrix/client/v3/rooms/:roomId/send/:eventName/:tnxId")
public static async sendEventToRoomWithTnxId (
@RequestHeader(MATRIX_AUTHORIZATION_HEADER_NAME, {
required: false,
defaultValue: ''
})
token: string,
@PathVariable('roomId', {required: true})
roomId = "",
@PathVariable('eventName', {required: true})
eventName = "",
@PathVariable('tnxId', {required: true})
tnxId = ""
): Promise<ResponseEntity<ReadonlyJsonObject | {readonly error: string}>> {
try {

LOG.debug(`inviteToRoom: roomId = `, roomId, eventName, tnxId);

return ResponseEntity.ok(
{
hello: 'world'
} as unknown as ReadonlyJsonObject
);

} catch (err) {
LOG.error(`ERROR: `, err);
return ResponseEntity.internalServerError<{readonly error: string}>().body(
createErrorDTO('Internal Server Error', 500)
);
}
}

}

0 comments on commit 3772277

Please sign in to comment.