1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13 | return new (P || (P = Promise))(function (resolve, reject) {
|
14 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18 | });
|
19 | };
|
20 | Object.defineProperty(exports, "__esModule", { value: true });
|
21 | exports.WikiApi = void 0;
|
22 | const basem = require("./ClientApiBases");
|
23 | const Comments_Contracts = require("./interfaces/CommentsInterfaces");
|
24 | const WikiInterfaces = require("./interfaces/WikiInterfaces");
|
25 | class WikiApi extends basem.ClientApiBase {
|
26 | constructor(baseUrl, handlers, options) {
|
27 | super(baseUrl, handlers, 'node-Wiki-api', options);
|
28 | }
|
29 | |
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | createCommentAttachment(customHeaders, contentStream, project, wikiIdentifier, pageId) {
|
38 | return __awaiter(this, void 0, void 0, function* () {
|
39 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
40 | let routeValues = {
|
41 | project: project,
|
42 | wikiIdentifier: wikiIdentifier,
|
43 | pageId: pageId
|
44 | };
|
45 | customHeaders = customHeaders || {};
|
46 | customHeaders["Content-Type"] = "application/octet-stream";
|
47 | try {
|
48 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "5100d976-363d-42e7-a19d-4171ecb44782", routeValues);
|
49 | let url = verData.requestUrl;
|
50 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
51 | options.additionalHeaders = customHeaders;
|
52 | let res;
|
53 | res = yield this.rest.uploadStream("POST", url, contentStream, options);
|
54 | let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentAttachment, false);
|
55 | resolve(ret);
|
56 | }
|
57 | catch (err) {
|
58 | reject(err);
|
59 | }
|
60 | }));
|
61 | });
|
62 | }
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 | getAttachmentContent(project, wikiIdentifier, pageId, attachmentId) {
|
72 | return __awaiter(this, void 0, void 0, function* () {
|
73 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
74 | let routeValues = {
|
75 | project: project,
|
76 | wikiIdentifier: wikiIdentifier,
|
77 | pageId: pageId,
|
78 | attachmentId: attachmentId
|
79 | };
|
80 | try {
|
81 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "5100d976-363d-42e7-a19d-4171ecb44782", routeValues);
|
82 | let url = verData.requestUrl;
|
83 | let apiVersion = verData.apiVersion;
|
84 | let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
|
85 | resolve((yield this.http.get(url, { "Accept": accept })).message);
|
86 | }
|
87 | catch (err) {
|
88 | reject(err);
|
89 | }
|
90 | }));
|
91 | });
|
92 | }
|
93 | |
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | addCommentReaction(project, wikiIdentifier, pageId, commentId, type) {
|
103 | return __awaiter(this, void 0, void 0, function* () {
|
104 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
105 | let routeValues = {
|
106 | project: project,
|
107 | wikiIdentifier: wikiIdentifier,
|
108 | pageId: pageId,
|
109 | commentId: commentId,
|
110 | type: type
|
111 | };
|
112 | try {
|
113 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "7a5bc693-aab7-4d48-8f34-36f373022063", routeValues);
|
114 | let url = verData.requestUrl;
|
115 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
116 | let res;
|
117 | res = yield this.rest.replace(url, null, options);
|
118 | let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentReaction, false);
|
119 | resolve(ret);
|
120 | }
|
121 | catch (err) {
|
122 | reject(err);
|
123 | }
|
124 | }));
|
125 | });
|
126 | }
|
127 | |
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | deleteCommentReaction(project, wikiIdentifier, pageId, commentId, type) {
|
137 | return __awaiter(this, void 0, void 0, function* () {
|
138 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
139 | let routeValues = {
|
140 | project: project,
|
141 | wikiIdentifier: wikiIdentifier,
|
142 | pageId: pageId,
|
143 | commentId: commentId,
|
144 | type: type
|
145 | };
|
146 | try {
|
147 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "7a5bc693-aab7-4d48-8f34-36f373022063", routeValues);
|
148 | let url = verData.requestUrl;
|
149 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
150 | let res;
|
151 | res = yield this.rest.del(url, options);
|
152 | let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentReaction, false);
|
153 | resolve(ret);
|
154 | }
|
155 | catch (err) {
|
156 | reject(err);
|
157 | }
|
158 | }));
|
159 | });
|
160 | }
|
161 | |
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | getEngagedUsers(project, wikiIdentifier, pageId, commentId, type, top, skip) {
|
173 | return __awaiter(this, void 0, void 0, function* () {
|
174 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
175 | let routeValues = {
|
176 | project: project,
|
177 | wikiIdentifier: wikiIdentifier,
|
178 | pageId: pageId,
|
179 | commentId: commentId,
|
180 | type: type
|
181 | };
|
182 | let queryValues = {
|
183 | '$top': top,
|
184 | '$skip': skip,
|
185 | };
|
186 | try {
|
187 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "598a5268-41a7-4162-b7dc-344131e4d1fa", routeValues, queryValues);
|
188 | let url = verData.requestUrl;
|
189 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
190 | let res;
|
191 | res = yield this.rest.get(url, options);
|
192 | let ret = this.formatResponse(res.result, null, true);
|
193 | resolve(ret);
|
194 | }
|
195 | catch (err) {
|
196 | reject(err);
|
197 | }
|
198 | }));
|
199 | });
|
200 | }
|
201 | |
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 | addComment(request, project, wikiIdentifier, pageId) {
|
210 | return __awaiter(this, void 0, void 0, function* () {
|
211 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
212 | let routeValues = {
|
213 | project: project,
|
214 | wikiIdentifier: wikiIdentifier,
|
215 | pageId: pageId
|
216 | };
|
217 | try {
|
218 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues);
|
219 | let url = verData.requestUrl;
|
220 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
221 | let res;
|
222 | res = yield this.rest.create(url, request, options);
|
223 | let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.Comment, false);
|
224 | resolve(ret);
|
225 | }
|
226 | catch (err) {
|
227 | reject(err);
|
228 | }
|
229 | }));
|
230 | });
|
231 | }
|
232 | |
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 | deleteComment(project, wikiIdentifier, pageId, id) {
|
241 | return __awaiter(this, void 0, void 0, function* () {
|
242 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
243 | let routeValues = {
|
244 | project: project,
|
245 | wikiIdentifier: wikiIdentifier,
|
246 | pageId: pageId,
|
247 | id: id
|
248 | };
|
249 | try {
|
250 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues);
|
251 | let url = verData.requestUrl;
|
252 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
253 | let res;
|
254 | res = yield this.rest.del(url, options);
|
255 | let ret = this.formatResponse(res.result, null, false);
|
256 | resolve(ret);
|
257 | }
|
258 | catch (err) {
|
259 | reject(err);
|
260 | }
|
261 | }));
|
262 | });
|
263 | }
|
264 | |
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 | getComment(project, wikiIdentifier, pageId, id, excludeDeleted, expand) {
|
275 | return __awaiter(this, void 0, void 0, function* () {
|
276 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
277 | let routeValues = {
|
278 | project: project,
|
279 | wikiIdentifier: wikiIdentifier,
|
280 | pageId: pageId,
|
281 | id: id
|
282 | };
|
283 | let queryValues = {
|
284 | excludeDeleted: excludeDeleted,
|
285 | '$expand': expand,
|
286 | };
|
287 | try {
|
288 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues, queryValues);
|
289 | let url = verData.requestUrl;
|
290 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
291 | let res;
|
292 | res = yield this.rest.get(url, options);
|
293 | let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.Comment, false);
|
294 | resolve(ret);
|
295 | }
|
296 | catch (err) {
|
297 | reject(err);
|
298 | }
|
299 | }));
|
300 | });
|
301 | }
|
302 | |
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 | listComments(project, wikiIdentifier, pageId, top, continuationToken, excludeDeleted, expand, order, parentId) {
|
316 | return __awaiter(this, void 0, void 0, function* () {
|
317 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
318 | let routeValues = {
|
319 | project: project,
|
320 | wikiIdentifier: wikiIdentifier,
|
321 | pageId: pageId
|
322 | };
|
323 | let queryValues = {
|
324 | '$top': top,
|
325 | continuationToken: continuationToken,
|
326 | excludeDeleted: excludeDeleted,
|
327 | '$expand': expand,
|
328 | order: order,
|
329 | parentId: parentId,
|
330 | };
|
331 | try {
|
332 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues, queryValues);
|
333 | let url = verData.requestUrl;
|
334 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
335 | let res;
|
336 | res = yield this.rest.get(url, options);
|
337 | let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentList, false);
|
338 | resolve(ret);
|
339 | }
|
340 | catch (err) {
|
341 | reject(err);
|
342 | }
|
343 | }));
|
344 | });
|
345 | }
|
346 | |
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | updateComment(comment, project, wikiIdentifier, pageId, id) {
|
356 | return __awaiter(this, void 0, void 0, function* () {
|
357 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
358 | let routeValues = {
|
359 | project: project,
|
360 | wikiIdentifier: wikiIdentifier,
|
361 | pageId: pageId,
|
362 | id: id
|
363 | };
|
364 | try {
|
365 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues);
|
366 | let url = verData.requestUrl;
|
367 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
368 | let res;
|
369 | res = yield this.rest.update(url, comment, options);
|
370 | let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.Comment, false);
|
371 | resolve(ret);
|
372 | }
|
373 | catch (err) {
|
374 | reject(err);
|
375 | }
|
376 | }));
|
377 | });
|
378 | }
|
379 | |
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 | getPageText(project, wikiIdentifier, path, recursionLevel, versionDescriptor, includeContent) {
|
390 | return __awaiter(this, void 0, void 0, function* () {
|
391 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
392 | let routeValues = {
|
393 | project: project,
|
394 | wikiIdentifier: wikiIdentifier
|
395 | };
|
396 | let queryValues = {
|
397 | path: path,
|
398 | recursionLevel: recursionLevel,
|
399 | versionDescriptor: versionDescriptor,
|
400 | includeContent: includeContent,
|
401 | };
|
402 | try {
|
403 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b", routeValues, queryValues);
|
404 | let url = verData.requestUrl;
|
405 | let apiVersion = verData.apiVersion;
|
406 | let accept = this.createAcceptHeader("text/plain", apiVersion);
|
407 | resolve((yield this.http.get(url, { "Accept": accept })).message);
|
408 | }
|
409 | catch (err) {
|
410 | reject(err);
|
411 | }
|
412 | }));
|
413 | });
|
414 | }
|
415 | |
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 | getPageZip(project, wikiIdentifier, path, recursionLevel, versionDescriptor, includeContent) {
|
426 | return __awaiter(this, void 0, void 0, function* () {
|
427 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
428 | let routeValues = {
|
429 | project: project,
|
430 | wikiIdentifier: wikiIdentifier
|
431 | };
|
432 | let queryValues = {
|
433 | path: path,
|
434 | recursionLevel: recursionLevel,
|
435 | versionDescriptor: versionDescriptor,
|
436 | includeContent: includeContent,
|
437 | };
|
438 | try {
|
439 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b", routeValues, queryValues);
|
440 | let url = verData.requestUrl;
|
441 | let apiVersion = verData.apiVersion;
|
442 | let accept = this.createAcceptHeader("application/zip", apiVersion);
|
443 | resolve((yield this.http.get(url, { "Accept": accept })).message);
|
444 | }
|
445 | catch (err) {
|
446 | reject(err);
|
447 | }
|
448 | }));
|
449 | });
|
450 | }
|
451 | |
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 | getPageByIdText(project, wikiIdentifier, id, recursionLevel, includeContent) {
|
461 | return __awaiter(this, void 0, void 0, function* () {
|
462 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
463 | let routeValues = {
|
464 | project: project,
|
465 | wikiIdentifier: wikiIdentifier,
|
466 | id: id
|
467 | };
|
468 | let queryValues = {
|
469 | recursionLevel: recursionLevel,
|
470 | includeContent: includeContent,
|
471 | };
|
472 | try {
|
473 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "ceddcf75-1068-452d-8b13-2d4d76e1f970", routeValues, queryValues);
|
474 | let url = verData.requestUrl;
|
475 | let apiVersion = verData.apiVersion;
|
476 | let accept = this.createAcceptHeader("text/plain", apiVersion);
|
477 | resolve((yield this.http.get(url, { "Accept": accept })).message);
|
478 | }
|
479 | catch (err) {
|
480 | reject(err);
|
481 | }
|
482 | }));
|
483 | });
|
484 | }
|
485 | |
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 | getPageByIdZip(project, wikiIdentifier, id, recursionLevel, includeContent) {
|
495 | return __awaiter(this, void 0, void 0, function* () {
|
496 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
497 | let routeValues = {
|
498 | project: project,
|
499 | wikiIdentifier: wikiIdentifier,
|
500 | id: id
|
501 | };
|
502 | let queryValues = {
|
503 | recursionLevel: recursionLevel,
|
504 | includeContent: includeContent,
|
505 | };
|
506 | try {
|
507 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "ceddcf75-1068-452d-8b13-2d4d76e1f970", routeValues, queryValues);
|
508 | let url = verData.requestUrl;
|
509 | let apiVersion = verData.apiVersion;
|
510 | let accept = this.createAcceptHeader("application/zip", apiVersion);
|
511 | resolve((yield this.http.get(url, { "Accept": accept })).message);
|
512 | }
|
513 | catch (err) {
|
514 | reject(err);
|
515 | }
|
516 | }));
|
517 | });
|
518 | }
|
519 | |
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 | getPagesBatch(pagesBatchRequest, project, wikiIdentifier, versionDescriptor) {
|
528 | return __awaiter(this, void 0, void 0, function* () {
|
529 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
530 | let routeValues = {
|
531 | project: project,
|
532 | wikiIdentifier: wikiIdentifier
|
533 | };
|
534 | let queryValues = {
|
535 | versionDescriptor: versionDescriptor,
|
536 | };
|
537 | try {
|
538 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "71323c46-2592-4398-8771-ced73dd87207", routeValues, queryValues);
|
539 | let url = verData.requestUrl;
|
540 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
541 | let res;
|
542 | res = yield this.rest.create(url, pagesBatchRequest, options);
|
543 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiPageDetail, true);
|
544 | resolve(ret);
|
545 | }
|
546 | catch (err) {
|
547 | reject(err);
|
548 | }
|
549 | }));
|
550 | });
|
551 | }
|
552 | |
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 | getPageData(project, wikiIdentifier, pageId, pageViewsForDays) {
|
561 | return __awaiter(this, void 0, void 0, function* () {
|
562 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
563 | let routeValues = {
|
564 | project: project,
|
565 | wikiIdentifier: wikiIdentifier,
|
566 | pageId: pageId
|
567 | };
|
568 | let queryValues = {
|
569 | pageViewsForDays: pageViewsForDays,
|
570 | };
|
571 | try {
|
572 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "81c4e0fe-7663-4d62-ad46-6ab78459f274", routeValues, queryValues);
|
573 | let url = verData.requestUrl;
|
574 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
575 | let res;
|
576 | res = yield this.rest.get(url, options);
|
577 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiPageDetail, false);
|
578 | resolve(ret);
|
579 | }
|
580 | catch (err) {
|
581 | reject(err);
|
582 | }
|
583 | }));
|
584 | });
|
585 | }
|
586 | |
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 | createOrUpdatePageViewStats(project, wikiIdentifier, wikiVersion, path, oldPath) {
|
596 | return __awaiter(this, void 0, void 0, function* () {
|
597 | if (wikiVersion == null) {
|
598 | throw new TypeError('wikiVersion can not be null or undefined');
|
599 | }
|
600 | if (path == null) {
|
601 | throw new TypeError('path can not be null or undefined');
|
602 | }
|
603 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
604 | let routeValues = {
|
605 | project: project,
|
606 | wikiIdentifier: wikiIdentifier
|
607 | };
|
608 | let queryValues = {
|
609 | wikiVersion: wikiVersion,
|
610 | path: path,
|
611 | oldPath: oldPath,
|
612 | };
|
613 | try {
|
614 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "1087b746-5d15-41b9-bea6-14e325e7f880", routeValues, queryValues);
|
615 | let url = verData.requestUrl;
|
616 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
617 | let res;
|
618 | res = yield this.rest.create(url, null, options);
|
619 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiPageViewStats, false);
|
620 | resolve(ret);
|
621 | }
|
622 | catch (err) {
|
623 | reject(err);
|
624 | }
|
625 | }));
|
626 | });
|
627 | }
|
628 | |
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 | createWiki(wikiCreateParams, project) {
|
635 | return __awaiter(this, void 0, void 0, function* () {
|
636 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
637 | let routeValues = {
|
638 | project: project
|
639 | };
|
640 | try {
|
641 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues);
|
642 | let url = verData.requestUrl;
|
643 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
644 | let res;
|
645 | res = yield this.rest.create(url, wikiCreateParams, options);
|
646 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false);
|
647 | resolve(ret);
|
648 | }
|
649 | catch (err) {
|
650 | reject(err);
|
651 | }
|
652 | }));
|
653 | });
|
654 | }
|
655 | |
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 | deleteWiki(wikiIdentifier, project) {
|
662 | return __awaiter(this, void 0, void 0, function* () {
|
663 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
664 | let routeValues = {
|
665 | project: project,
|
666 | wikiIdentifier: wikiIdentifier
|
667 | };
|
668 | try {
|
669 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues);
|
670 | let url = verData.requestUrl;
|
671 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
672 | let res;
|
673 | res = yield this.rest.del(url, options);
|
674 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false);
|
675 | resolve(ret);
|
676 | }
|
677 | catch (err) {
|
678 | reject(err);
|
679 | }
|
680 | }));
|
681 | });
|
682 | }
|
683 | |
684 |
|
685 |
|
686 |
|
687 |
|
688 | getAllWikis(project) {
|
689 | return __awaiter(this, void 0, void 0, function* () {
|
690 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
691 | let routeValues = {
|
692 | project: project
|
693 | };
|
694 | try {
|
695 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues);
|
696 | let url = verData.requestUrl;
|
697 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
698 | let res;
|
699 | res = yield this.rest.get(url, options);
|
700 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, true);
|
701 | resolve(ret);
|
702 | }
|
703 | catch (err) {
|
704 | reject(err);
|
705 | }
|
706 | }));
|
707 | });
|
708 | }
|
709 | |
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 | getWiki(wikiIdentifier, project) {
|
716 | return __awaiter(this, void 0, void 0, function* () {
|
717 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
718 | let routeValues = {
|
719 | project: project,
|
720 | wikiIdentifier: wikiIdentifier
|
721 | };
|
722 | try {
|
723 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues);
|
724 | let url = verData.requestUrl;
|
725 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
726 | let res;
|
727 | res = yield this.rest.get(url, options);
|
728 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false);
|
729 | resolve(ret);
|
730 | }
|
731 | catch (err) {
|
732 | reject(err);
|
733 | }
|
734 | }));
|
735 | });
|
736 | }
|
737 | |
738 |
|
739 |
|
740 |
|
741 |
|
742 |
|
743 |
|
744 | updateWiki(updateParameters, wikiIdentifier, project) {
|
745 | return __awaiter(this, void 0, void 0, function* () {
|
746 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
747 | let routeValues = {
|
748 | project: project,
|
749 | wikiIdentifier: wikiIdentifier
|
750 | };
|
751 | try {
|
752 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues);
|
753 | let url = verData.requestUrl;
|
754 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
755 | let res;
|
756 | res = yield this.rest.update(url, updateParameters, options);
|
757 | let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false);
|
758 | resolve(ret);
|
759 | }
|
760 | catch (err) {
|
761 | reject(err);
|
762 | }
|
763 | }));
|
764 | });
|
765 | }
|
766 | }
|
767 | exports.WikiApi = WikiApi;
|
768 | WikiApi.RESOURCE_AREA_ID = "bf7d82a0-8aa5-4613-94ef-6172a5ea01f3";
|