import { request } from '@/service/request';
/**
 * 分页获取
 * @param params
 * @returns
 */
export function fetchChannelList(data: any) {
  return request({
    url: '/smqjh-system/api/v1/access/page',
    method: 'get',
    params: data
  });
}

/**
 *
 * 删除
 * @returns
 */
export function fetchDelChannel(ids: string) {
  return request({
    url: `/smqjh-system/api/v1/access/${ids}`,
    method: 'delete'
  });
}

/**
 * 保存
 * @returns
 */
export function fetchAddChannel(data: any) {
  return request({
    url: '/smqjh-system/api/v1/access',
    method: 'post',
    data
  });
}

/**
 * 编辑
 * @returns
 */
export function fetchEditChannel(data: any) {
  return request({
    url: `/smqjh-system/api/v1/access/${data.id}`,
    method: 'put',
    data
  });
}

/**
 * 详情
 * @returns
 */
export function fetchChannelDetail(id: any) {
  return request({
    url: `/smqjh-system/api/v1/access/${id}`,
    method: 'get'
  });
}

/**
 * 查看秘钥
 * @returns
 */
export function fetchAppSecret(id: any) {
  return request({
    url: `/smqjh-system/api/v1/access/${id}/app-secret`,
    method: 'get'
  });
}

/**
 * 重置秘钥
 * @returns
 */
export function fetchResetAppSecret(id: any) {
  return request({
    url: `/smqjh-system/api/v1/access/${id}/app-secret/reset`,
    method: 'patch'
  });
}
