Files
kandev/apps/web/lib/api/domains/github-review-api.ts
T
2026-07-24 15:55:57 +01:00

37 lines
783 B
TypeScript

import { fetchJson } from "../client";
export async function submitPRReview(
owner: string,
repo: string,
number: number,
event: "APPROVE" | "COMMENT" | "REQUEST_CHANGES",
body?: string,
) {
return fetchJson<{ submitted: boolean }>(
`/api/v1/github/prs/${owner}/${repo}/${number}/reviews`,
{
init: {
method: "POST",
body: JSON.stringify({ event, body: body ?? "" }),
},
},
);
}
export async function requestPRReviewers(
owner: string,
repo: string,
number: number,
reviewers: string[],
) {
return fetchJson<{ requested: boolean }>(
`/api/v1/github/prs/${owner}/${repo}/${number}/requested-reviewers`,
{
init: {
method: "POST",
body: JSON.stringify({ reviewers }),
},
},
);
}