I am currently working on a project using Angular 2/Ionic2 that relies on a custom client api provided by Amazon AWS.
The api is composed of a main javascript file and other dependent scripts.
Traditionally, I would include these scripts in the HTML file using script tags, but due to TypeScript, I need a different approach.
In the primary javascript file, there is an object defined as follows:
var apigClientFactory = {};
apigClientFactory.newClient = function (config) {
var apigClient = { };
if(config === undefined) {
config = {
accessKey: '',
secretKey: '',
sessionToken: '',
region: '',
apiKey: undefined,
defaultContentType: 'application/json',
defaultAcceptType: 'application/json'
};
}
...
To make API calls in a service, I must follow this pattern:
var apigClient = apigClientFactory.newClient();
var params = {
limit: 5
};
var body = {
}
var additionalParams = {
}
var headers = {
}
var queryParams = {
}
apigClient.cadastroOptions (params, body, additionalParams).then(function(result){
var json = JSON.parse(result.data);
console.log('Result', json);
}).catch('Success', function(json){
console.log('Failure: ', json)
});
This is not a node module; it has been downloaded as a zip file.
How can I properly import this into my application?