UNPKG

37 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.ExtensionManagementApi = void 0;
22const basem = require("./ClientApiBases");
23const ExtensionManagementInterfaces = require("./interfaces/ExtensionManagementInterfaces");
24const GalleryInterfaces = require("./interfaces/GalleryInterfaces");
25class ExtensionManagementApi extends basem.ClientApiBase {
26 constructor(baseUrl, handlers, options) {
27 super(baseUrl, handlers, 'node-ExtensionManagement-api', options);
28 }
29 /**
30 * This API is called by acquisition/install page to get possible user actions like Buy/Request
31 *
32 * @param {string} itemId - Fully qualified name of extension (<publisher_id>.<extension_id>)
33 * @param {boolean} testCommerce - Parameter to test paid preview extension without making azure plans public
34 * @param {boolean} isFreeOrTrialInstall - Parameter represents install or trial workflow (required for legacy install flows)
35 * @param {boolean} isAccountOwner - Parameter represents whether user is owner or PCA of an account
36 * @param {boolean} isLinked - Parameter represents whether account is linked with a subscription
37 * @param {boolean} isConnectedServer - Parameter represents whether Buy operation should be evaluated
38 * @param {boolean} isBuyOperationValid
39 */
40 getAcquisitionOptions(itemId, testCommerce, isFreeOrTrialInstall, isAccountOwner, isLinked, isConnectedServer, isBuyOperationValid) {
41 return __awaiter(this, void 0, void 0, function* () {
42 if (itemId == null) {
43 throw new TypeError('itemId can not be null or undefined');
44 }
45 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
46 let routeValues = {};
47 let queryValues = {
48 itemId: itemId,
49 testCommerce: testCommerce,
50 isFreeOrTrialInstall: isFreeOrTrialInstall,
51 isAccountOwner: isAccountOwner,
52 isLinked: isLinked,
53 isConnectedServer: isConnectedServer,
54 isBuyOperationValid: isBuyOperationValid,
55 };
56 try {
57 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "288dff58-d13b-468e-9671-0fb754e9398c", routeValues, queryValues);
58 let url = verData.requestUrl;
59 let options = this.createRequestOptions('application/json', verData.apiVersion);
60 let res;
61 res = yield this.rest.get(url, options);
62 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.AcquisitionOptions, false);
63 resolve(ret);
64 }
65 catch (err) {
66 reject(err);
67 }
68 }));
69 });
70 }
71 /**
72 * @param {ExtensionManagementInterfaces.ExtensionAcquisitionRequest} acquisitionRequest
73 */
74 requestAcquisition(acquisitionRequest) {
75 return __awaiter(this, void 0, void 0, function* () {
76 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
77 let routeValues = {};
78 try {
79 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "da616457-eed3-4672-92d7-18d21f5c1658", routeValues);
80 let url = verData.requestUrl;
81 let options = this.createRequestOptions('application/json', verData.apiVersion);
82 let res;
83 res = yield this.rest.create(url, acquisitionRequest, options);
84 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.ExtensionAcquisitionRequest, false);
85 resolve(ret);
86 }
87 catch (err) {
88 reject(err);
89 }
90 }));
91 });
92 }
93 /**
94 * @param {string} publisherName
95 * @param {string} extensionName
96 */
97 getAuditLog(publisherName, extensionName) {
98 return __awaiter(this, void 0, void 0, function* () {
99 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
100 let routeValues = {
101 publisherName: publisherName,
102 extensionName: extensionName
103 };
104 try {
105 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "23a312e0-562d-42fb-a505-5a046b5635db", routeValues);
106 let url = verData.requestUrl;
107 let options = this.createRequestOptions('application/json', verData.apiVersion);
108 let res;
109 res = yield this.rest.get(url, options);
110 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.ExtensionAuditLog, false);
111 resolve(ret);
112 }
113 catch (err) {
114 reject(err);
115 }
116 }));
117 });
118 }
119 /**
120 * @param {string} publisherName
121 * @param {string} extensionName
122 * @param {string} registrationId
123 */
124 registerAuthorization(publisherName, extensionName, registrationId) {
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 publisherName: publisherName,
129 extensionName: extensionName,
130 registrationId: registrationId
131 };
132 try {
133 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "f21cfc80-d2d2-4248-98bb-7820c74c4606", routeValues);
134 let url = verData.requestUrl;
135 let options = this.createRequestOptions('application/json', verData.apiVersion);
136 let res;
137 res = yield this.rest.replace(url, null, options);
138 let ret = this.formatResponse(res.result, null, false);
139 resolve(ret);
140 }
141 catch (err) {
142 reject(err);
143 }
144 }));
145 });
146 }
147 /**
148 * @param {any} doc
149 * @param {string} publisherName
150 * @param {string} extensionName
151 * @param {string} scopeType
152 * @param {string} scopeValue
153 * @param {string} collectionName
154 */
155 createDocumentByName(doc, publisherName, extensionName, scopeType, scopeValue, collectionName) {
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 publisherName: publisherName,
160 extensionName: extensionName,
161 scopeType: scopeType,
162 scopeValue: scopeValue,
163 collectionName: collectionName
164 };
165 try {
166 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues);
167 let url = verData.requestUrl;
168 let options = this.createRequestOptions('application/json', verData.apiVersion);
169 let res;
170 res = yield this.rest.create(url, doc, options);
171 let ret = this.formatResponse(res.result, null, false);
172 resolve(ret);
173 }
174 catch (err) {
175 reject(err);
176 }
177 }));
178 });
179 }
180 /**
181 * @param {string} publisherName
182 * @param {string} extensionName
183 * @param {string} scopeType
184 * @param {string} scopeValue
185 * @param {string} collectionName
186 * @param {string} documentId
187 */
188 deleteDocumentByName(publisherName, extensionName, scopeType, scopeValue, collectionName, documentId) {
189 return __awaiter(this, void 0, void 0, function* () {
190 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
191 let routeValues = {
192 publisherName: publisherName,
193 extensionName: extensionName,
194 scopeType: scopeType,
195 scopeValue: scopeValue,
196 collectionName: collectionName,
197 documentId: documentId
198 };
199 try {
200 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues);
201 let url = verData.requestUrl;
202 let options = this.createRequestOptions('application/json', verData.apiVersion);
203 let res;
204 res = yield this.rest.del(url, options);
205 let ret = this.formatResponse(res.result, null, false);
206 resolve(ret);
207 }
208 catch (err) {
209 reject(err);
210 }
211 }));
212 });
213 }
214 /**
215 * @param {string} publisherName
216 * @param {string} extensionName
217 * @param {string} scopeType
218 * @param {string} scopeValue
219 * @param {string} collectionName
220 * @param {string} documentId
221 */
222 getDocumentByName(publisherName, extensionName, scopeType, scopeValue, collectionName, documentId) {
223 return __awaiter(this, void 0, void 0, function* () {
224 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
225 let routeValues = {
226 publisherName: publisherName,
227 extensionName: extensionName,
228 scopeType: scopeType,
229 scopeValue: scopeValue,
230 collectionName: collectionName,
231 documentId: documentId
232 };
233 try {
234 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues);
235 let url = verData.requestUrl;
236 let options = this.createRequestOptions('application/json', verData.apiVersion);
237 let res;
238 res = yield this.rest.get(url, options);
239 let ret = this.formatResponse(res.result, null, false);
240 resolve(ret);
241 }
242 catch (err) {
243 reject(err);
244 }
245 }));
246 });
247 }
248 /**
249 * @param {string} publisherName
250 * @param {string} extensionName
251 * @param {string} scopeType
252 * @param {string} scopeValue
253 * @param {string} collectionName
254 */
255 getDocumentsByName(publisherName, extensionName, scopeType, scopeValue, collectionName) {
256 return __awaiter(this, void 0, void 0, function* () {
257 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
258 let routeValues = {
259 publisherName: publisherName,
260 extensionName: extensionName,
261 scopeType: scopeType,
262 scopeValue: scopeValue,
263 collectionName: collectionName
264 };
265 try {
266 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues);
267 let url = verData.requestUrl;
268 let options = this.createRequestOptions('application/json', verData.apiVersion);
269 let res;
270 res = yield this.rest.get(url, options);
271 let ret = this.formatResponse(res.result, null, true);
272 resolve(ret);
273 }
274 catch (err) {
275 reject(err);
276 }
277 }));
278 });
279 }
280 /**
281 * @param {any} doc
282 * @param {string} publisherName
283 * @param {string} extensionName
284 * @param {string} scopeType
285 * @param {string} scopeValue
286 * @param {string} collectionName
287 */
288 setDocumentByName(doc, publisherName, extensionName, scopeType, scopeValue, collectionName) {
289 return __awaiter(this, void 0, void 0, function* () {
290 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
291 let routeValues = {
292 publisherName: publisherName,
293 extensionName: extensionName,
294 scopeType: scopeType,
295 scopeValue: scopeValue,
296 collectionName: collectionName
297 };
298 try {
299 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues);
300 let url = verData.requestUrl;
301 let options = this.createRequestOptions('application/json', verData.apiVersion);
302 let res;
303 res = yield this.rest.replace(url, doc, options);
304 let ret = this.formatResponse(res.result, null, false);
305 resolve(ret);
306 }
307 catch (err) {
308 reject(err);
309 }
310 }));
311 });
312 }
313 /**
314 * @param {any} doc
315 * @param {string} publisherName
316 * @param {string} extensionName
317 * @param {string} scopeType
318 * @param {string} scopeValue
319 * @param {string} collectionName
320 */
321 updateDocumentByName(doc, publisherName, extensionName, scopeType, scopeValue, collectionName) {
322 return __awaiter(this, void 0, void 0, function* () {
323 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
324 let routeValues = {
325 publisherName: publisherName,
326 extensionName: extensionName,
327 scopeType: scopeType,
328 scopeValue: scopeValue,
329 collectionName: collectionName
330 };
331 try {
332 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues);
333 let url = verData.requestUrl;
334 let options = this.createRequestOptions('application/json', verData.apiVersion);
335 let res;
336 res = yield this.rest.update(url, doc, options);
337 let ret = this.formatResponse(res.result, null, false);
338 resolve(ret);
339 }
340 catch (err) {
341 reject(err);
342 }
343 }));
344 });
345 }
346 /**
347 * Query for one or more data collections for the specified extension. Note: the token used for authorization must have been issued on behalf of the specified extension.
348 *
349 * @param {ExtensionManagementInterfaces.ExtensionDataCollectionQuery} collectionQuery
350 * @param {string} publisherName - Name of the publisher. Example: "fabrikam".
351 * @param {string} extensionName - Name of the extension. Example: "ops-tools".
352 */
353 queryCollectionsByName(collectionQuery, publisherName, extensionName) {
354 return __awaiter(this, void 0, void 0, function* () {
355 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
356 let routeValues = {
357 publisherName: publisherName,
358 extensionName: extensionName
359 };
360 try {
361 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "56c331f1-ce53-4318-adfd-4db5c52a7a2e", routeValues);
362 let url = verData.requestUrl;
363 let options = this.createRequestOptions('application/json', verData.apiVersion);
364 let res;
365 res = yield this.rest.create(url, collectionQuery, options);
366 let ret = this.formatResponse(res.result, null, true);
367 resolve(ret);
368 }
369 catch (err) {
370 reject(err);
371 }
372 }));
373 });
374 }
375 /**
376 * List state and version information for all installed extensions.
377 *
378 * @param {boolean} includeDisabled - If true (the default), include disabled extensions in the results.
379 * @param {boolean} includeErrors - If true, include installed extensions in an error state in the results.
380 * @param {boolean} includeInstallationIssues
381 * @param {boolean} forceRefresh
382 */
383 getStates(includeDisabled, includeErrors, includeInstallationIssues, forceRefresh) {
384 return __awaiter(this, void 0, void 0, function* () {
385 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
386 let routeValues = {};
387 let queryValues = {
388 includeDisabled: includeDisabled,
389 includeErrors: includeErrors,
390 includeInstallationIssues: includeInstallationIssues,
391 forceRefresh: forceRefresh,
392 };
393 try {
394 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "92755d3d-9a8a-42b3-8a4d-87359fe5aa93", routeValues, queryValues);
395 let url = verData.requestUrl;
396 let options = this.createRequestOptions('application/json', verData.apiVersion);
397 let res;
398 res = yield this.rest.get(url, options);
399 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.ExtensionState, true);
400 resolve(ret);
401 }
402 catch (err) {
403 reject(err);
404 }
405 }));
406 });
407 }
408 /**
409 * @param {ExtensionManagementInterfaces.InstalledExtensionQuery} query
410 */
411 queryExtensions(query) {
412 return __awaiter(this, void 0, void 0, function* () {
413 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
414 let routeValues = {};
415 try {
416 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "046c980f-1345-4ce2-bf85-b46d10ff4cfd", routeValues);
417 let url = verData.requestUrl;
418 let options = this.createRequestOptions('application/json', verData.apiVersion);
419 let res;
420 res = yield this.rest.create(url, query, options);
421 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, true);
422 resolve(ret);
423 }
424 catch (err) {
425 reject(err);
426 }
427 }));
428 });
429 }
430 /**
431 * List the installed extensions in the account / project collection.
432 *
433 * @param {boolean} includeDisabledExtensions - If true (the default), include disabled extensions in the results.
434 * @param {boolean} includeErrors - If true, include installed extensions with errors.
435 * @param {string[]} assetTypes - Determines which files are returned in the files array. Provide the wildcard '*' to return all files, or a colon separated list to retrieve files with specific asset types.
436 * @param {boolean} includeInstallationIssues
437 */
438 getInstalledExtensions(includeDisabledExtensions, includeErrors, assetTypes, includeInstallationIssues) {
439 return __awaiter(this, void 0, void 0, function* () {
440 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
441 let routeValues = {};
442 let queryValues = {
443 includeDisabledExtensions: includeDisabledExtensions,
444 includeErrors: includeErrors,
445 assetTypes: assetTypes && assetTypes.join(":"),
446 includeInstallationIssues: includeInstallationIssues,
447 };
448 try {
449 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "275424d0-c844-4fe2-bda6-04933a1357d8", routeValues, queryValues);
450 let url = verData.requestUrl;
451 let options = this.createRequestOptions('application/json', verData.apiVersion);
452 let res;
453 res = yield this.rest.get(url, options);
454 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, true);
455 resolve(ret);
456 }
457 catch (err) {
458 reject(err);
459 }
460 }));
461 });
462 }
463 /**
464 * Update an installed extension. Typically this API is used to enable or disable an extension.
465 *
466 * @param {ExtensionManagementInterfaces.InstalledExtension} extension
467 */
468 updateInstalledExtension(extension) {
469 return __awaiter(this, void 0, void 0, function* () {
470 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
471 let routeValues = {};
472 try {
473 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "275424d0-c844-4fe2-bda6-04933a1357d8", routeValues);
474 let url = verData.requestUrl;
475 let options = this.createRequestOptions('application/json', verData.apiVersion);
476 let res;
477 res = yield this.rest.update(url, extension, options);
478 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, false);
479 resolve(ret);
480 }
481 catch (err) {
482 reject(err);
483 }
484 }));
485 });
486 }
487 /**
488 * Get an installed extension by its publisher and extension name.
489 *
490 * @param {string} publisherName - Name of the publisher. Example: "fabrikam".
491 * @param {string} extensionName - Name of the extension. Example: "ops-tools".
492 * @param {string[]} assetTypes - Determines which files are returned in the files array. Provide the wildcard '*' to return all files, or a colon separated list to retrieve files with specific asset types.
493 */
494 getInstalledExtensionByName(publisherName, extensionName, assetTypes) {
495 return __awaiter(this, void 0, void 0, function* () {
496 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
497 let routeValues = {
498 publisherName: publisherName,
499 extensionName: extensionName
500 };
501 let queryValues = {
502 assetTypes: assetTypes && assetTypes.join(":"),
503 };
504 try {
505 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "fb0da285-f23e-4b56-8b53-3ef5f9f6de66", routeValues, queryValues);
506 let url = verData.requestUrl;
507 let options = this.createRequestOptions('application/json', verData.apiVersion);
508 let res;
509 res = yield this.rest.get(url, options);
510 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, false);
511 resolve(ret);
512 }
513 catch (err) {
514 reject(err);
515 }
516 }));
517 });
518 }
519 /**
520 * Install the specified extension into the account / project collection.
521 *
522 * @param {string} publisherName - Name of the publisher. Example: "fabrikam".
523 * @param {string} extensionName - Name of the extension. Example: "ops-tools".
524 * @param {string} version
525 */
526 installExtensionByName(publisherName, extensionName, version) {
527 return __awaiter(this, void 0, void 0, function* () {
528 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
529 let routeValues = {
530 publisherName: publisherName,
531 extensionName: extensionName,
532 version: version
533 };
534 try {
535 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "fb0da285-f23e-4b56-8b53-3ef5f9f6de66", routeValues);
536 let url = verData.requestUrl;
537 let options = this.createRequestOptions('application/json', verData.apiVersion);
538 let res;
539 res = yield this.rest.create(url, null, options);
540 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, false);
541 resolve(ret);
542 }
543 catch (err) {
544 reject(err);
545 }
546 }));
547 });
548 }
549 /**
550 * Uninstall the specified extension from the account / project collection.
551 *
552 * @param {string} publisherName - Name of the publisher. Example: "fabrikam".
553 * @param {string} extensionName - Name of the extension. Example: "ops-tools".
554 * @param {string} reason
555 * @param {string} reasonCode
556 */
557 uninstallExtensionByName(publisherName, extensionName, reason, reasonCode) {
558 return __awaiter(this, void 0, void 0, function* () {
559 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
560 let routeValues = {
561 publisherName: publisherName,
562 extensionName: extensionName
563 };
564 let queryValues = {
565 reason: reason,
566 reasonCode: reasonCode,
567 };
568 try {
569 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "fb0da285-f23e-4b56-8b53-3ef5f9f6de66", routeValues, queryValues);
570 let url = verData.requestUrl;
571 let options = this.createRequestOptions('application/json', verData.apiVersion);
572 let res;
573 res = yield this.rest.del(url, options);
574 let ret = this.formatResponse(res.result, null, false);
575 resolve(ret);
576 }
577 catch (err) {
578 reject(err);
579 }
580 }));
581 });
582 }
583 /**
584 * @param {string} userId
585 */
586 getPolicies(userId) {
587 return __awaiter(this, void 0, void 0, function* () {
588 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
589 let routeValues = {
590 userId: userId
591 };
592 try {
593 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "e5cc8c09-407b-4867-8319-2ae3338cbf6f", routeValues);
594 let url = verData.requestUrl;
595 let options = this.createRequestOptions('application/json', verData.apiVersion);
596 let res;
597 res = yield this.rest.get(url, options);
598 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.UserExtensionPolicy, false);
599 resolve(ret);
600 }
601 catch (err) {
602 reject(err);
603 }
604 }));
605 });
606 }
607 /**
608 * @param {string} rejectMessage
609 * @param {string} publisherName
610 * @param {string} extensionName
611 * @param {string} requesterId
612 * @param {ExtensionManagementInterfaces.ExtensionRequestState} state
613 */
614 resolveRequest(rejectMessage, publisherName, extensionName, requesterId, state) {
615 return __awaiter(this, void 0, void 0, function* () {
616 if (state == null) {
617 throw new TypeError('state can not be null or undefined');
618 }
619 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
620 let routeValues = {
621 publisherName: publisherName,
622 extensionName: extensionName,
623 requesterId: requesterId
624 };
625 let queryValues = {
626 state: state,
627 };
628 try {
629 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "aa93e1f3-511c-4364-8b9c-eb98818f2e0b", routeValues, queryValues);
630 let url = verData.requestUrl;
631 let options = this.createRequestOptions('application/json', verData.apiVersion);
632 let res;
633 res = yield this.rest.update(url, rejectMessage, options);
634 let ret = this.formatResponse(res.result, null, false);
635 resolve(ret);
636 }
637 catch (err) {
638 reject(err);
639 }
640 }));
641 });
642 }
643 /**
644 */
645 getRequests() {
646 return __awaiter(this, void 0, void 0, function* () {
647 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
648 let routeValues = {};
649 try {
650 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "216b978f-b164-424e-ada2-b77561e842b7", routeValues);
651 let url = verData.requestUrl;
652 let options = this.createRequestOptions('application/json', verData.apiVersion);
653 let res;
654 res = yield this.rest.get(url, options);
655 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.RequestedExtension, true);
656 resolve(ret);
657 }
658 catch (err) {
659 reject(err);
660 }
661 }));
662 });
663 }
664 /**
665 * @param {string} rejectMessage
666 * @param {string} publisherName
667 * @param {string} extensionName
668 * @param {ExtensionManagementInterfaces.ExtensionRequestState} state
669 */
670 resolveAllRequests(rejectMessage, publisherName, extensionName, state) {
671 return __awaiter(this, void 0, void 0, function* () {
672 if (state == null) {
673 throw new TypeError('state can not be null or undefined');
674 }
675 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
676 let routeValues = {
677 publisherName: publisherName,
678 extensionName: extensionName
679 };
680 let queryValues = {
681 state: state,
682 };
683 try {
684 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "ba93e1f3-511c-4364-8b9c-eb98818f2e0b", routeValues, queryValues);
685 let url = verData.requestUrl;
686 let options = this.createRequestOptions('application/json', verData.apiVersion);
687 let res;
688 res = yield this.rest.update(url, rejectMessage, options);
689 let ret = this.formatResponse(res.result, null, false);
690 resolve(ret);
691 }
692 catch (err) {
693 reject(err);
694 }
695 }));
696 });
697 }
698 /**
699 * @param {string} publisherName
700 * @param {string} extensionName
701 */
702 deleteRequest(publisherName, extensionName) {
703 return __awaiter(this, void 0, void 0, function* () {
704 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
705 let routeValues = {
706 publisherName: publisherName,
707 extensionName: extensionName
708 };
709 try {
710 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "f5afca1e-a728-4294-aa2d-4af0173431b5", routeValues);
711 let url = verData.requestUrl;
712 let options = this.createRequestOptions('application/json', verData.apiVersion);
713 let res;
714 res = yield this.rest.del(url, options);
715 let ret = this.formatResponse(res.result, null, false);
716 resolve(ret);
717 }
718 catch (err) {
719 reject(err);
720 }
721 }));
722 });
723 }
724 /**
725 * @param {string} publisherName
726 * @param {string} extensionName
727 * @param {string} requestMessage
728 */
729 requestExtension(publisherName, extensionName, requestMessage) {
730 return __awaiter(this, void 0, void 0, function* () {
731 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
732 let routeValues = {
733 publisherName: publisherName,
734 extensionName: extensionName
735 };
736 try {
737 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "f5afca1e-a728-4294-aa2d-4af0173431b5", routeValues);
738 let url = verData.requestUrl;
739 let options = this.createRequestOptions('application/json', verData.apiVersion);
740 let res;
741 res = yield this.rest.create(url, requestMessage, options);
742 let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.RequestedExtension, false);
743 resolve(ret);
744 }
745 catch (err) {
746 reject(err);
747 }
748 }));
749 });
750 }
751 /**
752 */
753 getToken() {
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 try {
758 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "3a2e24ed-1d6f-4cb2-9f3b-45a96bbfaf50", routeValues);
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, false);
764 resolve(ret);
765 }
766 catch (err) {
767 reject(err);
768 }
769 }));
770 });
771 }
772}
773exports.ExtensionManagementApi = ExtensionManagementApi;
774ExtensionManagementApi.RESOURCE_AREA_ID = "6c2b0933-3600-42ae-bf8b-93d4f7e83594";