Index

Api

MMO.edms · 1 symbol · generated 5 Oct 2026

class

Api

edms.js:116

The api of mmo.edms (controllers/FileController.php on the server)

class MMO.edms.Api
Namespace
MMO.edms
const api = MMO.edms.Api.Shared(); api.files({q: 'invoice', limit: 20}).then(({files, total}) => ...);

Methods19

constructor(url, token)

edms.js:121
constructor(url = null, token = null)
url = null?string- where the api is (.../edms/): the page's by default (MMO.edms.config.url)
token = null?string- the session's CSRF token: the page's by default

href(path, query)

edms.js:139
href(path, query = null)
pathstring- under the api (files.json)
query = null?Object
returnsstring

request(method, path, {query = null, json = undefined, body = undefined, headers = null, signal = null}, retry)

edms.js:154
request(method, path, {query = null, json = undefined, body = undefined, headers = null, signal = null} = {}, retry = true)
methodstring
pathstring
{query = null, json = undefined, body = undefined, headers = null, signal = null} = {}
retry = trueboolean- false: a refused token is not asked for again (refreshToken)
returnsPromise<Object>the answer's body: {meta, links, data}

refreshToken()

asyncedms.js:186

Ask the server for the session's CSRF token again (GET edms/token.json): the page's, and every api's, then

async refreshToken()
returnsPromise<boolean>true if it gave one

files(query)

edms.js:204

The files the user can see

files(query = {})
query = {}
returnsPromise<{files: Array<Object>, total: number>}

file(id)

edms.js:209
file(id)
id
returnsPromise<Object>the file id

updateFile(id, changes)

edms.js:218
updateFile(id, changes)
id*
changes
returnsPromise<Object>the file, changed

trashFile(id)

edms.js:223
trashFile(id)
id
returnsPromise<Object>the file, in the trash

restoreFile(id)

edms.js:228
restoreFile(id)
id
returnsPromise<Object>the file, out of the trash

deleteFile(id)

edms.js:233

Delete a file in the trash, for good

deleteFile(id)
id

bulk(action, ids, labels)

edms.js:243
bulk(action, ids, labels = [])
actionstring- trash, restore, delete, label or unlabel
idsArray
labels = []Array- the label ids, for label/unlabel
returnsPromise<{done: Array, errors: Object>}

contentUrl(id, inline)

edms.js:248
contentUrl(id, inline = false)
id
inline = false
returnsstringthe url of the bytes of the file id (inline: to show it rather than save it)

archiveUrl(ids)

edms.js:253
archiveUrl(ids)
ids
returnsstringthe url of a zip of the files ids

labels()

edms.js:259
labels()
returnsPromise<Array<Object>>the labels the user can see, as a tree: {id, label, path, color, rights, children}

createLabel(data)

edms.js:267
createLabel(data)
data
returnsPromise<Object>

updateLabel(id, changes)

edms.js:272
updateLabel(id, changes)
id
changes
returnsPromise<Object>the label, changed

upload(file, options)

edms.js:287

Upload a file: MMO.edms.Upload

upload(file, options = {})
fileFile
options = {}Object- MMO.edms.Upload
returnsMMO.edms.Uploadstarted: its promise gives the last answer (file: the file made)