import { flatMap } from 'lodash';
export default (function (projectId, envId, appId) {
  return {
    autoQuery: true,
    transport: {
      read: {
        method: 'get',
        url: "/devops/v1/projects/".concat(projectId, "/env/app_services/list_label?env_id=").concat(envId, "&app_service_id=").concat(appId),
        transformResponse: function transformResponse(resp) {
          try {
            var data = JSON.parse(resp);

            if (data && data.failed) {
              return data;
            } else if (data.length > 0) {
              return flatMap(data[0], function (value, key) {
                return {
                  meaning: "".concat(key, ":").concat(value),
                  value: "".concat(value),
                  key: "".concat(key)
                };
              });
            } else {
              return data;
            }
          } catch (e) {
            return resp;
          }
        }
      }
    }
  };
});