The media library.
Uploads count against the plan's storage allowance and are reachable with the posts
scope. Up to five files per call, 50 MB each; the API verifies the bytes against the
declared type.
{:ok, [asset]} =
FoPost.Media.upload(client, workspace_id: workspace.id, files: ["chart.png"])
FoPost.Posts.create(client,
workspace_id: workspace.id,
accounts: [account.id],
content: %{text: "The numbers", media: [FoPost.MediaAsset.to_media_item(asset)]}
)A file is a path, a {filename, content} tuple, or a map of :filename, :content,
and optionally :content_type.
Summary
Functions
Removes an asset from the library.
Same as delete/2, but raises FoPost.Error.
A workspace's media library. :workspace_id is required.
Same as list/2, but raises FoPost.Error.
Stores files in the media library.
Same as upload/2, but raises FoPost.Error.
Functions
@spec delete(FoPost.Client.t(), String.t()) :: {:ok, FoPost.Message.t()} | {:error, FoPost.Error.t()}
Removes an asset from the library.
Same as delete/2, but raises FoPost.Error.
@spec list( FoPost.Client.t(), keyword() ) :: {:ok, [FoPost.MediaAsset.t()]} | {:error, FoPost.Error.t()}
A workspace's media library. :workspace_id is required.
Same as list/2, but raises FoPost.Error.
@spec upload( FoPost.Client.t(), keyword() ) :: {:ok, [FoPost.MediaAsset.t()]} | {:error, FoPost.Error.t()}
Stores files in the media library.
Required: :files. Pass :workspace_id to save them to that workspace's library.
Same as upload/2, but raises FoPost.Error.