Api
MMO.edms · 1 symbol · generated 5 Oct 2026
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}) => ...);
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) | |
| labels() | |
| createLabel(data) | |
| updateLabel(id, changes) | |
| deleteLabel(id) | |
| upload(file, options) | Upload a file: MMO.edms.Upload |
Methods19
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 | ?Object | |
| returns | string | |
request(method, path, {query = null, json = undefined, body = undefined, headers = null, signal = null}, retry)
edms.js:154request(method, path, {query = null, json = undefined, body = undefined, headers = null, signal = null} = {}, retry = true)| method | string | |
| path | string | |
| {query = null, json = undefined, body = undefined, headers = null, signal = null} = {} | | |
| retry = true | boolean | - false: a refused token is not asked for again (refreshToken) |
| returns | 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()| returns | Promise<boolean> | true if it gave one |
The files the user can see
files(query = {})| query = {} | | |
| returns | Promise<{files: Array<Object>, total: number | >} |
file(id)| id | | |
| returns | Promise<Object> | the file id |
updateFile(id, changes)| id | * | |
| changes | | |
| returns | Promise<Object> | the file, changed |
trashFile(id)| id | | |
| returns | Promise<Object> | the file, in the trash |
restoreFile(id)| id | | |
| returns | 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 | Array | |
| labels = [] | Array | - the label ids, for label/unlabel |
| returns | Promise<{done: Array, errors: Object | >} |
contentUrl(id, inline = false)| id | | |
| inline = false | | |
| returns | string | the url of the bytes of the file id (inline: to show it rather than save it) |
archiveUrl(ids)| ids | | |
| returns | string | the url of a zip of the files ids |
labels()| returns | Promise<Array<Object>> | the labels the user can see, as a tree: {id, label, path, color, rights, children} |
createLabel(data)| data | | |
| returns | Promise<Object> | |
updateLabel(id, changes)| id | | |
| changes | | |
| returns | Promise<Object> | the label, changed |
deleteLabel(id)Upload a file: MMO.edms.Upload
upload(file, options = {})| file | File | |
| options = {} | Object | - MMO.edms.Upload |
| returns | MMO.edms.Upload | started: its promise gives the last answer (file: the file made) |