Documentations › mmo.edms › js › edms Api MMO.edms · 1 symbole · générée le 27 Oct 2026
The api of mmo.edms (controllers/FileController.php on the server)
class MMO.edms.Api Espace de noms MMO.edmsconst api = MMO.edms.Api.Shared();
api.files({q: 'invoice', limit: 20}).then(({files, total}) => ...);
Index constructor(url, token) Shared() static href(path, query) request(method, path, {query = null, json = undefined, body = undefined, headers = null, signal = null}, retry) refreshToken() async Ask the server for the session's CSRF token again (GET edms/token.json): the page's, and every api's, then files(query) The files the user can see file(id) updateFile(id, changes) trashFile(id) restoreFile(id) deleteFile(id) Delete a file in the trash, for good bulk(action, ids, labels) contentUrl(id, inline) archiveUrl(ids) archive(ids) A zip of the files ids, fetched rather than followed: the server says in its headers the files it left out because their bytes are missing on the disk (X-Missing-Files: how many, `X-Missing-Fil… filename(disposition) static missing(headers) static labels() createLabel(data) updateLabel(id, changes) deleteLabel(id) upload(file, options) Upload a file: MMO.edms.Upload sendFile(file, {name = null, labels = [], attachment = null, description = null}) Upload a file in one request (POST files.json, multipart): no progress and no resuming, for a small file -- an image -- that php takes whole (upload_max_filesize).
Méthodes23 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
static Shared() href(path, query = null) path string- under the api (files.json) query = null ?Objectretourne string
request(method, path, {query = null, json = undefined, body = undefined, headers = null, signal = null}, retry) edms.js:167 request(method, path, {query = null, json = undefined, body = undefined, headers = null, signal = null} = {}, retry = true) method stringpath string{query = null, json = undefined, body = undefined, headers = null, signal = null} = {} retry = true boolean- false: a refused token is not asked for again (refreshToken) retourne Promise<Object>the answer's body: {meta, links, data}
Ask the server for the session's CSRF token again (GET edms/token.json): the page's, and every api's, then
async refreshToken() retourne Promise<boolean>true if it gave one
The files the user can see
files(query = {}) query = {} retourne Promise<{files: Array<Object>, total: number>}
file(id) id retourne Promise<Object>the file id
updateFile(id, changes) id *changes retourne Promise<Object>the file, changed
trashFile(id) id retourne Promise<Object>the file, in the trash
restoreFile(id) id retourne Promise<Object>the file, out of the trash
Delete a file in the trash, for good
deleteFile(id) bulk(action, ids, labels = []) action string- trash, restore, delete, label or unlabel ids Arraylabels = [] Array- the label ids, for label/unlabel retourne Promise<{done: Array, errors: Object>}
contentUrl(id, inline = false) id inline = false retourne stringthe url of the bytes of the file id (inline: to show it rather than save it)
archiveUrl(ids) ids retourne stringthe url of a zip of the files ids
A zip of the files ids, fetched rather than followed: the server says in its headers the files it left out because their bytes are missing on the disk (X-Missing-Files: how many, X-Missing-File-Names: which, those that fit), which a link the browser follows never shows (my.oviepro #302).
archive(ids) ids Arrayretourne Promise<{blob: Blob, filename: string, missing: {count: number, names: string[]}>}
static filename(disposition) disposition ?string- a Content-Disposition header retourne ?stringthe file's name it gives, its utf-8 one first
MMO.edms.Api.filename("attachment; filename=\"_t_.zip\"; filename*=UTF-8''%C3%A9t%C3%A9.zip") // 'été.zip'
static missing(headers) headers Headers- an archive's retourne count: number, names: string[]} the files it left out: how many, and the names the server could fit
labels() retourne Promise<Array<Object>>the labels the user can see, as a tree: {id, label, path, color, rights, children}
createLabel(data) data retourne Promise<Object>
updateLabel(id, changes) id changes retourne Promise<Object>the label, changed
deleteLabel(id) Upload a file: MMO.edms.Upload
upload(file, options = {}) file Fileoptions = {} Object- MMO.edms.Upload retourne MMO.edms.Upload started: its promise gives the last answer (file: the file made)
sendFile(file, {name = null, labels = [], attachment = null, description = null}) edms.js:363 Upload a file in one request (POST files.json, multipart): no progress and no resuming, for a small file -- an image -- that php takes whole (upload_max_filesize). A bigger one goes a chunk at a time (upload).
sendFile(file, {name = null, labels = [], attachment = null, description = null} = {}) file File | Blob{name = null, labels = [], attachment = null, description = null} = {} retourne Promise<{file: Object, url: string>} the file made, and url the address showing it (inline)
MMO.edms.Api.Shared().sendFile(file, {labels: '"_TAGS/pages"'}).then(({url}) => img.src = url);