@sword-health/ui-http-mapper
Version:
UI clients tool for consumption of easy to read/config endpoint maps
120 lines (119 loc) • 2.79 kB
JavaScript
export default {
assessments: {
justAnotherLevelDeep: {
anodaOne: {
api: {
url: 'default',
version: '1',
},
headers: {},
$$method: 'post',
$$makeUrl(configs) {
return `clinical-forms/api/v${configs.api.version}/deep-form/`;
},
}
},
fetchFilters: {
api: {
url: 'default',
version: '1',
},
headers: {},
$$method: 'get',
$$makeUrl(configs) {
return `clinical-forms/api/v${configs.api.version}/form/filters`;
},
},
getForms: {
api: {
url: 'default',
version: '1',
},
$$method: 'get',
$$config: {
timeout: '5000',
headers: data => data.headers.authorization(),
},
$$meta: {
mockDir: '/some/mocked/data/path',
},
$$makeUrl(configs, { patientId }) {
return `clinical-forms/api/v${configs.api.version}/${patientId}`;
},
},
getFormsAnswers: {
api: {
url: 'default',
version: '2',
},
$$method: 'get',
$$config: {
headers: {},
},
$$makeUrl(configs) {
return `clinical-forms/api/v${configs.api.version}/submit/${configs.api.version}`;
},
},
generateForm: {
api: {
url: 'default',
version: '1',
},
$$method: 'post',
$$config: {
headers: { Authorization: '123' },
},
$$makeUrl(configs, { name }) {
return `clinical-forms/api/v${configs.api.version}/${name}`;
},
},
deleteForm: {
api: {
url: 'default',
version: '1',
},
$$method: 'delete',
$$config: {},
$$makeUrl(configs, { patientId, formId }) {
return `clinical-forms/api/v${configs.api.version}/${patientId}/${formId}`;
},
},
deleteFormById: {
api: {
url: 'default',
version: '1',
},
$$method: 'delete',
$$config: {},
$$makeUrl(configs, { patientId, formId }) {
return `clinical-forms/api/v${configs.api.version}/${patientId}/${formId}`;
},
},
reactivateForm: {
api: {
url: 'default',
version: '1',
},
$$method: 'put',
$$config: {
headers: {},
},
$$makeUrl(configs, { patientId, formId }) {
return `clinical-forms/api/v${configs.api.version}/${patientId}/${formId}`;
},
},
patchForm: {
api: {
url: 'default',
version: '1',
},
$$method: 'patch',
$$config: {
headers: {},
},
$$makeUrl(configs, { patientId, formId }) {
return `clinical-forms/api/v${configs.api.version}/${patientId}/${formId}`;
},
},
},
};