UNPKG

42.5 kBJavaScriptView Raw
1"use strict";
2/*
3 * ---------------------------------------------------------
4 * Copyright(C) Microsoft Corporation. All rights reserved.
5 * ---------------------------------------------------------
6 *
7 * ---------------------------------------------------------
8 * Generated file, DO NOT EDIT
9 * ---------------------------------------------------------
10 */
11var __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};
20Object.defineProperty(exports, "__esModule", { value: true });
21exports.TfvcApi = void 0;
22const basem = require("./ClientApiBases");
23const TfvcInterfaces = require("./interfaces/TfvcInterfaces");
24class TfvcApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Tfvc-api', options);
27 }
28 /**
29 * Get a single branch hierarchy at the given path with parents or children as specified.
30 *
31 * @param {string} path - Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder.
32 * @param {string} project - Project ID or project name
33 * @param {boolean} includeParent - Return the parent branch, if there is one. Default: False
34 * @param {boolean} includeChildren - Return child branches, if there are any. Default: False
35 */
36 getBranch(path, project, includeParent, includeChildren) {
37 return __awaiter(this, void 0, void 0, function* () {
38 if (path == null) {
39 throw new TypeError('path can not be null or undefined');
40 }
41 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
42 let routeValues = {
43 project: project
44 };
45 let queryValues = {
46 path: path,
47 includeParent: includeParent,
48 includeChildren: includeChildren,
49 };
50 try {
51 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "bc1f417e-239d-42e7-85e1-76e80cb2d6eb", routeValues, queryValues);
52 let url = verData.requestUrl;
53 let options = this.createRequestOptions('application/json', verData.apiVersion);
54 let res;
55 res = yield this.rest.get(url, options);
56 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcBranch, false);
57 resolve(ret);
58 }
59 catch (err) {
60 reject(err);
61 }
62 }));
63 });
64 }
65 /**
66 * Get a collection of branch roots -- first-level children, branches with no parents.
67 *
68 * @param {string} project - Project ID or project name
69 * @param {boolean} includeParent - Return the parent branch, if there is one. Default: False
70 * @param {boolean} includeChildren - Return the child branches for each root branch. Default: False
71 * @param {boolean} includeDeleted - Return deleted branches. Default: False
72 * @param {boolean} includeLinks - Return links. Default: False
73 */
74 getBranches(project, includeParent, includeChildren, includeDeleted, includeLinks) {
75 return __awaiter(this, void 0, void 0, function* () {
76 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
77 let routeValues = {
78 project: project
79 };
80 let queryValues = {
81 includeParent: includeParent,
82 includeChildren: includeChildren,
83 includeDeleted: includeDeleted,
84 includeLinks: includeLinks,
85 };
86 try {
87 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "bc1f417e-239d-42e7-85e1-76e80cb2d6eb", routeValues, queryValues);
88 let url = verData.requestUrl;
89 let options = this.createRequestOptions('application/json', verData.apiVersion);
90 let res;
91 res = yield this.rest.get(url, options);
92 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcBranch, true);
93 resolve(ret);
94 }
95 catch (err) {
96 reject(err);
97 }
98 }));
99 });
100 }
101 /**
102 * Get branch hierarchies below the specified scopePath
103 *
104 * @param {string} scopePath - Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder.
105 * @param {string} project - Project ID or project name
106 * @param {boolean} includeDeleted - Return deleted branches. Default: False
107 * @param {boolean} includeLinks - Return links. Default: False
108 */
109 getBranchRefs(scopePath, project, includeDeleted, includeLinks) {
110 return __awaiter(this, void 0, void 0, function* () {
111 if (scopePath == null) {
112 throw new TypeError('scopePath can not be null or undefined');
113 }
114 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
115 let routeValues = {
116 project: project
117 };
118 let queryValues = {
119 scopePath: scopePath,
120 includeDeleted: includeDeleted,
121 includeLinks: includeLinks,
122 };
123 try {
124 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "bc1f417e-239d-42e7-85e1-76e80cb2d6eb", routeValues, queryValues);
125 let url = verData.requestUrl;
126 let options = this.createRequestOptions('application/json', verData.apiVersion);
127 let res;
128 res = yield this.rest.get(url, options);
129 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcBranchRef, true);
130 resolve(ret);
131 }
132 catch (err) {
133 reject(err);
134 }
135 }));
136 });
137 }
138 /**
139 * Retrieve Tfvc changes for a given changeset.
140 *
141 * @param {number} id - ID of the changeset. Default: null
142 * @param {number} skip - Number of results to skip. Default: null
143 * @param {number} top - The maximum number of results to return. Default: null
144 */
145 getChangesetChanges(id, skip, top) {
146 return __awaiter(this, void 0, void 0, function* () {
147 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
148 let routeValues = {
149 id: id
150 };
151 let queryValues = {
152 '$skip': skip,
153 '$top': top,
154 };
155 try {
156 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "f32b86f2-15b9-4fe6-81b1-6f8938617ee5", routeValues, queryValues);
157 let url = verData.requestUrl;
158 let options = this.createRequestOptions('application/json', verData.apiVersion);
159 let res;
160 res = yield this.rest.get(url, options);
161 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChange, true);
162 resolve(ret);
163 }
164 catch (err) {
165 reject(err);
166 }
167 }));
168 });
169 }
170 /**
171 * Create a new changeset.
172 *
173 * @param {TfvcInterfaces.TfvcChangeset} changeset
174 * @param {string} project - Project ID or project name
175 */
176 createChangeset(changeset, project) {
177 return __awaiter(this, void 0, void 0, function* () {
178 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
179 let routeValues = {
180 project: project
181 };
182 try {
183 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "tfvc", "0bc8f0a4-6bfb-42a9-ba84-139da7b99c49", routeValues);
184 let url = verData.requestUrl;
185 let options = this.createRequestOptions('application/json', verData.apiVersion);
186 let res;
187 res = yield this.rest.create(url, changeset, options);
188 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangesetRef, false);
189 resolve(ret);
190 }
191 catch (err) {
192 reject(err);
193 }
194 }));
195 });
196 }
197 /**
198 * Retrieve a Tfvc Changeset
199 *
200 * @param {number} id - Changeset Id to retrieve.
201 * @param {string} project - Project ID or project name
202 * @param {number} maxChangeCount - Number of changes to return (maximum 100 changes) Default: 0
203 * @param {boolean} includeDetails - Include policy details and check-in notes in the response. Default: false
204 * @param {boolean} includeWorkItems - Include workitems. Default: false
205 * @param {number} maxCommentLength - Include details about associated work items in the response. Default: null
206 * @param {boolean} includeSourceRename - Include renames. Default: false
207 * @param {number} skip - Number of results to skip. Default: null
208 * @param {number} top - The maximum number of results to return. Default: null
209 * @param {string} orderby - Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order.
210 * @param {TfvcInterfaces.TfvcChangesetSearchCriteria} searchCriteria - Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null
211 */
212 getChangeset(id, project, maxChangeCount, includeDetails, includeWorkItems, maxCommentLength, includeSourceRename, skip, top, orderby, searchCriteria) {
213 return __awaiter(this, void 0, void 0, function* () {
214 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
215 let routeValues = {
216 project: project,
217 id: id
218 };
219 let queryValues = {
220 maxChangeCount: maxChangeCount,
221 includeDetails: includeDetails,
222 includeWorkItems: includeWorkItems,
223 maxCommentLength: maxCommentLength,
224 includeSourceRename: includeSourceRename,
225 '$skip': skip,
226 '$top': top,
227 '$orderby': orderby,
228 searchCriteria: searchCriteria,
229 };
230 try {
231 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "tfvc", "0bc8f0a4-6bfb-42a9-ba84-139da7b99c49", routeValues, queryValues);
232 let url = verData.requestUrl;
233 let options = this.createRequestOptions('application/json', verData.apiVersion);
234 let res;
235 res = yield this.rest.get(url, options);
236 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangeset, false);
237 resolve(ret);
238 }
239 catch (err) {
240 reject(err);
241 }
242 }));
243 });
244 }
245 /**
246 * Retrieve Tfvc Changesets
247 *
248 * @param {string} project - Project ID or project name
249 * @param {number} maxCommentLength - Include details about associated work items in the response. Default: null
250 * @param {number} skip - Number of results to skip. Default: null
251 * @param {number} top - The maximum number of results to return. Default: null
252 * @param {string} orderby - Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order.
253 * @param {TfvcInterfaces.TfvcChangesetSearchCriteria} searchCriteria - Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null
254 */
255 getChangesets(project, maxCommentLength, skip, top, orderby, searchCriteria) {
256 return __awaiter(this, void 0, void 0, function* () {
257 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
258 let routeValues = {
259 project: project
260 };
261 let queryValues = {
262 maxCommentLength: maxCommentLength,
263 '$skip': skip,
264 '$top': top,
265 '$orderby': orderby,
266 searchCriteria: searchCriteria,
267 };
268 try {
269 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "tfvc", "0bc8f0a4-6bfb-42a9-ba84-139da7b99c49", routeValues, queryValues);
270 let url = verData.requestUrl;
271 let options = this.createRequestOptions('application/json', verData.apiVersion);
272 let res;
273 res = yield this.rest.get(url, options);
274 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangesetRef, true);
275 resolve(ret);
276 }
277 catch (err) {
278 reject(err);
279 }
280 }));
281 });
282 }
283 /**
284 * Returns changesets for a given list of changeset Ids.
285 *
286 * @param {TfvcInterfaces.TfvcChangesetsRequestData} changesetsRequestData - List of changeset IDs.
287 */
288 getBatchedChangesets(changesetsRequestData) {
289 return __awaiter(this, void 0, void 0, function* () {
290 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
291 let routeValues = {};
292 try {
293 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "b7e7c173-803c-4fea-9ec8-31ee35c5502a", routeValues);
294 let url = verData.requestUrl;
295 let options = this.createRequestOptions('application/json', verData.apiVersion);
296 let res;
297 res = yield this.rest.create(url, changesetsRequestData, options);
298 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangesetRef, true);
299 resolve(ret);
300 }
301 catch (err) {
302 reject(err);
303 }
304 }));
305 });
306 }
307 /**
308 * Retrieves the work items associated with a particular changeset.
309 *
310 * @param {number} id - ID of the changeset.
311 */
312 getChangesetWorkItems(id) {
313 return __awaiter(this, void 0, void 0, function* () {
314 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
315 let routeValues = {
316 id: id
317 };
318 try {
319 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "64ae0bea-1d71-47c9-a9e5-fe73f5ea0ff4", routeValues);
320 let url = verData.requestUrl;
321 let options = this.createRequestOptions('application/json', verData.apiVersion);
322 let res;
323 res = yield this.rest.get(url, options);
324 let ret = this.formatResponse(res.result, null, true);
325 resolve(ret);
326 }
327 catch (err) {
328 reject(err);
329 }
330 }));
331 });
332 }
333 /**
334 * Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.
335 *
336 * @param {TfvcInterfaces.TfvcItemRequestData} itemRequestData
337 * @param {string} project - Project ID or project name
338 */
339 getItemsBatch(itemRequestData, project) {
340 return __awaiter(this, void 0, void 0, function* () {
341 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
342 let routeValues = {
343 project: project
344 };
345 try {
346 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "fe6f827b-5f64-480f-b8af-1eca3b80e833", routeValues);
347 let url = verData.requestUrl;
348 let options = this.createRequestOptions('application/json', verData.apiVersion);
349 let res;
350 res = yield this.rest.create(url, itemRequestData, options);
351 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, true);
352 resolve(ret);
353 }
354 catch (err) {
355 reject(err);
356 }
357 }));
358 });
359 }
360 /**
361 * Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.
362 *
363 * @param {TfvcInterfaces.TfvcItemRequestData} itemRequestData
364 * @param {string} project - Project ID or project name
365 */
366 getItemsBatchZip(itemRequestData, project) {
367 return __awaiter(this, void 0, void 0, function* () {
368 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
369 let routeValues = {
370 project: project
371 };
372 try {
373 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "fe6f827b-5f64-480f-b8af-1eca3b80e833", routeValues);
374 let url = verData.requestUrl;
375 let apiVersion = verData.apiVersion;
376 let accept = this.createAcceptHeader("application/zip", apiVersion);
377 resolve((yield this.http.get(url, { "Accept": accept })).message);
378 }
379 catch (err) {
380 reject(err);
381 }
382 }));
383 });
384 }
385 /**
386 * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.
387 *
388 * @param {string} path - Version control path of an individual item to return.
389 * @param {string} project - Project ID or project name
390 * @param {string} fileName - file name of item returned.
391 * @param {boolean} download - If true, create a downloadable attachment.
392 * @param {string} scopePath - Version control path of a folder to return multiple items.
393 * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder).
394 * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null.
395 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
396 */
397 getItem(path, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) {
398 return __awaiter(this, void 0, void 0, function* () {
399 if (path == null) {
400 throw new TypeError('path can not be null or undefined');
401 }
402 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
403 let routeValues = {
404 project: project
405 };
406 let queryValues = {
407 path: path,
408 fileName: fileName,
409 download: download,
410 scopePath: scopePath,
411 recursionLevel: recursionLevel,
412 versionDescriptor: versionDescriptor,
413 includeContent: includeContent,
414 };
415 try {
416 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues);
417 let url = verData.requestUrl;
418 let options = this.createRequestOptions('application/json', verData.apiVersion);
419 let res;
420 res = yield this.rest.get(url, options);
421 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, false);
422 resolve(ret);
423 }
424 catch (err) {
425 reject(err);
426 }
427 }));
428 });
429 }
430 /**
431 * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.
432 *
433 * @param {string} path - Version control path of an individual item to return.
434 * @param {string} project - Project ID or project name
435 * @param {string} fileName - file name of item returned.
436 * @param {boolean} download - If true, create a downloadable attachment.
437 * @param {string} scopePath - Version control path of a folder to return multiple items.
438 * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder).
439 * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null.
440 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
441 */
442 getItemContent(path, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) {
443 return __awaiter(this, void 0, void 0, function* () {
444 if (path == null) {
445 throw new TypeError('path can not be null or undefined');
446 }
447 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
448 let routeValues = {
449 project: project
450 };
451 let queryValues = {
452 path: path,
453 fileName: fileName,
454 download: download,
455 scopePath: scopePath,
456 recursionLevel: recursionLevel,
457 versionDescriptor: versionDescriptor,
458 includeContent: includeContent,
459 };
460 try {
461 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues);
462 let url = verData.requestUrl;
463 let apiVersion = verData.apiVersion;
464 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
465 resolve((yield this.http.get(url, { "Accept": accept })).message);
466 }
467 catch (err) {
468 reject(err);
469 }
470 }));
471 });
472 }
473 /**
474 * Get a list of Tfvc items
475 *
476 * @param {string} project - Project ID or project name
477 * @param {string} scopePath - Version control path of a folder to return multiple items.
478 * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder).
479 * @param {boolean} includeLinks - True to include links.
480 * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor
481 */
482 getItems(project, scopePath, recursionLevel, includeLinks, versionDescriptor) {
483 return __awaiter(this, void 0, void 0, function* () {
484 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
485 let routeValues = {
486 project: project
487 };
488 let queryValues = {
489 scopePath: scopePath,
490 recursionLevel: recursionLevel,
491 includeLinks: includeLinks,
492 versionDescriptor: versionDescriptor,
493 };
494 try {
495 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues);
496 let url = verData.requestUrl;
497 let options = this.createRequestOptions('application/json', verData.apiVersion);
498 let res;
499 res = yield this.rest.get(url, options);
500 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, true);
501 resolve(ret);
502 }
503 catch (err) {
504 reject(err);
505 }
506 }));
507 });
508 }
509 /**
510 * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.
511 *
512 * @param {string} path - Version control path of an individual item to return.
513 * @param {string} project - Project ID or project name
514 * @param {string} fileName - file name of item returned.
515 * @param {boolean} download - If true, create a downloadable attachment.
516 * @param {string} scopePath - Version control path of a folder to return multiple items.
517 * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder).
518 * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null.
519 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
520 */
521 getItemText(path, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) {
522 return __awaiter(this, void 0, void 0, function* () {
523 if (path == null) {
524 throw new TypeError('path can not be null or undefined');
525 }
526 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
527 let routeValues = {
528 project: project
529 };
530 let queryValues = {
531 path: path,
532 fileName: fileName,
533 download: download,
534 scopePath: scopePath,
535 recursionLevel: recursionLevel,
536 versionDescriptor: versionDescriptor,
537 includeContent: includeContent,
538 };
539 try {
540 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues);
541 let url = verData.requestUrl;
542 let apiVersion = verData.apiVersion;
543 let accept = this.createAcceptHeader("text/plain", apiVersion);
544 resolve((yield this.http.get(url, { "Accept": accept })).message);
545 }
546 catch (err) {
547 reject(err);
548 }
549 }));
550 });
551 }
552 /**
553 * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download.
554 *
555 * @param {string} path - Version control path of an individual item to return.
556 * @param {string} project - Project ID or project name
557 * @param {string} fileName - file name of item returned.
558 * @param {boolean} download - If true, create a downloadable attachment.
559 * @param {string} scopePath - Version control path of a folder to return multiple items.
560 * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder).
561 * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null.
562 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
563 */
564 getItemZip(path, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) {
565 return __awaiter(this, void 0, void 0, function* () {
566 if (path == null) {
567 throw new TypeError('path can not be null or undefined');
568 }
569 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
570 let routeValues = {
571 project: project
572 };
573 let queryValues = {
574 path: path,
575 fileName: fileName,
576 download: download,
577 scopePath: scopePath,
578 recursionLevel: recursionLevel,
579 versionDescriptor: versionDescriptor,
580 includeContent: includeContent,
581 };
582 try {
583 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues);
584 let url = verData.requestUrl;
585 let apiVersion = verData.apiVersion;
586 let accept = this.createAcceptHeader("application/zip", apiVersion);
587 resolve((yield this.http.get(url, { "Accept": accept })).message);
588 }
589 catch (err) {
590 reject(err);
591 }
592 }));
593 });
594 }
595 /**
596 * Get items under a label.
597 *
598 * @param {string} labelId - Unique identifier of label
599 * @param {number} top - Max number of items to return
600 * @param {number} skip - Number of items to skip
601 */
602 getLabelItems(labelId, top, skip) {
603 return __awaiter(this, void 0, void 0, function* () {
604 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
605 let routeValues = {
606 labelId: labelId
607 };
608 let queryValues = {
609 '$top': top,
610 '$skip': skip,
611 };
612 try {
613 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "06166e34-de17-4b60-8cd1-23182a346fda", routeValues, queryValues);
614 let url = verData.requestUrl;
615 let options = this.createRequestOptions('application/json', verData.apiVersion);
616 let res;
617 res = yield this.rest.get(url, options);
618 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, true);
619 resolve(ret);
620 }
621 catch (err) {
622 reject(err);
623 }
624 }));
625 });
626 }
627 /**
628 * Get a single deep label.
629 *
630 * @param {string} labelId - Unique identifier of label
631 * @param {TfvcInterfaces.TfvcLabelRequestData} requestData - maxItemCount
632 * @param {string} project - Project ID or project name
633 */
634 getLabel(labelId, requestData, project) {
635 return __awaiter(this, void 0, void 0, function* () {
636 if (requestData == null) {
637 throw new TypeError('requestData can not be null or undefined');
638 }
639 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
640 let routeValues = {
641 project: project,
642 labelId: labelId
643 };
644 let queryValues = {
645 requestData: requestData,
646 };
647 try {
648 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "a5d9bd7f-b661-4d0e-b9be-d9c16affae54", routeValues, queryValues);
649 let url = verData.requestUrl;
650 let options = this.createRequestOptions('application/json', verData.apiVersion);
651 let res;
652 res = yield this.rest.get(url, options);
653 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcLabel, false);
654 resolve(ret);
655 }
656 catch (err) {
657 reject(err);
658 }
659 }));
660 });
661 }
662 /**
663 * Get a collection of shallow label references.
664 *
665 * @param {TfvcInterfaces.TfvcLabelRequestData} requestData - labelScope, name, owner, and itemLabelFilter
666 * @param {string} project - Project ID or project name
667 * @param {number} top - Max number of labels to return, defaults to 100 when undefined
668 * @param {number} skip - Number of labels to skip
669 */
670 getLabels(requestData, project, top, skip) {
671 return __awaiter(this, void 0, void 0, function* () {
672 if (requestData == null) {
673 throw new TypeError('requestData can not be null or undefined');
674 }
675 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
676 let routeValues = {
677 project: project
678 };
679 let queryValues = {
680 requestData: requestData,
681 '$top': top,
682 '$skip': skip,
683 };
684 try {
685 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "a5d9bd7f-b661-4d0e-b9be-d9c16affae54", routeValues, queryValues);
686 let url = verData.requestUrl;
687 let options = this.createRequestOptions('application/json', verData.apiVersion);
688 let res;
689 res = yield this.rest.get(url, options);
690 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcLabelRef, true);
691 resolve(ret);
692 }
693 catch (err) {
694 reject(err);
695 }
696 }));
697 });
698 }
699 /**
700 * Get changes included in a shelveset.
701 *
702 * @param {string} shelvesetId - Shelveset's unique ID
703 * @param {number} top - Max number of changes to return
704 * @param {number} skip - Number of changes to skip
705 */
706 getShelvesetChanges(shelvesetId, top, skip) {
707 return __awaiter(this, void 0, void 0, function* () {
708 if (shelvesetId == null) {
709 throw new TypeError('shelvesetId can not be null or undefined');
710 }
711 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
712 let routeValues = {};
713 let queryValues = {
714 shelvesetId: shelvesetId,
715 '$top': top,
716 '$skip': skip,
717 };
718 try {
719 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "dbaf075b-0445-4c34-9e5b-82292f856522", routeValues, queryValues);
720 let url = verData.requestUrl;
721 let options = this.createRequestOptions('application/json', verData.apiVersion);
722 let res;
723 res = yield this.rest.get(url, options);
724 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChange, true);
725 resolve(ret);
726 }
727 catch (err) {
728 reject(err);
729 }
730 }));
731 });
732 }
733 /**
734 * Get a single deep shelveset.
735 *
736 * @param {string} shelvesetId - Shelveset's unique ID
737 * @param {TfvcInterfaces.TfvcShelvesetRequestData} requestData - includeDetails, includeWorkItems, maxChangeCount, and maxCommentLength
738 */
739 getShelveset(shelvesetId, requestData) {
740 return __awaiter(this, void 0, void 0, function* () {
741 if (shelvesetId == null) {
742 throw new TypeError('shelvesetId can not be null or undefined');
743 }
744 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
745 let routeValues = {};
746 let queryValues = {
747 shelvesetId: shelvesetId,
748 requestData: requestData,
749 };
750 try {
751 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "e36d44fb-e907-4b0a-b194-f83f1ed32ad3", routeValues, queryValues);
752 let url = verData.requestUrl;
753 let options = this.createRequestOptions('application/json', verData.apiVersion);
754 let res;
755 res = yield this.rest.get(url, options);
756 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcShelveset, false);
757 resolve(ret);
758 }
759 catch (err) {
760 reject(err);
761 }
762 }));
763 });
764 }
765 /**
766 * Return a collection of shallow shelveset references.
767 *
768 * @param {TfvcInterfaces.TfvcShelvesetRequestData} requestData - name, owner, and maxCommentLength
769 * @param {number} top - Max number of shelvesets to return
770 * @param {number} skip - Number of shelvesets to skip
771 */
772 getShelvesets(requestData, top, skip) {
773 return __awaiter(this, void 0, void 0, function* () {
774 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
775 let routeValues = {};
776 let queryValues = {
777 requestData: requestData,
778 '$top': top,
779 '$skip': skip,
780 };
781 try {
782 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "e36d44fb-e907-4b0a-b194-f83f1ed32ad3", routeValues, queryValues);
783 let url = verData.requestUrl;
784 let options = this.createRequestOptions('application/json', verData.apiVersion);
785 let res;
786 res = yield this.rest.get(url, options);
787 let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcShelvesetRef, true);
788 resolve(ret);
789 }
790 catch (err) {
791 reject(err);
792 }
793 }));
794 });
795 }
796 /**
797 * Get work items associated with a shelveset.
798 *
799 * @param {string} shelvesetId - Shelveset's unique ID
800 */
801 getShelvesetWorkItems(shelvesetId) {
802 return __awaiter(this, void 0, void 0, function* () {
803 if (shelvesetId == null) {
804 throw new TypeError('shelvesetId can not be null or undefined');
805 }
806 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
807 let routeValues = {};
808 let queryValues = {
809 shelvesetId: shelvesetId,
810 };
811 try {
812 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "a7a0c1c1-373e-425a-b031-a519474d743d", routeValues, queryValues);
813 let url = verData.requestUrl;
814 let options = this.createRequestOptions('application/json', verData.apiVersion);
815 let res;
816 res = yield this.rest.get(url, options);
817 let ret = this.formatResponse(res.result, null, true);
818 resolve(ret);
819 }
820 catch (err) {
821 reject(err);
822 }
823 }));
824 });
825 }
826 /**
827 * Provides File Count and Uncompressed Bytes for a Collection/Project at a particular scope for TFVC.
828 *
829 * @param {string} project - Project ID or project name
830 * @param {string} scopePath - '$/' for collection, '$/project' for specific project
831 */
832 getTfvcStatistics(project, scopePath) {
833 return __awaiter(this, void 0, void 0, function* () {
834 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
835 let routeValues = {
836 project: project
837 };
838 let queryValues = {
839 scopePath: scopePath,
840 };
841 try {
842 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "e15c74c0-3605-40e0-aed4-4cc61e549ed8", routeValues, queryValues);
843 let url = verData.requestUrl;
844 let options = this.createRequestOptions('application/json', verData.apiVersion);
845 let res;
846 res = yield this.rest.get(url, options);
847 let ret = this.formatResponse(res.result, null, false);
848 resolve(ret);
849 }
850 catch (err) {
851 reject(err);
852 }
853 }));
854 });
855 }
856}
857exports.TfvcApi = TfvcApi;
858TfvcApi.RESOURCE_AREA_ID = "8aa40520-446d-40e6-89f6-9c9f9ce44c48";