-
Notifications
You must be signed in to change notification settings - Fork 16
/
dist.d.ts
240 lines (182 loc) · 8.63 KB
/
dist.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
type ajaxCallbackType = (status: number, body: string | nl.sara.webdav.Multistatus, headers: string | string[]) => void;
interface NlType {
sara: {
webdav: {
Ace: nl.sara.webdav.Ace;
Acl: nl.sara.webdav.Acl;
Client: nl.sara.webdav.Client;
},
};
}
// export as namespace nl;
export = nl;
declare const nl: NlType;
// tslint:disable:no-namespace
// tslint:disable:no-internal-module
declare namespace nl {
export namespace sara {
export namespace webdav {
interface Ace {
test(a: string): boolean;
}
interface Acl { // http://sara-nl.github.io/js-webdav-client/symbols/nl.sara.webdav.Acl.html
test(a: string): boolean;
}
interface Client { // http://sara-nl.github.io/js-webdav-client/symbols/nl.sara.webdav.Client.html
new(config: any, useHTTPS?: boolean, port?: number, defaultHeaders?: any);
// Perform a WebDAV ACL request
acl(path: string, callback: ajaxCallbackType, acl: nl.sara.webdav.Acl, headers: string[])
: nl.sara.webdav.Client;
// AJAX request handler.
ajaxHandler(ajax: XMLHttpRequest, callback: ajaxCallbackType): void; // todo static!!!
// Perform a WebDAV COPY request
copy(
path: string,
callback: ajaxCallbackType,
destination: string,
overwriteMode?: number,
depth?: string,
headers?: string[],
): nl.sara.webdav.Client;
// Perform a WebDAV GET request
get(path: string, callback: ajaxCallbackType, headers?: string[])
: nl.sara.webdav.Client;
// Prepares a XMLHttpRequest object to be used for an AJAX request
getAjax(method: string, url: string, callback: ajaxCallbackType, headers: string[]): XMLHttpRequest;
// Converts a path to the full url (i.e. appends the protocol and host part)
getUrl(path: string): string;
// Perform a WebDAV HEAD request
head(path: string, callback: ajaxCallbackType, headers?: string[]): nl.sara.webdav.Client;
// Perform a WebDAV LOCK request
lock(path: string, callback: ajaxCallbackType, body?: Document, headers?: string[])
: nl.sara.webdav.Client;
// Perform a WebDAV MKCOL request
mkcol(path: string, callback: ajaxCallbackType, body?: string, contenttype?: string, headers?: string[])
: nl.sara.webdav.Client;
// Perform a WebDAV MOVE request
move(
path: string,
callback: ajaxCallbackType,
destination: string,
overwriteMode?: number,
headers?: string[],
): void;
// Perform a WebDAV POST request
post(path: string, callback: ajaxCallbackType, body?: string, contenttype?: string, headers?: string[])
: nl.sara.webdav.Client;
// Perform a WebDAV PROPFIND request
propfind(
path: string,
callback: ajaxCallbackType,
depth?: number,
props?: any,
include?: nl.sara.webdav.Property[],
headers?: string[],
): nl.sara.webdav.Client;
// Perform a WebDAV PROPPATCH request
proppatch(
path: string,
callback: ajaxCallbackType,
setProps?: nl.sara.webdav.Property[],
delProps?: nl.sara.webdav.Property[],
headers?: string[],
): nl.sara.webdav.Client;
// Perform a WebDAV PUT request
put(path: string, callback: ajaxCallbackType, body: string, contenttype?: string, headers?: string[])
: nl.sara.webdav.Client;
// Perform a WebDAV DELETE request Because 'delete' is an operator in JavaScript, I had to name this
// method 'remove'.
remove(path: string, callback: ajaxCallbackType, headers?: string[]): nl.sara.webdav.Client;
// Perform a WebDAV REPORT request
report(path: string, callback: ajaxCallbackType, body: Document, headers?: string[])
: nl.sara.webdav.Client;
// Perform a WebDAV UNLOCK request
unlock(path: string, callback: ajaxCallbackType, lockToken: string, headers?: string[])
: nl.sara.webdav.Client;
}
interface Codec {
// Functions which should return a representation of xmlvalue
fromXML: (nodeList: NodeList) => any; // todo type
// The namespace of the property to transcode
namespace: string;
// The tag name of the property to transcode
tagname: string;
// Function which should return a Document with the NodeList of the documentElement as the value of
// this property
toXML: (doc: any) => XMLDocument;
}
interface Multistatus {
// The response description
responsedescription: string;
// constructor
new(xmlNode?: XMLDocument);
// Adds a Response
addResponse(response: nl.sara.webdav.Response): nl.sara.webdav.Multistatus;
// Gets a Response
getResponse(name: string): nl.sara.webdav.Response;
// Gets the response names
getResponseNames(): string[];
}
interface Property {
// The namespace
namespace: string;
// The response description
responsedescription: string;
// The (HTTP) status code
status: number;
// The tag name
tagname: string;
// A NodeList with the value of this property
xmlvalue: NodeList;
// constructor
new(xmlNode?: Node, status?: number, responsedescription?: string, errors?: string[]);
// Adds functions to encode or decode properties This allows exact control in how Property.xmlvalue is
// parsed when getParsedValue() is called or how it is rebuild when setValueAndRebuildXml() is called.
addCodec(codec: nl.sara.webdav.Codec): void; // static
// Adds an error to this property
addError(error: Node): nl.sara.webdav.Property;
// Returns all errors
getErrors(): Node[];
// Parses the xmlvalue If a codec for this property is specified, it will use this codec to parse the
// XML nodes.
getParsedValue(): any;
// Sets a new value and rebuilds xmlvalue If a codec for this property is specified, it will use this
// codec to rebuild xmlvallue.
setValueAndRebuildXml(value: any): void;
// Overloads the default toString() method so it returns the value of this property
toString(): string;
}
interface Response {
// The error text
error: string;
// The path of the resource
href: string;
// In case of a 3XX response, the value that would normally be in the 'Location' header
location: string;
// The response description
responsedescription: string;
// The (HTTP) status code
status: string;
// constructor
new(xmlNode?: XMLDocument);
// Adds a WebDAV property
addProperty(property: nl.sara.webdav.Property): nl.sara.webdav.Response;
// Gets the namespace names
getNamespaceNames(): string[];
// Gets a WebDAV property
getProperty(namespace: string, prop: string): nl.sara.webdav.Property;
// Gets the property names of a namespace
getPropertyNames(namespace: string): string[];
}
}
}
}
/**
* Working module package, but not compiling
*/
/*
declare module "nl" {
let nL = nl;
export = nL;
}
*/