<aside> đ
Links (Object base class)
Notion Ruby Mapping Public API Reference
</aside>
<aside> âšī¸ â Table of Contents
</aside>
FileObject represents file information shared by file-based blocks and file properties. It is primarily a read-only representation of the file currently held by its owning block or property.
Do not construct or mutate a FileObject directly. Read it through APIs such as block.file_object or a file property's value, and perform updates through the owning block or property.
block = ImageBlock.new "<https://example.com/image.png>"
file = block.file_object
file.type
# => "external"
file.url
# => "<https://example.com/image.png>"
Returns the current Notion file type: "external", "file", or "file_upload".
Returns the external or Notion-hosted file URL. It returns nil while the object represents a pending FileUploadObject.
<aside> â ī¸
A URL returned for a Notion-hosted file (type == "file") may expire. Retrieve the block or page again when a fresh URL is required.
</aside>
Returns the upload object while the file type is "file_upload". After the owning object is saved and reconstructed from the Notion API response, the type becomes "file" and this method returns nil.
Returns true when the current type is "external"; otherwise, returns false.
Update files through the owning block or property. Direct setters and JSON conversion methods on FileObject are internal APIs.
block.url = "<https://example.com/new-image.png>"
block.save
FileObject#will_update is no longer available. Update tracking belongs to the owning block or property.