Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
node-madgex
Advanced tools
A node.js client for Madgex web services.
Madgex's web services are split between RESTful and SOAP APIs. This module currently supports only a subset of the APIs, but we would be delighted to receive pull requests for the methods that are missing.
The current set of supported web services is
var madgex = require('node-madgex')
var client = madgex.createClient('http://yoursite-webservice.madgexjbtest.com', { key: 'yourkey', secret: 'yoursecret' })
client.restApi.jobinfo({ jobid: 1257 }, function(err, data) {
console.log(data);
})
API methods usually accept a params hash and a completion callback with (err, data, result) signature;
As an alternative to the completion callback you can use promises as well. Api methods return with a promise that resolves after the completion callback (if one is present).
client.jobinfo({ jobid: 1257 })
.then(function(data) {
//handle data
})
.fail(function(err) {
//dome something with the error
});
Promised values are easy to compose:
client.jobinfo
.search({})
.then(function(jobs) { return client.jobinfo({jobid: jobs[0].id }) })
.then(function(jobdetails) { /*handle data*/ })
.fail(function(err) { /*dome something with the error */ });
The RESTful client API is dynamically built by code from the service description config file. Extend this to add new functions to the API. (/lib/rest-api-service-description.json)
Displays information about a job
a hash with the following fields
field | type,info |
---|---|
jobid | integer, required |
Searches in the job database
field | type,info |
---|---|
keywords | free text with boolean expressions allowed, optional |
dateFrom | ISO format date |
dateTo | ISO format date |
...and much more. refer to the Madgex REST documentation for full set of params.
Same as search but returns full dataset
Return search refiners for a search result. Params are same as in search()
Displays information about am employer
a hash with the following fields
field | type,info |
---|---|
id | integer, required |
Searches in the employer database
var madgex = require('node-madgex')
var client = madgex.createClient('http://yoursite-webservice.madgexjbtest.com', { key: 'yourkey', secret: 'yoursecret' })
client.soapApi.billingApi.getCategoryTerms({ categoryId: 105 }, function(err, data) {
console.log(data);
})
Each billingApi method takes an optional parameters object and typical callback. You can determine the available parameters names by inspecting the equivalent methods handlebars template (see ./lib/soap-templates/*.hbs). These are camel cased equivalents to the elements specified in the Madgex Billing API documentation. Working out which parameters are required and what their values should be requires a degree of experience.
Responses stripped of their SOAPiness and converted to camelCased json. Integers, floats and booleans are parsed, so instead of
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetCategoriesResponse xmlns="http://jobboard.webservice.madgex.co.uk">
<GetCategoriesResult>
<WSCategory>
<Mandatory>false</Mandatory>
<MultiSelect>true</MultiSelect>
<ID>105</ID>
<Name>Hours</Name>
</WSCategory>
</GetCategoriesResult>
</GetCategoriesResponse>
</soap:Body>
</soap:Envelope>
you'll receive
[
{
"mandatory": false,
"multiSelect": true,
"id": 105,
"name": "hours"
}
]
In the event of an HTTP error, the err object passed to your callback will be blessed with a 'statusCode' property. In the event ofa SOAP Fault, the err object will additionally be blessed with 'faultCode' and 'faultString' properties.
Adding more API methods is easy
FAQs
node-madgex
The npm package node-madgex receives a total of 0 weekly downloads. As such, node-madgex popularity was classified as not popular.
We found that node-madgex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.