
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
The semi official nodejs module (employee maintained)
##Introduction
This library provides a Nodejs interface to publicly available (beta) API for TradeGecko.
If you are unfamiliar with the TradeGecko API, you can read the documentation located at http://developer.tradegecko.com
##Installation
npm i billybonks\pygmy -save
##Basic Usage
var pygmy = require('pygmy')({token:yourToken,cleintId:clientId,secret:secret})
pygmy.products.all().then(function(products){
console.log(products)
},function(error){
console.log(error)
})
##Finding Records
pygmy.products.all()
pygmy.products.find(id)
pygmy.products.findMany(id_array)
pygmy.products.where(query_hash)
query hash will be converted into url encoded query string
##Identity Map
in development
##Building Records
###Create
pygmy.products.build(attribute_hash)
Each key should map to an attribute defined in api documentation, invalid keys will result in an error from the server
pygmy.companies.build({name:'Awesome',comapny_type:'business'}).save().then(function(result){
console.log(result)
},function(error){
console.log(error)
});
###Update
pygmy.products.find(id).then(function(product){
product.set('name','COOL NAME')
product.save().then(function(product){
console.log('awesome saved')
})
})
###Delete
pygmy.products.find(id).then(function(product){
product.set('name','COOL NAME')
product.delete().then(function(product){
console.log('awesome deleted')
})
})
##Errors Errors always return in the format
{message:message,statusCode:statusCode}
nothing says it more then showing you the code that generates returns from http requests
switch(res.statusCode){
case 200:
res.on('end',function(){
resolve(JSON.parse(data));
})
break;
case 201:
res.on('end',function(){
resolve(JSON.parse(data));
})
break;
case 204:
resolve({message:'Success',statusCode:res.statusCode})
break;
case 400:
reject({message:'Bad Request',statusCode:res.statusCode});
break;
case 401:
reject({message:'Unauthorized',statusCode:res.statusCode});
break;
case 403:
reject({message:'Forbidden',statusCode:res.statusCode});
break;
case 404:
reject({message:'Not Found',statusCode:res.statusCode});
case 414:
reject({message:'Request-URI Too Long',statusCode:res.statusCode});
case 422:
res.on('end',function(){
reject(_.merge({statusCode:res.statusCode},JSON.parse(data)))
})
break;
case 500:
reject({message:'Internal Server Error',statusCode:res.statusCode});
break;
case 503:
reject({message:'Service Unavailable',statusCode:res.statusCode});
break
}
##TODO
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)###Missing route?
Just add pygmy['addresses'] = routes.build(pygmy,'addresses');
where addresses is the endpoint name shown in api (they are always plural), to pygmy.js.
FAQs
Wrapper library for tradegecko api
The npm package pygmy receives a total of 0 weekly downloads. As such, pygmy popularity was classified as not popular.
We found that pygmy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.