refactor: Extract github-related calls

This commit is contained in:
Ankio
2023-10-31 17:51:00 +08:00
parent e2753d2444
commit 0bb95b5a6f
18 changed files with 614 additions and 487 deletions
+43
View File
@@ -0,0 +1,43 @@
import {BaseRepository} from "./BaseRepository";
import {TagInfo} from "../pr-collector/tags";
import {PullRequestInfo} from "../pr-collector/pullRequests";
import {DiffInfo} from "../pr-collector/commits";
export class GiteaRepository extends BaseRepository{
get defaultUrl(): string {
return "https://gitea.com/api/v1";
}
constructor(token: string, url?: string) {
super(token, url);
this.url = url || this.defaultUrl
}
fillTagInformation(repositoryPath: string, owner: string, repo: string, tagInfo: TagInfo): Promise<TagInfo> {
return Promise.resolve(undefined);
}
getBetweenDates(owner: string, repo: string, fromDate: moment.Moment, toDate: moment.Moment, maxPullRequests: number): Promise<PullRequestInfo[]> {
return Promise.resolve([]);
}
getDiffRemote(owner: string, repo: string, base: string, head: string): Promise<DiffInfo> {
return Promise.resolve(undefined);
}
getForCommitHash(owner: string, repo: string, commit_sha: string, maxPullRequests: number): Promise<PullRequestInfo[]> {
return Promise.resolve([]);
}
getOpen(owner: string, repo: string, maxPullRequests: number): Promise<PullRequestInfo[]> {
return Promise.resolve([]);
}
getReviews(owner: string, repo: string, pr: PullRequestInfo): Promise<void> {
return Promise.resolve(undefined);
}
getTags(owner: string, repo: string, maxTagsToFetch: number): Promise<TagInfo[]> {
return Promise.resolve([]);
}
}