Files
discordeno/src/helpers/invites/get_invite.ts
T
TriForMine d3e5f537d3 tests: add invites tests (#855)
* tests: add invites tests

Co-authored-by: TriForMine <TriForMine@users.noreply.github.com>
2021-04-14 08:26:39 +01:00

15 lines
529 B
TypeScript

import { rest } from "../../rest/rest.ts";
import { DiscordInvite, 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(
"get",
endpoints.INVITE(inviteCode),
);
return snakeKeysToCamelCase<Invite>(result);
}