Skip to content
Snippets Groups Projects
Commit dc110968 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

New: connection for Activated Features coscine/issues#672

parent c0590e7d
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ export { DisciplineApi } from './requests/discipline-api';
export { LicenseApi } from './requests/license-api';
export { MetadataApi } from './requests/metadata-api';
export { SearchApi } from './requests/search-api';
export { ActivatedFeaturesApi } from './requests/activatedFeatures-api';
import apiConnectionBasic from './basic/api-connection-basic';
......
const axios = require('axios');
import apiConnectionBasic from '../basic/api-connection-basic';
function getActivatedFeaturesApiUrl() {
return (
'https://' +
apiConnectionBasic.getHostName() +
'/coscine/api/Coscine.Api.ActivatedFeatures/ActivatedFeatures/'
);
}
export class ActivatedFeaturesApi {
public static listAllFeatures(
thenHandler: any = apiConnectionBasic.defaultThenHandler,
catchHandler: any = apiConnectionBasic.defaultOnCatch
) {
apiConnectionBasic.setHeader();
return axios
.get(getActivatedFeaturesApiUrl())
.then(thenHandler)
.catch(catchHandler);
}
public static listAllFeaturesOfProject(
projectId: any,
thenHandler: any = apiConnectionBasic.defaultThenHandler,
catchHandler: any = apiConnectionBasic.defaultOnCatch
) {
apiConnectionBasic.setHeader();
return axios
.get(getActivatedFeaturesApiUrl() + projectId)
.then(thenHandler)
.catch(catchHandler);
}
public static getActiveFeatures(
projectId: any,
thenHandler: any = apiConnectionBasic.defaultThenHandler,
catchHandler: any = apiConnectionBasic.defaultOnCatch
) {
apiConnectionBasic.setHeader();
return axios
.get(getActivatedFeaturesApiUrl() + projectId + '/activeFeatures')
.then(thenHandler)
.catch(catchHandler);
}
public static getInactiveFeatures(
projectId: any,
thenHandler: any = apiConnectionBasic.defaultThenHandler,
catchHandler: any = apiConnectionBasic.defaultOnCatch
) {
apiConnectionBasic.setHeader();
return axios
.get(getActivatedFeaturesApiUrl() + projectId + '/inactiveFeatures')
.then(thenHandler)
.catch(catchHandler);
}
public static activateFeature(
projectId: any,
featureId: any,
thenHandler: any = apiConnectionBasic.defaultThenHandler,
catchHandler: any = apiConnectionBasic.defaultOnCatch
) {
apiConnectionBasic.setHeader();
return axios
.get(getActivatedFeaturesApiUrl() + projectId + '/activateFeature/' + featureId)
.then(thenHandler)
.catch(catchHandler);
}
public static deactivateFeature(
projectId: any,
featureId: any,
thenHandler: any = apiConnectionBasic.defaultThenHandler,
catchHandler: any = apiConnectionBasic.defaultOnCatch
) {
apiConnectionBasic.setHeader();
return axios
.get(getActivatedFeaturesApiUrl() + projectId + '/deactivateFeature/' + featureId)
.then(thenHandler)
.catch(catchHandler);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment