Front-End Attachments API
Last modified by Manuel Leduc on 2026/02/05 17:22
Reference
/**
* @since 0.9
*/
interface Attachment {
id: string;
name: string;
mimetype: string;
href: string;
}
interface AttachmentsService {
list(): Ref<Attachment[]>;
count(): Ref<number>;
isLoading(): Ref<boolean>;
/**
* True while an attachment is uploading.
*/
isUploading(): Ref<boolean>;
getError(): Ref<string | undefined>;
/**
* Load the initial state of the attachments.
*/
refresh(page: string): Promise<void>;
/**
* Upload the provided list of files to a given page
* @param page - the page where to save the files
* @param files - the list of files to upload
* @returns (since 0.20) an optional list of resolved attachments URL (in the same order as the provided files). This
* is useful in the case where the url cannot be resolved from the name of the file and its document reference
* alone.
*/
upload(
page: string,
files: File[],
): Promise<(string | undefined)[] | undefined>;
}