import request from '@/utils/request'

// 分页查询外部接口配置
export function pageExternalApi(query) {
  return request({
    url: '/companyWorkflow/externalApi/page',
    method: 'get',
    params: query
  })
}

// 详情
export function getExternalApi(id) {
  return request({
    url: '/companyWorkflow/externalApi/' + id,
    method: 'get'
  })
}

// 新增/编辑
export function saveOrUpdateExternalApi(data) {
  return request({
    url: '/companyWorkflow/externalApi/saveOrUpdate',
    method: 'post',
    data
  })
}

// 启停
export function changeExternalApiStatus(id, status) {
  return request({
    url: '/companyWorkflow/externalApi/' + id + '/status',
    method: 'post',
    params: { status }
  })
}

// 删除
export function deleteExternalApi(id) {
  return request({
    url: '/companyWorkflow/externalApi/' + id,
    method: 'delete'
  })
}

// 测试接口
export function testExternalApi(id, data) {
  return request({
    url: '/companyWorkflow/externalApi/' + id + '/test',
    method: 'post',
    data
  })
}

// 调用日志分页
export function pageExternalApiLogs(query) {
  return request({
    url: '/companyWorkflow/externalApi/logs/page',
    method: 'get',
    params: query
  })
}

