import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
import { OceanEngine } from "@/api/interface/index";

/**
 * @name 公共模块
 */
// 是否认证
export const isAuthApi = () => {
  return http.get<any>(PORT1 + `/ocean/engine/common/is/auth`, {}, { loading: false });
};

// 获取巨量引擎 access token
export const getAccessTokenApi = (params: OceanEngine.ReqAccessToken) => {
  return http.post<OceanEngine.ResAccessToken>(PORT1 + `/ocean/engine/common/access/token`, params);
};

// 获取巨量引擎授权 url
export const getOauthUrlApi = () => {
  return http.get<OceanEngine.ResOauthUrl>(PORT1 + `/ocean/engine/common/oauth/url`);
};

// 刷新巨量引擎 access token
export const refreshAccessToken = () => {
  return http.post<OceanEngine.ResAccessToken>(PORT1 + `/ocean/engine/common/refresh/token`);
};
