1.4.2 • Published 8 years ago
nexusapi v1.4.2
Nexus API
This is a module that sends http requests to Nexus and returns an object with an array of artifacts for a give repository.
Installation
npm
Install the module via npm specifying a version.
$ npm install nexusapi --save
package.json
The npm command above will update the application's package.json file with a dependency.
...
"dependencies": {
"nexusapi": "~1.4.1"
},
...
nexusapi.getContent
The object is a function that is expecting config parameters to be passed.
// Modules
var nexusapi = require('nexusapi')(
{
url : 'https://mynexusserver.com/repomgr/service/local/repositories',
repo : 'SomeRepo'
});
// Get Content
module.exports = function ()
{
// Get top level nexusapi.getContent()
// Get group level nexusapi.getContent('SomeGroup')
// Get group/artifact level nexusapi.getContent('SomeGroup', 'SomeArtifact')
return nexusapi.getContent().then(function (data)
{
return data;
}).catch(function (err)
{
throw err;
});
};
return value
The module will return an array of artifacts.
[
{
"resourceURI": "https://mynexusserver.com/repomgr/service/local/repositories/SomeRepo/content/SomeGroup/",
"relativePath": "/SomeGroup/",
"text": "SomeGroup",
"leaf": false,
"lastModified": "2016-05-03 01:33:18.0 UTC",
"sizeOnDisk": -1
}
]
nexusapi.getVersions
The object is a function that is expecting config parameters to be passed.
// Modules
var nexusapi = require('nexusapi')(
{
url : 'https://mynexusserver.com/repomgr/service/local/repositories',
repo : 'SomeRepo'
});
// Get Versions
module.exports = function ()
{
// Get group/artifact level nexusapi.getVersions('SomeGroup', 'SomeArtifact')
return nexusapi.getVersions().then(function (data)
{
return data;
}).catch(function (err)
{
throw err;
});
};
return value
The module will return an array of versions.
[
'1.0.0',
'1.1.0',
'2.0.0'
]
nexusapi.getLatestVersion
The object is a function that is expecting config parameters to be passed.
// Modules
var nexusapi = require('nexusapi')(
{
url : 'https://mynexusserver.com/repomgr/service/local/repositories',
repo : 'SomeRepo'
});
// Get Latest Version
module.exports = function ()
{
// Get group/artifact level nexusapi.getLatestVersion('SomeGroup', 'SomeArtifact')
return nexusapi.getLatestVersion().then(function (val)
{
return val;
}).catch(function (err)
{
throw err;
});
};
return value
The module will return a single version.
'2.0.0'