Use a single js namespace as parent for all other nopaque namespaces.

This commit is contained in:
Patrick Jentsch
2023-11-09 14:29:01 +01:00
parent e8fe67d290
commit e3166ca54c
45 changed files with 322 additions and 325 deletions

View File

@ -1,19 +1,19 @@
/*****************************************************************************
* Requests for /admin routes *
*****************************************************************************/
Requests.admin = {};
nopaque.requests.admin = {};
Requests.admin.users = {};
nopaque.requests.admin.users = {};
Requests.admin.users.entity = {};
nopaque.requests.admin.users.entity = {};
Requests.admin.users.entity.confirmed = {};
nopaque.requests.admin.users.entity.confirmed = {};
Requests.admin.users.entity.confirmed.update = (userId, value) => {
nopaque.requests.admin.users.entity.confirmed.update = (userId, value) => {
let input = `/admin/users/${userId}/confirmed`;
let init = {
method: 'PUT',
body: JSON.stringify(value)
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};

View File

@ -1,58 +1,58 @@
/*****************************************************************************
* Requests for /contributions routes *
*****************************************************************************/
Requests.contributions = {};
nopaque.requests.contributions = {};
/*****************************************************************************
* Requests for /contributions/spacy-nlp-pipeline-models routes *
*****************************************************************************/
Requests.contributions.spacy_nlp_pipeline_models = {};
nopaque.requests.contributions.spacy_nlp_pipeline_models = {};
Requests.contributions.spacy_nlp_pipeline_models.entity = {};
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity = {};
Requests.contributions.spacy_nlp_pipeline_models.entity.delete = (spacyNlpPipelineModelId) => {
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.delete = (spacyNlpPipelineModelId) => {
let input = `/contributions/spacy-nlp-pipeline-models/${spacyNlpPipelineModelId}`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.contributions.spacy_nlp_pipeline_models.entity.isPublic = {};
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.isPublic = {};
Requests.contributions.spacy_nlp_pipeline_models.entity.isPublic.update = (spacyNlpPipelineModelId, value) => {
nopaque.requests.contributions.spacy_nlp_pipeline_models.entity.isPublic.update = (spacyNlpPipelineModelId, value) => {
let input = `/contributions/spacy-nlp-pipeline-models/${spacyNlpPipelineModelId}/is_public`;
let init = {
method: 'PUT',
body: JSON.stringify(value)
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
/*****************************************************************************
* Requests for /contributions/tesseract-ocr-pipeline-models routes *
*****************************************************************************/
Requests.contributions.tesseract_ocr_pipeline_models = {};
nopaque.requests.contributions.tesseract_ocr_pipeline_models = {};
Requests.contributions.tesseract_ocr_pipeline_models.entity = {};
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity = {};
Requests.contributions.tesseract_ocr_pipeline_models.entity.delete = (tesseractOcrPipelineModelId) => {
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.delete = (tesseractOcrPipelineModelId) => {
let input = `/contributions/tesseract-ocr-pipeline-models/${tesseractOcrPipelineModelId}`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic = {};
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic = {};
Requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic.update = (tesseractOcrPipelineModelId, value) => {
nopaque.requests.contributions.tesseract_ocr_pipeline_models.entity.isPublic.update = (tesseractOcrPipelineModelId, value) => {
let input = `/contributions/tesseract-ocr-pipeline-models/${tesseractOcrPipelineModelId}/is_public`;
let init = {
method: 'PUT',
body: JSON.stringify(value)
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};

View File

@ -1,102 +1,102 @@
/*****************************************************************************
* Requests for /corpora routes *
*****************************************************************************/
Requests.corpora = {};
nopaque.requests.corpora = {};
Requests.corpora.entity = {};
nopaque.requests.corpora.entity = {};
Requests.corpora.entity.delete = (corpusId) => {
nopaque.requests.corpora.entity.delete = (corpusId) => {
let input = `/corpora/${corpusId}`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.corpora.entity.build = (corpusId) => {
nopaque.requests.corpora.entity.build = (corpusId) => {
let input = `/corpora/${corpusId}/build`;
let init = {
method: 'POST',
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.corpora.entity.generateShareLink = (corpusId, role, expiration) => {
nopaque.requests.corpora.entity.generateShareLink = (corpusId, role, expiration) => {
let input = `/corpora/${corpusId}/generate-share-link`;
let init = {
method: 'POST',
body: JSON.stringify({role: role, expiration: expiration})
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.corpora.entity.getStopwords = () => {
nopaque.requests.corpora.entity.getStopwords = () => {
let input = `/corpora/stopwords`;
let init = {
method: 'GET'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.corpora.entity.isPublic = {};
nopaque.requests.corpora.entity.isPublic = {};
Requests.corpora.entity.isPublic.update = (corpusId, isPublic) => {
nopaque.requests.corpora.entity.isPublic.update = (corpusId, isPublic) => {
let input = `/corpora/${corpusId}/is_public`;
let init = {
method: 'PUT',
body: JSON.stringify(isPublic)
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
/*****************************************************************************
* Requests for /corpora/<entity>/files routes *
*****************************************************************************/
Requests.corpora.entity.files = {};
nopaque.requests.corpora.entity.files = {};
Requests.corpora.entity.files.ent = {};
nopaque.requests.corpora.entity.files.ent = {};
Requests.corpora.entity.files.ent.delete = (corpusId, corpusFileId) => {
nopaque.requests.corpora.entity.files.ent.delete = (corpusId, corpusFileId) => {
let input = `/corpora/${corpusId}/files/${corpusFileId}`;
let init = {
method: 'DELETE',
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
/*****************************************************************************
* Requests for /corpora/<entity>/followers routes *
*****************************************************************************/
Requests.corpora.entity.followers = {};
nopaque.requests.corpora.entity.followers = {};
Requests.corpora.entity.followers.add = (corpusId, usernames) => {
nopaque.requests.corpora.entity.followers.add = (corpusId, usernames) => {
let input = `/corpora/${corpusId}/followers`;
let init = {
method: 'POST',
body: JSON.stringify(usernames)
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.corpora.entity.followers.entity = {};
nopaque.requests.corpora.entity.followers.entity = {};
Requests.corpora.entity.followers.entity.delete = (corpusId, followerId) => {
nopaque.requests.corpora.entity.followers.entity.delete = (corpusId, followerId) => {
let input = `/corpora/${corpusId}/followers/${followerId}`;
let init = {
method: 'DELETE',
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.corpora.entity.followers.entity.role = {};
nopaque.requests.corpora.entity.followers.entity.role = {};
Requests.corpora.entity.followers.entity.role.update = (corpusId, followerId, value) => {
nopaque.requests.corpora.entity.followers.entity.role.update = (corpusId, followerId, value) => {
let input = `/corpora/${corpusId}/followers/${followerId}/role`;
let init = {
method: 'PUT',
body: JSON.stringify(value)
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};

View File

@ -1,6 +1,6 @@
var Requests = {};
nopaque.requests = {};
Requests.JSONfetch = (input, init={}) => {
nopaque.requests.JSONfetch = (input, init={}) => {
return new Promise((resolve, reject) => {
let fixedInit = {};
fixedInit.headers = {};
@ -8,7 +8,7 @@ Requests.JSONfetch = (input, init={}) => {
if (init.hasOwnProperty('body')) {
fixedInit.headers['Content-Type'] = 'application/json';
}
fetch(input, Utils.mergeObjectsDeep(init, fixedInit))
fetch(input, nopaque.Utils.mergeObjectsDeep(init, fixedInit))
.then(
(response) => {
if (response.ok) {

View File

@ -1,30 +1,30 @@
/*****************************************************************************
* Requests for /jobs routes *
*****************************************************************************/
Requests.jobs = {};
nopaque.requests.jobs = {};
Requests.jobs.entity = {};
nopaque.requests.jobs.entity = {};
Requests.jobs.entity.delete = (jobId) => {
nopaque.requests.jobs.entity.delete = (jobId) => {
let input = `/jobs/${jobId}`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.jobs.entity.log = (jobId) => {
nopaque.requests.jobs.entity.log = (jobId) => {
let input = `/jobs/${jobId}/log`;
let init = {
method: 'GET'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.jobs.entity.restart = (jobId) => {
nopaque.requests.jobs.entity.restart = (jobId) => {
let input = `/jobs/${jobId}/restart`;
let init = {
method: 'POST'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};

View File

@ -2,50 +2,50 @@
* Users *
* Fetch requests for /users routes *
*****************************************************************************/
Requests.users = {};
nopaque.requests.users = {};
Requests.users.entity = {};
nopaque.requests.users.entity = {};
Requests.users.entity.delete = (userId) => {
nopaque.requests.users.entity.delete = (userId) => {
let input = `/users/${userId}`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.users.entity.acceptTermsOfUse = () => {
nopaque.requests.users.entity.acceptTermsOfUse = () => {
let input = `/users/accept-terms-of-use`;
let init = {
method: 'POST'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};
Requests.users.entity.avatar = {};
nopaque.requests.users.entity.avatar = {};
Requests.users.entity.avatar.delete = (userId) => {
nopaque.requests.users.entity.avatar.delete = (userId) => {
let input = `/users/${userId}/avatar`;
let init = {
method: 'DELETE'
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
}
/*****************************************************************************
* Requests for /users/<entity>/settings routes *
*****************************************************************************/
Requests.users.entity.settings = {};
nopaque.requests.users.entity.settings = {};
Requests.users.entity.settings.profilePrivacy = {};
nopaque.requests.users.entity.settings.profilePrivacy = {};
Requests.users.entity.settings.profilePrivacy.update = (userId, profilePrivacySetting, enabled) => {
nopaque.requests.users.entity.settings.profilePrivacy.update = (userId, profilePrivacySetting, enabled) => {
let input = `/users/${userId}/settings/profile-privacy/${profilePrivacySetting}`;
let init = {
method: 'PUT',
body: JSON.stringify(enabled)
};
return Requests.JSONfetch(input, init);
return nopaque.requests.JSONfetch(input, init);
};