const kaskoFetch = require('../../kasko-fetch');

/**
 * @param {string} url
 * @param {Object.<string, *>} params
 * @param {string} item
 * @returns {Promise<Record<string, *>>}
 */
async function getItemManifest(url, params, item) {
  const data = await kaskoFetch(`${url}/items/${item}`, { method: 'get' }, params);

  if (!data) {
    throw new Error('No item data');
  }

  return data;
}

module.exports = getItemManifest;
