UNPKG

16.3 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.PipelinesApi = void 0;
22const basem = require("./ClientApiBases");
23const PipelinesInterfaces = require("./interfaces/PipelinesInterfaces");
24class PipelinesApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Pipelines-api', options);
27 }
28 /**
29 * Get a specific artifact from a pipeline run
30 *
31 * @param {string} project - Project ID or project name
32 * @param {number} pipelineId - ID of the pipeline.
33 * @param {number} runId - ID of the run of that pipeline.
34 * @param {string} artifactName - Name of the artifact.
35 * @param {PipelinesInterfaces.GetArtifactExpandOptions} expand - Expand options. Default is None.
36 */
37 getArtifact(project, pipelineId, runId, artifactName, expand) {
38 return __awaiter(this, void 0, void 0, function* () {
39 if (artifactName == null) {
40 throw new TypeError('artifactName can not be null or undefined');
41 }
42 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
43 let routeValues = {
44 project: project,
45 pipelineId: pipelineId,
46 runId: runId
47 };
48 let queryValues = {
49 artifactName: artifactName,
50 '$expand': expand,
51 };
52 try {
53 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "85023071-bd5e-4438-89b0-2a5bf362a19d", routeValues, queryValues);
54 let url = verData.requestUrl;
55 let options = this.createRequestOptions('application/json', verData.apiVersion);
56 let res;
57 res = yield this.rest.get(url, options);
58 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Artifact, false);
59 resolve(ret);
60 }
61 catch (err) {
62 reject(err);
63 }
64 }));
65 });
66 }
67 /**
68 * Get a specific log from a pipeline run
69 *
70 * @param {string} project - Project ID or project name
71 * @param {number} pipelineId - ID of the pipeline.
72 * @param {number} runId - ID of the run of that pipeline.
73 * @param {number} logId - ID of the log.
74 * @param {PipelinesInterfaces.GetLogExpandOptions} expand - Expand options. Default is None.
75 */
76 getLog(project, pipelineId, runId, logId, expand) {
77 return __awaiter(this, void 0, void 0, function* () {
78 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
79 let routeValues = {
80 project: project,
81 pipelineId: pipelineId,
82 runId: runId,
83 logId: logId
84 };
85 let queryValues = {
86 '$expand': expand,
87 };
88 try {
89 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "fb1b6d27-3957-43d5-a14b-a2d70403e545", routeValues, queryValues);
90 let url = verData.requestUrl;
91 let options = this.createRequestOptions('application/json', verData.apiVersion);
92 let res;
93 res = yield this.rest.get(url, options);
94 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Log, false);
95 resolve(ret);
96 }
97 catch (err) {
98 reject(err);
99 }
100 }));
101 });
102 }
103 /**
104 * Get a list of logs from a pipeline run.
105 *
106 * @param {string} project - Project ID or project name
107 * @param {number} pipelineId - ID of the pipeline.
108 * @param {number} runId - ID of the run of that pipeline.
109 * @param {PipelinesInterfaces.GetLogExpandOptions} expand - Expand options. Default is None.
110 */
111 listLogs(project, pipelineId, runId, expand) {
112 return __awaiter(this, void 0, void 0, function* () {
113 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
114 let routeValues = {
115 project: project,
116 pipelineId: pipelineId,
117 runId: runId
118 };
119 let queryValues = {
120 '$expand': expand,
121 };
122 try {
123 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "fb1b6d27-3957-43d5-a14b-a2d70403e545", routeValues, queryValues);
124 let url = verData.requestUrl;
125 let options = this.createRequestOptions('application/json', verData.apiVersion);
126 let res;
127 res = yield this.rest.get(url, options);
128 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.LogCollection, false);
129 resolve(ret);
130 }
131 catch (err) {
132 reject(err);
133 }
134 }));
135 });
136 }
137 /**
138 * Create a pipeline.
139 *
140 * @param {PipelinesInterfaces.CreatePipelineParameters} inputParameters - Input parameters.
141 * @param {string} project - Project ID or project name
142 */
143 createPipeline(inputParameters, project) {
144 return __awaiter(this, void 0, void 0, function* () {
145 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
146 let routeValues = {
147 project: project
148 };
149 try {
150 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "28e1305e-2afe-47bf-abaf-cbb0e6a91988", routeValues);
151 let url = verData.requestUrl;
152 let options = this.createRequestOptions('application/json', verData.apiVersion);
153 let res;
154 res = yield this.rest.create(url, inputParameters, options);
155 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Pipeline, false);
156 resolve(ret);
157 }
158 catch (err) {
159 reject(err);
160 }
161 }));
162 });
163 }
164 /**
165 * Gets a pipeline, optionally at the specified version
166 *
167 * @param {string} project - Project ID or project name
168 * @param {number} pipelineId - The pipeline ID
169 * @param {number} pipelineVersion - The pipeline version
170 */
171 getPipeline(project, pipelineId, pipelineVersion) {
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 project: project,
176 pipelineId: pipelineId
177 };
178 let queryValues = {
179 pipelineVersion: pipelineVersion,
180 };
181 try {
182 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "28e1305e-2afe-47bf-abaf-cbb0e6a91988", routeValues, queryValues);
183 let url = verData.requestUrl;
184 let options = this.createRequestOptions('application/json', verData.apiVersion);
185 let res;
186 res = yield this.rest.get(url, options);
187 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Pipeline, false);
188 resolve(ret);
189 }
190 catch (err) {
191 reject(err);
192 }
193 }));
194 });
195 }
196 /**
197 * Get a list of pipelines.
198 *
199 * @param {string} project - Project ID or project name
200 * @param {string} orderBy - A sort expression. Defaults to "name asc"
201 * @param {number} top - The maximum number of pipelines to return
202 * @param {string} continuationToken - A continuation token from a previous request, to retrieve the next page of results
203 */
204 listPipelines(project, orderBy, top, continuationToken) {
205 return __awaiter(this, void 0, void 0, function* () {
206 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
207 let routeValues = {
208 project: project
209 };
210 let queryValues = {
211 orderBy: orderBy,
212 '$top': top,
213 continuationToken: continuationToken,
214 };
215 try {
216 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "28e1305e-2afe-47bf-abaf-cbb0e6a91988", routeValues, queryValues);
217 let url = verData.requestUrl;
218 let options = this.createRequestOptions('application/json', verData.apiVersion);
219 let res;
220 res = yield this.rest.get(url, options);
221 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Pipeline, true);
222 resolve(ret);
223 }
224 catch (err) {
225 reject(err);
226 }
227 }));
228 });
229 }
230 /**
231 * Queues a dry run of the pipeline and returns an object containing the final yaml.
232 *
233 * @param {PipelinesInterfaces.RunPipelineParameters} runParameters - Optional additional parameters for this run.
234 * @param {string} project - Project ID or project name
235 * @param {number} pipelineId - The pipeline ID.
236 * @param {number} pipelineVersion - The pipeline version.
237 */
238 preview(runParameters, project, pipelineId, pipelineVersion) {
239 return __awaiter(this, void 0, void 0, function* () {
240 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
241 let routeValues = {
242 project: project,
243 pipelineId: pipelineId
244 };
245 let queryValues = {
246 pipelineVersion: pipelineVersion,
247 };
248 try {
249 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "53df2d18-29ea-46a9-bee0-933540f80abf", routeValues, queryValues);
250 let url = verData.requestUrl;
251 let options = this.createRequestOptions('application/json', verData.apiVersion);
252 let res;
253 res = yield this.rest.create(url, runParameters, options);
254 let ret = this.formatResponse(res.result, null, false);
255 resolve(ret);
256 }
257 catch (err) {
258 reject(err);
259 }
260 }));
261 });
262 }
263 /**
264 * Gets a run for a particular pipeline.
265 *
266 * @param {string} project - Project ID or project name
267 * @param {number} pipelineId - The pipeline id
268 * @param {number} runId - The run id
269 */
270 getRun(project, pipelineId, runId) {
271 return __awaiter(this, void 0, void 0, function* () {
272 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
273 let routeValues = {
274 project: project,
275 pipelineId: pipelineId,
276 runId: runId
277 };
278 try {
279 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "7859261e-d2e9-4a68-b820-a5d84cc5bb3d", routeValues);
280 let url = verData.requestUrl;
281 let options = this.createRequestOptions('application/json', verData.apiVersion);
282 let res;
283 res = yield this.rest.get(url, options);
284 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Run, false);
285 resolve(ret);
286 }
287 catch (err) {
288 reject(err);
289 }
290 }));
291 });
292 }
293 /**
294 * Gets top 10000 runs for a particular pipeline.
295 *
296 * @param {string} project - Project ID or project name
297 * @param {number} pipelineId - The pipeline id
298 */
299 listRuns(project, pipelineId) {
300 return __awaiter(this, void 0, void 0, function* () {
301 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
302 let routeValues = {
303 project: project,
304 pipelineId: pipelineId
305 };
306 try {
307 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "7859261e-d2e9-4a68-b820-a5d84cc5bb3d", routeValues);
308 let url = verData.requestUrl;
309 let options = this.createRequestOptions('application/json', verData.apiVersion);
310 let res;
311 res = yield this.rest.get(url, options);
312 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Run, true);
313 resolve(ret);
314 }
315 catch (err) {
316 reject(err);
317 }
318 }));
319 });
320 }
321 /**
322 * Runs a pipeline.
323 *
324 * @param {PipelinesInterfaces.RunPipelineParameters} runParameters - Optional additional parameters for this run.
325 * @param {string} project - Project ID or project name
326 * @param {number} pipelineId - The pipeline ID.
327 * @param {number} pipelineVersion - The pipeline version.
328 */
329 runPipeline(runParameters, project, pipelineId, pipelineVersion) {
330 return __awaiter(this, void 0, void 0, function* () {
331 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
332 let routeValues = {
333 project: project,
334 pipelineId: pipelineId
335 };
336 let queryValues = {
337 pipelineVersion: pipelineVersion,
338 };
339 try {
340 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "7859261e-d2e9-4a68-b820-a5d84cc5bb3d", routeValues, queryValues);
341 let url = verData.requestUrl;
342 let options = this.createRequestOptions('application/json', verData.apiVersion);
343 let res;
344 res = yield this.rest.create(url, runParameters, options);
345 let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Run, false);
346 resolve(ret);
347 }
348 catch (err) {
349 reject(err);
350 }
351 }));
352 });
353 }
354}
355exports.PipelinesApi = PipelinesApi;