npm install comfortable-javascript
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/comfortable-javascript@latest/dist/comfortable.min.js"></script>
Note: For a specific version replace @latest
with the version of your choice.
const Comfortable = require('comfortable-javascript');
const api = Comfortable.api('<repository-api-id>', '<api-key>', options);
api.getDocuments()
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})
const api = Comfortable.api('<repository-api-id>', '<api-key>', options);
api.getDocuments({
limit: 25,
offset: 0,
locale: 'en',
includes: 2,
includeTags: ['include', 'me'],
excludeTags: ['exclude', 'this'],
fields: 'meta,fields(title)',
embedAssets: true,
filters: new Comfortable.Filter()
.addAnd('title', 'like', '%Hello%')
.addOr('title', 'like', '%World%'),
sorting: new Comfortable.Sorting()
.add('date', 'asc')
.add('title', 'asc'),
search: 'sport -football +soccer'
})
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})