MetaFile

This Object represents a digital asset. A digital asset is an array of bits arranged in a specific sequence. It can be described with meta data, such as file type, size, hash and more.

Get One MetaFile

To retrieve a MetaFile you need to provide the UUID of the desired metafile as well as the name of the metalibrary in which it is located. Once you have retrieved the library reference using wranglebot.query.library.one(library_id), you can then retrieve the metafile reference using lib.query.metafiles.one(metafile_id). Finally, you can fetch the metadata of the metafile as a JSON object using metafile_ref.query.fetch().

You can also just call everything in one chained command: await wranglebot.query.library.one(library_id).metafiles.one(metafile_id).fetch()

const metafile_id = "<metafile-uuid>"
const library_id = "<metalibrary_name>"

const metafile = wranglebot.query.library.one(library_id).metafiles.one(metafile_id).fetch();

Delete One MetaFile

Marking a MetaFile as deleted is done by calling query.delete() on the queryied MetaFile

metafile.query.delete();

Get Many MetaFiles

To retrieve many metafiles at once you must provide an array of metafile UUIDs as a filter object.

const filters = {
    $ids: ["<metafile-uuid-1>","<metafile-uuid-2>"]
}

const metafiles = lib.query.metafiles.many(filters).fetch();

Update MetaData

You can update Meta Data by calling metafile_ref.query.metadata.put() and passing in an object with the key-value pairs that you want to update. In this example, the description key is being updated to "krissy and jordan wedding 2023".

metafile.query.metadata.put({
     "key" : "description",
     "value" : "krissy and jordan wedding 2023"     
})

Pre-publish a MetaFile

Enterprise Feature

In order to prepublish a MetaFile to the system, you can use the announce() endpoint in a MetaLibraries .metafiles command branch.

library.query.metafiles.announce([
    {
        hash : "<xxHash64-base64-encoded-hash>",
        basename: "thefileinquestion.mov", //the filename including extension
        size: "12312394875678" //file size in bytes
    }
])

Last updated