FilesWorld extension
The files of 12: upload sessions with parts (3.1, 3.2), completion with the check and the
scan (3.4), the states of 2, thumbnails (7.3), the transcript (8.2), downloads with
Repr-Digest (9.3), tickets (9.2) and attaching (10). The checks are the visibility and
the rules of 12 10, nothing else (README).
Example:
world.fileSettings
..partBytes = 4
..holdScan = true;
// the app uploads; the file shows "being checked"
world.finishScan(fileId);
- on
Methods
-
abortUpload(
String principalId, String fileId) → void -
Available on FakeWorld, provided by the FilesWorld extension
abortUpload: ends an open own session; the file becomesfailed(12 2). -
addReadyFile(
{required String uploaderId, required String channelId, required String name, required String mimeType, required List< int> bytes, String scanStatus = 'clean', String uploadState = 'complete'}) → String -
Available on FakeWorld, provided by the FilesWorld extension
A file ofuploaderIdinchannelIdthat is uploaded and checked already, for tests that start with attachments:scanStatusanduploadStateset its state (12 2); returns its ID. Attach it withcreateMessageandattachment_file_ids. -
completeUpload(
String principalId, String fileId, JsonMap body) → JsonMap -
Available on FakeWorld, provided by the FilesWorld extension
completeUpload(12 3.4): checks the listed parts, joins them, checks size and SHA-256 and scans (or holds the scan, FakeFileSettings.holdScan); returns theFile. A completed session answers the file again. -
content(
String principalId, String fileId, String variant) → (Uint8List, String) -
Available on FakeWorld, provided by the FilesWorld extension
The bytes and type ofvariant(originalor a thumbnail) offileIdforprincipalId(12 9.3). -
createTicket(
String principalId, String sessionId, String fileId, String variant) → JsonMap -
Available on FakeWorld, provided by the FilesWorld extension
createFileTicket(12 9.2): a ticket ofvariantbound tosessionId, valid for five minutes; returns the APIFileTicketwith a path below the origin. -
createUploadSession(
String principalId, String channelId, JsonMap body) → JsonMap -
Available on FakeWorld, provided by the FilesWorld extension
createUpload(12 3.1): a session for anUploadCreatebodyofprincipalIdinchannelId, with the parts of FakeFileSettings.partBytes. -
deleteOwnFile(
String principalId, String fileId) → void -
Available on FakeWorld, provided by the FilesWorld extension
deleteFile: deletes an own file that is not attached;409 conflictfor an attached one. -
finishScan(
String fileId, {String? result}) → void -
Available on FakeWorld, provided by the FilesWorld extension
Ends the scan offileIdwithresult(default FakeFileSettings.scanResult): the file becomescomplete; a servable image gets thumbnails and a voice file its duration; appendsfile.updated(12 3.4). -
putPart(
String principalId, String fileId, int number, String? contentDigest, Uint8List bytes) → JsonMap -
Available on FakeWorld, provided by the FilesWorld extension
uploadPart(12 3.2): stores partnumberoffileIdafter the length and digest checks; the same part with the same digest answers again without new work. -
putPresignedPart(
String fileId, int number, Uint8List bytes) → String -
Available on FakeWorld, provided by the FilesWorld extension
A part of apresignedsession, PUT to the object store URL of the session (12 3.3); returns the ETag. Throws like putPart. -
requestTranscription(
String principalId, String fileId) → JsonMap -
Available on FakeWorld, provided by the FilesWorld extension
requestTranscription(12 8.2): in modeservicethe transcript becomespending; otherwise409 conflictwithreasontranscription_unavailable. -
setTranscript(
String fileId, String text, {String language = 'en', String source = 'agent'}) → void -
Available on FakeWorld, provided by the FilesWorld extension
Sets the transcript offileIdtotext(transcript_status = done) and appendsfile.updated(12 8.2). -
transcriptOf(
String principalId, String fileId) → JsonMap -
Available on FakeWorld, provided by the FilesWorld extension
getTranscript(12 8.2): the APITranscript;textonly withstatusdone. -
uploadState(
String principalId, String fileId) → JsonMap -
Available on FakeWorld, provided by the FilesWorld extension
getUpload(12 3.2 item 5): the confirmed parts of an own session. -
visibleFile(
String principalId, String fileId) → FakeFile -
Available on FakeWorld, provided by the FilesWorld extension
The filefileIdwhenprincipalIdmay read it: the uploader, or anyone who sees the thread of the message it is attached to (12 3.7); else404 not_found.