matrix-js-sdk

    Class MSC3089TreeSpace

    Represents a MSC3089 file tree Space. Note that this is UNSTABLE and subject to breaking changes without notice.

    Index

    Constructors

    Properties

    room: Room
    roomId: string

    Accessors

    Methods

    • Creates (uploads) a new file to this tree. The file must have already been encrypted for the room. The file contents are in a type that is compatible with MatrixClient.uploadContent().

      Parameters

      • name: string

        The name of the file.

      • encryptedContents: XMLHttpRequestBodyInit

        The encrypted contents.

      • info: EncryptedFile

        The encrypted file information.

      • OptionaladditionalContent: IContent

        Optional event content fields to include in the message.

      Returns Promise<ISendEventResponse>

      Promise which resolves to the file event's sent response.

    • Gets a subdirectory of a given ID under this tree space. Note that this will not recurse into children and instead only look one level deep.

      Parameters

      • roomId: string

        The room ID (directory ID) to find.

      Returns undefined | MSC3089TreeSpace

      The directory, or undefined if not found.

    • Gets the current order index for this directory. Note that if this is the top level space then -1 will be returned.

      Returns number

      The order index of this space.

    • Gets the current permissions of a user. Note that any users missing explicit permissions (or not in the space) will be considered Viewers. Appropriate membership checks need to be performed elsewhere.

      Parameters

      • userId: string

        The user ID to check permissions of.

      Returns TreePermissions

      The permissions for the user, defaulting to Viewer.

    • Invites a user to the tree space. They will be given the default Viewer permission level unless specified elsewhere.

      Parameters

      • userId: string

        The user ID to invite.

      • andSubspaces: boolean = true

        True (default) to invite the user to all directories/subspaces too, recursively.

      Returns Promise<void>

      Promise which resolves when complete.

    • Sets the order index for this directory within its parent. Note that if this is a top level space then an error will be thrown. -1 can be used to move the child to the start, and numbers larger than the number of children can be used to move the child to the end.

      Parameters

      • index: number

        The new order index for this space.

      Returns Promise<void>

      Promise which resolves when complete.

      Throws if this is a top level space.

    • Sets the permissions of a user to the given role. Note that if setting a user to Owner then they will NOT be able to be demoted. If the user does not have permission to change the power level of the target, an error will be thrown.

      Parameters

      • userId: string

        The user ID to change the role of.

      • role: TreePermissions

        The role to assign.

      Returns Promise<void>

      Promise which resolves when complete.

    MMNEPVFCICPMFPCPTTAAATR