forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
52 lines (38 loc) · 1.31 KB
/
index.d.ts
File metadata and controls
52 lines (38 loc) · 1.31 KB
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
import { Har, Request } from "har-format";
/*~ This declaration specifies that the class constructor function
*~ is the exported object from the file
*/
export = HTTPSnippet;
/*~ Write your module's methods and properties in this class */
declare class HTTPSnippet {
constructor(data: HTTPSnippet.Data);
convert(target: string, options?: HTTPSnippet.Options): string | false;
convert(target: string, client?: string, options?: HTTPSnippet.Options): string | false;
static addTarget(target: HTTPSnippet.Target): void;
static addTargetClient(target: string, client: HTTPSnippet.TargetClient): void;
static availableTargets: string[];
static extName(target: string): string;
}
declare namespace HTTPSnippet {
type Data = Har | Request;
type Options = object;
interface TargetClientInfo {
key: string;
title: string;
link?: string | undefined;
description?: string | undefined;
}
interface TargetClient {
(source: Request, options: Options): string;
info: TargetClientInfo;
}
interface TargetInfo<C extends string> {
key: string;
title: string;
extname: string;
default: C;
}
type Target<C extends string = string> = {
info: TargetInfo<C>;
} & Record<C, TargetClient>;
}