all files / src/network/remote/ resource.js

36.36% Statements 4/11
0% Branches 0/4
25% Functions 1/4
36.36% Lines 4/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                                                                   
'use strict';
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
 
exports.default = function (_ref) {
  var client = _ref.client,
      filterQuery = _ref.filterQuery,
      mustContain = _ref.mustContain,
      busy = _ref.busy,
      encodeQueryAsString = _ref.encodeQueryAsString;
 
  return {
    downloadResources: function downloadResources(resourceList) {
      var withMetadata = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
 
      var params = {
        resourceList: JSON.toString(resourceList),
        withMetadata: withMetadata
      };
 
      return busy(client._.get('/resource/download', { params: params }));
    },
    searchResources: function searchResources(query, types) {
      var params = {
        q: JSON.toString(query),
        types: JSON.toString(types)
      };
      return busy(client._.get('/resource/search', { params: params }));
    },
    deleteResources: function deleteResources(resourceList) {
      var params = { resources: JSON.toString(resourceList) };
      return busy(client._.delete('/resource', { params: params }));
    }
  };
};