UNPKG

43.6 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.CoreApi = void 0;
22const basem = require("./ClientApiBases");
23const CoreInterfaces = require("./interfaces/CoreInterfaces");
24const OperationsInterfaces = require("./interfaces/common/OperationsInterfaces");
25class CoreApi extends basem.ClientApiBase {
26 constructor(baseUrl, handlers, options) {
27 super(baseUrl, handlers, 'node-Core-api', options);
28 }
29 /**
30 * Removes the avatar for the project.
31 *
32 * @param {string} projectId - The ID or name of the project.
33 */
34 removeProjectAvatar(projectId) {
35 return __awaiter(this, void 0, void 0, function* () {
36 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
37 let routeValues = {
38 projectId: projectId
39 };
40 try {
41 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "54b2a2a0-859b-4d05-827c-ec4c862f641a", routeValues);
42 let url = verData.requestUrl;
43 let options = this.createRequestOptions('application/json', verData.apiVersion);
44 let res;
45 res = yield this.rest.del(url, options);
46 let ret = this.formatResponse(res.result, null, false);
47 resolve(ret);
48 }
49 catch (err) {
50 reject(err);
51 }
52 }));
53 });
54 }
55 /**
56 * Sets the avatar for the project.
57 *
58 * @param {CoreInterfaces.ProjectAvatar} avatarBlob - The avatar blob data object to upload.
59 * @param {string} projectId - The ID or name of the project.
60 */
61 setProjectAvatar(avatarBlob, projectId) {
62 return __awaiter(this, void 0, void 0, function* () {
63 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
64 let routeValues = {
65 projectId: projectId
66 };
67 try {
68 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "54b2a2a0-859b-4d05-827c-ec4c862f641a", routeValues);
69 let url = verData.requestUrl;
70 let options = this.createRequestOptions('application/json', verData.apiVersion);
71 let res;
72 res = yield this.rest.replace(url, avatarBlob, options);
73 let ret = this.formatResponse(res.result, null, false);
74 resolve(ret);
75 }
76 catch (err) {
77 reject(err);
78 }
79 }));
80 });
81 }
82 /**
83 * Gets list of user readable teams in a project and teams user is member of (excluded from readable list).
84 *
85 * @param {string} projectId - The name or ID (GUID) of the team project containing the teams to retrieve.
86 * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object.
87 * @param {number} top - Maximum number of teams to return.
88 * @param {number} skip - Number of teams to skip.
89 */
90 getProjectTeamsByCategory(projectId, expandIdentity, top, skip) {
91 return __awaiter(this, void 0, void 0, function* () {
92 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
93 let routeValues = {
94 projectId: projectId
95 };
96 let queryValues = {
97 '$expandIdentity': expandIdentity,
98 '$top': top,
99 '$skip': skip,
100 };
101 try {
102 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "6f9619ff-8b86-d011-b42d-00c04fc964ff", routeValues, queryValues);
103 let url = verData.requestUrl;
104 let options = this.createRequestOptions('application/json', verData.apiVersion);
105 let res;
106 res = yield this.rest.get(url, options);
107 let ret = this.formatResponse(res.result, null, false);
108 resolve(ret);
109 }
110 catch (err) {
111 reject(err);
112 }
113 }));
114 });
115 }
116 /**
117 * @param {CoreInterfaces.WebApiConnectedServiceDetails} connectedServiceCreationData
118 * @param {string} projectId
119 */
120 createConnectedService(connectedServiceCreationData, projectId) {
121 return __awaiter(this, void 0, void 0, function* () {
122 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
123 let routeValues = {
124 projectId: projectId
125 };
126 try {
127 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "b4f70219-e18b-42c5-abe3-98b07d35525e", routeValues);
128 let url = verData.requestUrl;
129 let options = this.createRequestOptions('application/json', verData.apiVersion);
130 let res;
131 res = yield this.rest.create(url, connectedServiceCreationData, options);
132 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.WebApiConnectedService, false);
133 resolve(ret);
134 }
135 catch (err) {
136 reject(err);
137 }
138 }));
139 });
140 }
141 /**
142 * @param {string} projectId
143 * @param {string} name
144 */
145 getConnectedServiceDetails(projectId, name) {
146 return __awaiter(this, void 0, void 0, function* () {
147 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
148 let routeValues = {
149 projectId: projectId,
150 name: name
151 };
152 try {
153 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "b4f70219-e18b-42c5-abe3-98b07d35525e", routeValues);
154 let url = verData.requestUrl;
155 let options = this.createRequestOptions('application/json', verData.apiVersion);
156 let res;
157 res = yield this.rest.get(url, options);
158 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.WebApiConnectedServiceDetails, false);
159 resolve(ret);
160 }
161 catch (err) {
162 reject(err);
163 }
164 }));
165 });
166 }
167 /**
168 * @param {string} projectId
169 * @param {CoreInterfaces.ConnectedServiceKind} kind
170 */
171 getConnectedServices(projectId, kind) {
172 return __awaiter(this, void 0, void 0, function* () {
173 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
174 let routeValues = {
175 projectId: projectId
176 };
177 let queryValues = {
178 kind: kind,
179 };
180 try {
181 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "b4f70219-e18b-42c5-abe3-98b07d35525e", routeValues, queryValues);
182 let url = verData.requestUrl;
183 let options = this.createRequestOptions('application/json', verData.apiVersion);
184 let res;
185 res = yield this.rest.get(url, options);
186 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.WebApiConnectedService, true);
187 resolve(ret);
188 }
189 catch (err) {
190 reject(err);
191 }
192 }));
193 });
194 }
195 /**
196 * @param {CoreInterfaces.IdentityData} mruData
197 * @param {string} mruName
198 */
199 createIdentityMru(mruData, mruName) {
200 return __awaiter(this, void 0, void 0, function* () {
201 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
202 let routeValues = {
203 mruName: mruName
204 };
205 try {
206 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues);
207 let url = verData.requestUrl;
208 let options = this.createRequestOptions('application/json', verData.apiVersion);
209 let res;
210 res = yield this.rest.create(url, mruData, options);
211 let ret = this.formatResponse(res.result, null, false);
212 resolve(ret);
213 }
214 catch (err) {
215 reject(err);
216 }
217 }));
218 });
219 }
220 /**
221 * @param {CoreInterfaces.IdentityData} mruData
222 * @param {string} mruName
223 */
224 deleteIdentityMru(mruData, mruName) {
225 return __awaiter(this, void 0, void 0, function* () {
226 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
227 let routeValues = {
228 mruName: mruName
229 };
230 try {
231 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues);
232 let url = verData.requestUrl;
233 let options = this.createRequestOptions('application/json', verData.apiVersion);
234 let res;
235 res = yield this.rest.del(url, options);
236 let ret = this.formatResponse(res.result, null, false);
237 resolve(ret);
238 }
239 catch (err) {
240 reject(err);
241 }
242 }));
243 });
244 }
245 /**
246 * @param {string} mruName
247 */
248 getIdentityMru(mruName) {
249 return __awaiter(this, void 0, void 0, function* () {
250 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
251 let routeValues = {
252 mruName: mruName
253 };
254 try {
255 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues);
256 let url = verData.requestUrl;
257 let options = this.createRequestOptions('application/json', verData.apiVersion);
258 let res;
259 res = yield this.rest.get(url, options);
260 let ret = this.formatResponse(res.result, null, true);
261 resolve(ret);
262 }
263 catch (err) {
264 reject(err);
265 }
266 }));
267 });
268 }
269 /**
270 * @param {CoreInterfaces.IdentityData} mruData
271 * @param {string} mruName
272 */
273 updateIdentityMru(mruData, mruName) {
274 return __awaiter(this, void 0, void 0, function* () {
275 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
276 let routeValues = {
277 mruName: mruName
278 };
279 try {
280 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues);
281 let url = verData.requestUrl;
282 let options = this.createRequestOptions('application/json', verData.apiVersion);
283 let res;
284 res = yield this.rest.update(url, mruData, options);
285 let ret = this.formatResponse(res.result, null, false);
286 resolve(ret);
287 }
288 catch (err) {
289 reject(err);
290 }
291 }));
292 });
293 }
294 /**
295 * Get a list of members for a specific team.
296 *
297 * @param {string} projectId - The name or ID (GUID) of the team project the team belongs to.
298 * @param {string} teamId - The name or ID (GUID) of the team .
299 * @param {number} top
300 * @param {number} skip
301 */
302 getTeamMembersWithExtendedProperties(projectId, teamId, top, skip) {
303 return __awaiter(this, void 0, void 0, function* () {
304 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
305 let routeValues = {
306 projectId: projectId,
307 teamId: teamId
308 };
309 let queryValues = {
310 '$top': top,
311 '$skip': skip,
312 };
313 try {
314 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "294c494c-2600-4d7e-b76c-3dd50c3c95be", routeValues, queryValues);
315 let url = verData.requestUrl;
316 let options = this.createRequestOptions('application/json', verData.apiVersion);
317 let res;
318 res = yield this.rest.get(url, options);
319 let ret = this.formatResponse(res.result, null, true);
320 resolve(ret);
321 }
322 catch (err) {
323 reject(err);
324 }
325 }));
326 });
327 }
328 /**
329 * Get a process by ID.
330 *
331 * @param {string} processId - ID for a process.
332 */
333 getProcessById(processId) {
334 return __awaiter(this, void 0, void 0, function* () {
335 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
336 let routeValues = {
337 processId: processId
338 };
339 try {
340 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "93878975-88c5-4e6a-8abb-7ddd77a8a7d8", routeValues);
341 let url = verData.requestUrl;
342 let options = this.createRequestOptions('application/json', verData.apiVersion);
343 let res;
344 res = yield this.rest.get(url, options);
345 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.Process, false);
346 resolve(ret);
347 }
348 catch (err) {
349 reject(err);
350 }
351 }));
352 });
353 }
354 /**
355 * Get a list of processes.
356 *
357 */
358 getProcesses() {
359 return __awaiter(this, void 0, void 0, function* () {
360 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
361 let routeValues = {};
362 try {
363 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "93878975-88c5-4e6a-8abb-7ddd77a8a7d8", routeValues);
364 let url = verData.requestUrl;
365 let options = this.createRequestOptions('application/json', verData.apiVersion);
366 let res;
367 res = yield this.rest.get(url, options);
368 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.Process, true);
369 resolve(ret);
370 }
371 catch (err) {
372 reject(err);
373 }
374 }));
375 });
376 }
377 /**
378 * Get project collection with the specified id or name.
379 *
380 * @param {string} collectionId
381 */
382 getProjectCollection(collectionId) {
383 return __awaiter(this, void 0, void 0, function* () {
384 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
385 let routeValues = {
386 collectionId: collectionId
387 };
388 try {
389 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "8031090f-ef1d-4af6-85fc-698cd75d42bf", 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, CoreInterfaces.TypeInfo.TeamProjectCollection, false);
395 resolve(ret);
396 }
397 catch (err) {
398 reject(err);
399 }
400 }));
401 });
402 }
403 /**
404 * Get project collection references for this application.
405 *
406 * @param {number} top
407 * @param {number} skip
408 */
409 getProjectCollections(top, skip) {
410 return __awaiter(this, void 0, void 0, function* () {
411 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
412 let routeValues = {};
413 let queryValues = {
414 '$top': top,
415 '$skip': skip,
416 };
417 try {
418 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "8031090f-ef1d-4af6-85fc-698cd75d42bf", routeValues, queryValues);
419 let url = verData.requestUrl;
420 let options = this.createRequestOptions('application/json', verData.apiVersion);
421 let res;
422 res = yield this.rest.get(url, options);
423 let ret = this.formatResponse(res.result, null, true);
424 resolve(ret);
425 }
426 catch (err) {
427 reject(err);
428 }
429 }));
430 });
431 }
432 /**
433 * Gets the history of changes to the project.
434 *
435 * @param {number} minRevision - The minimum revision number to return in the history.
436 */
437 getProjectHistoryEntries(minRevision) {
438 return __awaiter(this, void 0, void 0, function* () {
439 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
440 let routeValues = {};
441 let queryValues = {
442 minRevision: minRevision,
443 };
444 try {
445 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "6488a877-4749-4954-82ea-7340d36be9f2", routeValues, queryValues);
446 let url = verData.requestUrl;
447 let options = this.createRequestOptions('application/json', verData.apiVersion);
448 let res;
449 res = yield this.rest.get(url, options);
450 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.ProjectInfo, true);
451 resolve(ret);
452 }
453 catch (err) {
454 reject(err);
455 }
456 }));
457 });
458 }
459 /**
460 * Get project with the specified id or name, optionally including capabilities.
461 *
462 * @param {string} projectId
463 * @param {boolean} includeCapabilities - Include capabilities (such as source control) in the team project result (default: false).
464 * @param {boolean} includeHistory - Search within renamed projects (that had such name in the past).
465 */
466 getProject(projectId, includeCapabilities, includeHistory) {
467 return __awaiter(this, void 0, void 0, function* () {
468 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
469 let routeValues = {
470 projectId: projectId
471 };
472 let queryValues = {
473 includeCapabilities: includeCapabilities,
474 includeHistory: includeHistory,
475 };
476 try {
477 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues, queryValues);
478 let url = verData.requestUrl;
479 let options = this.createRequestOptions('application/json', verData.apiVersion);
480 let res;
481 res = yield this.rest.get(url, options);
482 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.TeamProject, false);
483 resolve(ret);
484 }
485 catch (err) {
486 reject(err);
487 }
488 }));
489 });
490 }
491 /**
492 * Get all projects in the organization that the authenticated user has access to.
493 *
494 * @param {any} stateFilter - Filter on team projects in a specific team project state (default: WellFormed).
495 * @param {number} top
496 * @param {number} skip
497 * @param {number} continuationToken - Pointer that shows how many projects already been fetched.
498 * @param {boolean} getDefaultTeamImageUrl
499 */
500 getProjects(stateFilter, top, skip, continuationToken, getDefaultTeamImageUrl) {
501 return __awaiter(this, void 0, void 0, function* () {
502 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
503 let routeValues = {};
504 let queryValues = {
505 stateFilter: stateFilter,
506 '$top': top,
507 '$skip': skip,
508 continuationToken: continuationToken,
509 getDefaultTeamImageUrl: getDefaultTeamImageUrl,
510 };
511 try {
512 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues, queryValues);
513 let url = verData.requestUrl;
514 let options = this.createRequestOptions('application/json', verData.apiVersion);
515 let res;
516 res = yield this.rest.get(url, options);
517 let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.TeamProjectReference, true);
518 resolve(ret);
519 }
520 catch (err) {
521 reject(err);
522 }
523 }));
524 });
525 }
526 /**
527 * Queues a project to be created. Use the [GetOperation](../../operations/operations/get) to periodically check for create project status.
528 *
529 * @param {CoreInterfaces.TeamProject} projectToCreate - The project to create.
530 */
531 queueCreateProject(projectToCreate) {
532 return __awaiter(this, void 0, void 0, function* () {
533 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
534 let routeValues = {};
535 try {
536 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues);
537 let url = verData.requestUrl;
538 let options = this.createRequestOptions('application/json', verData.apiVersion);
539 let res;
540 res = yield this.rest.create(url, projectToCreate, options);
541 let ret = this.formatResponse(res.result, OperationsInterfaces.TypeInfo.OperationReference, false);
542 resolve(ret);
543 }
544 catch (err) {
545 reject(err);
546 }
547 }));
548 });
549 }
550 /**
551 * Queues a project to be deleted. Use the [GetOperation](../../operations/operations/get) to periodically check for delete project status.
552 *
553 * @param {string} projectId - The project id of the project to delete.
554 */
555 queueDeleteProject(projectId) {
556 return __awaiter(this, void 0, void 0, function* () {
557 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
558 let routeValues = {
559 projectId: projectId
560 };
561 try {
562 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues);
563 let url = verData.requestUrl;
564 let options = this.createRequestOptions('application/json', verData.apiVersion);
565 let res;
566 res = yield this.rest.del(url, options);
567 let ret = this.formatResponse(res.result, OperationsInterfaces.TypeInfo.OperationReference, false);
568 resolve(ret);
569 }
570 catch (err) {
571 reject(err);
572 }
573 }));
574 });
575 }
576 /**
577 * Update an existing project's name, abbreviation, description, or restore a project.
578 *
579 * @param {CoreInterfaces.TeamProject} projectUpdate - The updates for the project. The state must be set to wellFormed to restore the project.
580 * @param {string} projectId - The project id of the project to update.
581 */
582 updateProject(projectUpdate, projectId) {
583 return __awaiter(this, void 0, void 0, function* () {
584 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
585 let routeValues = {
586 projectId: projectId
587 };
588 try {
589 let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues);
590 let url = verData.requestUrl;
591 let options = this.createRequestOptions('application/json', verData.apiVersion);
592 let res;
593 res = yield this.rest.update(url, projectUpdate, options);
594 let ret = this.formatResponse(res.result, OperationsInterfaces.TypeInfo.OperationReference, false);
595 resolve(ret);
596 }
597 catch (err) {
598 reject(err);
599 }
600 }));
601 });
602 }
603 /**
604 * Get a collection of team project properties for multiple projects.
605 *
606 * @param {string[]} projectIds - A comma-delimited string of team project IDs
607 * @param {string[]} properties
608 */
609 getProjectsProperties(projectIds, properties) {
610 return __awaiter(this, void 0, void 0, function* () {
611 if (projectIds == null) {
612 throw new TypeError('projectIds can not be null or undefined');
613 }
614 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
615 let routeValues = {};
616 let queryValues = {
617 projectIds: projectIds && projectIds.join(","),
618 properties: properties && properties.join(","),
619 };
620 try {
621 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "0a3ffdfc-fe94-47a6-bb27-79bf3f762eac", routeValues, queryValues);
622 let url = verData.requestUrl;
623 let options = this.createRequestOptions('application/json', verData.apiVersion);
624 let res;
625 res = yield this.rest.get(url, options);
626 let ret = this.formatResponse(res.result, null, true);
627 resolve(ret);
628 }
629 catch (err) {
630 reject(err);
631 }
632 }));
633 });
634 }
635 /**
636 * Get a collection of team project properties.
637 *
638 * @param {string} projectId - The team project ID.
639 * @param {string[]} keys - A comma-delimited string of team project property names. Wildcard characters ("?" and "*") are supported. If no key is specified, all properties will be returned.
640 */
641 getProjectProperties(projectId, keys) {
642 return __awaiter(this, void 0, void 0, function* () {
643 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
644 let routeValues = {
645 projectId: projectId
646 };
647 let queryValues = {
648 keys: keys && keys.join(","),
649 };
650 try {
651 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "4976a71a-4487-49aa-8aab-a1eda469037a", routeValues, queryValues);
652 let url = verData.requestUrl;
653 let options = this.createRequestOptions('application/json', verData.apiVersion);
654 let res;
655 res = yield this.rest.get(url, options);
656 let ret = this.formatResponse(res.result, null, true);
657 resolve(ret);
658 }
659 catch (err) {
660 reject(err);
661 }
662 }));
663 });
664 }
665 /**
666 * Create, update, and delete team project properties.
667 *
668 * @param {string} projectId - The team project ID.
669 * @param {VSSInterfaces.JsonPatchDocument} patchDocument - A JSON Patch document that represents an array of property operations. See RFC 6902 for more details on JSON Patch. The accepted operation verbs are Add and Remove, where Add is used for both creating and updating properties. The path consists of a forward slash and a property name.
670 */
671 setProjectProperties(customHeaders, projectId, patchDocument) {
672 return __awaiter(this, void 0, void 0, function* () {
673 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
674 let routeValues = {
675 projectId: projectId
676 };
677 customHeaders = customHeaders || {};
678 customHeaders["Content-Type"] = "application/json-patch+json";
679 try {
680 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "4976a71a-4487-49aa-8aab-a1eda469037a", routeValues);
681 let url = verData.requestUrl;
682 let options = this.createRequestOptions('application/json', verData.apiVersion);
683 options.additionalHeaders = customHeaders;
684 let res;
685 res = yield this.rest.update(url, patchDocument, options);
686 let ret = this.formatResponse(res.result, null, false);
687 resolve(ret);
688 }
689 catch (err) {
690 reject(err);
691 }
692 }));
693 });
694 }
695 /**
696 * @param {CoreInterfaces.Proxy} proxy
697 */
698 createOrUpdateProxy(proxy) {
699 return __awaiter(this, void 0, void 0, function* () {
700 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
701 let routeValues = {};
702 try {
703 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "ec1f4311-f2b4-4c15-b2b8-8990b80d2908", routeValues);
704 let url = verData.requestUrl;
705 let options = this.createRequestOptions('application/json', verData.apiVersion);
706 let res;
707 res = yield this.rest.replace(url, proxy, options);
708 let ret = this.formatResponse(res.result, null, false);
709 resolve(ret);
710 }
711 catch (err) {
712 reject(err);
713 }
714 }));
715 });
716 }
717 /**
718 * @param {string} proxyUrl
719 * @param {string} site
720 */
721 deleteProxy(proxyUrl, site) {
722 return __awaiter(this, void 0, void 0, function* () {
723 if (proxyUrl == null) {
724 throw new TypeError('proxyUrl can not be null or undefined');
725 }
726 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
727 let routeValues = {};
728 let queryValues = {
729 proxyUrl: proxyUrl,
730 site: site,
731 };
732 try {
733 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "ec1f4311-f2b4-4c15-b2b8-8990b80d2908", routeValues, queryValues);
734 let url = verData.requestUrl;
735 let options = this.createRequestOptions('application/json', verData.apiVersion);
736 let res;
737 res = yield this.rest.del(url, options);
738 let ret = this.formatResponse(res.result, null, false);
739 resolve(ret);
740 }
741 catch (err) {
742 reject(err);
743 }
744 }));
745 });
746 }
747 /**
748 * @param {string} proxyUrl
749 */
750 getProxies(proxyUrl) {
751 return __awaiter(this, void 0, void 0, function* () {
752 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
753 let routeValues = {};
754 let queryValues = {
755 proxyUrl: proxyUrl,
756 };
757 try {
758 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "ec1f4311-f2b4-4c15-b2b8-8990b80d2908", routeValues, queryValues);
759 let url = verData.requestUrl;
760 let options = this.createRequestOptions('application/json', verData.apiVersion);
761 let res;
762 res = yield this.rest.get(url, options);
763 let ret = this.formatResponse(res.result, null, true);
764 resolve(ret);
765 }
766 catch (err) {
767 reject(err);
768 }
769 }));
770 });
771 }
772 /**
773 * Get a list of all teams.
774 *
775 * @param {boolean} mine - If true, then return all teams requesting user is member. Otherwise return all teams user has read access.
776 * @param {number} top - Maximum number of teams to return.
777 * @param {number} skip - Number of teams to skip.
778 * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object.
779 */
780 getAllTeams(mine, top, skip, expandIdentity) {
781 return __awaiter(this, void 0, void 0, function* () {
782 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
783 let routeValues = {};
784 let queryValues = {
785 '$mine': mine,
786 '$top': top,
787 '$skip': skip,
788 '$expandIdentity': expandIdentity,
789 };
790 try {
791 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "7a4d9ee9-3433-4347-b47a-7a80f1cf307e", routeValues, queryValues);
792 let url = verData.requestUrl;
793 let options = this.createRequestOptions('application/json', verData.apiVersion);
794 let res;
795 res = yield this.rest.get(url, options);
796 let ret = this.formatResponse(res.result, null, true);
797 resolve(ret);
798 }
799 catch (err) {
800 reject(err);
801 }
802 }));
803 });
804 }
805 /**
806 * Create a team in a team project.
807 *
808 * @param {CoreInterfaces.WebApiTeam} team - The team data used to create the team.
809 * @param {string} projectId - The name or ID (GUID) of the team project in which to create the team.
810 */
811 createTeam(team, projectId) {
812 return __awaiter(this, void 0, void 0, function* () {
813 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
814 let routeValues = {
815 projectId: projectId
816 };
817 try {
818 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues);
819 let url = verData.requestUrl;
820 let options = this.createRequestOptions('application/json', verData.apiVersion);
821 let res;
822 res = yield this.rest.create(url, team, options);
823 let ret = this.formatResponse(res.result, null, false);
824 resolve(ret);
825 }
826 catch (err) {
827 reject(err);
828 }
829 }));
830 });
831 }
832 /**
833 * Delete a team.
834 *
835 * @param {string} projectId - The name or ID (GUID) of the team project containing the team to delete.
836 * @param {string} teamId - The name or ID of the team to delete.
837 */
838 deleteTeam(projectId, teamId) {
839 return __awaiter(this, void 0, void 0, function* () {
840 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
841 let routeValues = {
842 projectId: projectId,
843 teamId: teamId
844 };
845 try {
846 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues);
847 let url = verData.requestUrl;
848 let options = this.createRequestOptions('application/json', verData.apiVersion);
849 let res;
850 res = yield this.rest.del(url, options);
851 let ret = this.formatResponse(res.result, null, false);
852 resolve(ret);
853 }
854 catch (err) {
855 reject(err);
856 }
857 }));
858 });
859 }
860 /**
861 * Get a specific team.
862 *
863 * @param {string} projectId - The name or ID (GUID) of the team project containing the team.
864 * @param {string} teamId - The name or ID (GUID) of the team.
865 * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object.
866 */
867 getTeam(projectId, teamId, expandIdentity) {
868 return __awaiter(this, void 0, void 0, function* () {
869 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
870 let routeValues = {
871 projectId: projectId,
872 teamId: teamId
873 };
874 let queryValues = {
875 '$expandIdentity': expandIdentity,
876 };
877 try {
878 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues, queryValues);
879 let url = verData.requestUrl;
880 let options = this.createRequestOptions('application/json', verData.apiVersion);
881 let res;
882 res = yield this.rest.get(url, options);
883 let ret = this.formatResponse(res.result, null, false);
884 resolve(ret);
885 }
886 catch (err) {
887 reject(err);
888 }
889 }));
890 });
891 }
892 /**
893 * Get a list of teams.
894 *
895 * @param {string} projectId
896 * @param {boolean} mine - If true return all the teams requesting user is member, otherwise return all the teams user has read access.
897 * @param {number} top - Maximum number of teams to return.
898 * @param {number} skip - Number of teams to skip.
899 * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object.
900 */
901 getTeams(projectId, mine, top, skip, expandIdentity) {
902 return __awaiter(this, void 0, void 0, function* () {
903 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
904 let routeValues = {
905 projectId: projectId
906 };
907 let queryValues = {
908 '$mine': mine,
909 '$top': top,
910 '$skip': skip,
911 '$expandIdentity': expandIdentity,
912 };
913 try {
914 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues, queryValues);
915 let url = verData.requestUrl;
916 let options = this.createRequestOptions('application/json', verData.apiVersion);
917 let res;
918 res = yield this.rest.get(url, options);
919 let ret = this.formatResponse(res.result, null, true);
920 resolve(ret);
921 }
922 catch (err) {
923 reject(err);
924 }
925 }));
926 });
927 }
928 /**
929 * Update a team's name and/or description.
930 *
931 * @param {CoreInterfaces.WebApiTeam} teamData
932 * @param {string} projectId - The name or ID (GUID) of the team project containing the team to update.
933 * @param {string} teamId - The name of ID of the team to update.
934 */
935 updateTeam(teamData, projectId, teamId) {
936 return __awaiter(this, void 0, void 0, function* () {
937 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
938 let routeValues = {
939 projectId: projectId,
940 teamId: teamId
941 };
942 try {
943 let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues);
944 let url = verData.requestUrl;
945 let options = this.createRequestOptions('application/json', verData.apiVersion);
946 let res;
947 res = yield this.rest.update(url, teamData, options);
948 let ret = this.formatResponse(res.result, null, false);
949 resolve(ret);
950 }
951 catch (err) {
952 reject(err);
953 }
954 }));
955 });
956 }
957}
958exports.CoreApi = CoreApi;
959CoreApi.RESOURCE_AREA_ID = "79134c72-4a58-4b42-976c-04e7115f32bf";