forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
traverson.d.ts
60 lines (46 loc) · 1.71 KB
/
traverson.d.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
58
59
60
// Type definitions for Traverson v2.0.1
// Project: https://github.com/basti1302/traverson
// Definitions by: Marcin Porębski <https://github.com/marcinporebski/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Traverson
{
interface TraversonMethods
{
from(uri: string): Builder;
registerMediaType(name: string, handler: any): TraversonMethods;
}
interface Builder
{
withRequestOptions(options: any): Builder;
withTemplateParameters(parameters: any): Builder;
json(): Builder;
jsonHal(): Builder;
setMediaType(type_name: string): Builder;
follow(first_pattern: string, ... rest_patterns: string[]): Builder;
get(callback: (err: any, document: any, traversal?: Traversal) => void): InAction;
getResource(callback: (err: any, document: any, traversal?: Traversal) => void): InAction;
getUrl(callback: (err: any, document: any, traversal?: Traversal) => void): InAction;
post(data: any, callback: (err: any, document: any, traversal?: Traversal) => void): InAction;
put(data: any, callback: (err: any, document: any, traversal?: Traversal) => void): InAction;
patch(data: any, callback: (err: any, document: any, traversal?: Traversal) => void): InAction;
delete(callback: (err: any, document: any, traversal?: Traversal) => void): InAction;
newRequest(): Builder;
}
interface Json
{
parseJson(): any;
}
interface Traversal
{
continue(): Builder;
}
interface InAction
{
abort(): void;
}
}
declare module "traverson"
{
var traverson: Traverson.TraversonMethods;
export = traverson;
}