Attempt to make this work

This commit is contained in:
Mark Wylde
2025-05-30 21:47:12 +01:00
parent c77bb0e4b3
commit c0d1a3fc4c
13 changed files with 468 additions and 878 deletions

View File

@@ -1,23 +1,11 @@
import { Octokit } from "@octokit/rest";
import { graphql } from "@octokit/graphql";
import { GITHUB_API_URL } from "./config";
import { GiteaApiClient, createGiteaClient } from "./gitea-client";
export type Octokits = {
rest: Octokit;
graphql: typeof graphql;
export type GitHubClient = {
api: GiteaApiClient;
};
export function createOctokit(token: string): Octokits {
export function createClient(token: string): GitHubClient {
return {
rest: new Octokit({
auth: token,
baseUrl: GITHUB_API_URL,
}),
graphql: graphql.defaults({
baseUrl: GITHUB_API_URL,
headers: {
authorization: `token ${token}`,
},
}),
api: createGiteaClient(token),
};
}