Clarify contents api further

This commit is contained in:
Vidar Tonaas Fauske 2019-10-31 10:18:52 +00:00 committed by GitHub
parent 24e4a2e4f5
commit 5280bf60a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,9 @@ model. There are three model types: **notebook**, **file**, and **directory**.
- The ``format`` field is either ``"text"`` or ``"base64"``.
- The ``mimetype`` field can be any mimetype string, but defaults to
``text/plain`` for text-format models and
``application/octet-stream`` for base64-format models.
``application/octet-stream`` for base64-format models. For files with
unknown mime types (e.g. unknown file extensions), this field may be
`None`.
- The ``content`` field is always of type ``unicode``. For text-format
file models, ``content`` simply contains the file's bytes after decoding
as UTF-8. Non-text (``base64``) files are read as bytes, base64 encoded,
@ -100,9 +102,10 @@ model. There are three model types: **notebook**, **file**, and **directory**.
In certain circumstances, we don't need the full content of an entity to
complete a Contents API request. In such cases, we omit the ``content``, and
``format`` keys from the model, and the default values for the ``mimetype``
field. This most commonly occurs when listing a directory, in which
circumstance we represent files within the directory as content-less models
to avoid having to recursively traverse and serialize the entire filesystem.
field (see above). This most commonly occurs when listing a directory, in
which circumstance we represent files within the directory as content-less
models to avoid having to recursively traverse and serialize the entire
filesystem.
**Sample Models**