{"size": 2290, "ext": "js", "max_stars_repo_path": "src/services/apiGatewayService.js", "max_stars_repo_name": "fzodc/api-stuido", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/services/apiGatewayService.js", "max_issues_repo_name": "fzodc/api-stuido", "max_issues_repo_issues_event_min_datetime": "2019-04-09T08:01:50.000Z", "max_issues_repo_issues_event_max_datetime": "2019-04-09T08:29:39.000Z", "max_forks_repo_path": "src/services/apiGatewayService.js", "max_forks_repo_name": "fzodc/ant-design-pro", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": null, "avg_line_length": 22.9, "max_line_length": 98, "alphanum_fraction": 0.6253275109}
// import { stringify } from 'qs';
import request from '@/utils/request';
import constants from '@/utils/constUtil';

const { PREFIX_PATH } = constants;

export async function apiList(params) {
  console.log('params in queryApi:', params,`${PREFIX_PATH}/baseInfo/apiService/apiList`);
  return request(`${PREFIX_PATH}/baseInfo/apiService/apiList`, {
    method: 'POST',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function callList(params) {
  console.log('params in queryApi:', params,`${PREFIX_PATH}/baseInfo/apiService/callApis`);
  return request(`${PREFIX_PATH}/baseInfo/apiService/callApis`, {
    method: 'POST',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function apiListBySearch(params) {
  console.log('params in queryApi:', params,`${PREFIX_PATH}/baseInfo/apiService/apiListBySearch`);
  return request(`${PREFIX_PATH}/baseInfo/apiService/apiListBySearch`, {
    method: 'POST',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function apiStatusBatch(params) {
  // console.log('params:', params);
  return request(`${PREFIX_PATH}/baseInfo/apiService/apiBatch`, {
    method: 'POST',
    data: {
      ...params,
      method: 'delete',
    },
  });
}

export async function addApi(params) {
  return request('/conf/apiGateway', {
    method: 'POST',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function updateApi(params) {
  return request('/conf/apiGateway', {
    method: 'POST',
    data: {
      ...params,
      method: 'update',
    },
  });
}

export async function apiInfo(params) {
  console.log('params in queryApi:', params);
  return request(`${PREFIX_PATH}/baseInfo/apiService/apiInfo`, {
    method: 'POST',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function saveApi(params) {
  return request(`${PREFIX_PATH}/baseInfo/apiService/saveApi`, {
    method: 'POST',
    data: params,
  });
}

// --------enumMock.js--------------
export async function getMasterData(params) {
  return request(`${PREFIX_PATH}enum/${params.key}`);
}

export async function removeApis(params){
  return request(`${PREFIX_PATH}/baseInfo/apiService/removeApis`, {
    method: 'POST',
    data: params,
  });
}
