haravan-client
Version:
### Haravan API
79 lines (78 loc) • 2.9 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.countHaravanCustomCollections = exports.getHaravanCustomCollections = exports.getHaravanCustomCollection = exports.postHaravanCustomCollection = exports.deleteHaravanCustomCollection = exports.putHaravanCustomCollection = void 0;
const common_1 = require("./common");
function putHaravanCustomCollection(param) {
const { accessToken, customCollection, delay, id } = param;
const config = common_1.makeRequestConfig({
path: `/com/custom_collections/${id}.json`,
method: 'PUT',
accessToken,
data: { custom_collection: customCollection },
rootField: 'custom_collection',
delay
});
return common_1.sendRequest(config);
}
exports.putHaravanCustomCollection = putHaravanCustomCollection;
function deleteHaravanCustomCollection(param) {
const { accessToken, id, delay } = param;
const config = common_1.makeRequestConfig({
path: `/com/custom_collections/${id}.json`,
method: 'DELETE',
accessToken,
delay
});
return common_1.sendRequest(config);
}
exports.deleteHaravanCustomCollection = deleteHaravanCustomCollection;
function postHaravanCustomCollection(param) {
const { accessToken, customCollection, delay } = param;
const config = common_1.makeRequestConfig({
path: '/com/custom_collections.json',
method: 'POST',
accessToken,
data: { custom_collection: customCollection },
rootField: 'custom_collection',
delay
});
return common_1.sendRequest(config);
}
exports.postHaravanCustomCollection = postHaravanCustomCollection;
function getHaravanCustomCollection(param) {
const { accessToken, query, delay, id } = param;
const config = common_1.makeRequestConfig({
path: `/com/custom_collections/${id}.json`,
method: 'GET',
accessToken,
rootField: 'custom_collection',
delay,
query
});
return common_1.sendRequest(config);
}
exports.getHaravanCustomCollection = getHaravanCustomCollection;
function getHaravanCustomCollections(param) {
const { accessToken, query, delay } = param;
const config = common_1.makeRequestConfig({
path: '/com/custom_collections.json',
method: 'GET',
accessToken,
rootField: 'custom_collections',
delay,
query
});
return common_1.sendRequest(config);
}
exports.getHaravanCustomCollections = getHaravanCustomCollections;
function countHaravanCustomCollections(param) {
const { accessToken, delay } = param;
const config = common_1.makeRequestConfig({
path: '/com/custom_collections/count.json',
method: 'GET',
accessToken,
delay
});
return common_1.sendRequest(config);
}
exports.countHaravanCustomCollections = countHaravanCustomCollections;