UNPKG

244 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.GitApi = void 0;
22const basem = require("./ClientApiBases");
23const GitInterfaces = require("./interfaces/GitInterfaces");
24class GitApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Git-api', options);
27 }
28 /**
29 * DELETE Deletes Enablement status and BillableCommitters data from DB. Deleting the enablement data will effectively disable it for the repositories affected.
30 *
31 * @param {boolean} allProjects
32 * @param {boolean} includeBillableCommitters
33 * @param {string[]} projectIds
34 */
35 deleteEnablementStatus(allProjects, includeBillableCommitters, projectIds) {
36 return __awaiter(this, void 0, void 0, function* () {
37 if (allProjects == null) {
38 throw new TypeError('allProjects can not be null or undefined');
39 }
40 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
41 let routeValues = {};
42 let queryValues = {
43 '$allProjects': allProjects,
44 '$includeBillableCommitters': includeBillableCommitters,
45 projectIds: projectIds,
46 };
47 try {
48 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues);
49 let url = verData.requestUrl;
50 let options = this.createRequestOptions('application/json', verData.apiVersion);
51 let res;
52 res = yield this.rest.del(url, options);
53 let ret = this.formatResponse(res.result, null, false);
54 resolve(ret);
55 }
56 catch (err) {
57 reject(err);
58 }
59 }));
60 });
61 }
62 /**
63 * GET Enablement status for project's repositories.
64 *
65 * @param {string[]} projectIds - Null defaults to all projects in the host, list of project's repos status to return
66 * @param {Date} billingDate - UTC expected, Null defaults to UtcNow(), can be provided for a point in time status
67 * @param {number} skip - Skip X rows of resultset to simulate paging.
68 * @param {number} take - Return Y rows of resultset to simulate paging.
69 */
70 getEnablementStatus(projectIds, billingDate, skip, take) {
71 return __awaiter(this, void 0, void 0, function* () {
72 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
73 let routeValues = {};
74 let queryValues = {
75 projectIds: projectIds,
76 '$billingDate': billingDate,
77 '$skip': skip,
78 '$take': take,
79 };
80 try {
81 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues);
82 let url = verData.requestUrl;
83 let options = this.createRequestOptions('application/json', verData.apiVersion);
84 let res;
85 res = yield this.rest.get(url, options);
86 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.AdvSecEnablementStatus, true);
87 resolve(ret);
88 }
89 catch (err) {
90 reject(err);
91 }
92 }));
93 });
94 }
95 /**
96 * @param {boolean} enableOnCreateHost
97 */
98 getEnableOnCreateHost(enableOnCreateHost) {
99 return __awaiter(this, void 0, void 0, function* () {
100 if (enableOnCreateHost == null) {
101 throw new TypeError('enableOnCreateHost can not be null or undefined');
102 }
103 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
104 let routeValues = {};
105 let queryValues = {
106 '$enableOnCreateHost': enableOnCreateHost,
107 };
108 try {
109 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues);
110 let url = verData.requestUrl;
111 let options = this.createRequestOptions('application/json', verData.apiVersion);
112 let res;
113 res = yield this.rest.get(url, options);
114 let ret = this.formatResponse(res.result, null, false);
115 resolve(ret);
116 }
117 catch (err) {
118 reject(err);
119 }
120 }));
121 });
122 }
123 /**
124 * @param {string} enableOnCreateProjectId
125 */
126 getEnableOnCreateProject(enableOnCreateProjectId) {
127 return __awaiter(this, void 0, void 0, function* () {
128 if (enableOnCreateProjectId == null) {
129 throw new TypeError('enableOnCreateProjectId can not be null or undefined');
130 }
131 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
132 let routeValues = {};
133 let queryValues = {
134 '$enableOnCreateProjectId': enableOnCreateProjectId,
135 };
136 try {
137 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues);
138 let url = verData.requestUrl;
139 let options = this.createRequestOptions('application/json', verData.apiVersion);
140 let res;
141 res = yield this.rest.get(url, options);
142 let ret = this.formatResponse(res.result, null, false);
143 resolve(ret);
144 }
145 catch (err) {
146 reject(err);
147 }
148 }));
149 });
150 }
151 /**
152 * @param {boolean} enableOnCreateHost
153 */
154 setEnableOnCreateHost(enableOnCreateHost) {
155 return __awaiter(this, void 0, void 0, function* () {
156 if (enableOnCreateHost == null) {
157 throw new TypeError('enableOnCreateHost can not be null or undefined');
158 }
159 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
160 let routeValues = {};
161 let queryValues = {
162 '$enableOnCreateHost': enableOnCreateHost,
163 };
164 try {
165 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues);
166 let url = verData.requestUrl;
167 let options = this.createRequestOptions('application/json', verData.apiVersion);
168 let res;
169 res = yield this.rest.replace(url, null, options);
170 let ret = this.formatResponse(res.result, null, false);
171 resolve(ret);
172 }
173 catch (err) {
174 reject(err);
175 }
176 }));
177 });
178 }
179 /**
180 * @param {string} enableOnCreateProjectId
181 * @param {boolean} enableOnStatus
182 */
183 setEnableOnCreateProject(enableOnCreateProjectId, enableOnStatus) {
184 return __awaiter(this, void 0, void 0, function* () {
185 if (enableOnCreateProjectId == null) {
186 throw new TypeError('enableOnCreateProjectId can not be null or undefined');
187 }
188 if (enableOnStatus == null) {
189 throw new TypeError('enableOnStatus can not be null or undefined');
190 }
191 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
192 let routeValues = {};
193 let queryValues = {
194 '$enableOnCreateProjectId': enableOnCreateProjectId,
195 '$enableOnStatus': enableOnStatus,
196 };
197 try {
198 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues);
199 let url = verData.requestUrl;
200 let options = this.createRequestOptions('application/json', verData.apiVersion);
201 let res;
202 res = yield this.rest.replace(url, null, options);
203 let ret = this.formatResponse(res.result, null, false);
204 resolve(ret);
205 }
206 catch (err) {
207 reject(err);
208 }
209 }));
210 });
211 }
212 /**
213 * POST Enablement status for repositories.
214 *
215 * @param {GitInterfaces.AdvSecEnablementUpdate[]} enablementUpdates
216 */
217 updateEnablementStatus(enablementUpdates) {
218 return __awaiter(this, void 0, void 0, function* () {
219 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
220 let routeValues = {};
221 try {
222 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues);
223 let url = verData.requestUrl;
224 let options = this.createRequestOptions('application/json', verData.apiVersion);
225 let res;
226 res = yield this.rest.create(url, enablementUpdates, options);
227 let ret = this.formatResponse(res.result, null, false);
228 resolve(ret);
229 }
230 catch (err) {
231 reject(err);
232 }
233 }));
234 });
235 }
236 /**
237 * Get estimated billable pushers for an Organization for last 90 days.
238 *
239 */
240 getEstimatedBillablePushersOrg() {
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 try {
245 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "2277ffbe-28d4-40d6-9c26-40baf26d1408", routeValues);
246 let url = verData.requestUrl;
247 let options = this.createRequestOptions('application/json', verData.apiVersion);
248 let res;
249 res = yield this.rest.get(url, options);
250 let ret = this.formatResponse(res.result, null, true);
251 resolve(ret);
252 }
253 catch (err) {
254 reject(err);
255 }
256 }));
257 });
258 }
259 /**
260 * Get estimated billable pushers for a project for last 90 days.
261 *
262 * @param {string} project - Project ID or project name
263 */
264 getEstimatedBillablePushersProject(project) {
265 return __awaiter(this, void 0, void 0, function* () {
266 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
267 let routeValues = {
268 project: project
269 };
270 try {
271 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1df7833e-1eed-447b-81a3-390c74923900", routeValues);
272 let url = verData.requestUrl;
273 let options = this.createRequestOptions('application/json', verData.apiVersion);
274 let res;
275 res = yield this.rest.get(url, options);
276 let ret = this.formatResponse(res.result, null, true);
277 resolve(ret);
278 }
279 catch (err) {
280 reject(err);
281 }
282 }));
283 });
284 }
285 /**
286 * Get estimated billable committers for a repository for the last 90 days.
287 *
288 * @param {string} project - Project ID or project name
289 * @param {string} repositoryId
290 */
291 getEstimatedBillableCommittersRepo(project, repositoryId) {
292 return __awaiter(this, void 0, void 0, function* () {
293 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
294 let routeValues = {
295 project: project,
296 repositoryId: repositoryId
297 };
298 try {
299 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5dcec07b-a844-4efb-9fc1-968fd1f149db", routeValues);
300 let url = verData.requestUrl;
301 let options = this.createRequestOptions('application/json', verData.apiVersion);
302 let res;
303 res = yield this.rest.get(url, options);
304 let ret = this.formatResponse(res.result, null, true);
305 resolve(ret);
306 }
307 catch (err) {
308 reject(err);
309 }
310 }));
311 });
312 }
313 /**
314 * GET Advanced Security Permission status.
315 *
316 * @param {string} projectName
317 * @param {string} repositoryId - Repository user is trying to access
318 * @param {string} permission - Permission being requestd, must be "viewAlert" "dismissAlert" "manage" "viewEnablement" or "repoRead"
319 */
320 getPermission(projectName, repositoryId, permission) {
321 return __awaiter(this, void 0, void 0, function* () {
322 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
323 let routeValues = {};
324 let queryValues = {
325 '$projectName': projectName,
326 '$repositoryId': repositoryId,
327 '$permission': permission,
328 };
329 try {
330 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "61b21a05-a60f-4910-a733-ba5347c2142d", routeValues, queryValues);
331 let url = verData.requestUrl;
332 let options = this.createRequestOptions('application/json', verData.apiVersion);
333 let res;
334 res = yield this.rest.get(url, options);
335 let ret = this.formatResponse(res.result, null, false);
336 resolve(ret);
337 }
338 catch (err) {
339 reject(err);
340 }
341 }));
342 });
343 }
344 /**
345 * Create an annotated tag.
346 *
347 * @param {GitInterfaces.GitAnnotatedTag} tagObject - Object containing details of tag to be created.
348 * @param {string} project - Project ID or project name
349 * @param {string} repositoryId - ID or name of the repository.
350 */
351 createAnnotatedTag(tagObject, project, repositoryId) {
352 return __awaiter(this, void 0, void 0, function* () {
353 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
354 let routeValues = {
355 project: project,
356 repositoryId: repositoryId
357 };
358 try {
359 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5e8a8081-3851-4626-b677-9891cc04102e", routeValues);
360 let url = verData.requestUrl;
361 let options = this.createRequestOptions('application/json', verData.apiVersion);
362 let res;
363 res = yield this.rest.create(url, tagObject, options);
364 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitAnnotatedTag, false);
365 resolve(ret);
366 }
367 catch (err) {
368 reject(err);
369 }
370 }));
371 });
372 }
373 /**
374 * Get an annotated tag.
375 *
376 * @param {string} project - Project ID or project name
377 * @param {string} repositoryId - ID or name of the repository.
378 * @param {string} objectId - ObjectId (Sha1Id) of tag to get.
379 */
380 getAnnotatedTag(project, repositoryId, objectId) {
381 return __awaiter(this, void 0, void 0, function* () {
382 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
383 let routeValues = {
384 project: project,
385 repositoryId: repositoryId,
386 objectId: objectId
387 };
388 try {
389 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5e8a8081-3851-4626-b677-9891cc04102e", routeValues);
390 let url = verData.requestUrl;
391 let options = this.createRequestOptions('application/json', verData.apiVersion);
392 let res;
393 res = yield this.rest.get(url, options);
394 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitAnnotatedTag, false);
395 resolve(ret);
396 }
397 catch (err) {
398 reject(err);
399 }
400 }));
401 });
402 }
403 /**
404 * Retrieve actual billable committers for Advanced Security service for a given date.
405 *
406 * @param {string} project - Project ID or project name
407 * @param {Date} billingDate - UTC expected. If not specified defaults to the previous billing day.
408 * @param {number} skip - Skip X rows of resultset to simulate paging.
409 * @param {number} take - Return Y rows of resultset to simulate paging.
410 */
411 getBillableCommitters(project, billingDate, skip, take) {
412 return __awaiter(this, void 0, void 0, function* () {
413 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
414 let routeValues = {
415 project: project
416 };
417 let queryValues = {
418 '$billingDate': billingDate,
419 '$skip': skip,
420 '$take': take,
421 };
422 try {
423 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5c5e3ebc-37b0-4547-a957-945912d44922", routeValues, queryValues);
424 let url = verData.requestUrl;
425 let options = this.createRequestOptions('application/json', verData.apiVersion);
426 let res;
427 res = yield this.rest.get(url, options);
428 let ret = this.formatResponse(res.result, null, true);
429 resolve(ret);
430 }
431 catch (err) {
432 reject(err);
433 }
434 }));
435 });
436 }
437 /**
438 * Retrieve detailed actual billable committers for Advanced Security service for a given date. Detailed results intentionally does not filter out soft deleted projects and repositories to help diagnose billing issues.
439 *
440 * @param {string} project - Project ID or project name
441 * @param {string} includeDetails - Return all the details on the billable committers.
442 * @param {Date} billingDate - UTC expected. If not specified defaults to the previous billing day.
443 */
444 getBillableCommittersDetail(project, includeDetails, billingDate) {
445 return __awaiter(this, void 0, void 0, function* () {
446 if (includeDetails == null) {
447 throw new TypeError('includeDetails can not be null or undefined');
448 }
449 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
450 let routeValues = {
451 project: project
452 };
453 let queryValues = {
454 '$includeDetails': includeDetails,
455 '$billingDate': billingDate,
456 };
457 try {
458 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5c5e3ebc-37b0-4547-a957-945912d44922", routeValues, queryValues);
459 let url = verData.requestUrl;
460 let options = this.createRequestOptions('application/json', verData.apiVersion);
461 let res;
462 res = yield this.rest.get(url, options);
463 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.BillableCommitterDetail, true);
464 resolve(ret);
465 }
466 catch (err) {
467 reject(err);
468 }
469 }));
470 });
471 }
472 /**
473 * Get a single blob.
474 *
475 * @param {string} repositoryId - The name or ID of the repository.
476 * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.
477 * @param {string} project - Project ID or project name
478 * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip
479 * @param {string} fileName - Provide a fileName to use for a download.
480 * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types
481 */
482 getBlob(repositoryId, sha1, project, download, fileName, resolveLfs) {
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 repositoryId: repositoryId,
488 sha1: sha1
489 };
490 let queryValues = {
491 download: download,
492 fileName: fileName,
493 resolveLfs: resolveLfs,
494 };
495 try {
496 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues);
497 let url = verData.requestUrl;
498 let options = this.createRequestOptions('application/json', verData.apiVersion);
499 let res;
500 res = yield this.rest.get(url, options);
501 let ret = this.formatResponse(res.result, null, false);
502 resolve(ret);
503 }
504 catch (err) {
505 reject(err);
506 }
507 }));
508 });
509 }
510 /**
511 * Get a single blob.
512 *
513 * @param {string} repositoryId - The name or ID of the repository.
514 * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.
515 * @param {string} project - Project ID or project name
516 * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip
517 * @param {string} fileName - Provide a fileName to use for a download.
518 * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types
519 */
520 getBlobContent(repositoryId, sha1, project, download, fileName, resolveLfs) {
521 return __awaiter(this, void 0, void 0, function* () {
522 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
523 let routeValues = {
524 project: project,
525 repositoryId: repositoryId,
526 sha1: sha1
527 };
528 let queryValues = {
529 download: download,
530 fileName: fileName,
531 resolveLfs: resolveLfs,
532 };
533 try {
534 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues);
535 let url = verData.requestUrl;
536 let apiVersion = verData.apiVersion;
537 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
538 resolve((yield this.http.get(url, { "Accept": accept })).message);
539 }
540 catch (err) {
541 reject(err);
542 }
543 }));
544 });
545 }
546 /**
547 * Gets one or more blobs in a zip file download.
548 *
549 * @param {string[]} blobIds - Blob IDs (SHA1 hashes) to be returned in the zip file.
550 * @param {string} repositoryId - The name or ID of the repository.
551 * @param {string} project - Project ID or project name
552 * @param {string} filename
553 */
554 getBlobsZip(blobIds, repositoryId, project, filename) {
555 return __awaiter(this, void 0, void 0, function* () {
556 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
557 let routeValues = {
558 project: project,
559 repositoryId: repositoryId
560 };
561 let queryValues = {
562 filename: filename,
563 };
564 try {
565 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues);
566 let url = verData.requestUrl;
567 let apiVersion = verData.apiVersion;
568 let accept = this.createAcceptHeader("application/zip", apiVersion);
569 resolve((yield this.http.get(url, { "Accept": accept })).message);
570 }
571 catch (err) {
572 reject(err);
573 }
574 }));
575 });
576 }
577 /**
578 * Get a single blob.
579 *
580 * @param {string} repositoryId - The name or ID of the repository.
581 * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint.
582 * @param {string} project - Project ID or project name
583 * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip
584 * @param {string} fileName - Provide a fileName to use for a download.
585 * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types
586 */
587 getBlobZip(repositoryId, sha1, project, download, fileName, resolveLfs) {
588 return __awaiter(this, void 0, void 0, function* () {
589 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
590 let routeValues = {
591 project: project,
592 repositoryId: repositoryId,
593 sha1: sha1
594 };
595 let queryValues = {
596 download: download,
597 fileName: fileName,
598 resolveLfs: resolveLfs,
599 };
600 try {
601 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues);
602 let url = verData.requestUrl;
603 let apiVersion = verData.apiVersion;
604 let accept = this.createAcceptHeader("application/zip", apiVersion);
605 resolve((yield this.http.get(url, { "Accept": accept })).message);
606 }
607 catch (err) {
608 reject(err);
609 }
610 }));
611 });
612 }
613 /**
614 * Retrieve statistics about a single branch.
615 *
616 * @param {string} repositoryId - The name or ID of the repository.
617 * @param {string} name - Name of the branch.
618 * @param {string} project - Project ID or project name
619 * @param {GitInterfaces.GitVersionDescriptor} baseVersionDescriptor - Identifies the commit or branch to use as the base.
620 */
621 getBranch(repositoryId, name, project, baseVersionDescriptor) {
622 return __awaiter(this, void 0, void 0, function* () {
623 if (name == null) {
624 throw new TypeError('name can not be null or undefined');
625 }
626 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
627 let routeValues = {
628 project: project,
629 repositoryId: repositoryId
630 };
631 let queryValues = {
632 name: name,
633 baseVersionDescriptor: baseVersionDescriptor,
634 };
635 try {
636 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", routeValues, queryValues);
637 let url = verData.requestUrl;
638 let options = this.createRequestOptions('application/json', verData.apiVersion);
639 let res;
640 res = yield this.rest.get(url, options);
641 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitBranchStats, false);
642 resolve(ret);
643 }
644 catch (err) {
645 reject(err);
646 }
647 }));
648 });
649 }
650 /**
651 * Retrieve statistics about all branches within a repository.
652 *
653 * @param {string} repositoryId - The name or ID of the repository.
654 * @param {string} project - Project ID or project name
655 * @param {GitInterfaces.GitVersionDescriptor} baseVersionDescriptor - Identifies the commit or branch to use as the base.
656 */
657 getBranches(repositoryId, project, baseVersionDescriptor) {
658 return __awaiter(this, void 0, void 0, function* () {
659 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
660 let routeValues = {
661 project: project,
662 repositoryId: repositoryId
663 };
664 let queryValues = {
665 baseVersionDescriptor: baseVersionDescriptor,
666 };
667 try {
668 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", routeValues, queryValues);
669 let url = verData.requestUrl;
670 let options = this.createRequestOptions('application/json', verData.apiVersion);
671 let res;
672 res = yield this.rest.get(url, options);
673 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitBranchStats, true);
674 resolve(ret);
675 }
676 catch (err) {
677 reject(err);
678 }
679 }));
680 });
681 }
682 /**
683 * Retrieve statistics for multiple commits
684 *
685 * @param {GitInterfaces.GitQueryBranchStatsCriteria} searchCriteria - Base Commit and List of Target Commits to compare.
686 * @param {string} repositoryId - The name or ID of the repository.
687 * @param {string} project - Project ID or project name
688 */
689 getBranchStatsBatch(searchCriteria, repositoryId, project) {
690 return __awaiter(this, void 0, void 0, function* () {
691 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
692 let routeValues = {
693 project: project,
694 repositoryId: repositoryId
695 };
696 try {
697 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", routeValues);
698 let url = verData.requestUrl;
699 let options = this.createRequestOptions('application/json', verData.apiVersion);
700 let res;
701 res = yield this.rest.create(url, searchCriteria, options);
702 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitBranchStats, true);
703 resolve(ret);
704 }
705 catch (err) {
706 reject(err);
707 }
708 }));
709 });
710 }
711 /**
712 * Retrieve changes for a particular commit.
713 *
714 * @param {string} commitId - The id of the commit.
715 * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
716 * @param {string} project - Project ID or project name
717 * @param {number} top - The maximum number of changes to return.
718 * @param {number} skip - The number of changes to skip.
719 */
720 getChanges(commitId, repositoryId, project, top, skip) {
721 return __awaiter(this, void 0, void 0, function* () {
722 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
723 let routeValues = {
724 project: project,
725 commitId: commitId,
726 repositoryId: repositoryId
727 };
728 let queryValues = {
729 top: top,
730 skip: skip,
731 };
732 try {
733 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5bf884f5-3e07-42e9-afb8-1b872267bf16", routeValues, queryValues);
734 let url = verData.requestUrl;
735 let options = this.createRequestOptions('application/json', verData.apiVersion);
736 let res;
737 res = yield this.rest.get(url, options);
738 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitChanges, false);
739 resolve(ret);
740 }
741 catch (err) {
742 reject(err);
743 }
744 }));
745 });
746 }
747 /**
748 * Retrieve one conflict for a cherry pick by ID
749 *
750 * @param {string} repositoryId
751 * @param {number} cherryPickId
752 * @param {number} conflictId
753 * @param {string} project - Project ID or project name
754 */
755 getCherryPickConflict(repositoryId, cherryPickId, conflictId, project) {
756 return __awaiter(this, void 0, void 0, function* () {
757 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
758 let routeValues = {
759 project: project,
760 repositoryId: repositoryId,
761 cherryPickId: cherryPickId,
762 conflictId: conflictId
763 };
764 try {
765 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues);
766 let url = verData.requestUrl;
767 let options = this.createRequestOptions('application/json', verData.apiVersion);
768 let res;
769 res = yield this.rest.get(url, options);
770 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false);
771 resolve(ret);
772 }
773 catch (err) {
774 reject(err);
775 }
776 }));
777 });
778 }
779 /**
780 * Retrieve all conflicts for a cherry pick
781 *
782 * @param {string} repositoryId
783 * @param {number} cherryPickId
784 * @param {string} project - Project ID or project name
785 * @param {string} continuationToken
786 * @param {number} top
787 * @param {boolean} excludeResolved
788 * @param {boolean} onlyResolved
789 * @param {boolean} includeObsolete
790 */
791 getCherryPickConflicts(repositoryId, cherryPickId, project, continuationToken, top, excludeResolved, onlyResolved, includeObsolete) {
792 return __awaiter(this, void 0, void 0, function* () {
793 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
794 let routeValues = {
795 project: project,
796 repositoryId: repositoryId,
797 cherryPickId: cherryPickId
798 };
799 let queryValues = {
800 continuationToken: continuationToken,
801 '$top': top,
802 excludeResolved: excludeResolved,
803 onlyResolved: onlyResolved,
804 includeObsolete: includeObsolete,
805 };
806 try {
807 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues, queryValues);
808 let url = verData.requestUrl;
809 let options = this.createRequestOptions('application/json', verData.apiVersion);
810 let res;
811 res = yield this.rest.get(url, options);
812 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, true);
813 resolve(ret);
814 }
815 catch (err) {
816 reject(err);
817 }
818 }));
819 });
820 }
821 /**
822 * Update merge conflict resolution
823 *
824 * @param {GitInterfaces.GitConflict} conflict
825 * @param {string} repositoryId
826 * @param {number} cherryPickId
827 * @param {number} conflictId
828 * @param {string} project - Project ID or project name
829 */
830 updateCherryPickConflict(conflict, repositoryId, cherryPickId, conflictId, project) {
831 return __awaiter(this, void 0, void 0, function* () {
832 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
833 let routeValues = {
834 project: project,
835 repositoryId: repositoryId,
836 cherryPickId: cherryPickId,
837 conflictId: conflictId
838 };
839 try {
840 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues);
841 let url = verData.requestUrl;
842 let options = this.createRequestOptions('application/json', verData.apiVersion);
843 let res;
844 res = yield this.rest.update(url, conflict, options);
845 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false);
846 resolve(ret);
847 }
848 catch (err) {
849 reject(err);
850 }
851 }));
852 });
853 }
854 /**
855 * Update multiple merge conflict resolutions
856 *
857 * @param {GitInterfaces.GitConflict[]} conflictUpdates
858 * @param {string} repositoryId
859 * @param {number} cherryPickId
860 * @param {string} project - Project ID or project name
861 */
862 updateCherryPickConflicts(conflictUpdates, repositoryId, cherryPickId, project) {
863 return __awaiter(this, void 0, void 0, function* () {
864 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
865 let routeValues = {
866 project: project,
867 repositoryId: repositoryId,
868 cherryPickId: cherryPickId
869 };
870 try {
871 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues);
872 let url = verData.requestUrl;
873 let options = this.createRequestOptions('application/json', verData.apiVersion);
874 let res;
875 res = yield this.rest.update(url, conflictUpdates, options);
876 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflictUpdateResult, true);
877 resolve(ret);
878 }
879 catch (err) {
880 reject(err);
881 }
882 }));
883 });
884 }
885 /**
886 * Given a commitId, returns a list of commits that are in the same cherry-pick family.
887 *
888 * @param {string} repositoryNameOrId
889 * @param {string} commitId
890 * @param {string} project - Project ID or project name
891 * @param {boolean} includeLinks
892 */
893 getCherryPickRelationships(repositoryNameOrId, commitId, project, includeLinks) {
894 return __awaiter(this, void 0, void 0, function* () {
895 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
896 let routeValues = {
897 project: project,
898 repositoryNameOrId: repositoryNameOrId,
899 commitId: commitId
900 };
901 let queryValues = {
902 includeLinks: includeLinks,
903 };
904 try {
905 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "8af142a4-27c2-4168-9e82-46b8629aaa0d", routeValues, queryValues);
906 let url = verData.requestUrl;
907 let options = this.createRequestOptions('application/json', verData.apiVersion);
908 let res;
909 res = yield this.rest.get(url, options);
910 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true);
911 resolve(ret);
912 }
913 catch (err) {
914 reject(err);
915 }
916 }));
917 });
918 }
919 /**
920 * Cherry pick a specific commit or commits that are associated to a pull request into a new branch.
921 *
922 * @param {GitInterfaces.GitAsyncRefOperationParameters} cherryPickToCreate
923 * @param {string} project - Project ID or project name
924 * @param {string} repositoryId - ID of the repository.
925 */
926 createCherryPick(cherryPickToCreate, project, repositoryId) {
927 return __awaiter(this, void 0, void 0, function* () {
928 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
929 let routeValues = {
930 project: project,
931 repositoryId: repositoryId
932 };
933 try {
934 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", routeValues);
935 let url = verData.requestUrl;
936 let options = this.createRequestOptions('application/json', verData.apiVersion);
937 let res;
938 res = yield this.rest.create(url, cherryPickToCreate, options);
939 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCherryPick, false);
940 resolve(ret);
941 }
942 catch (err) {
943 reject(err);
944 }
945 }));
946 });
947 }
948 /**
949 * Retrieve information about a cherry pick operation by cherry pick Id.
950 *
951 * @param {string} project - Project ID or project name
952 * @param {number} cherryPickId - ID of the cherry pick.
953 * @param {string} repositoryId - ID of the repository.
954 */
955 getCherryPick(project, cherryPickId, repositoryId) {
956 return __awaiter(this, void 0, void 0, function* () {
957 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
958 let routeValues = {
959 project: project,
960 cherryPickId: cherryPickId,
961 repositoryId: repositoryId
962 };
963 try {
964 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", routeValues);
965 let url = verData.requestUrl;
966 let options = this.createRequestOptions('application/json', verData.apiVersion);
967 let res;
968 res = yield this.rest.get(url, options);
969 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCherryPick, false);
970 resolve(ret);
971 }
972 catch (err) {
973 reject(err);
974 }
975 }));
976 });
977 }
978 /**
979 * Retrieve information about a cherry pick operation for a specific branch. This operation is expensive due to the underlying object structure, so this API only looks at the 1000 most recent cherry pick operations.
980 *
981 * @param {string} project - Project ID or project name
982 * @param {string} repositoryId - ID of the repository.
983 * @param {string} refName - The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation.
984 */
985 getCherryPickForRefName(project, repositoryId, refName) {
986 return __awaiter(this, void 0, void 0, function* () {
987 if (refName == null) {
988 throw new TypeError('refName can not be null or undefined');
989 }
990 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
991 let routeValues = {
992 project: project,
993 repositoryId: repositoryId
994 };
995 let queryValues = {
996 refName: refName,
997 };
998 try {
999 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", routeValues, queryValues);
1000 let url = verData.requestUrl;
1001 let options = this.createRequestOptions('application/json', verData.apiVersion);
1002 let res;
1003 res = yield this.rest.get(url, options);
1004 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCherryPick, false);
1005 resolve(ret);
1006 }
1007 catch (err) {
1008 reject(err);
1009 }
1010 }));
1011 });
1012 }
1013 /**
1014 * Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits.
1015 *
1016 * @param {string} repositoryId - The name or ID of the repository.
1017 * @param {string} project - Project ID or project name
1018 * @param {boolean} diffCommonCommit - If true, diff between common and target commits. If false, diff between base and target commits.
1019 * @param {number} top - Maximum number of changes to return. Defaults to 100.
1020 * @param {number} skip - Number of changes to skip
1021 * @param {GitInterfaces.GitBaseVersionDescriptor} baseVersionDescriptor - Descriptor for base commit.
1022 * @param {GitInterfaces.GitTargetVersionDescriptor} targetVersionDescriptor - Descriptor for target commit.
1023 */
1024 getCommitDiffs(repositoryId, project, diffCommonCommit, top, skip, baseVersionDescriptor, targetVersionDescriptor) {
1025 return __awaiter(this, void 0, void 0, function* () {
1026 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1027 let routeValues = {
1028 project: project,
1029 repositoryId: repositoryId
1030 };
1031 let queryValues = {
1032 diffCommonCommit: diffCommonCommit,
1033 '$top': top,
1034 '$skip': skip,
1035 };
1036 if (baseVersionDescriptor) {
1037 queryValues.baseVersionType = baseVersionDescriptor.versionType;
1038 queryValues.baseVersion = baseVersionDescriptor.version;
1039 queryValues.baseVersionOptions = baseVersionDescriptor.versionOptions;
1040 }
1041 if (targetVersionDescriptor) {
1042 queryValues.targetVersionType = targetVersionDescriptor.versionType;
1043 queryValues.targetVersion = targetVersionDescriptor.version;
1044 queryValues.targetVersionOptions = targetVersionDescriptor.versionOptions;
1045 }
1046 try {
1047 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "615588d5-c0c7-4b88-88f8-e625306446e8", routeValues, queryValues);
1048 let url = verData.requestUrl;
1049 let options = this.createRequestOptions('application/json', verData.apiVersion);
1050 let res;
1051 res = yield this.rest.get(url, options);
1052 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitDiffs, false);
1053 resolve(ret);
1054 }
1055 catch (err) {
1056 reject(err);
1057 }
1058 }));
1059 });
1060 }
1061 /**
1062 * Retrieve a particular commit.
1063 *
1064 * @param {string} commitId - The id of the commit.
1065 * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
1066 * @param {string} project - Project ID or project name
1067 * @param {number} changeCount - The number of changes to include in the result.
1068 */
1069 getCommit(commitId, repositoryId, project, changeCount) {
1070 return __awaiter(this, void 0, void 0, function* () {
1071 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1072 let routeValues = {
1073 project: project,
1074 commitId: commitId,
1075 repositoryId: repositoryId
1076 };
1077 let queryValues = {
1078 changeCount: changeCount,
1079 };
1080 try {
1081 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", routeValues, queryValues);
1082 let url = verData.requestUrl;
1083 let options = this.createRequestOptions('application/json', verData.apiVersion);
1084 let res;
1085 res = yield this.rest.get(url, options);
1086 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommit, false);
1087 resolve(ret);
1088 }
1089 catch (err) {
1090 reject(err);
1091 }
1092 }));
1093 });
1094 }
1095 /**
1096 * Retrieve git commits for a project
1097 *
1098 * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
1099 * @param {GitInterfaces.GitQueryCommitsCriteria} searchCriteria
1100 * @param {string} project - Project ID or project name
1101 * @param {number} skip
1102 * @param {number} top
1103 */
1104 getCommits(repositoryId, searchCriteria, project, skip, top) {
1105 return __awaiter(this, void 0, void 0, function* () {
1106 if (searchCriteria == null) {
1107 throw new TypeError('searchCriteria can not be null or undefined');
1108 }
1109 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1110 let routeValues = {
1111 project: project,
1112 repositoryId: repositoryId
1113 };
1114 let queryValues = {
1115 searchCriteria: searchCriteria,
1116 '$skip': skip,
1117 '$top': top,
1118 };
1119 try {
1120 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", routeValues, queryValues);
1121 let url = verData.requestUrl;
1122 let options = this.createRequestOptions('application/json', verData.apiVersion);
1123 let res;
1124 res = yield this.rest.get(url, options);
1125 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true);
1126 resolve(ret);
1127 }
1128 catch (err) {
1129 reject(err);
1130 }
1131 }));
1132 });
1133 }
1134 /**
1135 * Retrieve a list of commits associated with a particular push.
1136 *
1137 * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified.
1138 * @param {number} pushId - The id of the push.
1139 * @param {string} project - Project ID or project name
1140 * @param {number} top - The maximum number of commits to return ("get the top x commits").
1141 * @param {number} skip - The number of commits to skip.
1142 * @param {boolean} includeLinks - Set to false to avoid including REST Url links for resources. Defaults to true.
1143 */
1144 getPushCommits(repositoryId, pushId, project, top, skip, includeLinks) {
1145 return __awaiter(this, void 0, void 0, function* () {
1146 if (pushId == null) {
1147 throw new TypeError('pushId can not be null or undefined');
1148 }
1149 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1150 let routeValues = {
1151 project: project,
1152 repositoryId: repositoryId
1153 };
1154 let queryValues = {
1155 pushId: pushId,
1156 top: top,
1157 skip: skip,
1158 includeLinks: includeLinks,
1159 };
1160 try {
1161 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", routeValues, queryValues);
1162 let url = verData.requestUrl;
1163 let options = this.createRequestOptions('application/json', verData.apiVersion);
1164 let res;
1165 res = yield this.rest.get(url, options);
1166 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true);
1167 resolve(ret);
1168 }
1169 catch (err) {
1170 reject(err);
1171 }
1172 }));
1173 });
1174 }
1175 /**
1176 * Retrieve git commits for a project matching the search criteria
1177 *
1178 * @param {GitInterfaces.GitQueryCommitsCriteria} searchCriteria - Search options
1179 * @param {string} repositoryId - The name or ID of the repository.
1180 * @param {string} project - Project ID or project name
1181 * @param {number} skip - Number of commits to skip. The value cannot exceed 3,000,000.
1182 * @param {number} top - Maximum number of commits to return. The value cannot exceed 50,000.
1183 * @param {boolean} includeStatuses - True to include additional commit status information.
1184 */
1185 getCommitsBatch(searchCriteria, repositoryId, project, skip, top, includeStatuses) {
1186 return __awaiter(this, void 0, void 0, function* () {
1187 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1188 let routeValues = {
1189 project: project,
1190 repositoryId: repositoryId
1191 };
1192 let queryValues = {
1193 '$skip': skip,
1194 '$top': top,
1195 includeStatuses: includeStatuses,
1196 };
1197 try {
1198 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "6400dfb2-0bcb-462b-b992-5a57f8f1416c", routeValues, queryValues);
1199 let url = verData.requestUrl;
1200 let options = this.createRequestOptions('application/json', verData.apiVersion);
1201 let res;
1202 res = yield this.rest.create(url, searchCriteria, options);
1203 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true);
1204 resolve(ret);
1205 }
1206 catch (err) {
1207 reject(err);
1208 }
1209 }));
1210 });
1211 }
1212 /**
1213 * Retrieve deleted git repositories.
1214 *
1215 * @param {string} project - Project ID or project name
1216 */
1217 getDeletedRepositories(project) {
1218 return __awaiter(this, void 0, void 0, function* () {
1219 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1220 let routeValues = {
1221 project: project
1222 };
1223 try {
1224 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "2b6869c4-cb25-42b5-b7a3-0d3e6be0a11a", routeValues);
1225 let url = verData.requestUrl;
1226 let options = this.createRequestOptions('application/json', verData.apiVersion);
1227 let res;
1228 res = yield this.rest.get(url, options);
1229 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitDeletedRepository, true);
1230 resolve(ret);
1231 }
1232 catch (err) {
1233 reject(err);
1234 }
1235 }));
1236 });
1237 }
1238 /**
1239 * Get the file diffs for each of the specified files
1240 *
1241 * @param {GitInterfaces.FileDiffsCriteria} fileDiffsCriteria - List of file parameters objects
1242 * @param {string} project - Project ID or project name
1243 * @param {string} repositoryId - The name or ID of the repository
1244 */
1245 getFileDiffs(fileDiffsCriteria, project, repositoryId) {
1246 return __awaiter(this, void 0, void 0, function* () {
1247 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1248 let routeValues = {
1249 project: project,
1250 repositoryId: repositoryId
1251 };
1252 try {
1253 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "c4c5a7e6-e9f3-4730-a92b-84baacff694b", routeValues);
1254 let url = verData.requestUrl;
1255 let options = this.createRequestOptions('application/json', verData.apiVersion);
1256 let res;
1257 res = yield this.rest.create(url, fileDiffsCriteria, options);
1258 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.FileDiff, true);
1259 resolve(ret);
1260 }
1261 catch (err) {
1262 reject(err);
1263 }
1264 }));
1265 });
1266 }
1267 /**
1268 * Retrieve all forks of a repository in the collection.
1269 *
1270 * @param {string} repositoryNameOrId - The name or ID of the repository.
1271 * @param {string} collectionId - Team project collection ID.
1272 * @param {string} project - Project ID or project name
1273 * @param {boolean} includeLinks - True to include links.
1274 */
1275 getForks(repositoryNameOrId, collectionId, project, includeLinks) {
1276 return __awaiter(this, void 0, void 0, function* () {
1277 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1278 let routeValues = {
1279 project: project,
1280 repositoryNameOrId: repositoryNameOrId,
1281 collectionId: collectionId
1282 };
1283 let queryValues = {
1284 includeLinks: includeLinks,
1285 };
1286 try {
1287 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "158c0340-bf6f-489c-9625-d572a1480d57", routeValues, queryValues);
1288 let url = verData.requestUrl;
1289 let options = this.createRequestOptions('application/json', verData.apiVersion);
1290 let res;
1291 res = yield this.rest.get(url, options);
1292 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepositoryRef, true);
1293 resolve(ret);
1294 }
1295 catch (err) {
1296 reject(err);
1297 }
1298 }));
1299 });
1300 }
1301 /**
1302 * Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the <a href="https://docs.microsoft.com/en-us/rest/api/vsts/git/repositories/create?view=azure-devops-rest-5.1"> repositories endpoint</a>
1303 *
1304 * @param {GitInterfaces.GitForkSyncRequestParameters} syncParams - Source repository and ref mapping.
1305 * @param {string} repositoryNameOrId - The name or ID of the repository.
1306 * @param {string} project - Project ID or project name
1307 * @param {boolean} includeLinks - True to include links
1308 */
1309 createForkSyncRequest(syncParams, repositoryNameOrId, project, includeLinks) {
1310 return __awaiter(this, void 0, void 0, function* () {
1311 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1312 let routeValues = {
1313 project: project,
1314 repositoryNameOrId: repositoryNameOrId
1315 };
1316 let queryValues = {
1317 includeLinks: includeLinks,
1318 };
1319 try {
1320 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", routeValues, queryValues);
1321 let url = verData.requestUrl;
1322 let options = this.createRequestOptions('application/json', verData.apiVersion);
1323 let res;
1324 res = yield this.rest.create(url, syncParams, options);
1325 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitForkSyncRequest, false);
1326 resolve(ret);
1327 }
1328 catch (err) {
1329 reject(err);
1330 }
1331 }));
1332 });
1333 }
1334 /**
1335 * Get a specific fork sync operation's details.
1336 *
1337 * @param {string} repositoryNameOrId - The name or ID of the repository.
1338 * @param {number} forkSyncOperationId - OperationId of the sync request.
1339 * @param {string} project - Project ID or project name
1340 * @param {boolean} includeLinks - True to include links.
1341 */
1342 getForkSyncRequest(repositoryNameOrId, forkSyncOperationId, project, includeLinks) {
1343 return __awaiter(this, void 0, void 0, function* () {
1344 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1345 let routeValues = {
1346 project: project,
1347 repositoryNameOrId: repositoryNameOrId,
1348 forkSyncOperationId: forkSyncOperationId
1349 };
1350 let queryValues = {
1351 includeLinks: includeLinks,
1352 };
1353 try {
1354 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", routeValues, queryValues);
1355 let url = verData.requestUrl;
1356 let options = this.createRequestOptions('application/json', verData.apiVersion);
1357 let res;
1358 res = yield this.rest.get(url, options);
1359 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitForkSyncRequest, false);
1360 resolve(ret);
1361 }
1362 catch (err) {
1363 reject(err);
1364 }
1365 }));
1366 });
1367 }
1368 /**
1369 * Retrieve all requested fork sync operations on this repository.
1370 *
1371 * @param {string} repositoryNameOrId - The name or ID of the repository.
1372 * @param {string} project - Project ID or project name
1373 * @param {boolean} includeAbandoned - True to include abandoned requests.
1374 * @param {boolean} includeLinks - True to include links.
1375 */
1376 getForkSyncRequests(repositoryNameOrId, project, includeAbandoned, includeLinks) {
1377 return __awaiter(this, void 0, void 0, function* () {
1378 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1379 let routeValues = {
1380 project: project,
1381 repositoryNameOrId: repositoryNameOrId
1382 };
1383 let queryValues = {
1384 includeAbandoned: includeAbandoned,
1385 includeLinks: includeLinks,
1386 };
1387 try {
1388 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", routeValues, queryValues);
1389 let url = verData.requestUrl;
1390 let options = this.createRequestOptions('application/json', verData.apiVersion);
1391 let res;
1392 res = yield this.rest.get(url, options);
1393 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitForkSyncRequest, true);
1394 resolve(ret);
1395 }
1396 catch (err) {
1397 reject(err);
1398 }
1399 }));
1400 });
1401 }
1402 /**
1403 * Create an import request.
1404 *
1405 * @param {GitInterfaces.GitImportRequest} importRequest - The import request to create.
1406 * @param {string} project - Project ID or project name
1407 * @param {string} repositoryId - The name or ID of the repository.
1408 */
1409 createImportRequest(importRequest, project, repositoryId) {
1410 return __awaiter(this, void 0, void 0, function* () {
1411 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1412 let routeValues = {
1413 project: project,
1414 repositoryId: repositoryId
1415 };
1416 try {
1417 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues);
1418 let url = verData.requestUrl;
1419 let options = this.createRequestOptions('application/json', verData.apiVersion);
1420 let res;
1421 res = yield this.rest.create(url, importRequest, options);
1422 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false);
1423 resolve(ret);
1424 }
1425 catch (err) {
1426 reject(err);
1427 }
1428 }));
1429 });
1430 }
1431 /**
1432 * Retrieve a particular import request.
1433 *
1434 * @param {string} project - Project ID or project name
1435 * @param {string} repositoryId - The name or ID of the repository.
1436 * @param {number} importRequestId - The unique identifier for the import request.
1437 */
1438 getImportRequest(project, repositoryId, importRequestId) {
1439 return __awaiter(this, void 0, void 0, function* () {
1440 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1441 let routeValues = {
1442 project: project,
1443 repositoryId: repositoryId,
1444 importRequestId: importRequestId
1445 };
1446 try {
1447 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues);
1448 let url = verData.requestUrl;
1449 let options = this.createRequestOptions('application/json', verData.apiVersion);
1450 let res;
1451 res = yield this.rest.get(url, options);
1452 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false);
1453 resolve(ret);
1454 }
1455 catch (err) {
1456 reject(err);
1457 }
1458 }));
1459 });
1460 }
1461 /**
1462 * Retrieve import requests for a repository.
1463 *
1464 * @param {string} project - Project ID or project name
1465 * @param {string} repositoryId - The name or ID of the repository.
1466 * @param {boolean} includeAbandoned - True to include abandoned import requests in the results.
1467 */
1468 queryImportRequests(project, repositoryId, includeAbandoned) {
1469 return __awaiter(this, void 0, void 0, function* () {
1470 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1471 let routeValues = {
1472 project: project,
1473 repositoryId: repositoryId
1474 };
1475 let queryValues = {
1476 includeAbandoned: includeAbandoned,
1477 };
1478 try {
1479 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues, queryValues);
1480 let url = verData.requestUrl;
1481 let options = this.createRequestOptions('application/json', verData.apiVersion);
1482 let res;
1483 res = yield this.rest.get(url, options);
1484 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, true);
1485 resolve(ret);
1486 }
1487 catch (err) {
1488 reject(err);
1489 }
1490 }));
1491 });
1492 }
1493 /**
1494 * Retry or abandon a failed import request.
1495 *
1496 * @param {GitInterfaces.GitImportRequest} importRequestToUpdate - The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned.
1497 * @param {string} project - Project ID or project name
1498 * @param {string} repositoryId - The name or ID of the repository.
1499 * @param {number} importRequestId - The unique identifier for the import request to update.
1500 */
1501 updateImportRequest(importRequestToUpdate, project, repositoryId, importRequestId) {
1502 return __awaiter(this, void 0, void 0, function* () {
1503 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1504 let routeValues = {
1505 project: project,
1506 repositoryId: repositoryId,
1507 importRequestId: importRequestId
1508 };
1509 try {
1510 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues);
1511 let url = verData.requestUrl;
1512 let options = this.createRequestOptions('application/json', verData.apiVersion);
1513 let res;
1514 res = yield this.rest.update(url, importRequestToUpdate, options);
1515 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false);
1516 resolve(ret);
1517 }
1518 catch (err) {
1519 reject(err);
1520 }
1521 }));
1522 });
1523 }
1524 /**
1525 * 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.
1526 *
1527 * @param {string} repositoryId - The name or ID of the repository.
1528 * @param {string} path - The item path.
1529 * @param {string} project - Project ID or project name
1530 * @param {string} scopePath - The path scope. The default is null.
1531 * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
1532 * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
1533 * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false.
1534 * @param {boolean} download - Set to true to download the response as a file. Default is false.
1535 * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository.
1536 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
1537 * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
1538 * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.
1539 */
1540 getItem(repositoryId, path, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) {
1541 return __awaiter(this, void 0, void 0, function* () {
1542 if (path == null) {
1543 throw new TypeError('path can not be null or undefined');
1544 }
1545 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1546 let routeValues = {
1547 project: project,
1548 repositoryId: repositoryId
1549 };
1550 let queryValues = {
1551 path: path,
1552 scopePath: scopePath,
1553 recursionLevel: recursionLevel,
1554 includeContentMetadata: includeContentMetadata,
1555 latestProcessedChange: latestProcessedChange,
1556 download: download,
1557 versionDescriptor: versionDescriptor,
1558 includeContent: includeContent,
1559 resolveLfs: resolveLfs,
1560 sanitize: sanitize,
1561 };
1562 try {
1563 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues);
1564 let url = verData.requestUrl;
1565 let options = this.createRequestOptions('application/json', verData.apiVersion);
1566 let res;
1567 res = yield this.rest.get(url, options);
1568 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitItem, false);
1569 resolve(ret);
1570 }
1571 catch (err) {
1572 reject(err);
1573 }
1574 }));
1575 });
1576 }
1577 /**
1578 * 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.
1579 *
1580 * @param {string} repositoryId - The name or ID of the repository.
1581 * @param {string} path - The item path.
1582 * @param {string} project - Project ID or project name
1583 * @param {string} scopePath - The path scope. The default is null.
1584 * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
1585 * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
1586 * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false.
1587 * @param {boolean} download - Set to true to download the response as a file. Default is false.
1588 * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository.
1589 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
1590 * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
1591 * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.
1592 */
1593 getItemContent(repositoryId, path, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) {
1594 return __awaiter(this, void 0, void 0, function* () {
1595 if (path == null) {
1596 throw new TypeError('path can not be null or undefined');
1597 }
1598 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1599 let routeValues = {
1600 project: project,
1601 repositoryId: repositoryId
1602 };
1603 let queryValues = {
1604 path: path,
1605 scopePath: scopePath,
1606 recursionLevel: recursionLevel,
1607 includeContentMetadata: includeContentMetadata,
1608 latestProcessedChange: latestProcessedChange,
1609 download: download,
1610 versionDescriptor: versionDescriptor,
1611 includeContent: includeContent,
1612 resolveLfs: resolveLfs,
1613 sanitize: sanitize,
1614 };
1615 try {
1616 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues);
1617 let url = verData.requestUrl;
1618 let apiVersion = verData.apiVersion;
1619 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
1620 resolve((yield this.http.get(url, { "Accept": accept })).message);
1621 }
1622 catch (err) {
1623 reject(err);
1624 }
1625 }));
1626 });
1627 }
1628 /**
1629 * Get Item Metadata and/or Content for a collection of items. 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.
1630 *
1631 * @param {string} repositoryId - The name or ID of the repository.
1632 * @param {string} project - Project ID or project name
1633 * @param {string} scopePath - The path scope. The default is null.
1634 * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
1635 * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
1636 * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false.
1637 * @param {boolean} download - Set to true to download the response as a file. Default is false.
1638 * @param {boolean} includeLinks - Set to true to include links to items. Default is false.
1639 * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository.
1640 * @param {boolean} zipForUnix - Set to true to keep the file permissions for unix (and POSIX) systems like executables and symlinks
1641 */
1642 getItems(repositoryId, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, includeLinks, versionDescriptor, zipForUnix) {
1643 return __awaiter(this, void 0, void 0, function* () {
1644 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1645 let routeValues = {
1646 project: project,
1647 repositoryId: repositoryId
1648 };
1649 let queryValues = {
1650 scopePath: scopePath,
1651 recursionLevel: recursionLevel,
1652 includeContentMetadata: includeContentMetadata,
1653 latestProcessedChange: latestProcessedChange,
1654 download: download,
1655 includeLinks: includeLinks,
1656 versionDescriptor: versionDescriptor,
1657 zipForUnix: zipForUnix,
1658 };
1659 try {
1660 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues);
1661 let url = verData.requestUrl;
1662 let options = this.createRequestOptions('application/json', verData.apiVersion);
1663 let res;
1664 res = yield this.rest.get(url, options);
1665 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitItem, true);
1666 resolve(ret);
1667 }
1668 catch (err) {
1669 reject(err);
1670 }
1671 }));
1672 });
1673 }
1674 /**
1675 * 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.
1676 *
1677 * @param {string} repositoryId - The name or ID of the repository.
1678 * @param {string} path - The item path.
1679 * @param {string} project - Project ID or project name
1680 * @param {string} scopePath - The path scope. The default is null.
1681 * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
1682 * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
1683 * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false.
1684 * @param {boolean} download - Set to true to download the response as a file. Default is false.
1685 * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository.
1686 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
1687 * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
1688 * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.
1689 */
1690 getItemText(repositoryId, path, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) {
1691 return __awaiter(this, void 0, void 0, function* () {
1692 if (path == null) {
1693 throw new TypeError('path can not be null or undefined');
1694 }
1695 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1696 let routeValues = {
1697 project: project,
1698 repositoryId: repositoryId
1699 };
1700 let queryValues = {
1701 path: path,
1702 scopePath: scopePath,
1703 recursionLevel: recursionLevel,
1704 includeContentMetadata: includeContentMetadata,
1705 latestProcessedChange: latestProcessedChange,
1706 download: download,
1707 versionDescriptor: versionDescriptor,
1708 includeContent: includeContent,
1709 resolveLfs: resolveLfs,
1710 sanitize: sanitize,
1711 };
1712 try {
1713 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues);
1714 let url = verData.requestUrl;
1715 let apiVersion = verData.apiVersion;
1716 let accept = this.createAcceptHeader("text/plain", apiVersion);
1717 resolve((yield this.http.get(url, { "Accept": accept })).message);
1718 }
1719 catch (err) {
1720 reject(err);
1721 }
1722 }));
1723 });
1724 }
1725 /**
1726 * 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.
1727 *
1728 * @param {string} repositoryId - The name or ID of the repository.
1729 * @param {string} path - The item path.
1730 * @param {string} project - Project ID or project name
1731 * @param {string} scopePath - The path scope. The default is null.
1732 * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion.
1733 * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false.
1734 * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false.
1735 * @param {boolean} download - Set to true to download the response as a file. Default is false.
1736 * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository.
1737 * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false.
1738 * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false.
1739 * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false.
1740 */
1741 getItemZip(repositoryId, path, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) {
1742 return __awaiter(this, void 0, void 0, function* () {
1743 if (path == null) {
1744 throw new TypeError('path can not be null or undefined');
1745 }
1746 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1747 let routeValues = {
1748 project: project,
1749 repositoryId: repositoryId
1750 };
1751 let queryValues = {
1752 path: path,
1753 scopePath: scopePath,
1754 recursionLevel: recursionLevel,
1755 includeContentMetadata: includeContentMetadata,
1756 latestProcessedChange: latestProcessedChange,
1757 download: download,
1758 versionDescriptor: versionDescriptor,
1759 includeContent: includeContent,
1760 resolveLfs: resolveLfs,
1761 sanitize: sanitize,
1762 };
1763 try {
1764 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues);
1765 let url = verData.requestUrl;
1766 let apiVersion = verData.apiVersion;
1767 let accept = this.createAcceptHeader("application/zip", apiVersion);
1768 resolve((yield this.http.get(url, { "Accept": accept })).message);
1769 }
1770 catch (err) {
1771 reject(err);
1772 }
1773 }));
1774 });
1775 }
1776 /**
1777 * Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path
1778 *
1779 * @param {GitInterfaces.GitItemRequestData} requestData - Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references.
1780 * @param {string} repositoryId - The name or ID of the repository
1781 * @param {string} project - Project ID or project name
1782 */
1783 getItemsBatch(requestData, repositoryId, project) {
1784 return __awaiter(this, void 0, void 0, function* () {
1785 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1786 let routeValues = {
1787 project: project,
1788 repositoryId: repositoryId
1789 };
1790 try {
1791 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "630fd2e4-fb88-4f85-ad21-13f3fd1fbca9", routeValues);
1792 let url = verData.requestUrl;
1793 let options = this.createRequestOptions('application/json', verData.apiVersion);
1794 let res;
1795 res = yield this.rest.create(url, requestData, options);
1796 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitItem, true);
1797 resolve(ret);
1798 }
1799 catch (err) {
1800 reject(err);
1801 }
1802 }));
1803 });
1804 }
1805 /**
1806 * Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId.
1807 *
1808 * @param {string} repositoryNameOrId - ID or name of the local repository.
1809 * @param {string} commitId - First commit, usually the tip of the target branch of the potential merge.
1810 * @param {string} otherCommitId - Other commit, usually the tip of the source branch of the potential merge.
1811 * @param {string} project - Project ID or project name
1812 * @param {string} otherCollectionId - The collection ID where otherCommitId lives.
1813 * @param {string} otherRepositoryId - The repository ID where otherCommitId lives.
1814 */
1815 getMergeBases(repositoryNameOrId, commitId, otherCommitId, project, otherCollectionId, otherRepositoryId) {
1816 return __awaiter(this, void 0, void 0, function* () {
1817 if (otherCommitId == null) {
1818 throw new TypeError('otherCommitId can not be null or undefined');
1819 }
1820 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1821 let routeValues = {
1822 project: project,
1823 repositoryNameOrId: repositoryNameOrId,
1824 commitId: commitId
1825 };
1826 let queryValues = {
1827 otherCommitId: otherCommitId,
1828 otherCollectionId: otherCollectionId,
1829 otherRepositoryId: otherRepositoryId,
1830 };
1831 try {
1832 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7cf2abb6-c964-4f7e-9872-f78c66e72e9c", routeValues, queryValues);
1833 let url = verData.requestUrl;
1834 let options = this.createRequestOptions('application/json', verData.apiVersion);
1835 let res;
1836 res = yield this.rest.get(url, options);
1837 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true);
1838 resolve(ret);
1839 }
1840 catch (err) {
1841 reject(err);
1842 }
1843 }));
1844 });
1845 }
1846 /**
1847 * Request a git merge operation. Currently we support merging only 2 commits.
1848 *
1849 * @param {GitInterfaces.GitMergeParameters} mergeParameters - Parents commitIds and merge commit messsage.
1850 * @param {string} project - Project ID or project name
1851 * @param {string} repositoryNameOrId - The name or ID of the repository.
1852 * @param {boolean} includeLinks - True to include links
1853 */
1854 createMergeRequest(mergeParameters, project, repositoryNameOrId, includeLinks) {
1855 return __awaiter(this, void 0, void 0, function* () {
1856 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1857 let routeValues = {
1858 project: project,
1859 repositoryNameOrId: repositoryNameOrId
1860 };
1861 let queryValues = {
1862 includeLinks: includeLinks,
1863 };
1864 try {
1865 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "985f7ae9-844f-4906-9897-7ef41516c0e2", routeValues, queryValues);
1866 let url = verData.requestUrl;
1867 let options = this.createRequestOptions('application/json', verData.apiVersion);
1868 let res;
1869 res = yield this.rest.create(url, mergeParameters, options);
1870 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitMerge, false);
1871 resolve(ret);
1872 }
1873 catch (err) {
1874 reject(err);
1875 }
1876 }));
1877 });
1878 }
1879 /**
1880 * Get a specific merge operation's details.
1881 *
1882 * @param {string} project - Project ID or project name
1883 * @param {string} repositoryNameOrId - The name or ID of the repository.
1884 * @param {number} mergeOperationId - OperationId of the merge request.
1885 * @param {boolean} includeLinks - True to include links
1886 */
1887 getMergeRequest(project, repositoryNameOrId, mergeOperationId, includeLinks) {
1888 return __awaiter(this, void 0, void 0, function* () {
1889 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1890 let routeValues = {
1891 project: project,
1892 repositoryNameOrId: repositoryNameOrId,
1893 mergeOperationId: mergeOperationId
1894 };
1895 let queryValues = {
1896 includeLinks: includeLinks,
1897 };
1898 try {
1899 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "985f7ae9-844f-4906-9897-7ef41516c0e2", routeValues, queryValues);
1900 let url = verData.requestUrl;
1901 let options = this.createRequestOptions('application/json', verData.apiVersion);
1902 let res;
1903 res = yield this.rest.get(url, options);
1904 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitMerge, false);
1905 resolve(ret);
1906 }
1907 catch (err) {
1908 reject(err);
1909 }
1910 }));
1911 });
1912 }
1913 /**
1914 * Attach a new file to a pull request.
1915 *
1916 * @param {NodeJS.ReadableStream} contentStream - Content to upload
1917 * @param {string} fileName - The name of the file.
1918 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
1919 * @param {number} pullRequestId - ID of the pull request.
1920 * @param {string} project - Project ID or project name
1921 */
1922 createAttachment(customHeaders, contentStream, fileName, repositoryId, pullRequestId, project) {
1923 return __awaiter(this, void 0, void 0, function* () {
1924 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1925 let routeValues = {
1926 project: project,
1927 fileName: fileName,
1928 repositoryId: repositoryId,
1929 pullRequestId: pullRequestId
1930 };
1931 customHeaders = customHeaders || {};
1932 customHeaders["Content-Type"] = "application/octet-stream";
1933 try {
1934 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues);
1935 let url = verData.requestUrl;
1936 let options = this.createRequestOptions('application/json', verData.apiVersion);
1937 options.additionalHeaders = customHeaders;
1938 let res;
1939 res = yield this.rest.uploadStream("POST", url, contentStream, options);
1940 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Attachment, false);
1941 resolve(ret);
1942 }
1943 catch (err) {
1944 reject(err);
1945 }
1946 }));
1947 });
1948 }
1949 /**
1950 * Delete a pull request attachment.
1951 *
1952 * @param {string} fileName - The name of the attachment to delete.
1953 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
1954 * @param {number} pullRequestId - ID of the pull request.
1955 * @param {string} project - Project ID or project name
1956 */
1957 deleteAttachment(fileName, repositoryId, pullRequestId, project) {
1958 return __awaiter(this, void 0, void 0, function* () {
1959 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1960 let routeValues = {
1961 project: project,
1962 fileName: fileName,
1963 repositoryId: repositoryId,
1964 pullRequestId: pullRequestId
1965 };
1966 try {
1967 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues);
1968 let url = verData.requestUrl;
1969 let options = this.createRequestOptions('application/json', verData.apiVersion);
1970 let res;
1971 res = yield this.rest.del(url, options);
1972 let ret = this.formatResponse(res.result, null, false);
1973 resolve(ret);
1974 }
1975 catch (err) {
1976 reject(err);
1977 }
1978 }));
1979 });
1980 }
1981 /**
1982 * Get the file content of a pull request attachment.
1983 *
1984 * @param {string} fileName - The name of the attachment.
1985 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
1986 * @param {number} pullRequestId - ID of the pull request.
1987 * @param {string} project - Project ID or project name
1988 */
1989 getAttachmentContent(fileName, repositoryId, pullRequestId, project) {
1990 return __awaiter(this, void 0, void 0, function* () {
1991 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1992 let routeValues = {
1993 project: project,
1994 fileName: fileName,
1995 repositoryId: repositoryId,
1996 pullRequestId: pullRequestId
1997 };
1998 try {
1999 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues);
2000 let url = verData.requestUrl;
2001 let apiVersion = verData.apiVersion;
2002 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
2003 resolve((yield this.http.get(url, { "Accept": accept })).message);
2004 }
2005 catch (err) {
2006 reject(err);
2007 }
2008 }));
2009 });
2010 }
2011 /**
2012 * Get a list of files attached to a given pull request.
2013 *
2014 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2015 * @param {number} pullRequestId - ID of the pull request.
2016 * @param {string} project - Project ID or project name
2017 */
2018 getAttachments(repositoryId, pullRequestId, project) {
2019 return __awaiter(this, void 0, void 0, function* () {
2020 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2021 let routeValues = {
2022 project: project,
2023 repositoryId: repositoryId,
2024 pullRequestId: pullRequestId
2025 };
2026 try {
2027 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues);
2028 let url = verData.requestUrl;
2029 let options = this.createRequestOptions('application/json', verData.apiVersion);
2030 let res;
2031 res = yield this.rest.get(url, options);
2032 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Attachment, true);
2033 resolve(ret);
2034 }
2035 catch (err) {
2036 reject(err);
2037 }
2038 }));
2039 });
2040 }
2041 /**
2042 * Get the file content of a pull request attachment.
2043 *
2044 * @param {string} fileName - The name of the attachment.
2045 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2046 * @param {number} pullRequestId - ID of the pull request.
2047 * @param {string} project - Project ID or project name
2048 */
2049 getAttachmentZip(fileName, repositoryId, pullRequestId, project) {
2050 return __awaiter(this, void 0, void 0, function* () {
2051 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2052 let routeValues = {
2053 project: project,
2054 fileName: fileName,
2055 repositoryId: repositoryId,
2056 pullRequestId: pullRequestId
2057 };
2058 try {
2059 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues);
2060 let url = verData.requestUrl;
2061 let apiVersion = verData.apiVersion;
2062 let accept = this.createAcceptHeader("application/zip", apiVersion);
2063 resolve((yield this.http.get(url, { "Accept": accept })).message);
2064 }
2065 catch (err) {
2066 reject(err);
2067 }
2068 }));
2069 });
2070 }
2071 /**
2072 * Add a like on a comment.
2073 *
2074 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2075 * @param {number} pullRequestId - ID of the pull request.
2076 * @param {number} threadId - The ID of the thread that contains the comment.
2077 * @param {number} commentId - The ID of the comment.
2078 * @param {string} project - Project ID or project name
2079 */
2080 createLike(repositoryId, pullRequestId, threadId, commentId, project) {
2081 return __awaiter(this, void 0, void 0, function* () {
2082 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2083 let routeValues = {
2084 project: project,
2085 repositoryId: repositoryId,
2086 pullRequestId: pullRequestId,
2087 threadId: threadId,
2088 commentId: commentId
2089 };
2090 try {
2091 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5f2e2851-1389-425b-a00b-fb2adb3ef31b", routeValues);
2092 let url = verData.requestUrl;
2093 let options = this.createRequestOptions('application/json', verData.apiVersion);
2094 let res;
2095 res = yield this.rest.create(url, null, options);
2096 let ret = this.formatResponse(res.result, null, false);
2097 resolve(ret);
2098 }
2099 catch (err) {
2100 reject(err);
2101 }
2102 }));
2103 });
2104 }
2105 /**
2106 * Delete a like on a comment.
2107 *
2108 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2109 * @param {number} pullRequestId - ID of the pull request.
2110 * @param {number} threadId - The ID of the thread that contains the comment.
2111 * @param {number} commentId - The ID of the comment.
2112 * @param {string} project - Project ID or project name
2113 */
2114 deleteLike(repositoryId, pullRequestId, threadId, commentId, project) {
2115 return __awaiter(this, void 0, void 0, function* () {
2116 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2117 let routeValues = {
2118 project: project,
2119 repositoryId: repositoryId,
2120 pullRequestId: pullRequestId,
2121 threadId: threadId,
2122 commentId: commentId
2123 };
2124 try {
2125 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5f2e2851-1389-425b-a00b-fb2adb3ef31b", routeValues);
2126 let url = verData.requestUrl;
2127 let options = this.createRequestOptions('application/json', verData.apiVersion);
2128 let res;
2129 res = yield this.rest.del(url, options);
2130 let ret = this.formatResponse(res.result, null, false);
2131 resolve(ret);
2132 }
2133 catch (err) {
2134 reject(err);
2135 }
2136 }));
2137 });
2138 }
2139 /**
2140 * Get likes for a comment.
2141 *
2142 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2143 * @param {number} pullRequestId - ID of the pull request.
2144 * @param {number} threadId - The ID of the thread that contains the comment.
2145 * @param {number} commentId - The ID of the comment.
2146 * @param {string} project - Project ID or project name
2147 */
2148 getLikes(repositoryId, pullRequestId, threadId, commentId, project) {
2149 return __awaiter(this, void 0, void 0, function* () {
2150 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2151 let routeValues = {
2152 project: project,
2153 repositoryId: repositoryId,
2154 pullRequestId: pullRequestId,
2155 threadId: threadId,
2156 commentId: commentId
2157 };
2158 try {
2159 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5f2e2851-1389-425b-a00b-fb2adb3ef31b", routeValues);
2160 let url = verData.requestUrl;
2161 let options = this.createRequestOptions('application/json', verData.apiVersion);
2162 let res;
2163 res = yield this.rest.get(url, options);
2164 let ret = this.formatResponse(res.result, null, true);
2165 resolve(ret);
2166 }
2167 catch (err) {
2168 reject(err);
2169 }
2170 }));
2171 });
2172 }
2173 /**
2174 * Get the commits for the specified iteration of a pull request.
2175 *
2176 * @param {string} repositoryId - ID or name of the repository.
2177 * @param {number} pullRequestId - ID of the pull request.
2178 * @param {number} iterationId - ID of the iteration from which to get the commits.
2179 * @param {string} project - Project ID or project name
2180 * @param {number} top - Maximum number of commits to return. The maximum number of commits that can be returned per batch is 500.
2181 * @param {number} skip - Number of commits to skip.
2182 */
2183 getPullRequestIterationCommits(repositoryId, pullRequestId, iterationId, project, top, skip) {
2184 return __awaiter(this, void 0, void 0, function* () {
2185 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2186 let routeValues = {
2187 project: project,
2188 repositoryId: repositoryId,
2189 pullRequestId: pullRequestId,
2190 iterationId: iterationId
2191 };
2192 let queryValues = {
2193 top: top,
2194 skip: skip,
2195 };
2196 try {
2197 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "e7ea0883-095f-4926-b5fb-f24691c26fb9", routeValues, queryValues);
2198 let url = verData.requestUrl;
2199 let options = this.createRequestOptions('application/json', verData.apiVersion);
2200 let res;
2201 res = yield this.rest.get(url, options);
2202 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true);
2203 resolve(ret);
2204 }
2205 catch (err) {
2206 reject(err);
2207 }
2208 }));
2209 });
2210 }
2211 /**
2212 * Get the commits for the specified pull request.
2213 *
2214 * @param {string} repositoryId - ID or name of the repository.
2215 * @param {number} pullRequestId - ID of the pull request.
2216 * @param {string} project - Project ID or project name
2217 */
2218 getPullRequestCommits(repositoryId, pullRequestId, project) {
2219 return __awaiter(this, void 0, void 0, function* () {
2220 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2221 let routeValues = {
2222 project: project,
2223 repositoryId: repositoryId,
2224 pullRequestId: pullRequestId
2225 };
2226 try {
2227 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "52823034-34a8-4576-922c-8d8b77e9e4c4", routeValues);
2228 let url = verData.requestUrl;
2229 let options = this.createRequestOptions('application/json', verData.apiVersion);
2230 let res;
2231 res = yield this.rest.get(url, options);
2232 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true);
2233 resolve(ret);
2234 }
2235 catch (err) {
2236 reject(err);
2237 }
2238 }));
2239 });
2240 }
2241 /**
2242 * Retrieve one conflict for a pull request by ID
2243 *
2244 * @param {string} repositoryId
2245 * @param {number} pullRequestId
2246 * @param {number} conflictId
2247 * @param {string} project - Project ID or project name
2248 */
2249 getPullRequestConflict(repositoryId, pullRequestId, conflictId, project) {
2250 return __awaiter(this, void 0, void 0, function* () {
2251 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2252 let routeValues = {
2253 project: project,
2254 repositoryId: repositoryId,
2255 pullRequestId: pullRequestId,
2256 conflictId: conflictId
2257 };
2258 try {
2259 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues);
2260 let url = verData.requestUrl;
2261 let options = this.createRequestOptions('application/json', verData.apiVersion);
2262 let res;
2263 res = yield this.rest.get(url, options);
2264 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false);
2265 resolve(ret);
2266 }
2267 catch (err) {
2268 reject(err);
2269 }
2270 }));
2271 });
2272 }
2273 /**
2274 * Retrieve all conflicts for a pull request
2275 *
2276 * @param {string} repositoryId - The repository of the Pull Request.
2277 * @param {number} pullRequestId - The pull request ID.
2278 * @param {string} project - Project ID or project name
2279 * @param {number} skip - Conflicts to skip.
2280 * @param {number} top - Conflicts to return after skip.
2281 * @param {boolean} includeObsolete - Includes obsolete conflicts.
2282 * @param {boolean} excludeResolved - Excludes conflicts already resolved.
2283 * @param {boolean} onlyResolved - Returns only the conflicts that are resolved.
2284 */
2285 getPullRequestConflicts(repositoryId, pullRequestId, project, skip, top, includeObsolete, excludeResolved, onlyResolved) {
2286 return __awaiter(this, void 0, void 0, function* () {
2287 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2288 let routeValues = {
2289 project: project,
2290 repositoryId: repositoryId,
2291 pullRequestId: pullRequestId
2292 };
2293 let queryValues = {
2294 '$skip': skip,
2295 '$top': top,
2296 includeObsolete: includeObsolete,
2297 excludeResolved: excludeResolved,
2298 onlyResolved: onlyResolved,
2299 };
2300 try {
2301 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues, queryValues);
2302 let url = verData.requestUrl;
2303 let options = this.createRequestOptions('application/json', verData.apiVersion);
2304 let res;
2305 res = yield this.rest.get(url, options);
2306 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, true);
2307 resolve(ret);
2308 }
2309 catch (err) {
2310 reject(err);
2311 }
2312 }));
2313 });
2314 }
2315 /**
2316 * Update merge conflict resolution
2317 *
2318 * @param {GitInterfaces.GitConflict} conflict
2319 * @param {string} repositoryId
2320 * @param {number} pullRequestId
2321 * @param {number} conflictId
2322 * @param {string} project - Project ID or project name
2323 */
2324 updatePullRequestConflict(conflict, repositoryId, pullRequestId, conflictId, project) {
2325 return __awaiter(this, void 0, void 0, function* () {
2326 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2327 let routeValues = {
2328 project: project,
2329 repositoryId: repositoryId,
2330 pullRequestId: pullRequestId,
2331 conflictId: conflictId
2332 };
2333 try {
2334 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues);
2335 let url = verData.requestUrl;
2336 let options = this.createRequestOptions('application/json', verData.apiVersion);
2337 let res;
2338 res = yield this.rest.update(url, conflict, options);
2339 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false);
2340 resolve(ret);
2341 }
2342 catch (err) {
2343 reject(err);
2344 }
2345 }));
2346 });
2347 }
2348 /**
2349 * Update multiple merge conflict resolutions
2350 *
2351 * @param {GitInterfaces.GitConflict[]} conflictUpdates
2352 * @param {string} repositoryId
2353 * @param {number} pullRequestId
2354 * @param {string} project - Project ID or project name
2355 */
2356 updatePullRequestConflicts(conflictUpdates, repositoryId, pullRequestId, project) {
2357 return __awaiter(this, void 0, void 0, function* () {
2358 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2359 let routeValues = {
2360 project: project,
2361 repositoryId: repositoryId,
2362 pullRequestId: pullRequestId
2363 };
2364 try {
2365 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues);
2366 let url = verData.requestUrl;
2367 let options = this.createRequestOptions('application/json', verData.apiVersion);
2368 let res;
2369 res = yield this.rest.update(url, conflictUpdates, options);
2370 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflictUpdateResult, true);
2371 resolve(ret);
2372 }
2373 catch (err) {
2374 reject(err);
2375 }
2376 }));
2377 });
2378 }
2379 /**
2380 * Retrieve the changes made in a pull request between two iterations.
2381 *
2382 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2383 * @param {number} pullRequestId - ID of the pull request.
2384 * @param {number} iterationId - ID of the pull request iteration. <br /> Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch. Allowed values are between 1 and the maximum iteration on this pull request.
2385 * @param {string} project - Project ID or project name
2386 * @param {number} top - Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000.
2387 * @param {number} skip - Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100.
2388 * @param {number} compareTo - ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches
2389 */
2390 getPullRequestIterationChanges(repositoryId, pullRequestId, iterationId, project, top, skip, compareTo) {
2391 return __awaiter(this, void 0, void 0, function* () {
2392 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2393 let routeValues = {
2394 project: project,
2395 repositoryId: repositoryId,
2396 pullRequestId: pullRequestId,
2397 iterationId: iterationId
2398 };
2399 let queryValues = {
2400 '$top': top,
2401 '$skip': skip,
2402 '$compareTo': compareTo,
2403 };
2404 try {
2405 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4216bdcf-b6b1-4d59-8b82-c34cc183fc8b", routeValues, queryValues);
2406 let url = verData.requestUrl;
2407 let options = this.createRequestOptions('application/json', verData.apiVersion);
2408 let res;
2409 res = yield this.rest.get(url, options);
2410 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestIterationChanges, false);
2411 resolve(ret);
2412 }
2413 catch (err) {
2414 reject(err);
2415 }
2416 }));
2417 });
2418 }
2419 /**
2420 * Get the specified iteration for a pull request.
2421 *
2422 * @param {string} repositoryId - ID or name of the repository.
2423 * @param {number} pullRequestId - ID of the pull request.
2424 * @param {number} iterationId - ID of the pull request iteration to return.
2425 * @param {string} project - Project ID or project name
2426 */
2427 getPullRequestIteration(repositoryId, pullRequestId, iterationId, project) {
2428 return __awaiter(this, void 0, void 0, function* () {
2429 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2430 let routeValues = {
2431 project: project,
2432 repositoryId: repositoryId,
2433 pullRequestId: pullRequestId,
2434 iterationId: iterationId
2435 };
2436 try {
2437 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d43911ee-6958-46b0-a42b-8445b8a0d004", routeValues);
2438 let url = verData.requestUrl;
2439 let options = this.createRequestOptions('application/json', verData.apiVersion);
2440 let res;
2441 res = yield this.rest.get(url, options);
2442 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestIteration, false);
2443 resolve(ret);
2444 }
2445 catch (err) {
2446 reject(err);
2447 }
2448 }));
2449 });
2450 }
2451 /**
2452 * Get the list of iterations for the specified pull request.
2453 *
2454 * @param {string} repositoryId - ID or name of the repository.
2455 * @param {number} pullRequestId - ID of the pull request.
2456 * @param {string} project - Project ID or project name
2457 * @param {boolean} includeCommits - If true, include the commits associated with each iteration in the response.
2458 */
2459 getPullRequestIterations(repositoryId, pullRequestId, project, includeCommits) {
2460 return __awaiter(this, void 0, void 0, function* () {
2461 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2462 let routeValues = {
2463 project: project,
2464 repositoryId: repositoryId,
2465 pullRequestId: pullRequestId
2466 };
2467 let queryValues = {
2468 includeCommits: includeCommits,
2469 };
2470 try {
2471 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d43911ee-6958-46b0-a42b-8445b8a0d004", routeValues, queryValues);
2472 let url = verData.requestUrl;
2473 let options = this.createRequestOptions('application/json', verData.apiVersion);
2474 let res;
2475 res = yield this.rest.get(url, options);
2476 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestIteration, true);
2477 resolve(ret);
2478 }
2479 catch (err) {
2480 reject(err);
2481 }
2482 }));
2483 });
2484 }
2485 /**
2486 * Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body.
2487 *
2488 * @param {GitInterfaces.GitPullRequestStatus} status - Pull request status to create.
2489 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2490 * @param {number} pullRequestId - ID of the pull request.
2491 * @param {number} iterationId - ID of the pull request iteration.
2492 * @param {string} project - Project ID or project name
2493 */
2494 createPullRequestIterationStatus(status, repositoryId, pullRequestId, iterationId, project) {
2495 return __awaiter(this, void 0, void 0, function* () {
2496 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2497 let routeValues = {
2498 project: project,
2499 repositoryId: repositoryId,
2500 pullRequestId: pullRequestId,
2501 iterationId: iterationId
2502 };
2503 try {
2504 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues);
2505 let url = verData.requestUrl;
2506 let options = this.createRequestOptions('application/json', verData.apiVersion);
2507 let res;
2508 res = yield this.rest.create(url, status, options);
2509 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false);
2510 resolve(ret);
2511 }
2512 catch (err) {
2513 reject(err);
2514 }
2515 }));
2516 });
2517 }
2518 /**
2519 * Delete pull request iteration status.
2520 *
2521 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2522 * @param {number} pullRequestId - ID of the pull request.
2523 * @param {number} iterationId - ID of the pull request iteration.
2524 * @param {number} statusId - ID of the pull request status.
2525 * @param {string} project - Project ID or project name
2526 */
2527 deletePullRequestIterationStatus(repositoryId, pullRequestId, iterationId, statusId, project) {
2528 return __awaiter(this, void 0, void 0, function* () {
2529 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2530 let routeValues = {
2531 project: project,
2532 repositoryId: repositoryId,
2533 pullRequestId: pullRequestId,
2534 iterationId: iterationId,
2535 statusId: statusId
2536 };
2537 try {
2538 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues);
2539 let url = verData.requestUrl;
2540 let options = this.createRequestOptions('application/json', verData.apiVersion);
2541 let res;
2542 res = yield this.rest.del(url, options);
2543 let ret = this.formatResponse(res.result, null, false);
2544 resolve(ret);
2545 }
2546 catch (err) {
2547 reject(err);
2548 }
2549 }));
2550 });
2551 }
2552 /**
2553 * Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations.
2554 *
2555 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2556 * @param {number} pullRequestId - ID of the pull request.
2557 * @param {number} iterationId - ID of the pull request iteration.
2558 * @param {number} statusId - ID of the pull request status.
2559 * @param {string} project - Project ID or project name
2560 */
2561 getPullRequestIterationStatus(repositoryId, pullRequestId, iterationId, statusId, project) {
2562 return __awaiter(this, void 0, void 0, function* () {
2563 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2564 let routeValues = {
2565 project: project,
2566 repositoryId: repositoryId,
2567 pullRequestId: pullRequestId,
2568 iterationId: iterationId,
2569 statusId: statusId
2570 };
2571 try {
2572 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues);
2573 let url = verData.requestUrl;
2574 let options = this.createRequestOptions('application/json', verData.apiVersion);
2575 let res;
2576 res = yield this.rest.get(url, options);
2577 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false);
2578 resolve(ret);
2579 }
2580 catch (err) {
2581 reject(err);
2582 }
2583 }));
2584 });
2585 }
2586 /**
2587 * Get all the statuses associated with a pull request iteration.
2588 *
2589 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2590 * @param {number} pullRequestId - ID of the pull request.
2591 * @param {number} iterationId - ID of the pull request iteration.
2592 * @param {string} project - Project ID or project name
2593 */
2594 getPullRequestIterationStatuses(repositoryId, pullRequestId, iterationId, project) {
2595 return __awaiter(this, void 0, void 0, function* () {
2596 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2597 let routeValues = {
2598 project: project,
2599 repositoryId: repositoryId,
2600 pullRequestId: pullRequestId,
2601 iterationId: iterationId
2602 };
2603 try {
2604 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues);
2605 let url = verData.requestUrl;
2606 let options = this.createRequestOptions('application/json', verData.apiVersion);
2607 let res;
2608 res = yield this.rest.get(url, options);
2609 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, true);
2610 resolve(ret);
2611 }
2612 catch (err) {
2613 reject(err);
2614 }
2615 }));
2616 });
2617 }
2618 /**
2619 * Update pull request iteration statuses collection. The only supported operation type is `remove`.
2620 *
2621 * @param {VSSInterfaces.JsonPatchDocument} patchDocument - Operations to apply to the pull request statuses in JSON Patch format.
2622 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2623 * @param {number} pullRequestId - ID of the pull request.
2624 * @param {number} iterationId - ID of the pull request iteration.
2625 * @param {string} project - Project ID or project name
2626 */
2627 updatePullRequestIterationStatuses(customHeaders, patchDocument, repositoryId, pullRequestId, iterationId, project) {
2628 return __awaiter(this, void 0, void 0, function* () {
2629 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2630 let routeValues = {
2631 project: project,
2632 repositoryId: repositoryId,
2633 pullRequestId: pullRequestId,
2634 iterationId: iterationId
2635 };
2636 customHeaders = customHeaders || {};
2637 customHeaders["Content-Type"] = "application/json-patch+json";
2638 try {
2639 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues);
2640 let url = verData.requestUrl;
2641 let options = this.createRequestOptions('application/json', verData.apiVersion);
2642 options.additionalHeaders = customHeaders;
2643 let res;
2644 res = yield this.rest.update(url, patchDocument, options);
2645 let ret = this.formatResponse(res.result, null, false);
2646 resolve(ret);
2647 }
2648 catch (err) {
2649 reject(err);
2650 }
2651 }));
2652 });
2653 }
2654 /**
2655 * Create a tag (if that does not exists yet) and add that as a label (tag) for a specified pull request. The only required field is the name of the new label (tag).
2656 *
2657 * @param {TfsCoreInterfaces.WebApiCreateTagRequestData} label - Label to assign to the pull request.
2658 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2659 * @param {number} pullRequestId - ID of the pull request.
2660 * @param {string} project - Project ID or project name
2661 * @param {string} projectId - Project ID or project name.
2662 */
2663 createPullRequestLabel(label, repositoryId, pullRequestId, project, projectId) {
2664 return __awaiter(this, void 0, void 0, function* () {
2665 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2666 let routeValues = {
2667 project: project,
2668 repositoryId: repositoryId,
2669 pullRequestId: pullRequestId
2670 };
2671 let queryValues = {
2672 projectId: projectId,
2673 };
2674 try {
2675 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues);
2676 let url = verData.requestUrl;
2677 let options = this.createRequestOptions('application/json', verData.apiVersion);
2678 let res;
2679 res = yield this.rest.create(url, label, options);
2680 let ret = this.formatResponse(res.result, null, false);
2681 resolve(ret);
2682 }
2683 catch (err) {
2684 reject(err);
2685 }
2686 }));
2687 });
2688 }
2689 /**
2690 * Removes a label (tag) from the set of those assigned to the pull request. The tag itself will not be deleted.
2691 *
2692 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2693 * @param {number} pullRequestId - ID of the pull request.
2694 * @param {string} labelIdOrName - The name or ID of the label requested.
2695 * @param {string} project - Project ID or project name
2696 * @param {string} projectId - Project ID or project name.
2697 */
2698 deletePullRequestLabels(repositoryId, pullRequestId, labelIdOrName, project, projectId) {
2699 return __awaiter(this, void 0, void 0, function* () {
2700 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2701 let routeValues = {
2702 project: project,
2703 repositoryId: repositoryId,
2704 pullRequestId: pullRequestId,
2705 labelIdOrName: labelIdOrName
2706 };
2707 let queryValues = {
2708 projectId: projectId,
2709 };
2710 try {
2711 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues);
2712 let url = verData.requestUrl;
2713 let options = this.createRequestOptions('application/json', verData.apiVersion);
2714 let res;
2715 res = yield this.rest.del(url, options);
2716 let ret = this.formatResponse(res.result, null, false);
2717 resolve(ret);
2718 }
2719 catch (err) {
2720 reject(err);
2721 }
2722 }));
2723 });
2724 }
2725 /**
2726 * Retrieves a single label (tag) that has been assigned to a pull request.
2727 *
2728 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2729 * @param {number} pullRequestId - ID of the pull request.
2730 * @param {string} labelIdOrName - The name or ID of the label requested.
2731 * @param {string} project - Project ID or project name
2732 * @param {string} projectId - Project ID or project name.
2733 */
2734 getPullRequestLabel(repositoryId, pullRequestId, labelIdOrName, project, projectId) {
2735 return __awaiter(this, void 0, void 0, function* () {
2736 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2737 let routeValues = {
2738 project: project,
2739 repositoryId: repositoryId,
2740 pullRequestId: pullRequestId,
2741 labelIdOrName: labelIdOrName
2742 };
2743 let queryValues = {
2744 projectId: projectId,
2745 };
2746 try {
2747 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues);
2748 let url = verData.requestUrl;
2749 let options = this.createRequestOptions('application/json', verData.apiVersion);
2750 let res;
2751 res = yield this.rest.get(url, options);
2752 let ret = this.formatResponse(res.result, null, false);
2753 resolve(ret);
2754 }
2755 catch (err) {
2756 reject(err);
2757 }
2758 }));
2759 });
2760 }
2761 /**
2762 * Get all the labels (tags) assigned to a pull request.
2763 *
2764 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2765 * @param {number} pullRequestId - ID of the pull request.
2766 * @param {string} project - Project ID or project name
2767 * @param {string} projectId - Project ID or project name.
2768 */
2769 getPullRequestLabels(repositoryId, pullRequestId, project, projectId) {
2770 return __awaiter(this, void 0, void 0, function* () {
2771 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2772 let routeValues = {
2773 project: project,
2774 repositoryId: repositoryId,
2775 pullRequestId: pullRequestId
2776 };
2777 let queryValues = {
2778 projectId: projectId,
2779 };
2780 try {
2781 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues);
2782 let url = verData.requestUrl;
2783 let options = this.createRequestOptions('application/json', verData.apiVersion);
2784 let res;
2785 res = yield this.rest.get(url, options);
2786 let ret = this.formatResponse(res.result, null, true);
2787 resolve(ret);
2788 }
2789 catch (err) {
2790 reject(err);
2791 }
2792 }));
2793 });
2794 }
2795 /**
2796 * Get external properties of the pull request.
2797 *
2798 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2799 * @param {number} pullRequestId - ID of the pull request.
2800 * @param {string} project - Project ID or project name
2801 */
2802 getPullRequestProperties(repositoryId, pullRequestId, project) {
2803 return __awaiter(this, void 0, void 0, function* () {
2804 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2805 let routeValues = {
2806 project: project,
2807 repositoryId: repositoryId,
2808 pullRequestId: pullRequestId
2809 };
2810 try {
2811 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "48a52185-5b9e-4736-9dc1-bb1e2feac80b", routeValues);
2812 let url = verData.requestUrl;
2813 let options = this.createRequestOptions('application/json', verData.apiVersion);
2814 let res;
2815 res = yield this.rest.get(url, options);
2816 let ret = this.formatResponse(res.result, null, false);
2817 resolve(ret);
2818 }
2819 catch (err) {
2820 reject(err);
2821 }
2822 }));
2823 });
2824 }
2825 /**
2826 * Create or update pull request external properties. The patch operation can be `add`, `replace` or `remove`. For `add` operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For `replace` operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For `remove` operation, the path cannot be empty. If the path does not exist, no action will be performed.
2827 *
2828 * @param {VSSInterfaces.JsonPatchDocument} patchDocument - Properties to add, replace or remove in JSON Patch format.
2829 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
2830 * @param {number} pullRequestId - ID of the pull request.
2831 * @param {string} project - Project ID or project name
2832 */
2833 updatePullRequestProperties(customHeaders, patchDocument, repositoryId, pullRequestId, project) {
2834 return __awaiter(this, void 0, void 0, function* () {
2835 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2836 let routeValues = {
2837 project: project,
2838 repositoryId: repositoryId,
2839 pullRequestId: pullRequestId
2840 };
2841 customHeaders = customHeaders || {};
2842 customHeaders["Content-Type"] = "application/json-patch+json";
2843 try {
2844 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "48a52185-5b9e-4736-9dc1-bb1e2feac80b", routeValues);
2845 let url = verData.requestUrl;
2846 let options = this.createRequestOptions('application/json', verData.apiVersion);
2847 options.additionalHeaders = customHeaders;
2848 let res;
2849 res = yield this.rest.update(url, patchDocument, options);
2850 let ret = this.formatResponse(res.result, null, false);
2851 resolve(ret);
2852 }
2853 catch (err) {
2854 reject(err);
2855 }
2856 }));
2857 });
2858 }
2859 /**
2860 * This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests.
2861 *
2862 * @param {GitInterfaces.GitPullRequestQuery} queries - The list of queries to perform.
2863 * @param {string} repositoryId - ID of the repository.
2864 * @param {string} project - Project ID or project name
2865 */
2866 getPullRequestQuery(queries, repositoryId, project) {
2867 return __awaiter(this, void 0, void 0, function* () {
2868 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2869 let routeValues = {
2870 project: project,
2871 repositoryId: repositoryId
2872 };
2873 try {
2874 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b3a6eebe-9cf0-49ea-b6cb-1a4c5f5007b0", routeValues);
2875 let url = verData.requestUrl;
2876 let options = this.createRequestOptions('application/json', verData.apiVersion);
2877 let res;
2878 res = yield this.rest.create(url, queries, options);
2879 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestQuery, false);
2880 resolve(ret);
2881 }
2882 catch (err) {
2883 reject(err);
2884 }
2885 }));
2886 });
2887 }
2888 /**
2889 * Add a reviewer to a pull request or cast a vote.
2890 *
2891 * @param {GitInterfaces.IdentityRefWithVote} reviewer - Reviewer's vote.<br />If the reviewer's ID is included here, it must match the reviewerID parameter.<br />Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero.
2892 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2893 * @param {number} pullRequestId - ID of the pull request.
2894 * @param {string} reviewerId - ID of the reviewer.
2895 * @param {string} project - Project ID or project name
2896 */
2897 createPullRequestReviewer(reviewer, repositoryId, pullRequestId, reviewerId, project) {
2898 return __awaiter(this, void 0, void 0, function* () {
2899 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2900 let routeValues = {
2901 project: project,
2902 repositoryId: repositoryId,
2903 pullRequestId: pullRequestId,
2904 reviewerId: reviewerId
2905 };
2906 try {
2907 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
2908 let url = verData.requestUrl;
2909 let options = this.createRequestOptions('application/json', verData.apiVersion);
2910 let res;
2911 res = yield this.rest.replace(url, reviewer, options);
2912 let ret = this.formatResponse(res.result, null, false);
2913 resolve(ret);
2914 }
2915 catch (err) {
2916 reject(err);
2917 }
2918 }));
2919 });
2920 }
2921 /**
2922 * Add reviewers to a pull request.
2923 *
2924 * @param {VSSInterfaces.IdentityRef[]} reviewers - Reviewers to add to the pull request.
2925 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2926 * @param {number} pullRequestId - ID of the pull request.
2927 * @param {string} project - Project ID or project name
2928 */
2929 createPullRequestReviewers(reviewers, repositoryId, pullRequestId, project) {
2930 return __awaiter(this, void 0, void 0, function* () {
2931 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2932 let routeValues = {
2933 project: project,
2934 repositoryId: repositoryId,
2935 pullRequestId: pullRequestId
2936 };
2937 try {
2938 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
2939 let url = verData.requestUrl;
2940 let options = this.createRequestOptions('application/json', verData.apiVersion);
2941 let res;
2942 res = yield this.rest.create(url, reviewers, options);
2943 let ret = this.formatResponse(res.result, null, true);
2944 resolve(ret);
2945 }
2946 catch (err) {
2947 reject(err);
2948 }
2949 }));
2950 });
2951 }
2952 /**
2953 * Add an unmaterialized identity to the reviewers of a pull request.
2954 *
2955 * @param {GitInterfaces.IdentityRefWithVote} reviewer - Reviewer to add to the pull request.
2956 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2957 * @param {number} pullRequestId - ID of the pull request.
2958 * @param {string} project - Project ID or project name
2959 */
2960 createUnmaterializedPullRequestReviewer(reviewer, repositoryId, pullRequestId, project) {
2961 return __awaiter(this, void 0, void 0, function* () {
2962 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2963 let routeValues = {
2964 project: project,
2965 repositoryId: repositoryId,
2966 pullRequestId: pullRequestId
2967 };
2968 try {
2969 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
2970 let url = verData.requestUrl;
2971 let options = this.createRequestOptions('application/json', verData.apiVersion);
2972 let res;
2973 res = yield this.rest.replace(url, reviewer, options);
2974 let ret = this.formatResponse(res.result, null, false);
2975 resolve(ret);
2976 }
2977 catch (err) {
2978 reject(err);
2979 }
2980 }));
2981 });
2982 }
2983 /**
2984 * Remove a reviewer from a pull request.
2985 *
2986 * @param {string} repositoryId - The repository ID of the pull request's target branch.
2987 * @param {number} pullRequestId - ID of the pull request.
2988 * @param {string} reviewerId - ID of the reviewer to remove.
2989 * @param {string} project - Project ID or project name
2990 */
2991 deletePullRequestReviewer(repositoryId, pullRequestId, reviewerId, project) {
2992 return __awaiter(this, void 0, void 0, function* () {
2993 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2994 let routeValues = {
2995 project: project,
2996 repositoryId: repositoryId,
2997 pullRequestId: pullRequestId,
2998 reviewerId: reviewerId
2999 };
3000 try {
3001 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
3002 let url = verData.requestUrl;
3003 let options = this.createRequestOptions('application/json', verData.apiVersion);
3004 let res;
3005 res = yield this.rest.del(url, options);
3006 let ret = this.formatResponse(res.result, null, false);
3007 resolve(ret);
3008 }
3009 catch (err) {
3010 reject(err);
3011 }
3012 }));
3013 });
3014 }
3015 /**
3016 * Retrieve information about a particular reviewer on a pull request
3017 *
3018 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3019 * @param {number} pullRequestId - ID of the pull request.
3020 * @param {string} reviewerId - ID of the reviewer.
3021 * @param {string} project - Project ID or project name
3022 */
3023 getPullRequestReviewer(repositoryId, pullRequestId, reviewerId, project) {
3024 return __awaiter(this, void 0, void 0, function* () {
3025 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3026 let routeValues = {
3027 project: project,
3028 repositoryId: repositoryId,
3029 pullRequestId: pullRequestId,
3030 reviewerId: reviewerId
3031 };
3032 try {
3033 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
3034 let url = verData.requestUrl;
3035 let options = this.createRequestOptions('application/json', verData.apiVersion);
3036 let res;
3037 res = yield this.rest.get(url, options);
3038 let ret = this.formatResponse(res.result, null, false);
3039 resolve(ret);
3040 }
3041 catch (err) {
3042 reject(err);
3043 }
3044 }));
3045 });
3046 }
3047 /**
3048 * Retrieve the reviewers for a pull request
3049 *
3050 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3051 * @param {number} pullRequestId - ID of the pull request.
3052 * @param {string} project - Project ID or project name
3053 */
3054 getPullRequestReviewers(repositoryId, pullRequestId, project) {
3055 return __awaiter(this, void 0, void 0, function* () {
3056 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3057 let routeValues = {
3058 project: project,
3059 repositoryId: repositoryId,
3060 pullRequestId: pullRequestId
3061 };
3062 try {
3063 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
3064 let url = verData.requestUrl;
3065 let options = this.createRequestOptions('application/json', verData.apiVersion);
3066 let res;
3067 res = yield this.rest.get(url, options);
3068 let ret = this.formatResponse(res.result, null, true);
3069 resolve(ret);
3070 }
3071 catch (err) {
3072 reject(err);
3073 }
3074 }));
3075 });
3076 }
3077 /**
3078 * Edit a reviewer entry. These fields are patchable: isFlagged, hasDeclined
3079 *
3080 * @param {GitInterfaces.IdentityRefWithVote} reviewer - Reviewer data.<br />If the reviewer's ID is included here, it must match the reviewerID parameter.
3081 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3082 * @param {number} pullRequestId - ID of the pull request.
3083 * @param {string} reviewerId - ID of the reviewer.
3084 * @param {string} project - Project ID or project name
3085 */
3086 updatePullRequestReviewer(reviewer, repositoryId, pullRequestId, reviewerId, project) {
3087 return __awaiter(this, void 0, void 0, function* () {
3088 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3089 let routeValues = {
3090 project: project,
3091 repositoryId: repositoryId,
3092 pullRequestId: pullRequestId,
3093 reviewerId: reviewerId
3094 };
3095 try {
3096 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
3097 let url = verData.requestUrl;
3098 let options = this.createRequestOptions('application/json', verData.apiVersion);
3099 let res;
3100 res = yield this.rest.update(url, reviewer, options);
3101 let ret = this.formatResponse(res.result, null, false);
3102 resolve(ret);
3103 }
3104 catch (err) {
3105 reject(err);
3106 }
3107 }));
3108 });
3109 }
3110 /**
3111 * Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names.
3112 *
3113 * @param {GitInterfaces.IdentityRefWithVote[]} patchVotes - IDs of the reviewers whose votes will be reset to zero
3114 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3115 * @param {number} pullRequestId - ID of the pull request
3116 * @param {string} project - Project ID or project name
3117 */
3118 updatePullRequestReviewers(patchVotes, repositoryId, pullRequestId, project) {
3119 return __awaiter(this, void 0, void 0, function* () {
3120 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3121 let routeValues = {
3122 project: project,
3123 repositoryId: repositoryId,
3124 pullRequestId: pullRequestId
3125 };
3126 try {
3127 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues);
3128 let url = verData.requestUrl;
3129 let options = this.createRequestOptions('application/json', verData.apiVersion);
3130 let res;
3131 res = yield this.rest.update(url, patchVotes, options);
3132 let ret = this.formatResponse(res.result, null, false);
3133 resolve(ret);
3134 }
3135 catch (err) {
3136 reject(err);
3137 }
3138 }));
3139 });
3140 }
3141 /**
3142 * Retrieve a pull request.
3143 *
3144 * @param {number} pullRequestId - The ID of the pull request to retrieve.
3145 * @param {string} project - Project ID or project name
3146 */
3147 getPullRequestById(pullRequestId, project) {
3148 return __awaiter(this, void 0, void 0, function* () {
3149 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3150 let routeValues = {
3151 project: project,
3152 pullRequestId: pullRequestId
3153 };
3154 try {
3155 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "01a46dea-7d46-4d40-bc84-319e7c260d99", routeValues);
3156 let url = verData.requestUrl;
3157 let options = this.createRequestOptions('application/json', verData.apiVersion);
3158 let res;
3159 res = yield this.rest.get(url, options);
3160 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false);
3161 resolve(ret);
3162 }
3163 catch (err) {
3164 reject(err);
3165 }
3166 }));
3167 });
3168 }
3169 /**
3170 * Retrieve all pull requests matching a specified criteria.
3171 *
3172 * @param {string} project - Project ID or project name
3173 * @param {GitInterfaces.GitPullRequestSearchCriteria} searchCriteria - Pull requests will be returned that match this search criteria.
3174 * @param {number} maxCommentLength - Not used.
3175 * @param {number} skip - The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
3176 * @param {number} top - The number of pull requests to retrieve.
3177 */
3178 getPullRequestsByProject(project, searchCriteria, maxCommentLength, skip, top) {
3179 return __awaiter(this, void 0, void 0, function* () {
3180 if (searchCriteria == null) {
3181 throw new TypeError('searchCriteria can not be null or undefined');
3182 }
3183 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3184 let routeValues = {
3185 project: project
3186 };
3187 let queryValues = {
3188 searchCriteria: searchCriteria,
3189 maxCommentLength: maxCommentLength,
3190 '$skip': skip,
3191 '$top': top,
3192 };
3193 try {
3194 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "a5d28130-9cd2-40fa-9f08-902e7daa9efb", routeValues, queryValues);
3195 let url = verData.requestUrl;
3196 let options = this.createRequestOptions('application/json', verData.apiVersion);
3197 let res;
3198 res = yield this.rest.get(url, options);
3199 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, true);
3200 resolve(ret);
3201 }
3202 catch (err) {
3203 reject(err);
3204 }
3205 }));
3206 });
3207 }
3208 /**
3209 * Create a pull request.
3210 *
3211 * @param {GitInterfaces.GitPullRequest} gitPullRequestToCreate - The pull request to create.
3212 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3213 * @param {string} project - Project ID or project name
3214 * @param {boolean} supportsIterations - If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed.
3215 */
3216 createPullRequest(gitPullRequestToCreate, repositoryId, project, supportsIterations) {
3217 return __awaiter(this, void 0, void 0, function* () {
3218 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3219 let routeValues = {
3220 project: project,
3221 repositoryId: repositoryId
3222 };
3223 let queryValues = {
3224 supportsIterations: supportsIterations,
3225 };
3226 try {
3227 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues, queryValues);
3228 let url = verData.requestUrl;
3229 let options = this.createRequestOptions('application/json', verData.apiVersion);
3230 let res;
3231 res = yield this.rest.create(url, gitPullRequestToCreate, options);
3232 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false);
3233 resolve(ret);
3234 }
3235 catch (err) {
3236 reject(err);
3237 }
3238 }));
3239 });
3240 }
3241 /**
3242 * Retrieve a pull request.
3243 *
3244 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3245 * @param {number} pullRequestId - The ID of the pull request to retrieve.
3246 * @param {string} project - Project ID or project name
3247 * @param {number} maxCommentLength - Not used.
3248 * @param {number} skip - Not used.
3249 * @param {number} top - Not used.
3250 * @param {boolean} includeCommits - If true, the pull request will be returned with the associated commits.
3251 * @param {boolean} includeWorkItemRefs - If true, the pull request will be returned with the associated work item references.
3252 */
3253 getPullRequest(repositoryId, pullRequestId, project, maxCommentLength, skip, top, includeCommits, includeWorkItemRefs) {
3254 return __awaiter(this, void 0, void 0, function* () {
3255 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3256 let routeValues = {
3257 project: project,
3258 repositoryId: repositoryId,
3259 pullRequestId: pullRequestId
3260 };
3261 let queryValues = {
3262 maxCommentLength: maxCommentLength,
3263 '$skip': skip,
3264 '$top': top,
3265 includeCommits: includeCommits,
3266 includeWorkItemRefs: includeWorkItemRefs,
3267 };
3268 try {
3269 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues, queryValues);
3270 let url = verData.requestUrl;
3271 let options = this.createRequestOptions('application/json', verData.apiVersion);
3272 let res;
3273 res = yield this.rest.get(url, options);
3274 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false);
3275 resolve(ret);
3276 }
3277 catch (err) {
3278 reject(err);
3279 }
3280 }));
3281 });
3282 }
3283 /**
3284 * Retrieve all pull requests matching a specified criteria.
3285 *
3286 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3287 * @param {GitInterfaces.GitPullRequestSearchCriteria} searchCriteria - Pull requests will be returned that match this search criteria.
3288 * @param {string} project - Project ID or project name
3289 * @param {number} maxCommentLength - Not used.
3290 * @param {number} skip - The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100.
3291 * @param {number} top - The number of pull requests to retrieve.
3292 */
3293 getPullRequests(repositoryId, searchCriteria, project, maxCommentLength, skip, top) {
3294 return __awaiter(this, void 0, void 0, function* () {
3295 if (searchCriteria == null) {
3296 throw new TypeError('searchCriteria can not be null or undefined');
3297 }
3298 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3299 let routeValues = {
3300 project: project,
3301 repositoryId: repositoryId
3302 };
3303 let queryValues = {
3304 searchCriteria: searchCriteria,
3305 maxCommentLength: maxCommentLength,
3306 '$skip': skip,
3307 '$top': top,
3308 };
3309 try {
3310 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues, queryValues);
3311 let url = verData.requestUrl;
3312 let options = this.createRequestOptions('application/json', verData.apiVersion);
3313 let res;
3314 res = yield this.rest.get(url, options);
3315 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, true);
3316 resolve(ret);
3317 }
3318 catch (err) {
3319 reject(err);
3320 }
3321 }));
3322 });
3323 }
3324 /**
3325 * Update a pull request
3326 *
3327 * @param {GitInterfaces.GitPullRequest} gitPullRequestToUpdate - The pull request content that should be updated.
3328 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3329 * @param {number} pullRequestId - ID of the pull request to update.
3330 * @param {string} project - Project ID or project name
3331 */
3332 updatePullRequest(gitPullRequestToUpdate, repositoryId, pullRequestId, project) {
3333 return __awaiter(this, void 0, void 0, function* () {
3334 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3335 let routeValues = {
3336 project: project,
3337 repositoryId: repositoryId,
3338 pullRequestId: pullRequestId
3339 };
3340 try {
3341 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues);
3342 let url = verData.requestUrl;
3343 let options = this.createRequestOptions('application/json', verData.apiVersion);
3344 let res;
3345 res = yield this.rest.update(url, gitPullRequestToUpdate, options);
3346 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false);
3347 resolve(ret);
3348 }
3349 catch (err) {
3350 reject(err);
3351 }
3352 }));
3353 });
3354 }
3355 /**
3356 * Sends an e-mail notification about a specific pull request to a set of recipients
3357 *
3358 * @param {GitInterfaces.ShareNotificationContext} userMessage
3359 * @param {string} repositoryId - ID of the git repository.
3360 * @param {number} pullRequestId - ID of the pull request.
3361 * @param {string} project - Project ID or project name
3362 */
3363 sharePullRequest(userMessage, repositoryId, pullRequestId, project) {
3364 return __awaiter(this, void 0, void 0, function* () {
3365 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3366 let routeValues = {
3367 project: project,
3368 repositoryId: repositoryId,
3369 pullRequestId: pullRequestId
3370 };
3371 try {
3372 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "696f3a82-47c9-487f-9117-b9d00972ca84", routeValues);
3373 let url = verData.requestUrl;
3374 let options = this.createRequestOptions('application/json', verData.apiVersion);
3375 let res;
3376 res = yield this.rest.create(url, userMessage, options);
3377 let ret = this.formatResponse(res.result, null, false);
3378 resolve(ret);
3379 }
3380 catch (err) {
3381 reject(err);
3382 }
3383 }));
3384 });
3385 }
3386 /**
3387 * Create a pull request status.
3388 *
3389 * @param {GitInterfaces.GitPullRequestStatus} status - Pull request status to create.
3390 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
3391 * @param {number} pullRequestId - ID of the pull request.
3392 * @param {string} project - Project ID or project name
3393 */
3394 createPullRequestStatus(status, repositoryId, pullRequestId, project) {
3395 return __awaiter(this, void 0, void 0, function* () {
3396 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3397 let routeValues = {
3398 project: project,
3399 repositoryId: repositoryId,
3400 pullRequestId: pullRequestId
3401 };
3402 try {
3403 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues);
3404 let url = verData.requestUrl;
3405 let options = this.createRequestOptions('application/json', verData.apiVersion);
3406 let res;
3407 res = yield this.rest.create(url, status, options);
3408 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false);
3409 resolve(ret);
3410 }
3411 catch (err) {
3412 reject(err);
3413 }
3414 }));
3415 });
3416 }
3417 /**
3418 * Delete pull request status.
3419 *
3420 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
3421 * @param {number} pullRequestId - ID of the pull request.
3422 * @param {number} statusId - ID of the pull request status.
3423 * @param {string} project - Project ID or project name
3424 */
3425 deletePullRequestStatus(repositoryId, pullRequestId, statusId, project) {
3426 return __awaiter(this, void 0, void 0, function* () {
3427 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3428 let routeValues = {
3429 project: project,
3430 repositoryId: repositoryId,
3431 pullRequestId: pullRequestId,
3432 statusId: statusId
3433 };
3434 try {
3435 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues);
3436 let url = verData.requestUrl;
3437 let options = this.createRequestOptions('application/json', verData.apiVersion);
3438 let res;
3439 res = yield this.rest.del(url, options);
3440 let ret = this.formatResponse(res.result, null, false);
3441 resolve(ret);
3442 }
3443 catch (err) {
3444 reject(err);
3445 }
3446 }));
3447 });
3448 }
3449 /**
3450 * Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations.
3451 *
3452 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
3453 * @param {number} pullRequestId - ID of the pull request.
3454 * @param {number} statusId - ID of the pull request status.
3455 * @param {string} project - Project ID or project name
3456 */
3457 getPullRequestStatus(repositoryId, pullRequestId, statusId, project) {
3458 return __awaiter(this, void 0, void 0, function* () {
3459 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3460 let routeValues = {
3461 project: project,
3462 repositoryId: repositoryId,
3463 pullRequestId: pullRequestId,
3464 statusId: statusId
3465 };
3466 try {
3467 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues);
3468 let url = verData.requestUrl;
3469 let options = this.createRequestOptions('application/json', verData.apiVersion);
3470 let res;
3471 res = yield this.rest.get(url, options);
3472 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false);
3473 resolve(ret);
3474 }
3475 catch (err) {
3476 reject(err);
3477 }
3478 }));
3479 });
3480 }
3481 /**
3482 * Get all the statuses associated with a pull request.
3483 *
3484 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
3485 * @param {number} pullRequestId - ID of the pull request.
3486 * @param {string} project - Project ID or project name
3487 */
3488 getPullRequestStatuses(repositoryId, pullRequestId, project) {
3489 return __awaiter(this, void 0, void 0, function* () {
3490 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3491 let routeValues = {
3492 project: project,
3493 repositoryId: repositoryId,
3494 pullRequestId: pullRequestId
3495 };
3496 try {
3497 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues);
3498 let url = verData.requestUrl;
3499 let options = this.createRequestOptions('application/json', verData.apiVersion);
3500 let res;
3501 res = yield this.rest.get(url, options);
3502 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, true);
3503 resolve(ret);
3504 }
3505 catch (err) {
3506 reject(err);
3507 }
3508 }));
3509 });
3510 }
3511 /**
3512 * Update pull request statuses collection. The only supported operation type is `remove`.
3513 *
3514 * @param {VSSInterfaces.JsonPatchDocument} patchDocument - Operations to apply to the pull request statuses in JSON Patch format.
3515 * @param {string} repositoryId - The repository ID of the pull request’s target branch.
3516 * @param {number} pullRequestId - ID of the pull request.
3517 * @param {string} project - Project ID or project name
3518 */
3519 updatePullRequestStatuses(customHeaders, patchDocument, repositoryId, pullRequestId, project) {
3520 return __awaiter(this, void 0, void 0, function* () {
3521 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3522 let routeValues = {
3523 project: project,
3524 repositoryId: repositoryId,
3525 pullRequestId: pullRequestId
3526 };
3527 customHeaders = customHeaders || {};
3528 customHeaders["Content-Type"] = "application/json-patch+json";
3529 try {
3530 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues);
3531 let url = verData.requestUrl;
3532 let options = this.createRequestOptions('application/json', verData.apiVersion);
3533 options.additionalHeaders = customHeaders;
3534 let res;
3535 res = yield this.rest.update(url, patchDocument, options);
3536 let ret = this.formatResponse(res.result, null, false);
3537 resolve(ret);
3538 }
3539 catch (err) {
3540 reject(err);
3541 }
3542 }));
3543 });
3544 }
3545 /**
3546 * Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread).
3547 *
3548 * @param {GitInterfaces.Comment} comment - The comment to create. Comments can be up to 150,000 characters.
3549 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3550 * @param {number} pullRequestId - ID of the pull request.
3551 * @param {number} threadId - ID of the thread that the desired comment is in.
3552 * @param {string} project - Project ID or project name
3553 */
3554 createComment(comment, repositoryId, pullRequestId, threadId, project) {
3555 return __awaiter(this, void 0, void 0, function* () {
3556 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3557 let routeValues = {
3558 project: project,
3559 repositoryId: repositoryId,
3560 pullRequestId: pullRequestId,
3561 threadId: threadId
3562 };
3563 try {
3564 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues);
3565 let url = verData.requestUrl;
3566 let options = this.createRequestOptions('application/json', verData.apiVersion);
3567 let res;
3568 res = yield this.rest.create(url, comment, options);
3569 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, false);
3570 resolve(ret);
3571 }
3572 catch (err) {
3573 reject(err);
3574 }
3575 }));
3576 });
3577 }
3578 /**
3579 * Delete a comment associated with a specific thread in a pull request.
3580 *
3581 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3582 * @param {number} pullRequestId - ID of the pull request.
3583 * @param {number} threadId - ID of the thread that the desired comment is in.
3584 * @param {number} commentId - ID of the comment.
3585 * @param {string} project - Project ID or project name
3586 */
3587 deleteComment(repositoryId, pullRequestId, threadId, commentId, project) {
3588 return __awaiter(this, void 0, void 0, function* () {
3589 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3590 let routeValues = {
3591 project: project,
3592 repositoryId: repositoryId,
3593 pullRequestId: pullRequestId,
3594 threadId: threadId,
3595 commentId: commentId
3596 };
3597 try {
3598 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues);
3599 let url = verData.requestUrl;
3600 let options = this.createRequestOptions('application/json', verData.apiVersion);
3601 let res;
3602 res = yield this.rest.del(url, options);
3603 let ret = this.formatResponse(res.result, null, false);
3604 resolve(ret);
3605 }
3606 catch (err) {
3607 reject(err);
3608 }
3609 }));
3610 });
3611 }
3612 /**
3613 * Retrieve a comment associated with a specific thread in a pull request.
3614 *
3615 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3616 * @param {number} pullRequestId - ID of the pull request.
3617 * @param {number} threadId - ID of the thread that the desired comment is in.
3618 * @param {number} commentId - ID of the comment.
3619 * @param {string} project - Project ID or project name
3620 */
3621 getComment(repositoryId, pullRequestId, threadId, commentId, project) {
3622 return __awaiter(this, void 0, void 0, function* () {
3623 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3624 let routeValues = {
3625 project: project,
3626 repositoryId: repositoryId,
3627 pullRequestId: pullRequestId,
3628 threadId: threadId,
3629 commentId: commentId
3630 };
3631 try {
3632 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues);
3633 let url = verData.requestUrl;
3634 let options = this.createRequestOptions('application/json', verData.apiVersion);
3635 let res;
3636 res = yield this.rest.get(url, options);
3637 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, false);
3638 resolve(ret);
3639 }
3640 catch (err) {
3641 reject(err);
3642 }
3643 }));
3644 });
3645 }
3646 /**
3647 * Retrieve all comments associated with a specific thread in a pull request.
3648 *
3649 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3650 * @param {number} pullRequestId - ID of the pull request.
3651 * @param {number} threadId - ID of the thread.
3652 * @param {string} project - Project ID or project name
3653 */
3654 getComments(repositoryId, pullRequestId, threadId, project) {
3655 return __awaiter(this, void 0, void 0, function* () {
3656 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3657 let routeValues = {
3658 project: project,
3659 repositoryId: repositoryId,
3660 pullRequestId: pullRequestId,
3661 threadId: threadId
3662 };
3663 try {
3664 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues);
3665 let url = verData.requestUrl;
3666 let options = this.createRequestOptions('application/json', verData.apiVersion);
3667 let res;
3668 res = yield this.rest.get(url, options);
3669 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, true);
3670 resolve(ret);
3671 }
3672 catch (err) {
3673 reject(err);
3674 }
3675 }));
3676 });
3677 }
3678 /**
3679 * Update a comment associated with a specific thread in a pull request.
3680 *
3681 * @param {GitInterfaces.Comment} comment - The comment content that should be updated. Comments can be up to 150,000 characters.
3682 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3683 * @param {number} pullRequestId - ID of the pull request.
3684 * @param {number} threadId - ID of the thread that the desired comment is in.
3685 * @param {number} commentId - ID of the comment to update.
3686 * @param {string} project - Project ID or project name
3687 */
3688 updateComment(comment, repositoryId, pullRequestId, threadId, commentId, project) {
3689 return __awaiter(this, void 0, void 0, function* () {
3690 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3691 let routeValues = {
3692 project: project,
3693 repositoryId: repositoryId,
3694 pullRequestId: pullRequestId,
3695 threadId: threadId,
3696 commentId: commentId
3697 };
3698 try {
3699 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues);
3700 let url = verData.requestUrl;
3701 let options = this.createRequestOptions('application/json', verData.apiVersion);
3702 let res;
3703 res = yield this.rest.update(url, comment, options);
3704 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, false);
3705 resolve(ret);
3706 }
3707 catch (err) {
3708 reject(err);
3709 }
3710 }));
3711 });
3712 }
3713 /**
3714 * Create a thread in a pull request.
3715 *
3716 * @param {GitInterfaces.GitPullRequestCommentThread} commentThread - The thread to create. Thread must contain at least one comment.
3717 * @param {string} repositoryId - Repository ID of the pull request's target branch.
3718 * @param {number} pullRequestId - ID of the pull request.
3719 * @param {string} project - Project ID or project name
3720 */
3721 createThread(commentThread, repositoryId, pullRequestId, project) {
3722 return __awaiter(this, void 0, void 0, function* () {
3723 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3724 let routeValues = {
3725 project: project,
3726 repositoryId: repositoryId,
3727 pullRequestId: pullRequestId
3728 };
3729 try {
3730 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues);
3731 let url = verData.requestUrl;
3732 let options = this.createRequestOptions('application/json', verData.apiVersion);
3733 let res;
3734 res = yield this.rest.create(url, commentThread, options);
3735 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, false);
3736 resolve(ret);
3737 }
3738 catch (err) {
3739 reject(err);
3740 }
3741 }));
3742 });
3743 }
3744 /**
3745 * Retrieve a thread in a pull request.
3746 *
3747 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3748 * @param {number} pullRequestId - ID of the pull request.
3749 * @param {number} threadId - ID of the thread.
3750 * @param {string} project - Project ID or project name
3751 * @param {number} iteration - If specified, thread position will be tracked using this iteration as the right side of the diff.
3752 * @param {number} baseIteration - If specified, thread position will be tracked using this iteration as the left side of the diff.
3753 */
3754 getPullRequestThread(repositoryId, pullRequestId, threadId, project, iteration, baseIteration) {
3755 return __awaiter(this, void 0, void 0, function* () {
3756 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3757 let routeValues = {
3758 project: project,
3759 repositoryId: repositoryId,
3760 pullRequestId: pullRequestId,
3761 threadId: threadId
3762 };
3763 let queryValues = {
3764 '$iteration': iteration,
3765 '$baseIteration': baseIteration,
3766 };
3767 try {
3768 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues, queryValues);
3769 let url = verData.requestUrl;
3770 let options = this.createRequestOptions('application/json', verData.apiVersion);
3771 let res;
3772 res = yield this.rest.get(url, options);
3773 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, false);
3774 resolve(ret);
3775 }
3776 catch (err) {
3777 reject(err);
3778 }
3779 }));
3780 });
3781 }
3782 /**
3783 * Retrieve all threads in a pull request.
3784 *
3785 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3786 * @param {number} pullRequestId - ID of the pull request.
3787 * @param {string} project - Project ID or project name
3788 * @param {number} iteration - If specified, thread positions will be tracked using this iteration as the right side of the diff.
3789 * @param {number} baseIteration - If specified, thread positions will be tracked using this iteration as the left side of the diff.
3790 */
3791 getThreads(repositoryId, pullRequestId, project, iteration, baseIteration) {
3792 return __awaiter(this, void 0, void 0, function* () {
3793 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3794 let routeValues = {
3795 project: project,
3796 repositoryId: repositoryId,
3797 pullRequestId: pullRequestId
3798 };
3799 let queryValues = {
3800 '$iteration': iteration,
3801 '$baseIteration': baseIteration,
3802 };
3803 try {
3804 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues, queryValues);
3805 let url = verData.requestUrl;
3806 let options = this.createRequestOptions('application/json', verData.apiVersion);
3807 let res;
3808 res = yield this.rest.get(url, options);
3809 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, true);
3810 resolve(ret);
3811 }
3812 catch (err) {
3813 reject(err);
3814 }
3815 }));
3816 });
3817 }
3818 /**
3819 * Update a thread in a pull request.
3820 *
3821 * @param {GitInterfaces.GitPullRequestCommentThread} commentThread - The thread content that should be updated.
3822 * @param {string} repositoryId - The repository ID of the pull request's target branch.
3823 * @param {number} pullRequestId - ID of the pull request.
3824 * @param {number} threadId - ID of the thread to update.
3825 * @param {string} project - Project ID or project name
3826 */
3827 updateThread(commentThread, repositoryId, pullRequestId, threadId, project) {
3828 return __awaiter(this, void 0, void 0, function* () {
3829 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3830 let routeValues = {
3831 project: project,
3832 repositoryId: repositoryId,
3833 pullRequestId: pullRequestId,
3834 threadId: threadId
3835 };
3836 try {
3837 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues);
3838 let url = verData.requestUrl;
3839 let options = this.createRequestOptions('application/json', verData.apiVersion);
3840 let res;
3841 res = yield this.rest.update(url, commentThread, options);
3842 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, false);
3843 resolve(ret);
3844 }
3845 catch (err) {
3846 reject(err);
3847 }
3848 }));
3849 });
3850 }
3851 /**
3852 * Retrieve a list of work items associated with a pull request.
3853 *
3854 * @param {string} repositoryId - ID or name of the repository.
3855 * @param {number} pullRequestId - ID of the pull request.
3856 * @param {string} project - Project ID or project name
3857 */
3858 getPullRequestWorkItemRefs(repositoryId, pullRequestId, project) {
3859 return __awaiter(this, void 0, void 0, function* () {
3860 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3861 let routeValues = {
3862 project: project,
3863 repositoryId: repositoryId,
3864 pullRequestId: pullRequestId
3865 };
3866 try {
3867 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "0a637fcc-5370-4ce8-b0e8-98091f5f9482", routeValues);
3868 let url = verData.requestUrl;
3869 let options = this.createRequestOptions('application/json', verData.apiVersion);
3870 let res;
3871 res = yield this.rest.get(url, options);
3872 let ret = this.formatResponse(res.result, null, true);
3873 resolve(ret);
3874 }
3875 catch (err) {
3876 reject(err);
3877 }
3878 }));
3879 });
3880 }
3881 /**
3882 * Push changes to the repository.
3883 *
3884 * @param {GitInterfaces.GitPush} push
3885 * @param {string} repositoryId - The name or ID of the repository.
3886 * @param {string} project - Project ID or project name
3887 */
3888 createPush(push, repositoryId, project) {
3889 return __awaiter(this, void 0, void 0, function* () {
3890 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3891 let routeValues = {
3892 project: project,
3893 repositoryId: repositoryId
3894 };
3895 try {
3896 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "git", "ea98d07b-3c87-4971-8ede-a613694ffb55", routeValues);
3897 let url = verData.requestUrl;
3898 let options = this.createRequestOptions('application/json', verData.apiVersion);
3899 let res;
3900 res = yield this.rest.create(url, push, options);
3901 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPush, false);
3902 resolve(ret);
3903 }
3904 catch (err) {
3905 reject(err);
3906 }
3907 }));
3908 });
3909 }
3910 /**
3911 * Retrieves a particular push.
3912 *
3913 * @param {string} repositoryId - The name or ID of the repository.
3914 * @param {number} pushId - ID of the push.
3915 * @param {string} project - Project ID or project name
3916 * @param {number} includeCommits - The number of commits to include in the result.
3917 * @param {boolean} includeRefUpdates - If true, include the list of refs that were updated by the push.
3918 */
3919 getPush(repositoryId, pushId, project, includeCommits, includeRefUpdates) {
3920 return __awaiter(this, void 0, void 0, function* () {
3921 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3922 let routeValues = {
3923 project: project,
3924 repositoryId: repositoryId,
3925 pushId: pushId
3926 };
3927 let queryValues = {
3928 includeCommits: includeCommits,
3929 includeRefUpdates: includeRefUpdates,
3930 };
3931 try {
3932 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "git", "ea98d07b-3c87-4971-8ede-a613694ffb55", routeValues, queryValues);
3933 let url = verData.requestUrl;
3934 let options = this.createRequestOptions('application/json', verData.apiVersion);
3935 let res;
3936 res = yield this.rest.get(url, options);
3937 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPush, false);
3938 resolve(ret);
3939 }
3940 catch (err) {
3941 reject(err);
3942 }
3943 }));
3944 });
3945 }
3946 /**
3947 * Retrieves pushes associated with the specified repository.
3948 *
3949 * @param {string} repositoryId - The name or ID of the repository.
3950 * @param {string} project - Project ID or project name
3951 * @param {number} skip - Number of pushes to skip.
3952 * @param {number} top - Number of pushes to return.
3953 * @param {GitInterfaces.GitPushSearchCriteria} searchCriteria - Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references.
3954 */
3955 getPushes(repositoryId, project, skip, top, searchCriteria) {
3956 return __awaiter(this, void 0, void 0, function* () {
3957 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3958 let routeValues = {
3959 project: project,
3960 repositoryId: repositoryId
3961 };
3962 let queryValues = {
3963 '$skip': skip,
3964 '$top': top,
3965 searchCriteria: searchCriteria,
3966 };
3967 try {
3968 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "git", "ea98d07b-3c87-4971-8ede-a613694ffb55", routeValues, queryValues);
3969 let url = verData.requestUrl;
3970 let options = this.createRequestOptions('application/json', verData.apiVersion);
3971 let res;
3972 res = yield this.rest.get(url, options);
3973 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPush, true);
3974 resolve(ret);
3975 }
3976 catch (err) {
3977 reject(err);
3978 }
3979 }));
3980 });
3981 }
3982 /**
3983 * Destroy (hard delete) a soft-deleted Git repository.
3984 *
3985 * @param {string} project - Project ID or project name
3986 * @param {string} repositoryId - The ID of the repository.
3987 */
3988 deleteRepositoryFromRecycleBin(project, repositoryId) {
3989 return __awaiter(this, void 0, void 0, function* () {
3990 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
3991 let routeValues = {
3992 project: project,
3993 repositoryId: repositoryId
3994 };
3995 try {
3996 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "a663da97-81db-4eb3-8b83-287670f63073", routeValues);
3997 let url = verData.requestUrl;
3998 let options = this.createRequestOptions('application/json', verData.apiVersion);
3999 let res;
4000 res = yield this.rest.del(url, options);
4001 let ret = this.formatResponse(res.result, null, false);
4002 resolve(ret);
4003 }
4004 catch (err) {
4005 reject(err);
4006 }
4007 }));
4008 });
4009 }
4010 /**
4011 * Retrieve soft-deleted git repositories from the recycle bin.
4012 *
4013 * @param {string} project - Project ID or project name
4014 */
4015 getRecycleBinRepositories(project) {
4016 return __awaiter(this, void 0, void 0, function* () {
4017 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4018 let routeValues = {
4019 project: project
4020 };
4021 try {
4022 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "a663da97-81db-4eb3-8b83-287670f63073", routeValues);
4023 let url = verData.requestUrl;
4024 let options = this.createRequestOptions('application/json', verData.apiVersion);
4025 let res;
4026 res = yield this.rest.get(url, options);
4027 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitDeletedRepository, true);
4028 resolve(ret);
4029 }
4030 catch (err) {
4031 reject(err);
4032 }
4033 }));
4034 });
4035 }
4036 /**
4037 * Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable.
4038 *
4039 * @param {GitInterfaces.GitRecycleBinRepositoryDetails} repositoryDetails
4040 * @param {string} project - Project ID or project name
4041 * @param {string} repositoryId - The ID of the repository.
4042 */
4043 restoreRepositoryFromRecycleBin(repositoryDetails, project, repositoryId) {
4044 return __awaiter(this, void 0, void 0, function* () {
4045 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4046 let routeValues = {
4047 project: project,
4048 repositoryId: repositoryId
4049 };
4050 try {
4051 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "a663da97-81db-4eb3-8b83-287670f63073", routeValues);
4052 let url = verData.requestUrl;
4053 let options = this.createRequestOptions('application/json', verData.apiVersion);
4054 let res;
4055 res = yield this.rest.update(url, repositoryDetails, options);
4056 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false);
4057 resolve(ret);
4058 }
4059 catch (err) {
4060 reject(err);
4061 }
4062 }));
4063 });
4064 }
4065 /**
4066 * Queries the provided repository for its refs and returns them.
4067 *
4068 * @param {string} repositoryId - The name or ID of the repository.
4069 * @param {string} project - Project ID or project name
4070 * @param {string} filter - [optional] A filter to apply to the refs (starts with).
4071 * @param {boolean} includeLinks - [optional] Specifies if referenceLinks should be included in the result. default is false.
4072 * @param {boolean} includeStatuses - [optional] Includes up to the first 1000 commit statuses for each ref. The default value is false.
4073 * @param {boolean} includeMyBranches - [optional] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter.
4074 * @param {boolean} latestStatusesOnly - [optional] True to include only the tip commit status for each ref. This option requires `includeStatuses` to be true. The default value is false.
4075 * @param {boolean} peelTags - [optional] Annotated tags will populate the PeeledObjectId property. default is false.
4076 * @param {string} filterContains - [optional] A filter to apply to the refs (contains).
4077 */
4078 getRefs(repositoryId, project, filter, includeLinks, includeStatuses, includeMyBranches, latestStatusesOnly, peelTags, filterContains) {
4079 return __awaiter(this, void 0, void 0, function* () {
4080 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4081 let routeValues = {
4082 project: project,
4083 repositoryId: repositoryId
4084 };
4085 let queryValues = {
4086 filter: filter,
4087 includeLinks: includeLinks,
4088 includeStatuses: includeStatuses,
4089 includeMyBranches: includeMyBranches,
4090 latestStatusesOnly: latestStatusesOnly,
4091 peelTags: peelTags,
4092 filterContains: filterContains,
4093 };
4094 try {
4095 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "2d874a60-a811-4f62-9c9f-963a6ea0a55b", routeValues, queryValues);
4096 let url = verData.requestUrl;
4097 let options = this.createRequestOptions('application/json', verData.apiVersion);
4098 let res;
4099 res = yield this.rest.get(url, options);
4100 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRef, true);
4101 resolve(ret);
4102 }
4103 catch (err) {
4104 reject(err);
4105 }
4106 }));
4107 });
4108 }
4109 /**
4110 * Lock or Unlock a branch.
4111 *
4112 * @param {GitInterfaces.GitRefUpdate} newRefInfo - The ref update action (lock/unlock) to perform
4113 * @param {string} repositoryId - The name or ID of the repository.
4114 * @param {string} filter - The name of the branch to lock/unlock
4115 * @param {string} project - Project ID or project name
4116 * @param {string} projectId - ID or name of the team project. Optional if specifying an ID for repository.
4117 */
4118 updateRef(newRefInfo, repositoryId, filter, project, projectId) {
4119 return __awaiter(this, void 0, void 0, function* () {
4120 if (filter == null) {
4121 throw new TypeError('filter can not be null or undefined');
4122 }
4123 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4124 let routeValues = {
4125 project: project,
4126 repositoryId: repositoryId
4127 };
4128 let queryValues = {
4129 filter: filter,
4130 projectId: projectId,
4131 };
4132 try {
4133 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "2d874a60-a811-4f62-9c9f-963a6ea0a55b", routeValues, queryValues);
4134 let url = verData.requestUrl;
4135 let options = this.createRequestOptions('application/json', verData.apiVersion);
4136 let res;
4137 res = yield this.rest.update(url, newRefInfo, options);
4138 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRef, false);
4139 resolve(ret);
4140 }
4141 catch (err) {
4142 reject(err);
4143 }
4144 }));
4145 });
4146 }
4147 /**
4148 * Creating, updating, or deleting refs(branches).
4149 *
4150 * @param {GitInterfaces.GitRefUpdate[]} refUpdates - List of ref updates to attempt to perform
4151 * @param {string} repositoryId - The name or ID of the repository.
4152 * @param {string} project - Project ID or project name
4153 * @param {string} projectId - ID or name of the team project. Optional if specifying an ID for repository.
4154 */
4155 updateRefs(refUpdates, repositoryId, project, projectId) {
4156 return __awaiter(this, void 0, void 0, function* () {
4157 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4158 let routeValues = {
4159 project: project,
4160 repositoryId: repositoryId
4161 };
4162 let queryValues = {
4163 projectId: projectId,
4164 };
4165 try {
4166 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "2d874a60-a811-4f62-9c9f-963a6ea0a55b", routeValues, queryValues);
4167 let url = verData.requestUrl;
4168 let options = this.createRequestOptions('application/json', verData.apiVersion);
4169 let res;
4170 res = yield this.rest.create(url, refUpdates, options);
4171 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefUpdateResult, true);
4172 resolve(ret);
4173 }
4174 catch (err) {
4175 reject(err);
4176 }
4177 }));
4178 });
4179 }
4180 /**
4181 * Creates a ref favorite
4182 *
4183 * @param {GitInterfaces.GitRefFavorite} favorite - The ref favorite to create.
4184 * @param {string} project - Project ID or project name
4185 */
4186 createFavorite(favorite, project) {
4187 return __awaiter(this, void 0, void 0, function* () {
4188 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4189 let routeValues = {
4190 project: project
4191 };
4192 try {
4193 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues);
4194 let url = verData.requestUrl;
4195 let options = this.createRequestOptions('application/json', verData.apiVersion);
4196 let res;
4197 res = yield this.rest.create(url, favorite, options);
4198 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, false);
4199 resolve(ret);
4200 }
4201 catch (err) {
4202 reject(err);
4203 }
4204 }));
4205 });
4206 }
4207 /**
4208 * Deletes the refs favorite specified
4209 *
4210 * @param {string} project - Project ID or project name
4211 * @param {number} favoriteId - The Id of the ref favorite to delete.
4212 */
4213 deleteRefFavorite(project, favoriteId) {
4214 return __awaiter(this, void 0, void 0, function* () {
4215 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4216 let routeValues = {
4217 project: project,
4218 favoriteId: favoriteId
4219 };
4220 try {
4221 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues);
4222 let url = verData.requestUrl;
4223 let options = this.createRequestOptions('application/json', verData.apiVersion);
4224 let res;
4225 res = yield this.rest.del(url, options);
4226 let ret = this.formatResponse(res.result, null, false);
4227 resolve(ret);
4228 }
4229 catch (err) {
4230 reject(err);
4231 }
4232 }));
4233 });
4234 }
4235 /**
4236 * Gets the refs favorite for a favorite Id.
4237 *
4238 * @param {string} project - Project ID or project name
4239 * @param {number} favoriteId - The Id of the requested ref favorite.
4240 */
4241 getRefFavorite(project, favoriteId) {
4242 return __awaiter(this, void 0, void 0, function* () {
4243 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4244 let routeValues = {
4245 project: project,
4246 favoriteId: favoriteId
4247 };
4248 try {
4249 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues);
4250 let url = verData.requestUrl;
4251 let options = this.createRequestOptions('application/json', verData.apiVersion);
4252 let res;
4253 res = yield this.rest.get(url, options);
4254 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, false);
4255 resolve(ret);
4256 }
4257 catch (err) {
4258 reject(err);
4259 }
4260 }));
4261 });
4262 }
4263 /**
4264 * Gets the refs favorites for a repo and an identity.
4265 *
4266 * @param {string} project - Project ID or project name
4267 * @param {string} repositoryId - The id of the repository.
4268 * @param {string} identityId - The id of the identity whose favorites are to be retrieved. If null, the requesting identity is used.
4269 */
4270 getRefFavorites(project, repositoryId, identityId) {
4271 return __awaiter(this, void 0, void 0, function* () {
4272 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4273 let routeValues = {
4274 project: project
4275 };
4276 let queryValues = {
4277 repositoryId: repositoryId,
4278 identityId: identityId,
4279 };
4280 try {
4281 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues, queryValues);
4282 let url = verData.requestUrl;
4283 let options = this.createRequestOptions('application/json', verData.apiVersion);
4284 let res;
4285 res = yield this.rest.get(url, options);
4286 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, true);
4287 resolve(ret);
4288 }
4289 catch (err) {
4290 reject(err);
4291 }
4292 }));
4293 });
4294 }
4295 /**
4296 * @param {string} project - Project ID or project name
4297 * @param {string} identityId
4298 */
4299 getRefFavoritesForProject(project, identityId) {
4300 return __awaiter(this, void 0, void 0, function* () {
4301 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4302 let routeValues = {
4303 project: project
4304 };
4305 let queryValues = {
4306 identityId: identityId,
4307 };
4308 try {
4309 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4720896c-594c-4a6d-b94c-12eddd80b34a", routeValues, queryValues);
4310 let url = verData.requestUrl;
4311 let options = this.createRequestOptions('application/json', verData.apiVersion);
4312 let res;
4313 res = yield this.rest.get(url, options);
4314 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, true);
4315 resolve(ret);
4316 }
4317 catch (err) {
4318 reject(err);
4319 }
4320 }));
4321 });
4322 }
4323 /**
4324 * Create a git repository in a team project.
4325 *
4326 * @param {GitInterfaces.GitRepositoryCreateOptions} gitRepositoryToCreate - Specify the repo name, team project and/or parent repository. Team project information can be omitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id).
4327 * @param {string} project - Project ID or project name
4328 * @param {string} sourceRef - [optional] Specify the source refs to use while creating a fork repo
4329 */
4330 createRepository(gitRepositoryToCreate, project, sourceRef) {
4331 return __awaiter(this, void 0, void 0, function* () {
4332 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4333 let routeValues = {
4334 project: project
4335 };
4336 let queryValues = {
4337 sourceRef: sourceRef,
4338 };
4339 try {
4340 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues, queryValues);
4341 let url = verData.requestUrl;
4342 let options = this.createRequestOptions('application/json', verData.apiVersion);
4343 let res;
4344 res = yield this.rest.create(url, gitRepositoryToCreate, options);
4345 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false);
4346 resolve(ret);
4347 }
4348 catch (err) {
4349 reject(err);
4350 }
4351 }));
4352 });
4353 }
4354 /**
4355 * Delete a git repository
4356 *
4357 * @param {string} repositoryId - The ID of the repository.
4358 * @param {string} project - Project ID or project name
4359 */
4360 deleteRepository(repositoryId, project) {
4361 return __awaiter(this, void 0, void 0, function* () {
4362 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4363 let routeValues = {
4364 project: project,
4365 repositoryId: repositoryId
4366 };
4367 try {
4368 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues);
4369 let url = verData.requestUrl;
4370 let options = this.createRequestOptions('application/json', verData.apiVersion);
4371 let res;
4372 res = yield this.rest.del(url, options);
4373 let ret = this.formatResponse(res.result, null, false);
4374 resolve(ret);
4375 }
4376 catch (err) {
4377 reject(err);
4378 }
4379 }));
4380 });
4381 }
4382 /**
4383 * Retrieve git repositories.
4384 *
4385 * @param {string} project - Project ID or project name
4386 * @param {boolean} includeLinks - [optional] True to include reference links. The default value is false.
4387 * @param {boolean} includeAllUrls - [optional] True to include all remote URLs. The default value is false.
4388 * @param {boolean} includeHidden - [optional] True to include hidden repositories. The default value is false.
4389 */
4390 getRepositories(project, includeLinks, includeAllUrls, includeHidden) {
4391 return __awaiter(this, void 0, void 0, function* () {
4392 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4393 let routeValues = {
4394 project: project
4395 };
4396 let queryValues = {
4397 includeLinks: includeLinks,
4398 includeAllUrls: includeAllUrls,
4399 includeHidden: includeHidden,
4400 };
4401 try {
4402 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues, queryValues);
4403 let url = verData.requestUrl;
4404 let options = this.createRequestOptions('application/json', verData.apiVersion);
4405 let res;
4406 res = yield this.rest.get(url, options);
4407 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, true);
4408 resolve(ret);
4409 }
4410 catch (err) {
4411 reject(err);
4412 }
4413 }));
4414 });
4415 }
4416 /**
4417 * Retrieve a git repository.
4418 *
4419 * @param {string} repositoryId - The name or ID of the repository.
4420 * @param {string} project - Project ID or project name
4421 */
4422 getRepository(repositoryId, project) {
4423 return __awaiter(this, void 0, void 0, function* () {
4424 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4425 let routeValues = {
4426 project: project,
4427 repositoryId: repositoryId
4428 };
4429 try {
4430 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues);
4431 let url = verData.requestUrl;
4432 let options = this.createRequestOptions('application/json', verData.apiVersion);
4433 let res;
4434 res = yield this.rest.get(url, options);
4435 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false);
4436 resolve(ret);
4437 }
4438 catch (err) {
4439 reject(err);
4440 }
4441 }));
4442 });
4443 }
4444 /**
4445 * Retrieve a git repository.
4446 *
4447 * @param {string} repositoryId - The name or ID of the repository.
4448 * @param {boolean} includeParent - True to include parent repository. Only available in authenticated calls.
4449 * @param {string} project - Project ID or project name
4450 */
4451 getRepositoryWithParent(repositoryId, includeParent, project) {
4452 return __awaiter(this, void 0, void 0, function* () {
4453 if (includeParent == null) {
4454 throw new TypeError('includeParent can not be null or undefined');
4455 }
4456 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4457 let routeValues = {
4458 project: project,
4459 repositoryId: repositoryId
4460 };
4461 let queryValues = {
4462 includeParent: includeParent,
4463 };
4464 try {
4465 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues, queryValues);
4466 let url = verData.requestUrl;
4467 let options = this.createRequestOptions('application/json', verData.apiVersion);
4468 let res;
4469 res = yield this.rest.get(url, options);
4470 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false);
4471 resolve(ret);
4472 }
4473 catch (err) {
4474 reject(err);
4475 }
4476 }));
4477 });
4478 }
4479 /**
4480 * Updates the Git repository with either a new repo name or a new default branch.
4481 *
4482 * @param {GitInterfaces.GitRepository} newRepositoryInfo - Specify a new repo name or a new default branch of the repository
4483 * @param {string} repositoryId - The ID of the repository.
4484 * @param {string} project - Project ID or project name
4485 */
4486 updateRepository(newRepositoryInfo, repositoryId, project) {
4487 return __awaiter(this, void 0, void 0, function* () {
4488 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4489 let routeValues = {
4490 project: project,
4491 repositoryId: repositoryId
4492 };
4493 try {
4494 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues);
4495 let url = verData.requestUrl;
4496 let options = this.createRequestOptions('application/json', verData.apiVersion);
4497 let res;
4498 res = yield this.rest.update(url, newRepositoryInfo, options);
4499 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false);
4500 resolve(ret);
4501 }
4502 catch (err) {
4503 reject(err);
4504 }
4505 }));
4506 });
4507 }
4508 /**
4509 * Retrieve one conflict for a revert by ID
4510 *
4511 * @param {string} repositoryId
4512 * @param {number} revertId
4513 * @param {number} conflictId
4514 * @param {string} project - Project ID or project name
4515 */
4516 getRevertConflict(repositoryId, revertId, conflictId, project) {
4517 return __awaiter(this, void 0, void 0, function* () {
4518 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4519 let routeValues = {
4520 project: project,
4521 repositoryId: repositoryId,
4522 revertId: revertId,
4523 conflictId: conflictId
4524 };
4525 try {
4526 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues);
4527 let url = verData.requestUrl;
4528 let options = this.createRequestOptions('application/json', verData.apiVersion);
4529 let res;
4530 res = yield this.rest.get(url, options);
4531 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false);
4532 resolve(ret);
4533 }
4534 catch (err) {
4535 reject(err);
4536 }
4537 }));
4538 });
4539 }
4540 /**
4541 * Retrieve all conflicts for a revert
4542 *
4543 * @param {string} repositoryId
4544 * @param {number} revertId
4545 * @param {string} project - Project ID or project name
4546 * @param {string} continuationToken
4547 * @param {number} top
4548 * @param {boolean} excludeResolved
4549 * @param {boolean} onlyResolved
4550 * @param {boolean} includeObsolete
4551 */
4552 getRevertConflicts(repositoryId, revertId, project, continuationToken, top, excludeResolved, onlyResolved, includeObsolete) {
4553 return __awaiter(this, void 0, void 0, function* () {
4554 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4555 let routeValues = {
4556 project: project,
4557 repositoryId: repositoryId,
4558 revertId: revertId
4559 };
4560 let queryValues = {
4561 continuationToken: continuationToken,
4562 '$top': top,
4563 excludeResolved: excludeResolved,
4564 onlyResolved: onlyResolved,
4565 includeObsolete: includeObsolete,
4566 };
4567 try {
4568 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues, queryValues);
4569 let url = verData.requestUrl;
4570 let options = this.createRequestOptions('application/json', verData.apiVersion);
4571 let res;
4572 res = yield this.rest.get(url, options);
4573 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, true);
4574 resolve(ret);
4575 }
4576 catch (err) {
4577 reject(err);
4578 }
4579 }));
4580 });
4581 }
4582 /**
4583 * Update merge conflict resolution
4584 *
4585 * @param {GitInterfaces.GitConflict} conflict
4586 * @param {string} repositoryId
4587 * @param {number} revertId
4588 * @param {number} conflictId
4589 * @param {string} project - Project ID or project name
4590 */
4591 updateRevertConflict(conflict, repositoryId, revertId, conflictId, project) {
4592 return __awaiter(this, void 0, void 0, function* () {
4593 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4594 let routeValues = {
4595 project: project,
4596 repositoryId: repositoryId,
4597 revertId: revertId,
4598 conflictId: conflictId
4599 };
4600 try {
4601 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues);
4602 let url = verData.requestUrl;
4603 let options = this.createRequestOptions('application/json', verData.apiVersion);
4604 let res;
4605 res = yield this.rest.update(url, conflict, options);
4606 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false);
4607 resolve(ret);
4608 }
4609 catch (err) {
4610 reject(err);
4611 }
4612 }));
4613 });
4614 }
4615 /**
4616 * Update multiple merge conflict resolutions
4617 *
4618 * @param {GitInterfaces.GitConflict[]} conflictUpdates
4619 * @param {string} repositoryId
4620 * @param {number} revertId
4621 * @param {string} project - Project ID or project name
4622 */
4623 updateRevertConflicts(conflictUpdates, repositoryId, revertId, project) {
4624 return __awaiter(this, void 0, void 0, function* () {
4625 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4626 let routeValues = {
4627 project: project,
4628 repositoryId: repositoryId,
4629 revertId: revertId
4630 };
4631 try {
4632 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues);
4633 let url = verData.requestUrl;
4634 let options = this.createRequestOptions('application/json', verData.apiVersion);
4635 let res;
4636 res = yield this.rest.update(url, conflictUpdates, options);
4637 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflictUpdateResult, true);
4638 resolve(ret);
4639 }
4640 catch (err) {
4641 reject(err);
4642 }
4643 }));
4644 });
4645 }
4646 /**
4647 * Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request.
4648 *
4649 * @param {GitInterfaces.GitAsyncRefOperationParameters} revertToCreate
4650 * @param {string} project - Project ID or project name
4651 * @param {string} repositoryId - ID of the repository.
4652 */
4653 createRevert(revertToCreate, project, repositoryId) {
4654 return __awaiter(this, void 0, void 0, function* () {
4655 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4656 let routeValues = {
4657 project: project,
4658 repositoryId: repositoryId
4659 };
4660 try {
4661 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "bc866058-5449-4715-9cf1-a510b6ff193c", routeValues);
4662 let url = verData.requestUrl;
4663 let options = this.createRequestOptions('application/json', verData.apiVersion);
4664 let res;
4665 res = yield this.rest.create(url, revertToCreate, options);
4666 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRevert, false);
4667 resolve(ret);
4668 }
4669 catch (err) {
4670 reject(err);
4671 }
4672 }));
4673 });
4674 }
4675 /**
4676 * Retrieve information about a revert operation by revert Id.
4677 *
4678 * @param {string} project - Project ID or project name
4679 * @param {number} revertId - ID of the revert operation.
4680 * @param {string} repositoryId - ID of the repository.
4681 */
4682 getRevert(project, revertId, repositoryId) {
4683 return __awaiter(this, void 0, void 0, function* () {
4684 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4685 let routeValues = {
4686 project: project,
4687 revertId: revertId,
4688 repositoryId: repositoryId
4689 };
4690 try {
4691 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "bc866058-5449-4715-9cf1-a510b6ff193c", routeValues);
4692 let url = verData.requestUrl;
4693 let options = this.createRequestOptions('application/json', verData.apiVersion);
4694 let res;
4695 res = yield this.rest.get(url, options);
4696 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRevert, false);
4697 resolve(ret);
4698 }
4699 catch (err) {
4700 reject(err);
4701 }
4702 }));
4703 });
4704 }
4705 /**
4706 * Retrieve information about a revert operation for a specific branch.
4707 *
4708 * @param {string} project - Project ID or project name
4709 * @param {string} repositoryId - ID of the repository.
4710 * @param {string} refName - The GitAsyncRefOperationParameters generatedRefName used for the revert operation.
4711 */
4712 getRevertForRefName(project, repositoryId, refName) {
4713 return __awaiter(this, void 0, void 0, function* () {
4714 if (refName == null) {
4715 throw new TypeError('refName can not be null or undefined');
4716 }
4717 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4718 let routeValues = {
4719 project: project,
4720 repositoryId: repositoryId
4721 };
4722 let queryValues = {
4723 refName: refName,
4724 };
4725 try {
4726 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "bc866058-5449-4715-9cf1-a510b6ff193c", routeValues, queryValues);
4727 let url = verData.requestUrl;
4728 let options = this.createRequestOptions('application/json', verData.apiVersion);
4729 let res;
4730 res = yield this.rest.get(url, options);
4731 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRevert, false);
4732 resolve(ret);
4733 }
4734 catch (err) {
4735 reject(err);
4736 }
4737 }));
4738 });
4739 }
4740 /**
4741 * Create Git commit status.
4742 *
4743 * @param {GitInterfaces.GitStatus} gitCommitStatusToCreate - Git commit status object to create.
4744 * @param {string} commitId - ID of the Git commit.
4745 * @param {string} repositoryId - ID of the repository.
4746 * @param {string} project - Project ID or project name
4747 */
4748 createCommitStatus(gitCommitStatusToCreate, commitId, repositoryId, project) {
4749 return __awaiter(this, void 0, void 0, function* () {
4750 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4751 let routeValues = {
4752 project: project,
4753 commitId: commitId,
4754 repositoryId: repositoryId
4755 };
4756 try {
4757 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "428dd4fb-fda5-4722-af02-9313b80305da", routeValues);
4758 let url = verData.requestUrl;
4759 let options = this.createRequestOptions('application/json', verData.apiVersion);
4760 let res;
4761 res = yield this.rest.create(url, gitCommitStatusToCreate, options);
4762 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitStatus, false);
4763 resolve(ret);
4764 }
4765 catch (err) {
4766 reject(err);
4767 }
4768 }));
4769 });
4770 }
4771 /**
4772 * Get statuses associated with the Git commit.
4773 *
4774 * @param {string} commitId - ID of the Git commit.
4775 * @param {string} repositoryId - ID of the repository.
4776 * @param {string} project - Project ID or project name
4777 * @param {number} top - Optional. The number of statuses to retrieve. Default is 1000.
4778 * @param {number} skip - Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100.
4779 * @param {boolean} latestOnly - The flag indicates whether to get only latest statuses grouped by `Context.Name` and `Context.Genre`.
4780 */
4781 getStatuses(commitId, repositoryId, project, top, skip, latestOnly) {
4782 return __awaiter(this, void 0, void 0, function* () {
4783 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4784 let routeValues = {
4785 project: project,
4786 commitId: commitId,
4787 repositoryId: repositoryId
4788 };
4789 let queryValues = {
4790 top: top,
4791 skip: skip,
4792 latestOnly: latestOnly,
4793 };
4794 try {
4795 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "428dd4fb-fda5-4722-af02-9313b80305da", routeValues, queryValues);
4796 let url = verData.requestUrl;
4797 let options = this.createRequestOptions('application/json', verData.apiVersion);
4798 let res;
4799 res = yield this.rest.get(url, options);
4800 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitStatus, true);
4801 resolve(ret);
4802 }
4803 catch (err) {
4804 reject(err);
4805 }
4806 }));
4807 });
4808 }
4809 /**
4810 * Retrieve a pull request suggestion for a particular repository or team project.
4811 *
4812 * @param {string} repositoryId - ID of the git repository.
4813 * @param {string} project - Project ID or project name
4814 * @param {boolean} preferCompareBranch - If true, prefer the compare branch over the default branch as target branch for pull requests.
4815 */
4816 getSuggestions(repositoryId, project, preferCompareBranch) {
4817 return __awaiter(this, void 0, void 0, function* () {
4818 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4819 let routeValues = {
4820 project: project,
4821 repositoryId: repositoryId
4822 };
4823 let queryValues = {
4824 preferCompareBranch: preferCompareBranch,
4825 };
4826 try {
4827 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "9393b4fb-4445-4919-972b-9ad16f442d83", routeValues, queryValues);
4828 let url = verData.requestUrl;
4829 let options = this.createRequestOptions('application/json', verData.apiVersion);
4830 let res;
4831 res = yield this.rest.get(url, options);
4832 let ret = this.formatResponse(res.result, null, true);
4833 resolve(ret);
4834 }
4835 catch (err) {
4836 reject(err);
4837 }
4838 }));
4839 });
4840 }
4841 /**
4842 * The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.
4843 *
4844 * @param {string} repositoryId - Repository Id.
4845 * @param {string} sha1 - SHA1 hash of the tree object.
4846 * @param {string} project - Project ID or project name
4847 * @param {string} projectId - Project Id.
4848 * @param {boolean} recursive - Search recursively. Include trees underneath this tree. Default is false.
4849 * @param {string} fileName - Name to use if a .zip file is returned. Default is the object ID.
4850 */
4851 getTree(repositoryId, sha1, project, projectId, recursive, fileName) {
4852 return __awaiter(this, void 0, void 0, function* () {
4853 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4854 let routeValues = {
4855 project: project,
4856 repositoryId: repositoryId,
4857 sha1: sha1
4858 };
4859 let queryValues = {
4860 projectId: projectId,
4861 recursive: recursive,
4862 fileName: fileName,
4863 };
4864 try {
4865 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "729f6437-6f92-44ec-8bee-273a7111063c", routeValues, queryValues);
4866 let url = verData.requestUrl;
4867 let options = this.createRequestOptions('application/json', verData.apiVersion);
4868 let res;
4869 res = yield this.rest.get(url, options);
4870 let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitTreeRef, false);
4871 resolve(ret);
4872 }
4873 catch (err) {
4874 reject(err);
4875 }
4876 }));
4877 });
4878 }
4879 /**
4880 * The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository.
4881 *
4882 * @param {string} repositoryId - Repository Id.
4883 * @param {string} sha1 - SHA1 hash of the tree object.
4884 * @param {string} project - Project ID or project name
4885 * @param {string} projectId - Project Id.
4886 * @param {boolean} recursive - Search recursively. Include trees underneath this tree. Default is false.
4887 * @param {string} fileName - Name to use if a .zip file is returned. Default is the object ID.
4888 */
4889 getTreeZip(repositoryId, sha1, project, projectId, recursive, fileName) {
4890 return __awaiter(this, void 0, void 0, function* () {
4891 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
4892 let routeValues = {
4893 project: project,
4894 repositoryId: repositoryId,
4895 sha1: sha1
4896 };
4897 let queryValues = {
4898 projectId: projectId,
4899 recursive: recursive,
4900 fileName: fileName,
4901 };
4902 try {
4903 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "729f6437-6f92-44ec-8bee-273a7111063c", routeValues, queryValues);
4904 let url = verData.requestUrl;
4905 let apiVersion = verData.apiVersion;
4906 let accept = this.createAcceptHeader("application/zip", apiVersion);
4907 resolve((yield this.http.get(url, { "Accept": accept })).message);
4908 }
4909 catch (err) {
4910 reject(err);
4911 }
4912 }));
4913 });
4914 }
4915}
4916exports.GitApi = GitApi;
4917GitApi.RESOURCE_AREA_ID = "4e080c62-fa21-4fbc-8fef-2a10a2b38049";