import { service } from "./request";

export function discordAuthUrl(params) {
    return service({
        url: `/openapi/discord/authorize`,
        method: "post",
        data: params,
    });
}

/**
 * 请求 discord Api 获取邀请服务器信息
 * @param {} params 
 * @returns 
 */
export function getInviteGuildInfo(params) {
    return service({
        url: `https://discord.com/api/v9/invites/${params.inviteCode}?with_counts=true&with_expiration=true`,
        method: "get",
    });
}

export function getInviteGuildInfoByOpenApi(params) {
    return service({
        url: `https://discord.com/api/invites/${params.inviteCode}?with_counts=true&with_expiration=true`,
        method: "get",
    });
}


export function checkGuildJoined(params) {
    return service({
        url: `/openapi/discord/checkGuildJoined`,
        method: "post",
        data: params,
    });
}

export function saveInviteGuildInfo(params) {
    return service({
        url: `/openapi/discord/saveInviteGuildInfo`,
        method: "post",
        data: params,
    });
}