Readonly
optsInstall a custom handler for an incoming HTTP API request. This allows callers to add extra functionality, implement new APIs, etc...
Named options
Function to handle requests to this endpoint.
The HTTP method name.
Path to the endpoint.
Determines whether a room should be provisoned based on user provided rules and the room state. Will default to true if no rules have been provided.
resolves if can and rejects if it cannot. A status code is returned on both.
The room to check.
Should the validator check its cache.
Find a member for a given room. This method will fetch the joined members from the homeserver if the cache doesn't have it stored.
The userID of the member.
Should we prefer the bot user over a ghost user
Get the AS bot instance.
Retrieve the connected event store instance, if one was configured.
Retrieve an Intent instance for the specified user ID. If no ID is given, an instance for the bot itself is returned.
The intent instance
Optional
userId: stringOptional. The user ID to get an Intent for.
Optional
request: Request<unknown>Optional. The request instance to tie the MatrixClient instance to. Useful for logging contextual request IDs.
Retrieve an Intent instance for the specified user ID localpart. This must be the complete user localpart.
The intent instance
The user ID localpart to get an Intent for.
Optional
request: Request<unknown>Optional. The request instance to tie the MatrixClient instance to. Useful for logging contextual request IDs.
Returns a PrometheusMetrics instance stored on the bridge, creating it first if required. The instance will be registered with the HTTP server so it can serve the "/metrics" page in the usual way. The instance will automatically register the Matrix SDK metrics by calling {PrometheusMetrics~registerMatrixSdkMetrics}.
Ensure that PackageInfo.getBridgeVersion
is returns the correct version before calling this,
as changes to the bridge version after metric instantiation will not be detected.
Register the /metrics endpoint on the appservice HTTP server. Defaults to true.
Note: listen()
must have been called if this is true or this will throw.
Optional
registry: RegistryOptionally provide an alternative registry for metrics.
Retrieve the request factory used to create incoming requests.
Retrieve the connected room store instance, if one was configured.
Retrieve the connected user activity store instance.
Retrieve the connected user store instance, if one was configured.
Setup a HTTP listener to handle appservice traffic. ** This must be called after .initalise() **
The port to listen on.
Optional hostname to bind to.
Optional
appServiceInstance: AppServiceThe AppService instance to attach to. If not provided, one will be created.
Check the homeserver -> appservice connection by sending a ping event.
This will throw if another ping attempt is made, or if the request times out.
The delay in milliseconds
The room to use as a ping check.
How long to wait for the ping attempt. Defaults to 60s.
Provision a user on the homeserver.
Resolved when provisioned.
The virtual user to be provisioned.
Optional
provisionedUser: { name?: string; remote?: RemoteUser; url?: string }Provisioning information.
Optional
name?: stringOptional
remote?: RemoteUserOptional
url?: stringA convenient shortcut to calling registerBridgeGauges() on the PrometheusMetrics instance directly. This version will supply the value of the matrixGhosts field if the counter function did not return it, for convenience.
bridge.registerBridgeGauges(() => {
return {
matrixRoomConfigs: Object.keys(this.matrixRooms).length,
remoteRoomConfigs: Object.keys(this.remoteRooms).length,
remoteGhosts: Object.keys(this.remoteGhosts).length,
...
}
})
A function that when invoked returns the current counts of various items in the bridge.
Check a express Request to see if it's correctly
authenticated (includes the hsToken). The query parameter access_token
and the Authorization
header are checked.
True if authenticated, False if not.
Run the bridge (start listening). This calls initalise()
and listen()
.
A promise resolving when the bridge is ready.
The port to listen on.
Optional
appServiceInstance: AppServiceThe AppService instance to attach to. If not provided, one will be created.
Optional hostname to bind to.
Generated using TypeDoc
Options to pass to the bridge