api.tools

readDocument()

api.tools.readDocument(sourceId) → Promise<IaGenifyFile>

يُقرأ أحد ملفات الحساب، المحتوى مُضمّن. حرّ، ونفس النداء مثل api.files.get().

GET /api/files/:idfreecontent included
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

المعاملات

sourceIdstringمطلوب

(ب) تحديد الهوية من لـئز أو من مصدر للخلاص، والمفقودين يُثارون فوراً

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 otherwise
first = 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 otherwise

ما الذي يعود إلى

A الفئة - نفس الجسم api.files.create() - أنت، بالفعل تحمل sourceIdلذا القراءة، التغيير وإعادة وضعها هي ثلاثة خطوط.

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 sourceId
from 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_id
namestring

اسم الملف

contentstring | Buffer

نص a نص أي منها ك a ك a.

mimeTypestring

ما تم حفظه كـ

sourceIdstring

تم تعيينها - update() -أعمال مباشرة

location · metadataobject

أين تعيش، وما هو مسجل عنها.

كأداة، يأخذ طريقاً أيضاً

واحد، اثنان من نوعي قيمة

مع نموذج ، فإن معلمته تسمى مستنداً وتقبل إما هوية أو مساراً على حاسوب المتصل. الهوية هي التي تُجرب أولاً ؛ إذا لم يكن الأمر كذلك ، فإن المسار يقرأ على الآلة من خلال الحزمة. أداة واحدة لكلا الطرفين ، لأن النموذج لا ينبغي أن يعرف من هو الذي يحمله.

ويقرأ ملف ثنائي ان هذه الطريقة تُبلَّغ كثنائية بدلا من ان تُعاد كسلسلة مُزَلَّقة ، ويُقال للنموذج الاسم والنوع والحجم ، ويمكن ان يطلب تحويلا بدلا من ذلك .

الأخطاء

الرمزالحالةمتى
file_not_found404لا يوجد ملف في هذا الحساب
file_missing_on_disk404السجل موجود و المنافذ ليست كذلك

A نداء مع لا sourceId يُطرح قبل أي طلب: هو a خطأ بوصة رمز ليس a إجابة من منصة.