This commit is contained in:
ITOH
2021-04-24 19:38:24 +02:00
parent 0c02b94143
commit 0feb6822d0
5 changed files with 14 additions and 23 deletions
+2 -5
View File
@@ -1,14 +1,11 @@
import { rest } from "../../rest/rest.ts";
import { DiscordInvite, Invite } from "../../types/invites/invite.ts";
import { Invite } from "../../types/invites/invite.ts";
import { endpoints } from "../../util/constants.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
/** Returns an invite for the given code or throws an error if the invite doesn't exists. */
export async function getInvite(inviteCode: string) {
const result: DiscordInvite = await rest.runMethod(
return await rest.runMethod<Invite>(
"get",
endpoints.INVITE(inviteCode),
);
return snakeKeysToCamelCase<Invite>(result);
}