Class MSC3089TreeSpace

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

Hierarchy

  • MSC3089TreeSpace

Constructors

Properties

client: MatrixClient
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().

    Returns

    Resolves to the file event's sent response.

    Parameters

    • name: string

      The name of the file.

    • encryptedContents: XMLHttpRequestBodyInit

      The encrypted contents.

    • info: Partial<IEncryptedFile>

      The encrypted file information.

    • Optional additionalContent: IContent

      Optional event content fields to include in the message.

    Returns Promise<ISendEventResponse>

  • Deletes the tree, kicking all members and deleting all subdirectories.

    Returns

    Resolves when complete.

    Returns Promise<void>

  • 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.

    Returns

    The directory, or undefined if not found.

    Parameters

    • roomId: string

      The room ID (directory ID) to find.

    Returns undefined | MSC3089TreeSpace

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

    Returns

    The order index of this space.

    Returns number

  • 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.

    Returns

    The permissions for the user, defaulting to Viewer.

    Parameters

    • userId: string

      The user ID to check permissions of.

    Returns TreePermissions

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

    Returns

    Resolves when complete.

    Parameters

    • userId: string

      The user ID to invite.

    • andSubspaces: boolean = true

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

    • shareHistoryKeys: boolean = true

      True (default) to share encryption keys with the invited user. This will allow them to decrypt the events (files) in the tree. Keys will not be shared if the room is lacking appropriate history visibility (by default, history visibility is "shared" in trees, which is an appropriate visibility for these purposes).

    Returns Promise<void>

  • Sets the name of the tree space.

    Returns

    Resolves when complete.

    Parameters

    • name: string

      The new name for the space.

    Returns Promise<void>

  • 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.

    Returns

    Resolves when complete.

    Throws

    Throws if this is a top level space.

    Parameters

    • index: number

      The new order index for this space.

    Returns Promise<void>

  • 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.

    Returns

    Resolves when complete.

    Parameters

    • userId: string

      The user ID to change the role of.

    • role: TreePermissions

      The role to assign.

    Returns Promise<void>

Generated using TypeDoc