UNPKG

8.24 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.CixApi = void 0;
22const basem = require("./ClientApiBases");
23class CixApi extends basem.ClientApiBase {
24 constructor(baseUrl, handlers, options) {
25 super(baseUrl, handlers, 'node-Pipelines-api', options);
26 }
27 /**
28 * Gets a list of existing configuration files for the given repository.
29 *
30 * @param {string} project - Project ID or project name
31 * @param {string} repositoryType - The type of the repository such as GitHub, TfsGit (i.e. Azure Repos), Bitbucket, etc.
32 * @param {string} repositoryId - The vendor-specific identifier or the name of the repository, e.g. Microsoft/vscode (GitHub) or e9d82045-ddba-4e01-a63d-2ab9f040af62 (Azure Repos)
33 * @param {string} branch - The repository branch where to look for the configuration file.
34 * @param {string} serviceConnectionId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TfsGit (i.e. Azure Repos).
35 */
36 getConfigurations(project, repositoryType, repositoryId, branch, serviceConnectionId) {
37 return __awaiter(this, void 0, void 0, function* () {
38 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
39 let routeValues = {
40 project: project
41 };
42 let queryValues = {
43 repositoryType: repositoryType,
44 repositoryId: repositoryId,
45 branch: branch,
46 serviceConnectionId: serviceConnectionId,
47 };
48 try {
49 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "8fc87684-9ebc-4c37-ab92-f4ac4a58cb3a", routeValues, queryValues);
50 let url = verData.requestUrl;
51 let options = this.createRequestOptions('application/json', verData.apiVersion);
52 let res;
53 res = yield this.rest.get(url, options);
54 let ret = this.formatResponse(res.result, null, true);
55 resolve(ret);
56 }
57 catch (err) {
58 reject(err);
59 }
60 }));
61 });
62 }
63 /**
64 * Creates a new Pipeline connection between the provider installation and the specified project. Returns the PipelineConnection object created.
65 *
66 * @param {CIXInterfaces.CreatePipelineConnectionInputs} createConnectionInputs
67 * @param {string} project
68 */
69 createProjectConnection(createConnectionInputs, project) {
70 return __awaiter(this, void 0, void 0, function* () {
71 if (project == null) {
72 throw new TypeError('project can not be null or undefined');
73 }
74 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
75 let routeValues = {};
76 let queryValues = {
77 project: project,
78 };
79 try {
80 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "00df4879-9216-45d5-b38d-4a487b626b2c", routeValues, queryValues);
81 let url = verData.requestUrl;
82 let options = this.createRequestOptions('application/json', verData.apiVersion);
83 let res;
84 res = yield this.rest.create(url, createConnectionInputs, options);
85 let ret = this.formatResponse(res.result, null, false);
86 resolve(ret);
87 }
88 catch (err) {
89 reject(err);
90 }
91 }));
92 });
93 }
94 /**
95 * Returns a list of build frameworks that best match the given repository based on its contents.
96 *
97 * @param {string} project - Project ID or project name
98 * @param {string} repositoryType - The type of the repository such as GitHub, TfsGit (i.e. Azure Repos), Bitbucket, etc.
99 * @param {string} repositoryId - The vendor-specific identifier or the name of the repository, e.g. Microsoft/vscode (GitHub) or e9d82045-ddba-4e01-a63d-2ab9f040af62 (Azure Repos)
100 * @param {string} branch - The repository branch to detect build frameworks for.
101 * @param {CIXInterfaces.BuildFrameworkDetectionType} detectionType
102 * @param {string} serviceConnectionId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TfsGit (i.e. Azure Repos).
103 */
104 getDetectedBuildFrameworks(project, repositoryType, repositoryId, branch, detectionType, serviceConnectionId) {
105 return __awaiter(this, void 0, void 0, function* () {
106 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
107 let routeValues = {
108 project: project
109 };
110 let queryValues = {
111 repositoryType: repositoryType,
112 repositoryId: repositoryId,
113 branch: branch,
114 detectionType: detectionType,
115 serviceConnectionId: serviceConnectionId,
116 };
117 try {
118 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "29a30bab-9efb-4652-bf1b-9269baca0980", routeValues, queryValues);
119 let url = verData.requestUrl;
120 let options = this.createRequestOptions('application/json', verData.apiVersion);
121 let res;
122 res = yield this.rest.get(url, options);
123 let ret = this.formatResponse(res.result, null, true);
124 resolve(ret);
125 }
126 catch (err) {
127 reject(err);
128 }
129 }));
130 });
131 }
132 /**
133 * @param {{ [key: string] : CIXInterfaces.ResourceCreationParameter; }} creationParameters
134 * @param {string} project - Project ID or project name
135 */
136 createResources(creationParameters, project) {
137 return __awaiter(this, void 0, void 0, function* () {
138 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
139 let routeValues = {
140 project: project
141 };
142 try {
143 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "43201899-7690-4870-9c79-ab69605f21ed", routeValues);
144 let url = verData.requestUrl;
145 let options = this.createRequestOptions('application/json', verData.apiVersion);
146 let res;
147 res = yield this.rest.create(url, creationParameters, options);
148 let ret = this.formatResponse(res.result, null, false);
149 resolve(ret);
150 }
151 catch (err) {
152 reject(err);
153 }
154 }));
155 });
156 }
157}
158exports.CixApi = CixApi;