The weeb for the next gen discord boat - Wamellow
wamellow.com
bot
discord
1import type { Endpoints } from "@octokit/types";
2
3export async function getRepository(fullname: string) {
4 const res = await request<Endpoints["GET /repos/{owner}/{repo}"]["response"]["data"]>("GET", `/repos/${fullname}`);
5 return res;
6}
7
8async function request<T>(method: "GET", path: string) {
9 const response = await fetch(`https://api.github.com${path}`, {
10 method,
11 headers: {
12 Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
13 Accept: "application/vnd.github.v3+json",
14 "Content-Type": "application/json"
15 }
16 });
17
18 return response.json() as Promise<T>;
19}