-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathextensionApi.ts
57 lines (51 loc) · 2.2 KB
/
extensionApi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import * as httpyac from 'httpyac';
import * as vscode from 'vscode';
export interface ResponseItem {
readonly id: string;
readonly created: Date;
readonly name: string;
readonly openWith?: string;
readonly extension: string;
readonly testResults?: Array<httpyac.TestResult>;
readonly metaData: Record<string, unknown>;
readonly response: httpyac.HttpResponse;
responseUri?: vscode.Uri;
documentUri?: vscode.Uri;
isCachedResponse: boolean;
loadResponseBody?(): Promise<void>;
}
export type ResponseHandler = (responseItem: ResponseItem) => Promise<boolean>;
export interface ResponseOutputProcessor {
show: httpyac.RequestLogger;
}
export interface DocumentStore {
readonly httpFileStore: httpyac.store.HttpFileStore;
activeEnvironment: Array<string> | undefined;
getActiveEnvironment(httpFile: httpyac.HttpFile): Array<string> | undefined;
setActiveEnvironment(httpFile: httpyac.HttpFile, env: Array<string> | undefined): void;
getDocumentPathLike: (document: vscode.TextDocument) => httpyac.PathLike;
getHttpFile(document: vscode.TextDocument): Promise<httpyac.HttpFile | undefined>;
getAll(): Array<httpyac.HttpFile>;
getOrCreate(path: httpyac.PathLike, getText: () => Promise<string>, version: number): Promise<httpyac.HttpFile>;
parse(uri: vscode.Uri | undefined, text: string): Promise<httpyac.HttpFile>;
remove(document: vscode.TextDocument): void;
send: (context: httpyac.HttpFileSendContext | httpyac.HttpRegionsSendContext) => Promise<boolean>;
clear(): void;
}
export interface ResponseStore {
readonly hasItems: boolean;
readonly historyChanged: vscode.Event<void>;
add(response: httpyac.HttpResponse, httpRegion?: httpyac.HttpRegion, show?: boolean): Promise<void>;
remove(responseItem: ResponseItem): Promise<boolean>;
clear(): Promise<void>;
}
export interface HttpYacExtensionApi {
httpyac: typeof httpyac;
documentStore: DocumentStore;
responseStore: ResponseStore;
httpDocumentSelector: vscode.DocumentSelector;
allHttpDocumentSelector: vscode.DocumentSelector;
environmentChanged: vscode.Event<string[] | undefined>;
getEnvironmentConfig(path: httpyac.PathLike): Promise<httpyac.EnvironmentConfig>;
getErrorQuickFix: (err: Error) => string | undefined;
}