1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
import { MatrixClient } from "../client";
import { IEncryptedFile } from "../@types/event";
import { IContent, MatrixEvent } from "./event";
import { MSC3089TreeSpace } from "./MSC3089TreeSpace";
import { FileType } from "../http-api";
import type { ISendEventResponse } from "../@types/requests";
/**
* Represents a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) branch - a reference
* to a file (leaf) in the tree. Note that this is UNSTABLE and subject to breaking changes
* without notice.
*/
export declare class MSC3089Branch {
private client;
readonly indexEvent: MatrixEvent;
readonly directory: MSC3089TreeSpace;
constructor(client: MatrixClient, indexEvent: MatrixEvent, directory: MSC3089TreeSpace);
/**
* The file ID.
*/
get id(): string;
/**
* Whether this branch is active/valid.
*/
get isActive(): boolean;
/**
* Version for the file, one-indexed.
*/
get version(): number;
private get roomId();
/**
* Deletes the file from the tree, including all prior edits/versions.
* @returns Promise which resolves when complete.
*/
delete(): Promise<void>;
/**
* Gets the name for this file.
* @returns The name, or "Unnamed File" if unknown.
*/
getName(): string;
/**
* Sets the name for this file.
* @param name - The new name for this file.
* @returns Promise which resolves when complete.
*/
setName(name: string): Promise<void>;
/**
* Gets whether or not a file is locked.
* @returns True if locked, false otherwise.
*/
isLocked(): boolean;
/**
* Sets a file as locked or unlocked.
* @param locked - True to lock the file, false otherwise.
* @returns Promise which resolves when complete.
*/
setLocked(locked: boolean): Promise<void>;
/**
* Gets information about the file needed to download it.
* @returns Information about the file.
*/
getFileInfo(): Promise<{
info: IEncryptedFile;
httpUrl: string;
}>;
/**
* Gets the event the file points to.
* @returns Promise which resolves to the file's event.
*/
getFileEvent(): Promise<MatrixEvent>;
/**
* Creates a new version of this file with contents in a type that is compatible with MatrixClient.uploadContent().
* @param name - The name of the file.
* @param encryptedContents - The encrypted contents.
* @param info - The encrypted file information.
* @param additionalContent - Optional event content fields to include in the message.
* @returns Promise which resolves to the file event's sent response.
*/
createNewVersion(name: string, encryptedContents: FileType, info: Partial<IEncryptedFile>, additionalContent?: IContent): Promise<ISendEventResponse>;
/**
* Gets the file's version history, starting at this file.
* @returns Promise which resolves to the file's version history, with the
* first element being the current version and the last element being the first version.
*/
getVersionHistory(): Promise<MSC3089Branch[]>;
}
//# sourceMappingURL=MSC3089Branch.d.ts.map
|