market-api-gateway-js
JavaScript SDK for Envato marketplace api-gateway
Installation
npm install @envato-marketplace-foundation/market-api-gateway-js
Documentation
For detail documentation, check https://build.envato.com/api
API Overview
Create a new apiGateway instance:
const ApiGateway = require('@envato-marketplace-foundation/market-api-gateway-js')
const apiGateway = new ApiGateway('ACCESS_TOKEN')
// or
const apiGateway = new ApiGateway({
accessToken: 'ACCESS_TOKEN',
baseURL: 'new api endpint', // optional
timeout: 3000 // optional
})
optional options:
-
baseURL
String api base url, default to https://api.envato.com -
timeout
Integer request timeout, default to 2000
Each resource is under it's own category as documented on https://build.envato.com/api/ and it return a Promise
:
apiGateway.stats.getTotalUsers()
.then(function (res) {
console.log('res', res)
})
.catch(function (err) {
console.log('err', err)
})
Available resources & methods
- user
- stats
- catalog
- recommender
getRecommendedItems(itemId)
getRecommendedSearches(term, site)
Development
$ npm install
$ npm test
Publish to npm.
npm publish --access=public
If you want to publish module to npm, check the documentation at Working with scoped packages for more detail.
License
MIT