UNPKG

41.4 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.TaskApi = void 0;
22const basem = require("./ClientApiBases");
23const TaskAgentInterfaces = require("./interfaces/TaskAgentInterfaces");
24class TaskApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Task-api', options);
27 }
28 /**
29 * @param {string} scopeIdentifier - The project GUID to scope the request
30 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
31 * @param {string} planId
32 * @param {string} type
33 */
34 getPlanAttachments(scopeIdentifier, hubName, planId, type) {
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 scopeIdentifier: scopeIdentifier,
39 hubName: hubName,
40 planId: planId,
41 type: type
42 };
43 try {
44 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "eb55e5d6-2f30-4295-b5ed-38da50b1fc52", routeValues);
45 let url = verData.requestUrl;
46 let options = this.createRequestOptions('application/json', verData.apiVersion);
47 let res;
48 res = yield this.rest.get(url, options);
49 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, true);
50 resolve(ret);
51 }
52 catch (err) {
53 reject(err);
54 }
55 }));
56 });
57 }
58 /**
59 * @param {NodeJS.ReadableStream} contentStream - Content to upload
60 * @param {string} scopeIdentifier - The project GUID to scope the request
61 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
62 * @param {string} planId
63 * @param {string} timelineId
64 * @param {string} recordId
65 * @param {string} type
66 * @param {string} name
67 */
68 createAttachment(customHeaders, contentStream, scopeIdentifier, hubName, planId, timelineId, recordId, type, name) {
69 return __awaiter(this, void 0, void 0, function* () {
70 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
71 let routeValues = {
72 scopeIdentifier: scopeIdentifier,
73 hubName: hubName,
74 planId: planId,
75 timelineId: timelineId,
76 recordId: recordId,
77 type: type,
78 name: name
79 };
80 customHeaders = customHeaders || {};
81 customHeaders["Content-Type"] = "application/octet-stream";
82 try {
83 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues);
84 let url = verData.requestUrl;
85 let options = this.createRequestOptions('application/json', verData.apiVersion);
86 options.additionalHeaders = customHeaders;
87 let res;
88 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
89 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, false);
90 resolve(ret);
91 }
92 catch (err) {
93 reject(err);
94 }
95 }));
96 });
97 }
98 /**
99 * @param {string} scopeIdentifier - The project GUID to scope the request
100 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
101 * @param {string} planId
102 * @param {string} timelineId
103 * @param {string} recordId
104 * @param {string} type
105 * @param {string} name
106 * @param {string} artifactHash
107 * @param {number} length
108 */
109 createAttachmentFromArtifact(scopeIdentifier, hubName, planId, timelineId, recordId, type, name, artifactHash, length) {
110 return __awaiter(this, void 0, void 0, function* () {
111 if (artifactHash == null) {
112 throw new TypeError('artifactHash can not be null or undefined');
113 }
114 if (length == null) {
115 throw new TypeError('length can not be null or undefined');
116 }
117 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
118 let routeValues = {
119 scopeIdentifier: scopeIdentifier,
120 hubName: hubName,
121 planId: planId,
122 timelineId: timelineId,
123 recordId: recordId,
124 type: type,
125 name: name
126 };
127 let queryValues = {
128 artifactHash: artifactHash,
129 length: length,
130 };
131 try {
132 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues, queryValues);
133 let url = verData.requestUrl;
134 let options = this.createRequestOptions('application/json', verData.apiVersion);
135 let res;
136 res = yield this.rest.replace(url, null, options);
137 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, false);
138 resolve(ret);
139 }
140 catch (err) {
141 reject(err);
142 }
143 }));
144 });
145 }
146 /**
147 * @param {string} scopeIdentifier - The project GUID to scope the request
148 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
149 * @param {string} planId
150 * @param {string} timelineId
151 * @param {string} recordId
152 * @param {string} type
153 * @param {string} name
154 */
155 getAttachment(scopeIdentifier, hubName, planId, timelineId, recordId, type, name) {
156 return __awaiter(this, void 0, void 0, function* () {
157 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
158 let routeValues = {
159 scopeIdentifier: scopeIdentifier,
160 hubName: hubName,
161 planId: planId,
162 timelineId: timelineId,
163 recordId: recordId,
164 type: type,
165 name: name
166 };
167 try {
168 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues);
169 let url = verData.requestUrl;
170 let options = this.createRequestOptions('application/json', verData.apiVersion);
171 let res;
172 res = yield this.rest.get(url, options);
173 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, false);
174 resolve(ret);
175 }
176 catch (err) {
177 reject(err);
178 }
179 }));
180 });
181 }
182 /**
183 * @param {string} scopeIdentifier - The project GUID to scope the request
184 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
185 * @param {string} planId
186 * @param {string} timelineId
187 * @param {string} recordId
188 * @param {string} type
189 * @param {string} name
190 */
191 getAttachmentContent(scopeIdentifier, hubName, planId, timelineId, recordId, type, name) {
192 return __awaiter(this, void 0, void 0, function* () {
193 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
194 let routeValues = {
195 scopeIdentifier: scopeIdentifier,
196 hubName: hubName,
197 planId: planId,
198 timelineId: timelineId,
199 recordId: recordId,
200 type: type,
201 name: name
202 };
203 try {
204 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues);
205 let url = verData.requestUrl;
206 let apiVersion = verData.apiVersion;
207 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
208 resolve((yield this.http.get(url, { "Accept": accept })).message);
209 }
210 catch (err) {
211 reject(err);
212 }
213 }));
214 });
215 }
216 /**
217 * @param {string} scopeIdentifier - The project GUID to scope the request
218 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
219 * @param {string} planId
220 * @param {string} timelineId
221 * @param {string} recordId
222 * @param {string} type
223 */
224 getAttachments(scopeIdentifier, hubName, planId, timelineId, recordId, type) {
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 scopeIdentifier: scopeIdentifier,
229 hubName: hubName,
230 planId: planId,
231 timelineId: timelineId,
232 recordId: recordId,
233 type: type
234 };
235 try {
236 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues);
237 let url = verData.requestUrl;
238 let options = this.createRequestOptions('application/json', verData.apiVersion);
239 let res;
240 res = yield this.rest.get(url, options);
241 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, true);
242 resolve(ret);
243 }
244 catch (err) {
245 reject(err);
246 }
247 }));
248 });
249 }
250 /**
251 * Append content to timeline record feed.
252 *
253 * @param {TaskAgentInterfaces.TimelineRecordFeedLinesWrapper} lines - Content to be appended to the timeline record feed.
254 * @param {string} scopeIdentifier - The project GUID to scope the request
255 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
256 * @param {string} planId - ID of the plan.
257 * @param {string} timelineId - ID of the task's timeline.
258 * @param {string} recordId - ID of the timeline record.
259 */
260 appendTimelineRecordFeed(lines, scopeIdentifier, hubName, planId, timelineId, recordId) {
261 return __awaiter(this, void 0, void 0, function* () {
262 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
263 let routeValues = {
264 scopeIdentifier: scopeIdentifier,
265 hubName: hubName,
266 planId: planId,
267 timelineId: timelineId,
268 recordId: recordId
269 };
270 try {
271 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "858983e4-19bd-4c5e-864c-507b59b58b12", routeValues);
272 let url = verData.requestUrl;
273 let options = this.createRequestOptions('application/json', verData.apiVersion);
274 let res;
275 res = yield this.rest.create(url, lines, options);
276 let ret = this.formatResponse(res.result, null, false);
277 resolve(ret);
278 }
279 catch (err) {
280 reject(err);
281 }
282 }));
283 });
284 }
285 /**
286 * @param {string} scopeIdentifier - The project GUID to scope the request
287 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
288 * @param {string} planId
289 * @param {string} timelineId
290 * @param {string} recordId
291 * @param {string} stepId
292 * @param {number} endLine
293 * @param {number} takeCount
294 * @param {string} continuationToken
295 */
296 getLines(scopeIdentifier, hubName, planId, timelineId, recordId, stepId, endLine, takeCount, continuationToken) {
297 return __awaiter(this, void 0, void 0, function* () {
298 if (stepId == null) {
299 throw new TypeError('stepId can not be null or undefined');
300 }
301 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
302 let routeValues = {
303 scopeIdentifier: scopeIdentifier,
304 hubName: hubName,
305 planId: planId,
306 timelineId: timelineId,
307 recordId: recordId
308 };
309 let queryValues = {
310 stepId: stepId,
311 endLine: endLine,
312 takeCount: takeCount,
313 continuationToken: continuationToken,
314 };
315 try {
316 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "858983e4-19bd-4c5e-864c-507b59b58b12", routeValues, queryValues);
317 let url = verData.requestUrl;
318 let options = this.createRequestOptions('application/json', verData.apiVersion);
319 let res;
320 res = yield this.rest.get(url, options);
321 let ret = this.formatResponse(res.result, null, false);
322 resolve(ret);
323 }
324 catch (err) {
325 reject(err);
326 }
327 }));
328 });
329 }
330 /**
331 * @param {string} scopeIdentifier - The project GUID to scope the request
332 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
333 * @param {string} orchestrationId
334 */
335 getJobInstance(scopeIdentifier, hubName, orchestrationId) {
336 return __awaiter(this, void 0, void 0, function* () {
337 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
338 let routeValues = {
339 scopeIdentifier: scopeIdentifier,
340 hubName: hubName,
341 orchestrationId: orchestrationId
342 };
343 try {
344 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0a1efd25-abda-43bd-9629-6c7bdd2e0d60", routeValues);
345 let url = verData.requestUrl;
346 let options = this.createRequestOptions('application/json', verData.apiVersion);
347 let res;
348 res = yield this.rest.get(url, options);
349 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJob, false);
350 resolve(ret);
351 }
352 catch (err) {
353 reject(err);
354 }
355 }));
356 });
357 }
358 /**
359 * Append a log to a task's log. The log should be sent in the body of the request as a TaskLog object stream.
360 *
361 * @param {NodeJS.ReadableStream} contentStream - Content to upload
362 * @param {string} scopeIdentifier - The project GUID to scope the request
363 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
364 * @param {string} planId - The ID of the plan.
365 * @param {number} logId - The ID of the log.
366 */
367 appendLogContent(customHeaders, contentStream, scopeIdentifier, hubName, planId, logId) {
368 return __awaiter(this, void 0, void 0, function* () {
369 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
370 let routeValues = {
371 scopeIdentifier: scopeIdentifier,
372 hubName: hubName,
373 planId: planId,
374 logId: logId
375 };
376 customHeaders = customHeaders || {};
377 customHeaders["Content-Type"] = "application/octet-stream";
378 try {
379 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues);
380 let url = verData.requestUrl;
381 let options = this.createRequestOptions('application/json', verData.apiVersion);
382 options.additionalHeaders = customHeaders;
383 let res;
384 res = yield this.rest.uploadStream("POST", url, contentStream, options);
385 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, false);
386 resolve(ret);
387 }
388 catch (err) {
389 reject(err);
390 }
391 }));
392 });
393 }
394 /**
395 * @param {string} scopeIdentifier - The project GUID to scope the request
396 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
397 * @param {string} planId
398 * @param {number} logId
399 * @param {string} serializedBlobId
400 * @param {number} lineCount
401 */
402 associateLog(scopeIdentifier, hubName, planId, logId, serializedBlobId, lineCount) {
403 return __awaiter(this, void 0, void 0, function* () {
404 if (serializedBlobId == null) {
405 throw new TypeError('serializedBlobId can not be null or undefined');
406 }
407 if (lineCount == null) {
408 throw new TypeError('lineCount can not be null or undefined');
409 }
410 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
411 let routeValues = {
412 scopeIdentifier: scopeIdentifier,
413 hubName: hubName,
414 planId: planId,
415 logId: logId
416 };
417 let queryValues = {
418 serializedBlobId: serializedBlobId,
419 lineCount: lineCount,
420 };
421 try {
422 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues, queryValues);
423 let url = verData.requestUrl;
424 let options = this.createRequestOptions('application/json', verData.apiVersion);
425 let res;
426 res = yield this.rest.create(url, null, options);
427 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, false);
428 resolve(ret);
429 }
430 catch (err) {
431 reject(err);
432 }
433 }));
434 });
435 }
436 /**
437 * Create a log and connect it to a pipeline run's execution plan.
438 *
439 * @param {TaskAgentInterfaces.TaskLog} log - An object that contains information about log's path.
440 * @param {string} scopeIdentifier - The project GUID to scope the request
441 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
442 * @param {string} planId - The ID of the plan.
443 */
444 createLog(log, scopeIdentifier, hubName, planId) {
445 return __awaiter(this, void 0, void 0, function* () {
446 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
447 let routeValues = {
448 scopeIdentifier: scopeIdentifier,
449 hubName: hubName,
450 planId: planId
451 };
452 try {
453 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues);
454 let url = verData.requestUrl;
455 let options = this.createRequestOptions('application/json', verData.apiVersion);
456 let res;
457 res = yield this.rest.create(url, log, options);
458 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, false);
459 resolve(ret);
460 }
461 catch (err) {
462 reject(err);
463 }
464 }));
465 });
466 }
467 /**
468 * @param {string} scopeIdentifier - The project GUID to scope the request
469 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
470 * @param {string} planId
471 * @param {number} logId
472 * @param {number} startLine
473 * @param {number} endLine
474 */
475 getLog(scopeIdentifier, hubName, planId, logId, startLine, endLine) {
476 return __awaiter(this, void 0, void 0, function* () {
477 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
478 let routeValues = {
479 scopeIdentifier: scopeIdentifier,
480 hubName: hubName,
481 planId: planId,
482 logId: logId
483 };
484 let queryValues = {
485 startLine: startLine,
486 endLine: endLine,
487 };
488 try {
489 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues, queryValues);
490 let url = verData.requestUrl;
491 let options = this.createRequestOptions('application/json', verData.apiVersion);
492 let res;
493 res = yield this.rest.get(url, options);
494 let ret = this.formatResponse(res.result, null, true);
495 resolve(ret);
496 }
497 catch (err) {
498 reject(err);
499 }
500 }));
501 });
502 }
503 /**
504 * @param {string} scopeIdentifier - The project GUID to scope the request
505 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
506 * @param {string} planId
507 */
508 getLogs(scopeIdentifier, hubName, planId) {
509 return __awaiter(this, void 0, void 0, function* () {
510 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
511 let routeValues = {
512 scopeIdentifier: scopeIdentifier,
513 hubName: hubName,
514 planId: planId
515 };
516 try {
517 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues);
518 let url = verData.requestUrl;
519 let options = this.createRequestOptions('application/json', verData.apiVersion);
520 let res;
521 res = yield this.rest.get(url, options);
522 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, true);
523 resolve(ret);
524 }
525 catch (err) {
526 reject(err);
527 }
528 }));
529 });
530 }
531 /**
532 * @param {string} scopeIdentifier - The project GUID to scope the request
533 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
534 */
535 getPlanGroupsQueueMetrics(scopeIdentifier, hubName) {
536 return __awaiter(this, void 0, void 0, function* () {
537 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
538 let routeValues = {
539 scopeIdentifier: scopeIdentifier,
540 hubName: hubName
541 };
542 try {
543 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "038fd4d5-cda7-44ca-92c0-935843fee1a7", routeValues);
544 let url = verData.requestUrl;
545 let options = this.createRequestOptions('application/json', verData.apiVersion);
546 let res;
547 res = yield this.rest.get(url, options);
548 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationPlanGroupsQueueMetrics, true);
549 resolve(ret);
550 }
551 catch (err) {
552 reject(err);
553 }
554 }));
555 });
556 }
557 /**
558 * @param {{ [key: string] : string; }} claims
559 * @param {string} scopeIdentifier - The project GUID to scope the request
560 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
561 * @param {string} planId
562 * @param {string} jobId
563 * @param {string} serviceConnectionId
564 */
565 createOidcToken(claims, scopeIdentifier, hubName, planId, jobId, serviceConnectionId) {
566 return __awaiter(this, void 0, void 0, function* () {
567 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
568 let routeValues = {
569 scopeIdentifier: scopeIdentifier,
570 hubName: hubName,
571 planId: planId,
572 jobId: jobId
573 };
574 let queryValues = {
575 serviceConnectionId: serviceConnectionId,
576 };
577 try {
578 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "69a319f4-28c1-4bfd-93e6-ea0ff5c6f1a2", routeValues, queryValues);
579 let url = verData.requestUrl;
580 let options = this.createRequestOptions('application/json', verData.apiVersion);
581 let res;
582 res = yield this.rest.create(url, claims, options);
583 let ret = this.formatResponse(res.result, null, false);
584 resolve(ret);
585 }
586 catch (err) {
587 reject(err);
588 }
589 }));
590 });
591 }
592 /**
593 * @param {string} scopeIdentifier - The project GUID to scope the request
594 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
595 * @param {TaskAgentInterfaces.PlanGroupStatus} statusFilter
596 * @param {number} count
597 */
598 getQueuedPlanGroups(scopeIdentifier, hubName, statusFilter, count) {
599 return __awaiter(this, void 0, void 0, function* () {
600 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
601 let routeValues = {
602 scopeIdentifier: scopeIdentifier,
603 hubName: hubName
604 };
605 let queryValues = {
606 statusFilter: statusFilter,
607 count: count,
608 };
609 try {
610 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0dd73091-3e36-4f43-b443-1b76dd426d84", routeValues, queryValues);
611 let url = verData.requestUrl;
612 let options = this.createRequestOptions('application/json', verData.apiVersion);
613 let res;
614 res = yield this.rest.get(url, options);
615 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationQueuedPlanGroup, true);
616 resolve(ret);
617 }
618 catch (err) {
619 reject(err);
620 }
621 }));
622 });
623 }
624 /**
625 * @param {string} scopeIdentifier - The project GUID to scope the request
626 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
627 * @param {string} planGroup
628 */
629 getQueuedPlanGroup(scopeIdentifier, hubName, planGroup) {
630 return __awaiter(this, void 0, void 0, function* () {
631 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
632 let routeValues = {
633 scopeIdentifier: scopeIdentifier,
634 hubName: hubName,
635 planGroup: planGroup
636 };
637 try {
638 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "65fd0708-bc1e-447b-a731-0587c5464e5b", routeValues);
639 let url = verData.requestUrl;
640 let options = this.createRequestOptions('application/json', verData.apiVersion);
641 let res;
642 res = yield this.rest.get(url, options);
643 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationQueuedPlanGroup, false);
644 resolve(ret);
645 }
646 catch (err) {
647 reject(err);
648 }
649 }));
650 });
651 }
652 /**
653 * @param {string} scopeIdentifier - The project GUID to scope the request
654 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
655 * @param {string} planId
656 */
657 getPlan(scopeIdentifier, hubName, planId) {
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 scopeIdentifier: scopeIdentifier,
662 hubName: hubName,
663 planId: planId
664 };
665 try {
666 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "5cecd946-d704-471e-a45f-3b4064fcfaba", routeValues);
667 let url = verData.requestUrl;
668 let options = this.createRequestOptions('application/json', verData.apiVersion);
669 let res;
670 res = yield this.rest.get(url, options);
671 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationPlan, false);
672 resolve(ret);
673 }
674 catch (err) {
675 reject(err);
676 }
677 }));
678 });
679 }
680 /**
681 * @param {string} scopeIdentifier - The project GUID to scope the request
682 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
683 * @param {string} planId
684 * @param {string} timelineId
685 * @param {number} changeId
686 */
687 getRecords(scopeIdentifier, hubName, planId, timelineId, changeId) {
688 return __awaiter(this, void 0, void 0, function* () {
689 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
690 let routeValues = {
691 scopeIdentifier: scopeIdentifier,
692 hubName: hubName,
693 planId: planId,
694 timelineId: timelineId
695 };
696 let queryValues = {
697 changeId: changeId,
698 };
699 try {
700 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8893bc5b-35b2-4be7-83cb-99e683551db4", routeValues, queryValues);
701 let url = verData.requestUrl;
702 let options = this.createRequestOptions('application/json', verData.apiVersion);
703 let res;
704 res = yield this.rest.get(url, options);
705 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TimelineRecord, true);
706 resolve(ret);
707 }
708 catch (err) {
709 reject(err);
710 }
711 }));
712 });
713 }
714 /**
715 * Update timeline records if they already exist, otherwise create new ones for the same timeline.
716 *
717 * @param {VSSInterfaces.VssJsonCollectionWrapperV<TaskAgentInterfaces.TimelineRecord[]>} records - The array of timeline records to be updated.
718 * @param {string} scopeIdentifier - The project GUID to scope the request
719 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
720 * @param {string} planId - The ID of the plan.
721 * @param {string} timelineId - The ID of the timeline.
722 */
723 updateRecords(records, scopeIdentifier, hubName, planId, timelineId) {
724 return __awaiter(this, void 0, void 0, function* () {
725 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
726 let routeValues = {
727 scopeIdentifier: scopeIdentifier,
728 hubName: hubName,
729 planId: planId,
730 timelineId: timelineId
731 };
732 try {
733 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8893bc5b-35b2-4be7-83cb-99e683551db4", routeValues);
734 let url = verData.requestUrl;
735 let options = this.createRequestOptions('application/json', verData.apiVersion);
736 let res;
737 res = yield this.rest.update(url, records, options);
738 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TimelineRecord, true);
739 resolve(ret);
740 }
741 catch (err) {
742 reject(err);
743 }
744 }));
745 });
746 }
747 /**
748 * @param {TaskAgentInterfaces.Timeline} timeline
749 * @param {string} scopeIdentifier - The project GUID to scope the request
750 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
751 * @param {string} planId
752 */
753 createTimeline(timeline, scopeIdentifier, hubName, planId) {
754 return __awaiter(this, void 0, void 0, function* () {
755 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
756 let routeValues = {
757 scopeIdentifier: scopeIdentifier,
758 hubName: hubName,
759 planId: planId
760 };
761 try {
762 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues);
763 let url = verData.requestUrl;
764 let options = this.createRequestOptions('application/json', verData.apiVersion);
765 let res;
766 res = yield this.rest.create(url, timeline, options);
767 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.Timeline, false);
768 resolve(ret);
769 }
770 catch (err) {
771 reject(err);
772 }
773 }));
774 });
775 }
776 /**
777 * @param {string} scopeIdentifier - The project GUID to scope the request
778 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
779 * @param {string} planId
780 * @param {string} timelineId
781 */
782 deleteTimeline(scopeIdentifier, hubName, planId, timelineId) {
783 return __awaiter(this, void 0, void 0, function* () {
784 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
785 let routeValues = {
786 scopeIdentifier: scopeIdentifier,
787 hubName: hubName,
788 planId: planId,
789 timelineId: timelineId
790 };
791 try {
792 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues);
793 let url = verData.requestUrl;
794 let options = this.createRequestOptions('application/json', verData.apiVersion);
795 let res;
796 res = yield this.rest.del(url, options);
797 let ret = this.formatResponse(res.result, null, false);
798 resolve(ret);
799 }
800 catch (err) {
801 reject(err);
802 }
803 }));
804 });
805 }
806 /**
807 * @param {string} scopeIdentifier - The project GUID to scope the request
808 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
809 * @param {string} planId
810 * @param {string} timelineId
811 * @param {number} changeId
812 * @param {boolean} includeRecords
813 */
814 getTimeline(scopeIdentifier, hubName, planId, timelineId, changeId, includeRecords) {
815 return __awaiter(this, void 0, void 0, function* () {
816 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
817 let routeValues = {
818 scopeIdentifier: scopeIdentifier,
819 hubName: hubName,
820 planId: planId,
821 timelineId: timelineId
822 };
823 let queryValues = {
824 changeId: changeId,
825 includeRecords: includeRecords,
826 };
827 try {
828 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues, queryValues);
829 let url = verData.requestUrl;
830 let options = this.createRequestOptions('application/json', verData.apiVersion);
831 let res;
832 res = yield this.rest.get(url, options);
833 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.Timeline, false);
834 resolve(ret);
835 }
836 catch (err) {
837 reject(err);
838 }
839 }));
840 });
841 }
842 /**
843 * @param {string} scopeIdentifier - The project GUID to scope the request
844 * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks"
845 * @param {string} planId
846 */
847 getTimelines(scopeIdentifier, hubName, planId) {
848 return __awaiter(this, void 0, void 0, function* () {
849 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
850 let routeValues = {
851 scopeIdentifier: scopeIdentifier,
852 hubName: hubName,
853 planId: planId
854 };
855 try {
856 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues);
857 let url = verData.requestUrl;
858 let options = this.createRequestOptions('application/json', verData.apiVersion);
859 let res;
860 res = yield this.rest.get(url, options);
861 let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.Timeline, true);
862 resolve(ret);
863 }
864 catch (err) {
865 reject(err);
866 }
867 }));
868 });
869 }
870}
871exports.TaskApi = TaskApi;