async function get (action, { getService } = {}) {
  const {
    type,
    service: serviceId = null,
    onlyMappedValues = false,
    endpoint
  } = action.payload

  const service = (typeof getService === 'function')
    ? getService(type, serviceId) : null
  if (!service) {
    return createUnknownServiceError(type, serviceId, 'GET')
  }

  const id = getIdFromPayload(action.payload)

  // Do individual gets for array of ids, if there is no collection scoped endpoint
  if (Array.isArray(id) && !hasCollectionEndpoint(service.endpoints)) {
    return getIndividualItems(id, action, getService)
  }

  const endpointDebug = (endpoint) ? `endpoint '${endpoint}'` : `endpoint matching type '${type}' and id '${id}'`
  debug('GET: Fetch from service %s at %s', service.id, endpointDebug)

  const { response } = await service.send(appendToAction(action, { id, onlyMappedValues }))

  return response
}
async function get (action, { getService } = {}) {
  const {
    type,
    service: serviceId = null,
    onlyMappedValues = false,
    endpoint
  } = action.payload

  const service = (typeof getService === 'function')
    ? getService(type, serviceId) : null
  if (!service) {
    return createUnknownServiceError(type, serviceId, 'GET')
  }

  const id = getIdFromPayload(action.payload)

  // Do individual gets for array of ids, if there is no collection scoped endpoint
  if (Array.isArray(id) && !hasCollectionEndpoint(service.endpoints)) {
    return getIndividualItems(id, action, getService)
  }

  const endpointDebug = (endpoint) ? `endpoint '${endpoint}'` : `endpoint matching type '${type}' and id '${id}'`
  debug('GET: Fetch from service %s at %s', service.id, endpointDebug)

  const { response } = await service.send(appendToAction(action, { id, onlyMappedValues }))

  return response
}
async function get ( action , { getService } = { } ) { const { type , service : serviceId = null , onlyMappedValues = false , endpoint } = action . payload const service = ( typeof getService === 'function' ) ? getService ( type , serviceId ) : null if ( ! service ) { return createUnknownServiceError ( type , serviceId , 'GET' ) } const id = getIdFromPayload ( action . payload ) // Do individual gets for array of ids, if there is no collection scoped endpoint if ( Array . isArray ( id ) && ! hasCollectionEndpoint ( service . endpoints ) ) { return getIndividualItems ( id , action , getService ) } const endpointDebug = ( endpoint ) ? ` ${ endpoint } ` : ` ${ type } ${ id } ` debug ( 'GET: Fetch from service %s at %s' , service . id , endpointDebug ) const { response } = await service . send ( appendToAction ( action , { id , onlyMappedValues } ) ) return response }
Get several items from a service, based on the given action object.
@param {Object} action - payload and ident from the action object
@param {Object} resources - Object with getService
@returns {array} Array of data from the service
Get several items from a service based on the given action object .