78 lines
1.7 KiB
TypeScript
78 lines
1.7 KiB
TypeScript
export interface CopycatConfig {
|
|
vendorConfigs: CopycatProfile[];
|
|
}
|
|
|
|
export interface CopycatProfile {
|
|
name: string;
|
|
vendor: Vendor;
|
|
/** authentication etc., always depends on vendor */
|
|
config: any;
|
|
}
|
|
|
|
/** indicates the used api */
|
|
export enum VENDOR_TYPE {
|
|
/** github, https://en.wikipedia.org/wiki/GitHub, both github.com (default) and github enterprise server */
|
|
GITHUB = 'github',
|
|
/** gitlab, https://en.wikipedia.org/wiki/GitLab */
|
|
GITLAB = 'gitlab',
|
|
/** gitea, https://en.wikipedia.org/wiki/Gitea */
|
|
GITEA = 'gitea',
|
|
}
|
|
|
|
export interface Vendor {
|
|
/** human-readable name like 'GitLab' */
|
|
display: string;
|
|
/** indicates the used api */
|
|
type: VENDOR_TYPE;
|
|
/** the host, like 'framagit.org' */
|
|
domain: string;
|
|
}
|
|
|
|
export interface VendorManager<T = any> {
|
|
vendor: Vendor;
|
|
config: T;
|
|
initialize: () => Promise<VendorManager<T>>;
|
|
getRepo: (path: string) => Promise<RepoManager>;
|
|
}
|
|
|
|
export interface Repo {
|
|
vendor: Vendor;
|
|
owner: Actor;
|
|
name: string;
|
|
}
|
|
|
|
export interface RepoManager {
|
|
repo: Repo;
|
|
initialize: () => Promise<RepoManager>;
|
|
getIssue: (id: string) => Promise<Issue>;
|
|
}
|
|
|
|
export interface Issue {
|
|
id: string;
|
|
title: string;
|
|
content: string;
|
|
repo: Repo;
|
|
}
|
|
|
|
/** the account that did an action */
|
|
export enum ACTOR_TYPE {
|
|
/** human person, absolutely not a sentient lizard */
|
|
USER = 'user',
|
|
/** organization */
|
|
ORG = 'org',
|
|
/** bot */
|
|
BOT = 'bot',
|
|
/** deleted account, imported actions or anything */
|
|
GHOST = 'ghost',
|
|
/** unknown (before initializing sth) */
|
|
UNKNOWN = 'unknown',
|
|
}
|
|
|
|
/** repository owner, issue/MR/comment/... creator */
|
|
export interface Actor {
|
|
type: ACTOR_TYPE;
|
|
username: string;
|
|
display_name?: string | null;
|
|
vendor: Vendor;
|
|
}
|