UNPKG

12.7 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.LocationsApi = void 0;
22const basem = require("./ClientApiBases");
23const LocationsInterfaces = require("./interfaces/LocationsInterfaces");
24class LocationsApi extends basem.ClientApiBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Locations-api', options);
27 }
28 /**
29 * This was copied and adapted from TeamFoundationConnectionService.Connect()
30 *
31 * @param {VSSInterfaces.ConnectOptions} connectOptions
32 * @param {number} lastChangeId - Obsolete 32-bit LastChangeId
33 * @param {number} lastChangeId64 - Non-truncated 64-bit LastChangeId
34 */
35 getConnectionData(connectOptions, lastChangeId, lastChangeId64) {
36 return __awaiter(this, void 0, void 0, function* () {
37 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
38 let routeValues = {};
39 let queryValues = {
40 connectOptions: connectOptions,
41 lastChangeId: lastChangeId,
42 lastChangeId64: lastChangeId64,
43 };
44 try {
45 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "00d9565f-ed9c-4a06-9a50-00e7896ccab4", routeValues, queryValues);
46 let url = verData.requestUrl;
47 let options = this.createRequestOptions('application/json', verData.apiVersion);
48 let res;
49 res = yield this.rest.get(url, options);
50 let ret = this.formatResponse(res.result, LocationsInterfaces.TypeInfo.ConnectionData, false);
51 resolve(ret);
52 }
53 catch (err) {
54 reject(err);
55 }
56 }));
57 });
58 }
59 /**
60 * @param {string} areaId
61 * @param {string} enterpriseName
62 * @param {string} organizationName
63 */
64 getResourceArea(areaId, enterpriseName, organizationName) {
65 return __awaiter(this, void 0, void 0, function* () {
66 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
67 let routeValues = {
68 areaId: areaId
69 };
70 let queryValues = {
71 enterpriseName: enterpriseName,
72 organizationName: organizationName,
73 };
74 try {
75 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues);
76 let url = verData.requestUrl;
77 let options = this.createRequestOptions('application/json', verData.apiVersion);
78 let res;
79 res = yield this.rest.get(url, options);
80 let ret = this.formatResponse(res.result, null, false);
81 resolve(ret);
82 }
83 catch (err) {
84 reject(err);
85 }
86 }));
87 });
88 }
89 /**
90 * @param {string} areaId
91 * @param {string} hostId
92 */
93 getResourceAreaByHost(areaId, hostId) {
94 return __awaiter(this, void 0, void 0, function* () {
95 if (hostId == null) {
96 throw new TypeError('hostId can not be null or undefined');
97 }
98 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
99 let routeValues = {
100 areaId: areaId
101 };
102 let queryValues = {
103 hostId: hostId,
104 };
105 try {
106 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues);
107 let url = verData.requestUrl;
108 let options = this.createRequestOptions('application/json', verData.apiVersion);
109 let res;
110 res = yield this.rest.get(url, options);
111 let ret = this.formatResponse(res.result, null, false);
112 resolve(ret);
113 }
114 catch (err) {
115 reject(err);
116 }
117 }));
118 });
119 }
120 /**
121 * @param {string} enterpriseName
122 * @param {string} organizationName
123 */
124 getResourceAreas(enterpriseName, organizationName) {
125 return __awaiter(this, void 0, void 0, function* () {
126 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
127 let routeValues = {};
128 let queryValues = {
129 enterpriseName: enterpriseName,
130 organizationName: organizationName,
131 };
132 try {
133 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues);
134 let url = verData.requestUrl;
135 let options = this.createRequestOptions('application/json', verData.apiVersion);
136 let res;
137 res = yield this.rest.get(url, options);
138 let ret = this.formatResponse(res.result, null, true);
139 resolve(ret);
140 }
141 catch (err) {
142 reject(err);
143 }
144 }));
145 });
146 }
147 /**
148 * @param {string} hostId
149 */
150 getResourceAreasByHost(hostId) {
151 return __awaiter(this, void 0, void 0, function* () {
152 if (hostId == null) {
153 throw new TypeError('hostId can not be null or undefined');
154 }
155 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
156 let routeValues = {};
157 let queryValues = {
158 hostId: hostId,
159 };
160 try {
161 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues);
162 let url = verData.requestUrl;
163 let options = this.createRequestOptions('application/json', verData.apiVersion);
164 let res;
165 res = yield this.rest.get(url, options);
166 let ret = this.formatResponse(res.result, null, true);
167 resolve(ret);
168 }
169 catch (err) {
170 reject(err);
171 }
172 }));
173 });
174 }
175 /**
176 * @param {string} serviceType
177 * @param {string} identifier
178 */
179 deleteServiceDefinition(serviceType, identifier) {
180 return __awaiter(this, void 0, void 0, function* () {
181 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
182 let routeValues = {
183 serviceType: serviceType,
184 identifier: identifier
185 };
186 try {
187 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", routeValues);
188 let url = verData.requestUrl;
189 let options = this.createRequestOptions('application/json', verData.apiVersion);
190 let res;
191 res = yield this.rest.del(url, options);
192 let ret = this.formatResponse(res.result, null, false);
193 resolve(ret);
194 }
195 catch (err) {
196 reject(err);
197 }
198 }));
199 });
200 }
201 /**
202 * Finds a given service definition.
203 *
204 * @param {string} serviceType
205 * @param {string} identifier
206 * @param {boolean} allowFaultIn - If true, we will attempt to fault in a host instance mapping if in SPS.
207 * @param {boolean} previewFaultIn - If true, we will calculate and return a host instance mapping, but not persist it.
208 */
209 getServiceDefinition(serviceType, identifier, allowFaultIn, previewFaultIn) {
210 return __awaiter(this, void 0, void 0, function* () {
211 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
212 let routeValues = {
213 serviceType: serviceType,
214 identifier: identifier
215 };
216 let queryValues = {
217 allowFaultIn: allowFaultIn,
218 previewFaultIn: previewFaultIn,
219 };
220 try {
221 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", routeValues, queryValues);
222 let url = verData.requestUrl;
223 let options = this.createRequestOptions('application/json', verData.apiVersion);
224 let res;
225 res = yield this.rest.get(url, options);
226 let ret = this.formatResponse(res.result, LocationsInterfaces.TypeInfo.ServiceDefinition, false);
227 resolve(ret);
228 }
229 catch (err) {
230 reject(err);
231 }
232 }));
233 });
234 }
235 /**
236 * @param {string} serviceType
237 */
238 getServiceDefinitions(serviceType) {
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 serviceType: serviceType
243 };
244 try {
245 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", 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, LocationsInterfaces.TypeInfo.ServiceDefinition, true);
251 resolve(ret);
252 }
253 catch (err) {
254 reject(err);
255 }
256 }));
257 });
258 }
259 /**
260 * @param {VSSInterfaces.VssJsonCollectionWrapperV<LocationsInterfaces.ServiceDefinition[]>} serviceDefinitions
261 */
262 updateServiceDefinitions(serviceDefinitions) {
263 return __awaiter(this, void 0, void 0, function* () {
264 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
265 let routeValues = {};
266 try {
267 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", routeValues);
268 let url = verData.requestUrl;
269 let options = this.createRequestOptions('application/json', verData.apiVersion);
270 let res;
271 res = yield this.rest.update(url, serviceDefinitions, options);
272 let ret = this.formatResponse(res.result, null, false);
273 resolve(ret);
274 }
275 catch (err) {
276 reject(err);
277 }
278 }));
279 });
280 }
281}
282exports.LocationsApi = LocationsApi;