OXYGENHUB
◆ main oxygenhub-vscode / src / oxygenapi.ts
1.5 KiB · last changed Reach self-signed hubs with the remote's CA (0.7.0) 1 month ago source blame history raw
1
// The Oxygen extension's exported API, as its src/api.ts declares it.
2
// Kept as a copy of the interface so this extension compiles alone.
3
4
export interface RemoteProvider {
5
  readonly id: string;
6
  readonly label: string;
7
  matches(remoteUrl: string): boolean;
8
  urlFor(remoteUrl: string, target: RemoteTarget): string | undefined;
9
}
10
11
export type RemoteTarget =
12
  | { kind: "repository" }
13
  | { kind: "bookmark"; name: string }
14
  | { kind: "change"; hash: string }
15
  | { kind: "file"; reference: string; path: string; line?: number; endLine?: number }
16
  | { kind: "proposals" }
17
  | { kind: "issues" };
18
19
export interface RepositoryHandle {
20
  readonly root: string;
21
  readonly status: unknown;
22
  readonly bookmarks: { name: string; heads: string[]; current?: boolean }[];
23
  readonly currentBookmark: string | undefined;
24
  /** With the CA file each names for a self-signed hub (Oxygen extension 0.13+). */
25
  remotes(): Promise<{ name: string; url: string; ca?: string }[]>;
26
  json<T>(args: string[]): Promise<T>;
27
  refresh(): Promise<void>;
28
}
29
30
export interface OxygenAPI {
31
  readonly version: 1;
32
  readonly repositories: readonly RepositoryHandle[];
33
  readonly onDidChangeStatus: (listener: (repo: RepositoryHandle) => void) => { dispose(): void };
34
  readonly onDidChangeRepositories: (listener: () => void) => { dispose(): void };
35
  getRepository(fsPath: string): RepositoryHandle | undefined;
36
  registerRemoteProvider(provider: RemoteProvider): { dispose(): void };
37
  remoteProviders(): readonly RemoteProvider[];
38
}