function _M.getTenantAPIs()

in scripts/lua/management/lib/tenants.lua [158:180]


function _M.getTenantAPIs(dataStore, id, queryParams)
  local apis_obj = dataStore:getAllAPIs()
  local apiList
  if next(queryParams) ~= nil then
    apiList = filterTenantAPIs(id, apis_obj, queryParams);
  end
  if apiList == nil then
    apiList = {}
    for k, v in pairs(apis_obj) do
      if k%2 == 0 then
        local decoded = cjson.decode(v)
        if decoded.tenantId == id then
          apiList[#apiList+1] = decoded
        end
      end
    end
  end
  if (((queryParams['skip'] == nil or queryParams['skip'] == 'undefined') and (queryParams['limit'] == nil or queryParams['limit'] == 'undefined')) or table.getn(apiList) == 0) then
    return apiList
  else
    return applyPagingToAPIs(apiList, queryParams)
  end
end