@coscine/api-connection
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -46,2 +46,9 @@ var axios = require('axios'); | ||
} | ||
ResourceApi$$1.getResourceInformation = function (resourceId, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$1 | ||
.get(getResourceApiUrl() + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
ResourceApi$$1.storeResource = function (parentId, body, thenHandler, catchHandler) { | ||
@@ -54,2 +61,16 @@ apiConnection.setHeader(); | ||
}; | ||
ResourceApi$$1.deleteResource = function (resourceId, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$1 | ||
.delete(getResourceApiUrl() + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
ResourceApi$$1.updateResource = function (resourceId, body, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$1 | ||
.post(getResourceApiUrl() + resourceId, body) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return ResourceApi$$1; | ||
@@ -72,2 +93,9 @@ }()); | ||
}; | ||
ResourceTypeApi$$1.getFields = function (resourceTypeId, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$2 | ||
.get(getResourceTypeApiUrl() + resourceTypeId + '/fields') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return ResourceTypeApi$$1; | ||
@@ -149,3 +177,3 @@ }()); | ||
axios$6 | ||
.get(getDataSourceApiUrl() + resourceId + path) | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
@@ -156,8 +184,53 @@ .catch(catchHandler); | ||
apiConnection.setHeader(); | ||
axios$6.get(getDataSourceApiUrl() + resourceId + path, { responseType: 'blob' }).then(function (response) { | ||
axios$6 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), { | ||
responseType: 'blob' | ||
}) | ||
.then(function (response) { | ||
// Let the user save the file. | ||
// The data is cached until the response is completed! | ||
FileSaver_min.saveAs(response.data, name); | ||
}).catch(catchHandler); | ||
}) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.getDataSource = function (resourceId, path, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.delete = function (resourceId, path, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6 | ||
.delete(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.Upload = function (resourceId, path, data, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), | ||
headers: { | ||
'Content-Type': 'application/binary' | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.Update = function (resourceId, path, data, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path) + '/update', | ||
headers: { | ||
'Content-Type': 'application/binary' | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return DataSourceApi$$1; | ||
@@ -218,2 +291,19 @@ }()); | ||
var axios$a = require('axios'); | ||
function getLicenseApiUrl() { | ||
return 'https://' + apiConnection.getHostName() + '/coscine/api/Coscine.Api.Project/License/'; | ||
} | ||
var LicenseApi$$1 = /** @class */ (function () { | ||
function LicenseApi$$1() { | ||
} | ||
LicenseApi$$1.getLicenses = function (thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$a | ||
.get(getLicenseApiUrl()) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return LicenseApi$$1; | ||
}()); | ||
var axios$b = require('axios'); | ||
var headerKey = 'Authorization'; | ||
@@ -232,7 +322,7 @@ var hostName = window.location.hostname; | ||
setHeader: function () { | ||
axios$a.defaults.headers.common[headerKey] = 'Bearer ' + coscine.authorization.bearer; | ||
axios$b.defaults.headers.common[headerKey] = 'Bearer ' + coscine.authorization.bearer; | ||
} | ||
}; | ||
var axios$b = require('axios'); | ||
var axios$c = require('axios'); | ||
function getProjectApiUrl() { | ||
@@ -246,3 +336,3 @@ return 'https://' + apiConnection.getHostName() + '/coscine/api/Coscine.Api.Project/Project/'; | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.get(getProjectApiUrl() + projectId) | ||
@@ -254,3 +344,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.post(getProjectApiUrl(), body) | ||
@@ -262,3 +352,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.post(getProjectApiUrl() + projectId, body) | ||
@@ -270,3 +360,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.get(getProjectApiUrl() + parentId + '/resources') | ||
@@ -278,3 +368,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.delete(getProjectApiUrl() + projectId) | ||
@@ -286,3 +376,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.get(getProjectApiUrl()) | ||
@@ -295,3 +385,3 @@ .then(thenHandler) | ||
var axios$c = require('axios'); | ||
var axios$d = require('axios'); | ||
var headerKey$1 = 'Authorization'; | ||
@@ -326,3 +416,3 @@ var hostName$1 = window.location.hostname; | ||
setHeader: function () { | ||
axios$c.defaults.headers.common[headerKey$1] = 'Bearer ' + coscine.authorization.bearer; | ||
axios$d.defaults.headers.common[headerKey$1] = 'Bearer ' + coscine.authorization.bearer; | ||
} | ||
@@ -332,3 +422,3 @@ }; | ||
export default apiConnection$1; | ||
export { defaultOnCatch$1 as defaultOnCatch, redirectToProject$1 as redirectToProject, ProjectApi$$1 as ProjectApi, ProjectRoleApi$$1 as ProjectRoleApi, ResourceApi$$1 as ResourceApi, ResourceTypeApi$$1 as ResourceTypeApi, RoleApi$$1 as RoleApi, SubProjectApi$$1 as SubProjectApi, UserApi$$1 as UserApi, DataSourceApi$$1 as DataSourceApi, VisibilityApi$$1 as VisibilityApi, InstituteApi$$1 as InstituteApi, DisciplineApi$$1 as DisciplineApi }; | ||
export { defaultOnCatch$1 as defaultOnCatch, redirectToProject$1 as redirectToProject, ProjectApi$$1 as ProjectApi, ProjectRoleApi$$1 as ProjectRoleApi, ResourceApi$$1 as ResourceApi, ResourceTypeApi$$1 as ResourceTypeApi, RoleApi$$1 as RoleApi, SubProjectApi$$1 as SubProjectApi, UserApi$$1 as UserApi, DataSourceApi$$1 as DataSourceApi, VisibilityApi$$1 as VisibilityApi, InstituteApi$$1 as InstituteApi, DisciplineApi$$1 as DisciplineApi, LicenseApi$$1 as LicenseApi }; | ||
//# sourceMappingURL=api-connection.es5.js.map |
@@ -52,2 +52,9 @@ (function (global, factory) { | ||
} | ||
ResourceApi$$1.getResourceInformation = function (resourceId, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$1 | ||
.get(getResourceApiUrl() + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
ResourceApi$$1.storeResource = function (parentId, body, thenHandler, catchHandler) { | ||
@@ -60,2 +67,16 @@ apiConnection.setHeader(); | ||
}; | ||
ResourceApi$$1.deleteResource = function (resourceId, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$1 | ||
.delete(getResourceApiUrl() + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
ResourceApi$$1.updateResource = function (resourceId, body, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$1 | ||
.post(getResourceApiUrl() + resourceId, body) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return ResourceApi$$1; | ||
@@ -78,2 +99,9 @@ }()); | ||
}; | ||
ResourceTypeApi$$1.getFields = function (resourceTypeId, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$2 | ||
.get(getResourceTypeApiUrl() + resourceTypeId + '/fields') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return ResourceTypeApi$$1; | ||
@@ -155,3 +183,3 @@ }()); | ||
axios$6 | ||
.get(getDataSourceApiUrl() + resourceId + path) | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
@@ -162,8 +190,53 @@ .catch(catchHandler); | ||
apiConnection.setHeader(); | ||
axios$6.get(getDataSourceApiUrl() + resourceId + path, { responseType: 'blob' }).then(function (response) { | ||
axios$6 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), { | ||
responseType: 'blob' | ||
}) | ||
.then(function (response) { | ||
// Let the user save the file. | ||
// The data is cached until the response is completed! | ||
FileSaver_min.saveAs(response.data, name); | ||
}).catch(catchHandler); | ||
}) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.getDataSource = function (resourceId, path, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6 | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.delete = function (resourceId, path, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6 | ||
.delete(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.Upload = function (resourceId, path, data, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), | ||
headers: { | ||
'Content-Type': 'application/binary' | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi$$1.Update = function (resourceId, path, data, thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$6({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path) + '/update', | ||
headers: { | ||
'Content-Type': 'application/binary' | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return DataSourceApi$$1; | ||
@@ -224,2 +297,19 @@ }()); | ||
var axios$a = require('axios'); | ||
function getLicenseApiUrl() { | ||
return 'https://' + apiConnection.getHostName() + '/coscine/api/Coscine.Api.Project/License/'; | ||
} | ||
var LicenseApi$$1 = /** @class */ (function () { | ||
function LicenseApi$$1() { | ||
} | ||
LicenseApi$$1.getLicenses = function (thenHandler, catchHandler) { | ||
apiConnection.setHeader(); | ||
axios$a | ||
.get(getLicenseApiUrl()) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return LicenseApi$$1; | ||
}()); | ||
var axios$b = require('axios'); | ||
var headerKey = 'Authorization'; | ||
@@ -238,7 +328,7 @@ var hostName = window.location.hostname; | ||
setHeader: function () { | ||
axios$a.defaults.headers.common[headerKey] = 'Bearer ' + coscine.authorization.bearer; | ||
axios$b.defaults.headers.common[headerKey] = 'Bearer ' + coscine.authorization.bearer; | ||
} | ||
}; | ||
var axios$b = require('axios'); | ||
var axios$c = require('axios'); | ||
function getProjectApiUrl() { | ||
@@ -252,3 +342,3 @@ return 'https://' + apiConnection.getHostName() + '/coscine/api/Coscine.Api.Project/Project/'; | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.get(getProjectApiUrl() + projectId) | ||
@@ -260,3 +350,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.post(getProjectApiUrl(), body) | ||
@@ -268,3 +358,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.post(getProjectApiUrl() + projectId, body) | ||
@@ -276,3 +366,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.get(getProjectApiUrl() + parentId + '/resources') | ||
@@ -284,3 +374,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.delete(getProjectApiUrl() + projectId) | ||
@@ -292,3 +382,3 @@ .then(thenHandler) | ||
apiConnection.setHeader(); | ||
axios$b | ||
axios$c | ||
.get(getProjectApiUrl()) | ||
@@ -301,3 +391,3 @@ .then(thenHandler) | ||
var axios$c = require('axios'); | ||
var axios$d = require('axios'); | ||
var headerKey$1 = 'Authorization'; | ||
@@ -332,3 +422,3 @@ var hostName$1 = window.location.hostname; | ||
setHeader: function () { | ||
axios$c.defaults.headers.common[headerKey$1] = 'Bearer ' + coscine.authorization.bearer; | ||
axios$d.defaults.headers.common[headerKey$1] = 'Bearer ' + coscine.authorization.bearer; | ||
} | ||
@@ -351,2 +441,3 @@ }; | ||
exports.DisciplineApi = DisciplineApi$$1; | ||
exports.LicenseApi = LicenseApi$$1; | ||
@@ -353,0 +444,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -26,2 +26,4 @@ "use strict"; | ||
exports.DisciplineApi = discipline_api_1.DisciplineApi; | ||
var license_api_1 = require("./requests/license-api"); | ||
exports.LicenseApi = license_api_1.LicenseApi; | ||
var headerKey = 'Authorization'; | ||
@@ -28,0 +30,0 @@ var hostName = window.location.hostname; |
@@ -15,3 +15,3 @@ "use strict"; | ||
axios | ||
.get(getDataSourceApiUrl() + resourceId + path) | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
@@ -22,8 +22,53 @@ .catch(catchHandler); | ||
api_connection_1.default.setHeader(); | ||
axios.get(getDataSourceApiUrl() + resourceId + path, { responseType: 'blob' }).then(function (response) { | ||
axios | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), { | ||
responseType: 'blob' | ||
}) | ||
.then(function (response) { | ||
// Let the user save the file. | ||
// The data is cached until the response is completed! | ||
file_saver_1.default.saveAs(response.data, name); | ||
}).catch(catchHandler); | ||
}) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.getDataSource = function (resourceId, path, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios | ||
.get(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.delete = function (resourceId, path, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios | ||
.delete(getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path)) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.Upload = function (resourceId, path, data, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path), | ||
headers: { | ||
'Content-Type': 'application/binary' | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
DataSourceApi.Update = function (resourceId, path, data, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios({ | ||
method: 'PUT', | ||
url: getDataSourceApiUrl() + resourceId + '/' + encodeURIComponent(path) + '/update', | ||
headers: { | ||
'Content-Type': 'application/binary' | ||
}, | ||
data: data | ||
}) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return DataSourceApi; | ||
@@ -30,0 +75,0 @@ }()); |
@@ -11,2 +11,9 @@ "use strict"; | ||
} | ||
ResourceApi.getResourceInformation = function (resourceId, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios | ||
.get(getResourceApiUrl() + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
ResourceApi.storeResource = function (parentId, body, thenHandler, catchHandler) { | ||
@@ -19,2 +26,16 @@ api_connection_1.default.setHeader(); | ||
}; | ||
ResourceApi.deleteResource = function (resourceId, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios | ||
.delete(getResourceApiUrl() + resourceId) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
ResourceApi.updateResource = function (resourceId, body, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios | ||
.post(getResourceApiUrl() + resourceId, body) | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return ResourceApi; | ||
@@ -21,0 +42,0 @@ }()); |
@@ -18,2 +18,9 @@ "use strict"; | ||
}; | ||
ResourceTypeApi.getFields = function (resourceTypeId, thenHandler, catchHandler) { | ||
api_connection_1.default.setHeader(); | ||
axios | ||
.get(getResourceTypeApiUrl() + resourceTypeId + '/fields') | ||
.then(thenHandler) | ||
.catch(catchHandler); | ||
}; | ||
return ResourceTypeApi; | ||
@@ -20,0 +27,0 @@ }()); |
@@ -12,2 +12,3 @@ export { ProjectApi } from './requests/project-api'; | ||
export { DisciplineApi } from './requests/discipline-api'; | ||
export { LicenseApi } from './requests/license-api'; | ||
export declare function defaultOnCatch(error: any): void; | ||
@@ -14,0 +15,0 @@ export declare function redirectToProject(project: any): void; |
export declare class DataSourceApi { | ||
static getDataSourceFolder(resourceId: any, path: string, thenHandler: any, catchHandler: any): void; | ||
static downloadDataSourceFile(resourceId: any, path: string, name: string, catchHandler: any): void; | ||
static getDataSource(resourceId: any, path: any, thenHandler: any, catchHandler: any): void; | ||
static delete(resourceId: any, path: any, thenHandler: any, catchHandler: any): void; | ||
static Upload(resourceId: any, path: any, data: any, thenHandler: any, catchHandler: any): void; | ||
static Update(resourceId: any, path: any, data: any, thenHandler: any, catchHandler: any): void; | ||
} |
export declare class ResourceApi { | ||
static getResourceInformation(resourceId: string, thenHandler: any, catchHandler: any): void; | ||
static storeResource(parentId: string, body: any, thenHandler: any, catchHandler: any): void; | ||
static deleteResource(resourceId: string, thenHandler: any, catchHandler: any): void; | ||
static updateResource(resourceId: string, body: any, thenHandler: any, catchHandler: any): void; | ||
} |
export declare class ResourceTypeApi { | ||
static getResourceTypes(thenHandler: any, catchHandler: any): void; | ||
static getFields(resourceTypeId: any, thenHandler: any, catchHandler: any): void; | ||
} |
{ | ||
"name": "@coscine/api-connection", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "This library provides methods to connect to CoScInE Apis with JavaScript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
171023
47
1328