Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AppServiceRegistration

Hierarchy

  • AppServiceRegistration

Index

Constructors

constructor

  • Parameters

    • url: null | string

    Returns AppServiceRegistration

Properties

pushEphemeral

pushEphemeral: undefined | boolean

Experimental Signal to the homeserver that this appservice will accept ephemeral events.

Methods

_isMatch

  • _isMatch(regexList: undefined | RegexObj[], sample: string, onlyExclusive: boolean): boolean
  • Parameters

    • regexList: undefined | RegexObj[]
    • sample: string
    • onlyExclusive: boolean

    Returns boolean

addRegexPattern

  • addRegexPattern(type: "users" | "rooms" | "aliases", regex: string, exclusive?: boolean): void
  • Add a regex pattern to be registered.

    throws

    If given an invalid type or regex.

    Parameters

    • type: "users" | "rooms" | "aliases"

      : The type of regex pattern. Must be 'users', 'rooms', or 'aliases'.

    • regex: string

      : The regex pattern.

    • Optional exclusive: boolean

      : True to reserve the matched namespace.

    Returns void

getAppServiceToken

  • getAppServiceToken(): null | string
  • Get the token the app service will use to communicate with the homeserver.

    Returns null | string

    The token

getAppServiceUrl

  • getAppServiceUrl(): null | string
  • Get the URL which the home server will hit in order to talk to the AS.

    Returns null | string

getHomeserverToken

  • getHomeserverToken(): null | string
  • Get the token the homeserver will use to communicate with the app service.

    Returns null | string

    The token

getId

  • getId(): null | string
  • Get the ID of the appservice.

    Returns null | string

    The ID

getOutput

  • Get the key-value output which should be written to a YAML file.

    throws

    If required fields hs_token, as-token, url, sender_localpart are missing.

    Returns AppServiceOutput

getProtocols

  • getProtocols(): null | string[]
  • Get the list of protocols that this appservice will serve for third party lookups. Will return null if no protocols have been set.

    Returns null | string[]

    The protocols.

getSenderLocalpart

  • getSenderLocalpart(): null | string
  • Get the desired user_id localpart for the app service itself.

    Returns null | string

    The user_id localpart ("alice" in "@alice:domain")

isAliasMatch

  • isAliasMatch(alias: string, onlyExclusive: boolean): boolean
  • Check if a room alias meets this registration regex.

    Parameters

    • alias: string

      The room alias

    • onlyExclusive: boolean

      True to restrict matching to only exclusive regexes. False to allow exclusive or non-exlusive regexes to match.

    Returns boolean

    True if there is a match.

isRateLimited

  • isRateLimited(): boolean
  • Get whether requests from this AS are rate-limited by the home server.

    Returns boolean

isRoomMatch

  • isRoomMatch(roomId: string, onlyExclusive: boolean): boolean
  • Check if a room ID meets this registration regex.

    Parameters

    • roomId: string

      The room ID

    • onlyExclusive: boolean

      True to restrict matching to only exclusive regexes. False to allow exclusive or non-exlusive regexes to match.

    Returns boolean

    True if there is a match.

isUserMatch

  • isUserMatch(userId: string, onlyExclusive: boolean): boolean
  • Check if a user_id meets this registration regex.

    Parameters

    • userId: string

      The user ID

    • onlyExclusive: boolean

      True to restrict matching to only exclusive regexes. False to allow exclusive or non-exlusive regexes to match.

    Returns boolean

    True if there is a match.

outputAsYaml

  • outputAsYaml(filename: string): void
  • Output this registration to the given file name.

    throws

    If required fields hs_token, as_token, url are missing.

    Parameters

    • filename: string

      The file name to write the yaml to.

    Returns void

pushEphemeralEnabled

  • pushEphemeralEnabled(): boolean
  • Experimental

    Should the appservice receive ephemeral events. Note this requires a homeserver implementing MSC2409.

    Returns boolean

setAppServiceToken

  • setAppServiceToken(token: string): void
  • Set the token the app service will use to communicate with the homeserver.

    Parameters

    • token: string

      The token

    Returns void

setAppServiceUrl

  • setAppServiceUrl(url: string): void
  • Set the URL which the home server will hit in order to talk to the AS.

    Parameters

    • url: string

      The application service url

    Returns void

setHomeserverToken

  • setHomeserverToken(token: string): void
  • Set the token the homeserver will use to communicate with the app service.

    Parameters

    • token: string

      The token

    Returns void

setId

  • setId(id: string): void
  • Set the ID of the appservice; must be unique across the homeserver and never change.

    Parameters

    • id: string

      The ID

    Returns void

setProtocols

  • setProtocols(protocols: string[]): void
  • Set the list of protocols that this appservice will serve for third party lookups.

    Parameters

    • protocols: string[]

      The protocols

    Returns void

setRateLimited

  • setRateLimited(isRateLimited: boolean): void
  • Set whether requests from this AS are rate-limited by the home server.

    Parameters

    • isRateLimited: boolean

      The flag which is set to true to enable rate rate limiting, false to disable.

    Returns void

setSenderLocalpart

  • setSenderLocalpart(localpart: string): void
  • Set the desired user_id localpart for the app service itself.

    Parameters

    • localpart: string

      The user_id localpart ("alice" in "@alice:domain")

    Returns void

Static fromObject

  • Convert a JSON object to an AppServiceRegistration object.

    static

    Parameters

    Returns AppServiceRegistration

    The registration.

Static generateToken

  • generateToken(): string
  • Generate a random token.

    Returns string

    A randomly generated token.

Generated using TypeDoc