Parâmetros
sourceIdstringobrigatórioL'identificator da listDocuments() o da un salva. Mancando leva imediatamente.
const [first] = await api.tools.listDocuments();
const file = await api.tools.readDocument(first.id);
console.log(file.name, file.mimeType);
console.log(file.content); // a string for text, a Buffer otherwisefirst = api.tools.list_documents()["account"][0]
file = api.tools.read_document(first["id"])
print(file.name, file.mime_type)
print(file.content) # a str for text, bytes otherwiseCe torna
Un IaGenifyFile — il medesimo objeto api.files.create() ti manda, ya portando il suo sourceId. Quindi ler, cambiare e riporlo è tre righe.
const file = await api.tools.readDocument(id);
file.content = `${file.content}\n\nReviewed on ${new Date().toISOString().slice(0, 10)}.`;
await file.update(); // replaces it, same sourceIdfrom datetime import date
file = api.tools.read_document(source_id)
file.content = f"{file.content}\n\nReviewed on {date.today().isoformat()}."
file.update() # replaces it, same source_idnamestringNome del dossier.
contentstring | BufferTexte come una string; qualquer altra cosa como un Buffer.
mimeTypestringComa quels fuse salvat.
sourceIdstringYa set — update() funcionà istanzion.
location · metadataobjectOnde vive, e che cosa è registrat al suo sobre.
Como un utensilio, il cadèn a un sentiero tambèn
Dichiarat a un model, il parametro è chiamato documente e accetta o un id o un perit sul computer del caller. Un id è tentat prima; a sfascia, il perit è let a la macchina attraverso il pacchetto. Un utensiliu per ambeds lati, perché un model non deve saper che sta sostenendo.
Un file binario letçâ di quel modo è reportat come binario e non restituit como una stringa disgregada — al modele è dito il nome, il tipo e il tamaño, e poten a chiedere una conversione in lugar.
Erros
| Código | Status | Quando |
|---|---|---|
| file_not_found | 404 | Nessuna tal file su este cont. |
| file_missing_on_disk | 404 | Il record è là e i bytes non lo sono. |
Un appello con no sourceId lance prima di ogni richiesta: è un erro nel vostro codice, non una risposta da plataforma.