MMOframework
Pourquoi l'IA Playground Bibliothèques Documentation Rechercher Agence
FR EN
Index

Api

MMO.edms · 1 symbole · générée le 27 Oct 2026

class

Api

edms.js:129

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

class MMO.edms.Api
Espace de noms
MMO.edms
const 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() asyncAsk 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, token)

edms.js:134
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:152
href(path, query = null)
pathstring- under the api (files.json)
query = null?Object
retournestring

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)
methodstring
pathstring
{query = null, json = undefined, body = undefined, headers = null, signal = null} = {}
retry = trueboolean- false: a refused token is not asked for again (refreshToken)
retournePromise<Object>the answer's body: {meta, links, data}

refreshToken()

asyncedms.js:199

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

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

files(query)

edms.js:217

The files the user can see

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

file(id)

edms.js:222
file(id)
id
retournePromise<Object>the file id

updateFile(id, changes)

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

trashFile(id)

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

restoreFile(id)

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

deleteFile(id)

edms.js:246

Delete a file in the trash, for good

deleteFile(id)
id

bulk(action, ids, labels)

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

contentUrl(id, inline)

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

archiveUrl(ids)

edms.js:266
archiveUrl(ids)
ids
retournestringthe url of a zip of the files ids

archive(ids)

edms.js:277

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)
idsArray
retournePromise<{blob: Blob, filename: string, missing: {count: number, names: string[]}>}

filename(disposition)

staticedms.js:296
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'

missing(headers)

staticedms.js:310
static missing(headers)
headersHeaders- an archive's
retournecount: number, names: string[]} the files it left out: how many, and the names the server could fit

labels()

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

createLabel(data)

edms.js:329
createLabel(data)
data
retournePromise<Object>

updateLabel(id, changes)

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

upload(file, options)

edms.js:349

Upload a file: MMO.edms.Upload

upload(file, options = {})
fileFile
options = {}Object- MMO.edms.Upload
retourneMMO.edms.Uploadstarted: 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} = {})
fileFile | Blob
{name = null, labels = [], attachment = null, description = null} = {}
retournePromise<{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);