2.1.1 • Published 2 years ago
ssapi-wrapper v2.1.1
SSAPI Wrapper
Just a SearchSpring API Wrapper for JavaScript client-side or NodeJS applications...
Install
pnpm
pnpm add ssapi-wrapper
npm
npm i ssapi-wrapper
Usage
Search
import * as SSAPI from 'ssapi-wrapper'
// define new client
const api = new SSAPI.Client( 'siteId', { resultsPerPage: 10 } );
// define callback for the "search" event
api.on('search', ({ detail: response }) => {
console.log(response);
});
// execute functions and trigger search
const singleRequest = api
.backgroundFilter( 'category', 'clothing' ) // methods can be chained in sequence to modify the state
.query( 'shirts' )
.sort( 'price', 'asc' )
.filter( 'size', 'Small' )
.filter( 'color', 'Red' )
.page( 2 )
.search(); // the request will only be sent once the `search` method is called
// alternatively handle the promise generated from the `search` method
const response = await singleRequest;
Autocomplete
import * as SSAPI from 'ssapi-wrapper'
// define new client
const api = new SSAPI.Client( 'siteId', {}, { limit: 4 } );
// define callback for the "autocomplete" event
api.on('autocomplete', ({ detail: response }) => {
console.log(response);
});
// execute functions and trigger autocomplete
const singleRequest = api
.query( 'shirts' )
.autocomplete(); // the request will only be sent once the `autocomplete` method is called
// alternatively handle the promise generated from the `autocomplete` method
const response = await singleRequest;
2.1.1
2 years ago
2.1.0
2 years ago
2.0.0
2 years ago
1.3.0
3 years ago
1.2.0
3 years ago
1.1.0
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.6.0
4 years ago
0.5.0
5 years ago
0.4.0
5 years ago
0.3.1
5 years ago
0.3.0
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago