export function getApi()

in dev-portal/src/services/api-catalog.js [90:113]


export function getApi (apiId, selectIt = false, stage, cacheBust = false) {
  return updateUsagePlansAndApisList(cacheBust)
    .then(() => {
      let thisApi

      const allApis = [].concat(store.apiList.apiGateway, store.apiList.generic)

      if (allApis.length) {
        if (apiId === 'ANY' || apiId === 'FIRST') {
          thisApi = allApis[0]
        } else {
          thisApi = allApis.find(api => (api.apiId === apiId && api.apiStage === stage))

          if (!thisApi) {
            thisApi = allApis.find(api => (api.id.toString() === apiId))
          }
        }
      }

      if (selectIt) store.api = thisApi

      return thisApi
    })
}