UNPKG

120 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.GalleryApi = void 0;
22const compatBase = require("././GalleryCompatHttpClientBase");
23const GalleryInterfaces = require("./interfaces/GalleryInterfaces");
24class GalleryApi extends compatBase.GalleryCompatHttpClientBase {
25 constructor(baseUrl, handlers, options) {
26 super(baseUrl, handlers, 'node-Gallery-api', options);
27 }
28 /**
29 * @param {string} extensionId
30 * @param {string} accountName
31 */
32 shareExtensionById(extensionId, accountName) {
33 return __awaiter(this, void 0, void 0, function* () {
34 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
35 let routeValues = {
36 extensionId: extensionId,
37 accountName: accountName
38 };
39 try {
40 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "1f19631b-a0b4-4a03-89c2-d79785d24360", routeValues);
41 let url = verData.requestUrl;
42 let options = this.createRequestOptions('application/json', verData.apiVersion);
43 let res;
44 res = yield this.rest.create(url, null, options);
45 let ret = this.formatResponse(res.result, null, false);
46 resolve(ret);
47 }
48 catch (err) {
49 reject(err);
50 }
51 }));
52 });
53 }
54 /**
55 * @param {string} extensionId
56 * @param {string} accountName
57 */
58 unshareExtensionById(extensionId, accountName) {
59 return __awaiter(this, void 0, void 0, function* () {
60 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
61 let routeValues = {
62 extensionId: extensionId,
63 accountName: accountName
64 };
65 try {
66 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "1f19631b-a0b4-4a03-89c2-d79785d24360", routeValues);
67 let url = verData.requestUrl;
68 let options = this.createRequestOptions('application/json', verData.apiVersion);
69 let res;
70 res = yield this.rest.del(url, options);
71 let ret = this.formatResponse(res.result, null, false);
72 resolve(ret);
73 }
74 catch (err) {
75 reject(err);
76 }
77 }));
78 });
79 }
80 /**
81 * @param {string} publisherName
82 * @param {string} extensionName
83 * @param {string} accountName
84 */
85 shareExtension(publisherName, extensionName, accountName) {
86 return __awaiter(this, void 0, void 0, function* () {
87 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
88 let routeValues = {
89 publisherName: publisherName,
90 extensionName: extensionName,
91 accountName: accountName
92 };
93 try {
94 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "a1e66d8f-f5de-4d16-8309-91a4e015ee46", routeValues);
95 let url = verData.requestUrl;
96 let options = this.createRequestOptions('application/json', verData.apiVersion);
97 let res;
98 res = yield this.rest.create(url, null, options);
99 let ret = this.formatResponse(res.result, null, false);
100 resolve(ret);
101 }
102 catch (err) {
103 reject(err);
104 }
105 }));
106 });
107 }
108 /**
109 * @param {string} publisherName
110 * @param {string} extensionName
111 * @param {string} accountName
112 */
113 unshareExtension(publisherName, extensionName, accountName) {
114 return __awaiter(this, void 0, void 0, function* () {
115 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
116 let routeValues = {
117 publisherName: publisherName,
118 extensionName: extensionName,
119 accountName: accountName
120 };
121 try {
122 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "a1e66d8f-f5de-4d16-8309-91a4e015ee46", routeValues);
123 let url = verData.requestUrl;
124 let options = this.createRequestOptions('application/json', verData.apiVersion);
125 let res;
126 res = yield this.rest.del(url, options);
127 let ret = this.formatResponse(res.result, null, false);
128 resolve(ret);
129 }
130 catch (err) {
131 reject(err);
132 }
133 }));
134 });
135 }
136 /**
137 * @param {string} itemId
138 * @param {string} installationTarget
139 * @param {boolean} testCommerce
140 * @param {boolean} isFreeOrTrialInstall
141 */
142 getAcquisitionOptions(itemId, installationTarget, testCommerce, isFreeOrTrialInstall) {
143 return __awaiter(this, void 0, void 0, function* () {
144 if (installationTarget == null) {
145 throw new TypeError('installationTarget can not be null or undefined');
146 }
147 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
148 let routeValues = {
149 itemId: itemId
150 };
151 let queryValues = {
152 installationTarget: installationTarget,
153 testCommerce: testCommerce,
154 isFreeOrTrialInstall: isFreeOrTrialInstall,
155 };
156 try {
157 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "9d0a0105-075e-4760-aa15-8bcf54d1bd7d", routeValues, queryValues);
158 let url = verData.requestUrl;
159 let options = this.createRequestOptions('application/json', verData.apiVersion);
160 let res;
161 res = yield this.rest.get(url, options);
162 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.AcquisitionOptions, false);
163 resolve(ret);
164 }
165 catch (err) {
166 reject(err);
167 }
168 }));
169 });
170 }
171 /**
172 * @param {GalleryInterfaces.ExtensionAcquisitionRequest} acquisitionRequest
173 */
174 requestAcquisition(acquisitionRequest) {
175 return __awaiter(this, void 0, void 0, function* () {
176 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
177 let routeValues = {};
178 try {
179 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "3adb1f2d-e328-446e-be73-9f6d98071c45", routeValues);
180 let url = verData.requestUrl;
181 let options = this.createRequestOptions('application/json', verData.apiVersion);
182 let res;
183 res = yield this.rest.create(url, acquisitionRequest, options);
184 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionAcquisitionRequest, false);
185 resolve(ret);
186 }
187 catch (err) {
188 reject(err);
189 }
190 }));
191 });
192 }
193 /**
194 * @param {string} publisherName
195 * @param {string} extensionName
196 * @param {string} version
197 * @param {string} assetType
198 * @param {string} accountToken
199 * @param {boolean} acceptDefault
200 * @param {String} accountTokenHeader - Header to pass the account token
201 */
202 getAssetByName(customHeaders, publisherName, extensionName, version, assetType, accountToken, acceptDefault, accountTokenHeader) {
203 return __awaiter(this, void 0, void 0, function* () {
204 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
205 let routeValues = {
206 publisherName: publisherName,
207 extensionName: extensionName,
208 version: version,
209 assetType: assetType
210 };
211 let queryValues = {
212 accountToken: accountToken,
213 acceptDefault: acceptDefault,
214 };
215 customHeaders = customHeaders || {};
216 customHeaders["X-Market-AccountToken"] = "accountTokenHeader";
217 try {
218 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7529171f-a002-4180-93ba-685f358a0482", routeValues, queryValues);
219 let url = verData.requestUrl;
220 let apiVersion = verData.apiVersion;
221 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
222 resolve((yield this.http.get(url, { "Accept": accept })).message);
223 }
224 catch (err) {
225 reject(err);
226 }
227 }));
228 });
229 }
230 /**
231 * @param {string} extensionId
232 * @param {string} version
233 * @param {string} assetType
234 * @param {string} accountToken
235 * @param {boolean} acceptDefault
236 * @param {String} accountTokenHeader - Header to pass the account token
237 */
238 getAsset(customHeaders, extensionId, version, assetType, accountToken, acceptDefault, accountTokenHeader) {
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 extensionId: extensionId,
243 version: version,
244 assetType: assetType
245 };
246 let queryValues = {
247 accountToken: accountToken,
248 acceptDefault: acceptDefault,
249 };
250 customHeaders = customHeaders || {};
251 customHeaders["X-Market-AccountToken"] = "accountTokenHeader";
252 try {
253 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "5d545f3d-ef47-488b-8be3-f5ee1517856c", routeValues, queryValues);
254 let url = verData.requestUrl;
255 let apiVersion = verData.apiVersion;
256 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
257 resolve((yield this.http.get(url, { "Accept": accept })).message);
258 }
259 catch (err) {
260 reject(err);
261 }
262 }));
263 });
264 }
265 /**
266 * @param {string} publisherName
267 * @param {string} extensionName
268 * @param {string} version
269 * @param {string} assetType
270 * @param {string} accountToken
271 * @param {String} accountTokenHeader - Header to pass the account token
272 */
273 getAssetAuthenticated(customHeaders, publisherName, extensionName, version, assetType, accountToken, accountTokenHeader) {
274 return __awaiter(this, void 0, void 0, function* () {
275 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
276 let routeValues = {
277 publisherName: publisherName,
278 extensionName: extensionName,
279 version: version,
280 assetType: assetType
281 };
282 let queryValues = {
283 accountToken: accountToken,
284 };
285 customHeaders = customHeaders || {};
286 customHeaders["X-Market-AccountToken"] = "accountTokenHeader";
287 try {
288 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "506aff36-2622-4f70-8063-77cce6366d20", routeValues, queryValues);
289 let url = verData.requestUrl;
290 let apiVersion = verData.apiVersion;
291 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
292 resolve((yield this.http.get(url, { "Accept": accept })).message);
293 }
294 catch (err) {
295 reject(err);
296 }
297 }));
298 });
299 }
300 /**
301 * @param {string} publisherName
302 * @param {string} azurePublisherId
303 */
304 associateAzurePublisher(publisherName, azurePublisherId) {
305 return __awaiter(this, void 0, void 0, function* () {
306 if (azurePublisherId == null) {
307 throw new TypeError('azurePublisherId can not be null or undefined');
308 }
309 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
310 let routeValues = {
311 publisherName: publisherName
312 };
313 let queryValues = {
314 azurePublisherId: azurePublisherId,
315 };
316 try {
317 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "efd202a6-9d87-4ebc-9229-d2b8ae2fdb6d", routeValues, queryValues);
318 let url = verData.requestUrl;
319 let options = this.createRequestOptions('application/json', verData.apiVersion);
320 let res;
321 res = yield this.rest.replace(url, null, options);
322 let ret = this.formatResponse(res.result, null, false);
323 resolve(ret);
324 }
325 catch (err) {
326 reject(err);
327 }
328 }));
329 });
330 }
331 /**
332 * @param {string} publisherName
333 */
334 queryAssociatedAzurePublisher(publisherName) {
335 return __awaiter(this, void 0, void 0, function* () {
336 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
337 let routeValues = {
338 publisherName: publisherName
339 };
340 try {
341 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "efd202a6-9d87-4ebc-9229-d2b8ae2fdb6d", routeValues);
342 let url = verData.requestUrl;
343 let options = this.createRequestOptions('application/json', verData.apiVersion);
344 let res;
345 res = yield this.rest.get(url, options);
346 let ret = this.formatResponse(res.result, null, false);
347 resolve(ret);
348 }
349 catch (err) {
350 reject(err);
351 }
352 }));
353 });
354 }
355 /**
356 * @param {string} languages
357 */
358 getCategories(languages) {
359 return __awaiter(this, void 0, void 0, function* () {
360 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
361 let routeValues = {};
362 let queryValues = {
363 languages: languages,
364 };
365 try {
366 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e0a5a71e-3ac3-43a0-ae7d-0bb5c3046a2a", routeValues, queryValues);
367 let url = verData.requestUrl;
368 let options = this.createRequestOptions('application/json', verData.apiVersion);
369 let res;
370 res = yield this.rest.get(url, options);
371 let ret = this.formatResponse(res.result, null, true);
372 resolve(ret);
373 }
374 catch (err) {
375 reject(err);
376 }
377 }));
378 });
379 }
380 /**
381 * @param {string} categoryName
382 * @param {string} languages
383 * @param {string} product
384 */
385 getCategoryDetails(categoryName, languages, product) {
386 return __awaiter(this, void 0, void 0, function* () {
387 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
388 let routeValues = {
389 categoryName: categoryName
390 };
391 let queryValues = {
392 languages: languages,
393 product: product,
394 };
395 try {
396 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "75d3c04d-84d2-4973-acd2-22627587dabc", routeValues, queryValues);
397 let url = verData.requestUrl;
398 let options = this.createRequestOptions('application/json', verData.apiVersion);
399 let res;
400 res = yield this.rest.get(url, options);
401 let ret = this.formatResponse(res.result, null, false);
402 resolve(ret);
403 }
404 catch (err) {
405 reject(err);
406 }
407 }));
408 });
409 }
410 /**
411 * @param {string} product
412 * @param {string} categoryId
413 * @param {number} lcid
414 * @param {string} source
415 * @param {string} productVersion
416 * @param {string} skus
417 * @param {string} subSkus
418 * @param {string} productArchitecture
419 */
420 getCategoryTree(product, categoryId, lcid, source, productVersion, skus, subSkus, productArchitecture) {
421 return __awaiter(this, void 0, void 0, function* () {
422 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
423 let routeValues = {
424 product: product,
425 categoryId: categoryId
426 };
427 let queryValues = {
428 lcid: lcid,
429 source: source,
430 productVersion: productVersion,
431 skus: skus,
432 subSkus: subSkus,
433 productArchitecture: productArchitecture,
434 };
435 try {
436 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "1102bb42-82b0-4955-8d8a-435d6b4cedd3", routeValues, queryValues);
437 let url = verData.requestUrl;
438 let options = this.createRequestOptions('application/json', verData.apiVersion);
439 let res;
440 res = yield this.rest.get(url, options);
441 let ret = this.formatResponse(res.result, null, false);
442 resolve(ret);
443 }
444 catch (err) {
445 reject(err);
446 }
447 }));
448 });
449 }
450 /**
451 * @param {string} product
452 * @param {number} lcid
453 * @param {string} source
454 * @param {string} productVersion
455 * @param {string} skus
456 * @param {string} subSkus
457 */
458 getRootCategories(product, lcid, source, productVersion, skus, subSkus) {
459 return __awaiter(this, void 0, void 0, function* () {
460 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
461 let routeValues = {
462 product: product
463 };
464 let queryValues = {
465 lcid: lcid,
466 source: source,
467 productVersion: productVersion,
468 skus: skus,
469 subSkus: subSkus,
470 };
471 try {
472 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "31fba831-35b2-46f6-a641-d05de5a877d8", routeValues, queryValues);
473 let url = verData.requestUrl;
474 let options = this.createRequestOptions('application/json', verData.apiVersion);
475 let res;
476 res = yield this.rest.get(url, options);
477 let ret = this.formatResponse(res.result, null, false);
478 resolve(ret);
479 }
480 catch (err) {
481 reject(err);
482 }
483 }));
484 });
485 }
486 /**
487 * @param {string} publisherName
488 * @param {string} extensionName
489 * @param {string} version
490 */
491 getCertificate(publisherName, extensionName, version) {
492 return __awaiter(this, void 0, void 0, function* () {
493 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
494 let routeValues = {
495 publisherName: publisherName,
496 extensionName: extensionName,
497 version: version
498 };
499 try {
500 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e905ad6a-3f1f-4d08-9f6d-7d357ff8b7d0", routeValues);
501 let url = verData.requestUrl;
502 let apiVersion = verData.apiVersion;
503 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
504 resolve((yield this.http.get(url, { "Accept": accept })).message);
505 }
506 catch (err) {
507 reject(err);
508 }
509 }));
510 });
511 }
512 /**
513 * @param {string} publisherName
514 * @param {string} extensionName
515 */
516 getContentVerificationLog(publisherName, extensionName) {
517 return __awaiter(this, void 0, void 0, function* () {
518 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
519 let routeValues = {
520 publisherName: publisherName,
521 extensionName: extensionName
522 };
523 try {
524 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "c0f1c7c4-3557-4ffb-b774-1e48c4865e99", routeValues);
525 let url = verData.requestUrl;
526 let apiVersion = verData.apiVersion;
527 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
528 resolve((yield this.http.get(url, { "Accept": accept })).message);
529 }
530 catch (err) {
531 reject(err);
532 }
533 }));
534 });
535 }
536 /**
537 * @param {GalleryInterfaces.CustomerSupportRequest} customerSupportRequest
538 */
539 createSupportRequest(customerSupportRequest) {
540 return __awaiter(this, void 0, void 0, function* () {
541 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
542 let routeValues = {};
543 try {
544 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "8eded385-026a-4c15-b810-b8eb402771f1", routeValues);
545 let url = verData.requestUrl;
546 let options = this.createRequestOptions('application/json', verData.apiVersion);
547 let res;
548 res = yield this.rest.create(url, customerSupportRequest, options);
549 let ret = this.formatResponse(res.result, null, false);
550 resolve(ret);
551 }
552 catch (err) {
553 reject(err);
554 }
555 }));
556 });
557 }
558 /**
559 * @param {string} publisherName
560 * @param {string} extensionName
561 */
562 createDraftForEditExtension(publisherName, extensionName) {
563 return __awaiter(this, void 0, void 0, function* () {
564 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
565 let routeValues = {
566 publisherName: publisherName,
567 extensionName: extensionName
568 };
569 try {
570 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "02b33873-4e61-496e-83a2-59d1df46b7d8", routeValues);
571 let url = verData.requestUrl;
572 let options = this.createRequestOptions('application/json', verData.apiVersion);
573 let res;
574 res = yield this.rest.create(url, null, options);
575 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false);
576 resolve(ret);
577 }
578 catch (err) {
579 reject(err);
580 }
581 }));
582 });
583 }
584 /**
585 * @param {GalleryInterfaces.ExtensionDraftPatch} draftPatch
586 * @param {string} publisherName
587 * @param {string} extensionName
588 * @param {string} draftId
589 */
590 performEditExtensionDraftOperation(draftPatch, publisherName, extensionName, draftId) {
591 return __awaiter(this, void 0, void 0, function* () {
592 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
593 let routeValues = {
594 publisherName: publisherName,
595 extensionName: extensionName,
596 draftId: draftId
597 };
598 try {
599 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "02b33873-4e61-496e-83a2-59d1df46b7d8", routeValues);
600 let url = verData.requestUrl;
601 let options = this.createRequestOptions('application/json', verData.apiVersion);
602 let res;
603 res = yield this.rest.update(url, draftPatch, options);
604 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false);
605 resolve(ret);
606 }
607 catch (err) {
608 reject(err);
609 }
610 }));
611 });
612 }
613 /**
614 * @param {NodeJS.ReadableStream} contentStream - Content to upload
615 * @param {string} publisherName
616 * @param {string} extensionName
617 * @param {string} draftId
618 * @param {String} fileName - Header to pass the filename of the uploaded data
619 */
620 updatePayloadInDraftForEditExtension(customHeaders, contentStream, publisherName, extensionName, draftId, fileName) {
621 return __awaiter(this, void 0, void 0, function* () {
622 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
623 let routeValues = {
624 publisherName: publisherName,
625 extensionName: extensionName,
626 draftId: draftId
627 };
628 customHeaders = customHeaders || {};
629 customHeaders["Content-Type"] = "application/octet-stream";
630 customHeaders["X-Market-UploadFileName"] = "fileName";
631 try {
632 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "02b33873-4e61-496e-83a2-59d1df46b7d8", routeValues);
633 let url = verData.requestUrl;
634 let options = this.createRequestOptions('application/json', verData.apiVersion);
635 options.additionalHeaders = customHeaders;
636 let res;
637 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
638 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false);
639 resolve(ret);
640 }
641 catch (err) {
642 reject(err);
643 }
644 }));
645 });
646 }
647 /**
648 * @param {NodeJS.ReadableStream} contentStream - Content to upload
649 * @param {string} publisherName
650 * @param {string} extensionName
651 * @param {string} draftId
652 * @param {string} assetType
653 */
654 addAssetForEditExtensionDraft(customHeaders, contentStream, publisherName, extensionName, draftId, assetType) {
655 return __awaiter(this, void 0, void 0, function* () {
656 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
657 let routeValues = {
658 publisherName: publisherName,
659 extensionName: extensionName,
660 draftId: draftId,
661 assetType: assetType
662 };
663 customHeaders = customHeaders || {};
664 customHeaders["Content-Type"] = "application/octet-stream";
665 try {
666 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "f1db9c47-6619-4998-a7e5-d7f9f41a4617", routeValues);
667 let url = verData.requestUrl;
668 let options = this.createRequestOptions('application/json', verData.apiVersion);
669 options.additionalHeaders = customHeaders;
670 let res;
671 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
672 let ret = this.formatResponse(res.result, null, false);
673 resolve(ret);
674 }
675 catch (err) {
676 reject(err);
677 }
678 }));
679 });
680 }
681 /**
682 * @param {NodeJS.ReadableStream} contentStream - Content to upload
683 * @param {string} publisherName
684 * @param {String} product - Header to pass the product type of the payload file
685 * @param {String} fileName - Header to pass the filename of the uploaded data
686 */
687 createDraftForNewExtension(customHeaders, contentStream, publisherName, product, fileName) {
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 publisherName: publisherName
692 };
693 customHeaders = customHeaders || {};
694 customHeaders["Content-Type"] = "application/octet-stream";
695 customHeaders["X-Market-UploadFileProduct"] = "product";
696 customHeaders["X-Market-UploadFileName"] = "fileName";
697 try {
698 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b3ab127d-ebb9-4d22-b611-4e09593c8d79", routeValues);
699 let url = verData.requestUrl;
700 let options = this.createRequestOptions('application/json', verData.apiVersion);
701 options.additionalHeaders = customHeaders;
702 let res;
703 res = yield this.rest.uploadStream("POST", url, contentStream, options);
704 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false);
705 resolve(ret);
706 }
707 catch (err) {
708 reject(err);
709 }
710 }));
711 });
712 }
713 /**
714 * @param {GalleryInterfaces.ExtensionDraftPatch} draftPatch
715 * @param {string} publisherName
716 * @param {string} draftId
717 */
718 performNewExtensionDraftOperation(draftPatch, publisherName, draftId) {
719 return __awaiter(this, void 0, void 0, function* () {
720 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
721 let routeValues = {
722 publisherName: publisherName,
723 draftId: draftId
724 };
725 try {
726 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b3ab127d-ebb9-4d22-b611-4e09593c8d79", routeValues);
727 let url = verData.requestUrl;
728 let options = this.createRequestOptions('application/json', verData.apiVersion);
729 let res;
730 res = yield this.rest.update(url, draftPatch, options);
731 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false);
732 resolve(ret);
733 }
734 catch (err) {
735 reject(err);
736 }
737 }));
738 });
739 }
740 /**
741 * @param {NodeJS.ReadableStream} contentStream - Content to upload
742 * @param {string} publisherName
743 * @param {string} draftId
744 * @param {String} fileName - Header to pass the filename of the uploaded data
745 */
746 updatePayloadInDraftForNewExtension(customHeaders, contentStream, publisherName, draftId, fileName) {
747 return __awaiter(this, void 0, void 0, function* () {
748 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
749 let routeValues = {
750 publisherName: publisherName,
751 draftId: draftId
752 };
753 customHeaders = customHeaders || {};
754 customHeaders["Content-Type"] = "application/octet-stream";
755 customHeaders["X-Market-UploadFileName"] = "fileName";
756 try {
757 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b3ab127d-ebb9-4d22-b611-4e09593c8d79", routeValues);
758 let url = verData.requestUrl;
759 let options = this.createRequestOptions('application/json', verData.apiVersion);
760 options.additionalHeaders = customHeaders;
761 let res;
762 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
763 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false);
764 resolve(ret);
765 }
766 catch (err) {
767 reject(err);
768 }
769 }));
770 });
771 }
772 /**
773 * @param {NodeJS.ReadableStream} contentStream - Content to upload
774 * @param {string} publisherName
775 * @param {string} draftId
776 * @param {string} assetType
777 */
778 addAssetForNewExtensionDraft(customHeaders, contentStream, publisherName, draftId, assetType) {
779 return __awaiter(this, void 0, void 0, function* () {
780 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
781 let routeValues = {
782 publisherName: publisherName,
783 draftId: draftId,
784 assetType: assetType
785 };
786 customHeaders = customHeaders || {};
787 customHeaders["Content-Type"] = "application/octet-stream";
788 try {
789 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7", routeValues);
790 let url = verData.requestUrl;
791 let options = this.createRequestOptions('application/json', verData.apiVersion);
792 options.additionalHeaders = customHeaders;
793 let res;
794 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
795 let ret = this.formatResponse(res.result, null, false);
796 resolve(ret);
797 }
798 catch (err) {
799 reject(err);
800 }
801 }));
802 });
803 }
804 /**
805 * @param {string} publisherName
806 * @param {string} draftId
807 * @param {string} assetType
808 * @param {string} extensionName
809 */
810 getAssetFromEditExtensionDraft(publisherName, draftId, assetType, extensionName) {
811 return __awaiter(this, void 0, void 0, function* () {
812 if (extensionName == null) {
813 throw new TypeError('extensionName can not be null or undefined');
814 }
815 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
816 let routeValues = {
817 publisherName: publisherName,
818 draftId: draftId,
819 assetType: assetType
820 };
821 let queryValues = {
822 extensionName: extensionName,
823 };
824 try {
825 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7", routeValues, queryValues);
826 let url = verData.requestUrl;
827 let apiVersion = verData.apiVersion;
828 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
829 resolve((yield this.http.get(url, { "Accept": accept })).message);
830 }
831 catch (err) {
832 reject(err);
833 }
834 }));
835 });
836 }
837 /**
838 * @param {string} publisherName
839 * @param {string} draftId
840 * @param {string} assetType
841 */
842 getAssetFromNewExtensionDraft(publisherName, draftId, assetType) {
843 return __awaiter(this, void 0, void 0, function* () {
844 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
845 let routeValues = {
846 publisherName: publisherName,
847 draftId: draftId,
848 assetType: assetType
849 };
850 try {
851 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7", routeValues);
852 let url = verData.requestUrl;
853 let apiVersion = verData.apiVersion;
854 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
855 resolve((yield this.http.get(url, { "Accept": accept })).message);
856 }
857 catch (err) {
858 reject(err);
859 }
860 }));
861 });
862 }
863 /**
864 * Get install/uninstall events of an extension. If both count and afterDate parameters are specified, count takes precedence.
865 *
866 * @param {string} publisherName - Name of the publisher
867 * @param {string} extensionName - Name of the extension
868 * @param {number} count - Count of events to fetch, applies to each event type.
869 * @param {Date} afterDate - Fetch events that occurred on or after this date
870 * @param {string} include - Filter options. Supported values: install, uninstall, review, acquisition, sales. Default is to fetch all types of events
871 * @param {string} includeProperty - Event properties to include. Currently only 'lastContactDetails' is supported for uninstall events
872 */
873 getExtensionEvents(publisherName, extensionName, count, afterDate, include, includeProperty) {
874 return __awaiter(this, void 0, void 0, function* () {
875 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
876 let routeValues = {
877 publisherName: publisherName,
878 extensionName: extensionName
879 };
880 let queryValues = {
881 count: count,
882 afterDate: afterDate,
883 include: include,
884 includeProperty: includeProperty,
885 };
886 try {
887 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "3d13c499-2168-4d06-bef4-14aba185dcd5", routeValues, queryValues);
888 let url = verData.requestUrl;
889 let options = this.createRequestOptions('application/json', verData.apiVersion);
890 let res;
891 res = yield this.rest.get(url, options);
892 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionEvents, false);
893 resolve(ret);
894 }
895 catch (err) {
896 reject(err);
897 }
898 }));
899 });
900 }
901 /**
902 * API endpoint to publish extension install/uninstall events. This is meant to be invoked by EMS only for sending us data related to install/uninstall of an extension.
903 *
904 * @param {GalleryInterfaces.ExtensionEvents[]} extensionEvents
905 */
906 publishExtensionEvents(extensionEvents) {
907 return __awaiter(this, void 0, void 0, function* () {
908 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
909 let routeValues = {};
910 try {
911 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "0bf2bd3a-70e0-4d5d-8bf7-bd4a9c2ab6e7", routeValues);
912 let url = verData.requestUrl;
913 let options = this.createRequestOptions('application/json', verData.apiVersion);
914 let res;
915 res = yield this.rest.create(url, extensionEvents, options);
916 let ret = this.formatResponse(res.result, null, false);
917 resolve(ret);
918 }
919 catch (err) {
920 reject(err);
921 }
922 }));
923 });
924 }
925 /**
926 * @param {GalleryInterfaces.ExtensionQuery} extensionQuery
927 * @param {string} accountToken
928 * @param {String} accountTokenHeader - Header to pass the account token
929 */
930 queryExtensions(customHeaders, extensionQuery, accountToken, accountTokenHeader) {
931 return __awaiter(this, void 0, void 0, function* () {
932 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
933 let routeValues = {};
934 let queryValues = {
935 accountToken: accountToken,
936 };
937 customHeaders = customHeaders || {};
938 customHeaders["X-Market-AccountToken"] = "accountTokenHeader";
939 try {
940 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "eb9d5ee1-6d43-456b-b80e-8a96fbc014b6", routeValues, queryValues);
941 let url = verData.requestUrl;
942 let options = this.createRequestOptions('application/json', verData.apiVersion);
943 options.additionalHeaders = customHeaders;
944 let res;
945 res = yield this.rest.create(url, extensionQuery, options);
946 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionQueryResult, false);
947 resolve(ret);
948 }
949 catch (err) {
950 reject(err);
951 }
952 }));
953 });
954 }
955 /**
956 * @param {NodeJS.ReadableStream} contentStream - Content to upload
957 * @param {string} extensionType
958 * @param {string} reCaptchaToken
959 */
960 createExtension(customHeaders, contentStream, extensionType, reCaptchaToken) {
961 return __awaiter(this, void 0, void 0, function* () {
962 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
963 let routeValues = {};
964 let queryValues = {
965 extensionType: extensionType,
966 reCaptchaToken: reCaptchaToken,
967 };
968 customHeaders = customHeaders || {};
969 customHeaders["Content-Type"] = "application/octet-stream";
970 try {
971 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues);
972 let url = verData.requestUrl;
973 let options = this.createRequestOptions('application/json', verData.apiVersion);
974 options.additionalHeaders = customHeaders;
975 let res;
976 res = yield this.rest.uploadStream("POST", url, contentStream, options);
977 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
978 resolve(ret);
979 }
980 catch (err) {
981 reject(err);
982 }
983 }));
984 });
985 }
986 /**
987 * @param {string} extensionId
988 * @param {string} version
989 */
990 deleteExtensionById(extensionId, version) {
991 return __awaiter(this, void 0, void 0, function* () {
992 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
993 let routeValues = {
994 extensionId: extensionId
995 };
996 let queryValues = {
997 version: version,
998 };
999 try {
1000 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues);
1001 let url = verData.requestUrl;
1002 let options = this.createRequestOptions('application/json', verData.apiVersion);
1003 let res;
1004 res = yield this.rest.del(url, options);
1005 let ret = this.formatResponse(res.result, null, false);
1006 resolve(ret);
1007 }
1008 catch (err) {
1009 reject(err);
1010 }
1011 }));
1012 });
1013 }
1014 /**
1015 * @param {string} extensionId
1016 * @param {string} version
1017 * @param {GalleryInterfaces.ExtensionQueryFlags} flags
1018 */
1019 getExtensionById(extensionId, version, flags) {
1020 return __awaiter(this, void 0, void 0, function* () {
1021 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1022 let routeValues = {
1023 extensionId: extensionId
1024 };
1025 let queryValues = {
1026 version: version,
1027 flags: flags,
1028 };
1029 try {
1030 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues);
1031 let url = verData.requestUrl;
1032 let options = this.createRequestOptions('application/json', verData.apiVersion);
1033 let res;
1034 res = yield this.rest.get(url, options);
1035 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
1036 resolve(ret);
1037 }
1038 catch (err) {
1039 reject(err);
1040 }
1041 }));
1042 });
1043 }
1044 /**
1045 * @param {string} extensionId
1046 * @param {string} reCaptchaToken
1047 */
1048 updateExtensionById(extensionId, reCaptchaToken) {
1049 return __awaiter(this, void 0, void 0, function* () {
1050 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1051 let routeValues = {
1052 extensionId: extensionId
1053 };
1054 let queryValues = {
1055 reCaptchaToken: reCaptchaToken,
1056 };
1057 try {
1058 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues);
1059 let url = verData.requestUrl;
1060 let options = this.createRequestOptions('application/json', verData.apiVersion);
1061 let res;
1062 res = yield this.rest.replace(url, null, options);
1063 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
1064 resolve(ret);
1065 }
1066 catch (err) {
1067 reject(err);
1068 }
1069 }));
1070 });
1071 }
1072 /**
1073 * @param {NodeJS.ReadableStream} contentStream - Content to upload
1074 * @param {string} publisherName
1075 * @param {string} extensionType
1076 * @param {string} reCaptchaToken
1077 */
1078 createExtensionWithPublisher(customHeaders, contentStream, publisherName, extensionType, reCaptchaToken) {
1079 return __awaiter(this, void 0, void 0, function* () {
1080 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1081 let routeValues = {
1082 publisherName: publisherName
1083 };
1084 let queryValues = {
1085 extensionType: extensionType,
1086 reCaptchaToken: reCaptchaToken,
1087 };
1088 customHeaders = customHeaders || {};
1089 customHeaders["Content-Type"] = "application/octet-stream";
1090 try {
1091 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues);
1092 let url = verData.requestUrl;
1093 let options = this.createRequestOptions('application/json', verData.apiVersion);
1094 options.additionalHeaders = customHeaders;
1095 let res;
1096 res = yield this.rest.uploadStream("POST", url, contentStream, options);
1097 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
1098 resolve(ret);
1099 }
1100 catch (err) {
1101 reject(err);
1102 }
1103 }));
1104 });
1105 }
1106 /**
1107 * @param {string} publisherName
1108 * @param {string} extensionName
1109 * @param {string} version
1110 */
1111 deleteExtension(publisherName, extensionName, version) {
1112 return __awaiter(this, void 0, void 0, function* () {
1113 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1114 let routeValues = {
1115 publisherName: publisherName,
1116 extensionName: extensionName
1117 };
1118 let queryValues = {
1119 version: version,
1120 };
1121 try {
1122 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues);
1123 let url = verData.requestUrl;
1124 let options = this.createRequestOptions('application/json', verData.apiVersion);
1125 let res;
1126 res = yield this.rest.del(url, options);
1127 let ret = this.formatResponse(res.result, null, false);
1128 resolve(ret);
1129 }
1130 catch (err) {
1131 reject(err);
1132 }
1133 }));
1134 });
1135 }
1136 /**
1137 * @param {string} publisherName
1138 * @param {string} extensionName
1139 * @param {string} version
1140 * @param {GalleryInterfaces.ExtensionQueryFlags} flags
1141 * @param {string} accountToken
1142 * @param {String} accountTokenHeader - Header to pass the account token
1143 */
1144 getExtension(customHeaders, publisherName, extensionName, version, flags, accountToken, accountTokenHeader) {
1145 return __awaiter(this, void 0, void 0, function* () {
1146 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1147 let routeValues = {
1148 publisherName: publisherName,
1149 extensionName: extensionName
1150 };
1151 let queryValues = {
1152 version: version,
1153 flags: flags,
1154 accountToken: accountToken,
1155 };
1156 customHeaders = customHeaders || {};
1157 customHeaders["X-Market-AccountToken"] = "accountTokenHeader";
1158 try {
1159 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues);
1160 let url = verData.requestUrl;
1161 let options = this.createRequestOptions('application/json', verData.apiVersion);
1162 options.additionalHeaders = customHeaders;
1163 let res;
1164 res = yield this.rest.get(url, options);
1165 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
1166 resolve(ret);
1167 }
1168 catch (err) {
1169 reject(err);
1170 }
1171 }));
1172 });
1173 }
1174 /**
1175 * REST endpoint to update an extension.
1176 *
1177 * @param {NodeJS.ReadableStream} contentStream - Content to upload
1178 * @param {string} publisherName - Name of the publisher
1179 * @param {string} extensionName - Name of the extension
1180 * @param {string} extensionType
1181 * @param {string} reCaptchaToken
1182 * @param {boolean} bypassScopeCheck - This parameter decides if the scope change check needs to be invoked or not
1183 */
1184 updateExtension(customHeaders, contentStream, publisherName, extensionName, extensionType, reCaptchaToken, bypassScopeCheck) {
1185 return __awaiter(this, void 0, void 0, function* () {
1186 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1187 let routeValues = {
1188 publisherName: publisherName,
1189 extensionName: extensionName
1190 };
1191 let queryValues = {
1192 extensionType: extensionType,
1193 reCaptchaToken: reCaptchaToken,
1194 bypassScopeCheck: bypassScopeCheck,
1195 };
1196 customHeaders = customHeaders || {};
1197 customHeaders["Content-Type"] = "application/octet-stream";
1198 try {
1199 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues);
1200 let url = verData.requestUrl;
1201 let options = this.createRequestOptions('application/json', verData.apiVersion);
1202 options.additionalHeaders = customHeaders;
1203 let res;
1204 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
1205 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
1206 resolve(ret);
1207 }
1208 catch (err) {
1209 reject(err);
1210 }
1211 }));
1212 });
1213 }
1214 /**
1215 * @param {string} publisherName
1216 * @param {string} extensionName
1217 * @param {GalleryInterfaces.PublishedExtensionFlags} flags
1218 */
1219 updateExtensionProperties(publisherName, extensionName, flags) {
1220 return __awaiter(this, void 0, void 0, function* () {
1221 if (flags == null) {
1222 throw new TypeError('flags can not be null or undefined');
1223 }
1224 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1225 let routeValues = {
1226 publisherName: publisherName,
1227 extensionName: extensionName
1228 };
1229 let queryValues = {
1230 flags: flags,
1231 };
1232 try {
1233 let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues);
1234 let url = verData.requestUrl;
1235 let options = this.createRequestOptions('application/json', verData.apiVersion);
1236 let res;
1237 res = yield this.rest.update(url, null, options);
1238 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
1239 resolve(ret);
1240 }
1241 catch (err) {
1242 reject(err);
1243 }
1244 }));
1245 });
1246 }
1247 /**
1248 * @param {string} publisherName
1249 * @param {string} extensionName
1250 * @param {string} hostType
1251 * @param {string} hostName
1252 */
1253 shareExtensionWithHost(publisherName, extensionName, hostType, hostName) {
1254 return __awaiter(this, void 0, void 0, function* () {
1255 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1256 let routeValues = {
1257 publisherName: publisherName,
1258 extensionName: extensionName,
1259 hostType: hostType,
1260 hostName: hostName
1261 };
1262 try {
1263 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "328a3af8-d124-46e9-9483-01690cd415b9", routeValues);
1264 let url = verData.requestUrl;
1265 let options = this.createRequestOptions('application/json', verData.apiVersion);
1266 let res;
1267 res = yield this.rest.create(url, null, options);
1268 let ret = this.formatResponse(res.result, null, false);
1269 resolve(ret);
1270 }
1271 catch (err) {
1272 reject(err);
1273 }
1274 }));
1275 });
1276 }
1277 /**
1278 * @param {string} publisherName
1279 * @param {string} extensionName
1280 * @param {string} hostType
1281 * @param {string} hostName
1282 */
1283 unshareExtensionWithHost(publisherName, extensionName, hostType, hostName) {
1284 return __awaiter(this, void 0, void 0, function* () {
1285 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1286 let routeValues = {
1287 publisherName: publisherName,
1288 extensionName: extensionName,
1289 hostType: hostType,
1290 hostName: hostName
1291 };
1292 try {
1293 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "328a3af8-d124-46e9-9483-01690cd415b9", routeValues);
1294 let url = verData.requestUrl;
1295 let options = this.createRequestOptions('application/json', verData.apiVersion);
1296 let res;
1297 res = yield this.rest.del(url, options);
1298 let ret = this.formatResponse(res.result, null, false);
1299 resolve(ret);
1300 }
1301 catch (err) {
1302 reject(err);
1303 }
1304 }));
1305 });
1306 }
1307 /**
1308 * Rest end point to validate if an Azure publisher owns an extension for 3rd party commerce scenario. Azure only supports POST operations and the above signature is not typical of the REST operations. http://sharepoint/sites/AzureUX/_layouts/15/WopiFrame2.aspx?sourcedoc={A793D31E-6DC6-4174-8FA3-DE3F82B51642}&file=Data%20Market%20Partner%20integration%20with%20Marketplace%20service.docx&action=default
1309 *
1310 * @param {GalleryInterfaces.AzureRestApiRequestModel} azureRestApiRequestModel - All the parameters are sent in the request body
1311 */
1312 extensionValidator(azureRestApiRequestModel) {
1313 return __awaiter(this, void 0, void 0, function* () {
1314 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1315 let routeValues = {};
1316 try {
1317 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "05e8a5e1-8c59-4c2c-8856-0ff087d1a844", routeValues);
1318 let url = verData.requestUrl;
1319 let options = this.createRequestOptions('application/json', verData.apiVersion);
1320 let res;
1321 res = yield this.rest.create(url, azureRestApiRequestModel, options);
1322 let ret = this.formatResponse(res.result, null, false);
1323 resolve(ret);
1324 }
1325 catch (err) {
1326 reject(err);
1327 }
1328 }));
1329 });
1330 }
1331 /**
1332 * Send Notification
1333 *
1334 * @param {GalleryInterfaces.NotificationsData} notificationData - Denoting the data needed to send notification
1335 */
1336 sendNotifications(notificationData) {
1337 return __awaiter(this, void 0, void 0, function* () {
1338 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1339 let routeValues = {};
1340 try {
1341 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "eab39817-413c-4602-a49f-07ad00844980", routeValues);
1342 let url = verData.requestUrl;
1343 let options = this.createRequestOptions('application/json', verData.apiVersion);
1344 let res;
1345 res = yield this.rest.create(url, notificationData, options);
1346 let ret = this.formatResponse(res.result, null, false);
1347 resolve(ret);
1348 }
1349 catch (err) {
1350 reject(err);
1351 }
1352 }));
1353 });
1354 }
1355 /**
1356 * This endpoint gets hit when you download a VSTS extension from the Web UI
1357 *
1358 * @param {string} publisherName
1359 * @param {string} extensionName
1360 * @param {string} version
1361 * @param {string} accountToken
1362 * @param {boolean} acceptDefault
1363 * @param {String} accountTokenHeader - Header to pass the account token
1364 */
1365 getPackage(customHeaders, publisherName, extensionName, version, accountToken, acceptDefault, accountTokenHeader) {
1366 return __awaiter(this, void 0, void 0, function* () {
1367 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1368 let routeValues = {
1369 publisherName: publisherName,
1370 extensionName: extensionName,
1371 version: version
1372 };
1373 let queryValues = {
1374 accountToken: accountToken,
1375 acceptDefault: acceptDefault,
1376 };
1377 customHeaders = customHeaders || {};
1378 customHeaders["X-Market-AccountToken"] = "accountTokenHeader";
1379 try {
1380 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7cb576f8-1cae-4c4b-b7b1-e4af5759e965", routeValues, queryValues);
1381 let url = verData.requestUrl;
1382 let apiVersion = verData.apiVersion;
1383 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
1384 resolve((yield this.http.get(url, { "Accept": accept })).message);
1385 }
1386 catch (err) {
1387 reject(err);
1388 }
1389 }));
1390 });
1391 }
1392 /**
1393 * @param {string} publisherName
1394 * @param {string} extensionName
1395 * @param {string} version
1396 * @param {string} assetType
1397 * @param {string} assetToken
1398 * @param {string} accountToken
1399 * @param {boolean} acceptDefault
1400 * @param {String} accountTokenHeader - Header to pass the account token
1401 */
1402 getAssetWithToken(customHeaders, publisherName, extensionName, version, assetType, assetToken, accountToken, acceptDefault, accountTokenHeader) {
1403 return __awaiter(this, void 0, void 0, function* () {
1404 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1405 let routeValues = {
1406 publisherName: publisherName,
1407 extensionName: extensionName,
1408 version: version,
1409 assetType: assetType,
1410 assetToken: assetToken
1411 };
1412 let queryValues = {
1413 accountToken: accountToken,
1414 acceptDefault: acceptDefault,
1415 };
1416 customHeaders = customHeaders || {};
1417 customHeaders["X-Market-AccountToken"] = "accountTokenHeader";
1418 try {
1419 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "364415a1-0077-4a41-a7a0-06edd4497492", routeValues, queryValues);
1420 let url = verData.requestUrl;
1421 let apiVersion = verData.apiVersion;
1422 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
1423 resolve((yield this.http.get(url, { "Accept": accept })).message);
1424 }
1425 catch (err) {
1426 reject(err);
1427 }
1428 }));
1429 });
1430 }
1431 /**
1432 * Delete publisher asset like logo
1433 *
1434 * @param {string} publisherName - Internal name of the publisher
1435 * @param {string} assetType - Type of asset. Default value is 'logo'.
1436 */
1437 deletePublisherAsset(publisherName, assetType) {
1438 return __awaiter(this, void 0, void 0, function* () {
1439 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1440 let routeValues = {
1441 publisherName: publisherName
1442 };
1443 let queryValues = {
1444 assetType: assetType,
1445 };
1446 try {
1447 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "21143299-34f9-4c62-8ca8-53da691192f9", routeValues, queryValues);
1448 let url = verData.requestUrl;
1449 let options = this.createRequestOptions('application/json', verData.apiVersion);
1450 let res;
1451 res = yield this.rest.del(url, options);
1452 let ret = this.formatResponse(res.result, null, false);
1453 resolve(ret);
1454 }
1455 catch (err) {
1456 reject(err);
1457 }
1458 }));
1459 });
1460 }
1461 /**
1462 * Get publisher asset like logo as a stream
1463 *
1464 * @param {string} publisherName - Internal name of the publisher
1465 * @param {string} assetType - Type of asset. Default value is 'logo'.
1466 */
1467 getPublisherAsset(publisherName, assetType) {
1468 return __awaiter(this, void 0, void 0, function* () {
1469 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1470 let routeValues = {
1471 publisherName: publisherName
1472 };
1473 let queryValues = {
1474 assetType: assetType,
1475 };
1476 try {
1477 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "21143299-34f9-4c62-8ca8-53da691192f9", routeValues, queryValues);
1478 let url = verData.requestUrl;
1479 let apiVersion = verData.apiVersion;
1480 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
1481 resolve((yield this.http.get(url, { "Accept": accept })).message);
1482 }
1483 catch (err) {
1484 reject(err);
1485 }
1486 }));
1487 });
1488 }
1489 /**
1490 * Update publisher asset like logo. It accepts asset file as an octet stream and file name is passed in header values.
1491 *
1492 * @param {NodeJS.ReadableStream} contentStream - Content to upload
1493 * @param {string} publisherName - Internal name of the publisher
1494 * @param {string} assetType - Type of asset. Default value is 'logo'.
1495 * @param {String} fileName - Header to pass the filename of the uploaded data
1496 */
1497 updatePublisherAsset(customHeaders, contentStream, publisherName, assetType, fileName) {
1498 return __awaiter(this, void 0, void 0, function* () {
1499 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1500 let routeValues = {
1501 publisherName: publisherName
1502 };
1503 let queryValues = {
1504 assetType: assetType,
1505 };
1506 customHeaders = customHeaders || {};
1507 customHeaders["Content-Type"] = "application/octet-stream";
1508 customHeaders["X-Market-UploadFileName"] = "fileName";
1509 try {
1510 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "21143299-34f9-4c62-8ca8-53da691192f9", routeValues, queryValues);
1511 let url = verData.requestUrl;
1512 let options = this.createRequestOptions('application/json', verData.apiVersion);
1513 options.additionalHeaders = customHeaders;
1514 let res;
1515 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
1516 let ret = this.formatResponse(res.result, null, true);
1517 resolve(ret);
1518 }
1519 catch (err) {
1520 reject(err);
1521 }
1522 }));
1523 });
1524 }
1525 /**
1526 * @param {string} publisherName
1527 */
1528 fetchDomainToken(publisherName) {
1529 return __awaiter(this, void 0, void 0, function* () {
1530 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1531 let routeValues = {
1532 publisherName: publisherName
1533 };
1534 try {
1535 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "67a609ef-fa74-4b52-8664-78d76f7b3634", routeValues);
1536 let url = verData.requestUrl;
1537 let options = this.createRequestOptions('application/json', verData.apiVersion);
1538 let res;
1539 res = yield this.rest.get(url, options);
1540 let ret = this.formatResponse(res.result, null, false);
1541 resolve(ret);
1542 }
1543 catch (err) {
1544 reject(err);
1545 }
1546 }));
1547 });
1548 }
1549 /**
1550 * @param {string} publisherName
1551 */
1552 verifyDomainToken(publisherName) {
1553 return __awaiter(this, void 0, void 0, function* () {
1554 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1555 let routeValues = {
1556 publisherName: publisherName
1557 };
1558 try {
1559 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "67a609ef-fa74-4b52-8664-78d76f7b3634", routeValues);
1560 let url = verData.requestUrl;
1561 let options = this.createRequestOptions('application/json', verData.apiVersion);
1562 let res;
1563 res = yield this.rest.replace(url, null, options);
1564 let ret = this.formatResponse(res.result, null, false);
1565 resolve(ret);
1566 }
1567 catch (err) {
1568 reject(err);
1569 }
1570 }));
1571 });
1572 }
1573 /**
1574 * @param {GalleryInterfaces.PublisherQuery} publisherQuery
1575 */
1576 queryPublishers(publisherQuery) {
1577 return __awaiter(this, void 0, void 0, function* () {
1578 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1579 let routeValues = {};
1580 try {
1581 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "2ad6ee0a-b53f-4034-9d1d-d009fda1212e", routeValues);
1582 let url = verData.requestUrl;
1583 let options = this.createRequestOptions('application/json', verData.apiVersion);
1584 let res;
1585 res = yield this.rest.create(url, publisherQuery, options);
1586 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublisherQueryResult, false);
1587 resolve(ret);
1588 }
1589 catch (err) {
1590 reject(err);
1591 }
1592 }));
1593 });
1594 }
1595 /**
1596 * @param {GalleryInterfaces.Publisher} publisher
1597 */
1598 createPublisher(publisher) {
1599 return __awaiter(this, void 0, void 0, function* () {
1600 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1601 let routeValues = {};
1602 try {
1603 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues);
1604 let url = verData.requestUrl;
1605 let options = this.createRequestOptions('application/json', verData.apiVersion);
1606 let res;
1607 res = yield this.rest.create(url, publisher, options);
1608 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false);
1609 resolve(ret);
1610 }
1611 catch (err) {
1612 reject(err);
1613 }
1614 }));
1615 });
1616 }
1617 /**
1618 * @param {string} publisherName
1619 */
1620 deletePublisher(publisherName) {
1621 return __awaiter(this, void 0, void 0, function* () {
1622 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1623 let routeValues = {
1624 publisherName: publisherName
1625 };
1626 try {
1627 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues);
1628 let url = verData.requestUrl;
1629 let options = this.createRequestOptions('application/json', verData.apiVersion);
1630 let res;
1631 res = yield this.rest.del(url, options);
1632 let ret = this.formatResponse(res.result, null, false);
1633 resolve(ret);
1634 }
1635 catch (err) {
1636 reject(err);
1637 }
1638 }));
1639 });
1640 }
1641 /**
1642 * @param {string} publisherName
1643 * @param {number} flags
1644 */
1645 getPublisher(publisherName, flags) {
1646 return __awaiter(this, void 0, void 0, function* () {
1647 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1648 let routeValues = {
1649 publisherName: publisherName
1650 };
1651 let queryValues = {
1652 flags: flags,
1653 };
1654 try {
1655 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues, queryValues);
1656 let url = verData.requestUrl;
1657 let options = this.createRequestOptions('application/json', verData.apiVersion);
1658 let res;
1659 res = yield this.rest.get(url, options);
1660 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false);
1661 resolve(ret);
1662 }
1663 catch (err) {
1664 reject(err);
1665 }
1666 }));
1667 });
1668 }
1669 /**
1670 * @param {GalleryInterfaces.Publisher} publisher
1671 * @param {string} publisherName
1672 */
1673 updatePublisher(publisher, publisherName) {
1674 return __awaiter(this, void 0, void 0, function* () {
1675 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1676 let routeValues = {
1677 publisherName: publisherName
1678 };
1679 try {
1680 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues);
1681 let url = verData.requestUrl;
1682 let options = this.createRequestOptions('application/json', verData.apiVersion);
1683 let res;
1684 res = yield this.rest.replace(url, publisher, options);
1685 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false);
1686 resolve(ret);
1687 }
1688 catch (err) {
1689 reject(err);
1690 }
1691 }));
1692 });
1693 }
1694 /**
1695 * Endpoint to add/modify publisher membership. Currently Supports only addition/modification of 1 user at a time Works only for adding members of same tenant.
1696 *
1697 * @param {GalleryInterfaces.PublisherUserRoleAssignmentRef[]} roleAssignments - List of user identifiers(email address) and role to be added. Currently only one entry is supported.
1698 * @param {string} publisherName - The name/id of publisher to which users have to be added
1699 * @param {boolean} limitToCallerIdentityDomain - Should cross tenant addtions be allowed or not.
1700 */
1701 updatePublisherMembers(roleAssignments, publisherName, limitToCallerIdentityDomain) {
1702 return __awaiter(this, void 0, void 0, function* () {
1703 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1704 let routeValues = {
1705 publisherName: publisherName
1706 };
1707 let queryValues = {
1708 limitToCallerIdentityDomain: limitToCallerIdentityDomain,
1709 };
1710 try {
1711 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues, queryValues);
1712 let url = verData.requestUrl;
1713 let options = this.createRequestOptions('application/json', verData.apiVersion);
1714 let res;
1715 res = yield this.rest.create(url, roleAssignments, options);
1716 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublisherRoleAssignment, true);
1717 resolve(ret);
1718 }
1719 catch (err) {
1720 reject(err);
1721 }
1722 }));
1723 });
1724 }
1725 /**
1726 * @param {NodeJS.ReadableStream} contentStream - Content to upload
1727 * @param {string} publisherName
1728 * @param {string} extensionName
1729 * @param {string} extensionType
1730 * @param {string} reCaptchaToken
1731 * @param {boolean} bypassScopeCheck
1732 */
1733 publishExtensionWithPublisherSignature(customHeaders, contentStream, publisherName, extensionName, extensionType, reCaptchaToken, bypassScopeCheck) {
1734 return __awaiter(this, void 0, void 0, function* () {
1735 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1736 let routeValues = {
1737 publisherName: publisherName,
1738 extensionName: extensionName
1739 };
1740 let queryValues = {
1741 extensionType: extensionType,
1742 reCaptchaToken: reCaptchaToken,
1743 bypassScopeCheck: bypassScopeCheck,
1744 };
1745 customHeaders = customHeaders || {};
1746 customHeaders["Content-Type"] = "multipart/related";
1747 try {
1748 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0969", routeValues, queryValues);
1749 let url = verData.requestUrl;
1750 let options = this.createRequestOptions('application/json', verData.apiVersion);
1751 options.additionalHeaders = customHeaders;
1752 let res;
1753 res = yield this.rest.uploadStream("PUT", url, contentStream, options);
1754 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
1755 resolve(ret);
1756 }
1757 catch (err) {
1758 reject(err);
1759 }
1760 }));
1761 });
1762 }
1763 /**
1764 * @param {string} publisherName
1765 */
1766 getPublisherWithoutToken(publisherName) {
1767 return __awaiter(this, void 0, void 0, function* () {
1768 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1769 let routeValues = {
1770 publisherName: publisherName
1771 };
1772 try {
1773 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "215a2ed8-458a-4850-ad5a-45f1dabc3461", routeValues);
1774 let url = verData.requestUrl;
1775 let options = this.createRequestOptions('application/json', verData.apiVersion);
1776 let res;
1777 res = yield this.rest.get(url, options);
1778 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false);
1779 resolve(ret);
1780 }
1781 catch (err) {
1782 reject(err);
1783 }
1784 }));
1785 });
1786 }
1787 /**
1788 * Returns a list of questions with their responses associated with an extension.
1789 *
1790 * @param {string} publisherName - Name of the publisher who published the extension.
1791 * @param {string} extensionName - Name of the extension.
1792 * @param {number} count - Number of questions to retrieve (defaults to 10).
1793 * @param {number} page - Page number from which set of questions are to be retrieved.
1794 * @param {Date} afterDate - If provided, results questions are returned which were posted after this date
1795 */
1796 getQuestions(publisherName, extensionName, count, page, afterDate) {
1797 return __awaiter(this, void 0, void 0, function* () {
1798 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1799 let routeValues = {
1800 publisherName: publisherName,
1801 extensionName: extensionName
1802 };
1803 let queryValues = {
1804 count: count,
1805 page: page,
1806 afterDate: afterDate,
1807 };
1808 try {
1809 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "c010d03d-812c-4ade-ae07-c1862475eda5", routeValues, queryValues);
1810 let url = verData.requestUrl;
1811 let options = this.createRequestOptions('application/json', verData.apiVersion);
1812 let res;
1813 res = yield this.rest.get(url, options);
1814 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.QuestionsResult, false);
1815 resolve(ret);
1816 }
1817 catch (err) {
1818 reject(err);
1819 }
1820 }));
1821 });
1822 }
1823 /**
1824 * Flags a concern with an existing question for an extension.
1825 *
1826 * @param {GalleryInterfaces.Concern} concern - User reported concern with a question for the extension.
1827 * @param {string} pubName - Name of the publisher who published the extension.
1828 * @param {string} extName - Name of the extension.
1829 * @param {number} questionId - Identifier of the question to be updated for the extension.
1830 */
1831 reportQuestion(concern, pubName, extName, questionId) {
1832 return __awaiter(this, void 0, void 0, function* () {
1833 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1834 let routeValues = {
1835 pubName: pubName,
1836 extName: extName,
1837 questionId: questionId
1838 };
1839 try {
1840 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "784910cd-254a-494d-898b-0728549b2f10", routeValues);
1841 let url = verData.requestUrl;
1842 let options = this.createRequestOptions('application/json', verData.apiVersion);
1843 let res;
1844 res = yield this.rest.create(url, concern, options);
1845 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Concern, false);
1846 resolve(ret);
1847 }
1848 catch (err) {
1849 reject(err);
1850 }
1851 }));
1852 });
1853 }
1854 /**
1855 * Creates a new question for an extension.
1856 *
1857 * @param {GalleryInterfaces.Question} question - Question to be created for the extension.
1858 * @param {string} publisherName - Name of the publisher who published the extension.
1859 * @param {string} extensionName - Name of the extension.
1860 */
1861 createQuestion(question, publisherName, extensionName) {
1862 return __awaiter(this, void 0, void 0, function* () {
1863 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1864 let routeValues = {
1865 publisherName: publisherName,
1866 extensionName: extensionName
1867 };
1868 try {
1869 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "6d1d9741-eca8-4701-a3a5-235afc82dfa4", routeValues);
1870 let url = verData.requestUrl;
1871 let options = this.createRequestOptions('application/json', verData.apiVersion);
1872 let res;
1873 res = yield this.rest.create(url, question, options);
1874 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Question, false);
1875 resolve(ret);
1876 }
1877 catch (err) {
1878 reject(err);
1879 }
1880 }));
1881 });
1882 }
1883 /**
1884 * Deletes an existing question and all its associated responses for an extension. (soft delete)
1885 *
1886 * @param {string} publisherName - Name of the publisher who published the extension.
1887 * @param {string} extensionName - Name of the extension.
1888 * @param {number} questionId - Identifier of the question to be deleted for the extension.
1889 */
1890 deleteQuestion(publisherName, extensionName, questionId) {
1891 return __awaiter(this, void 0, void 0, function* () {
1892 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1893 let routeValues = {
1894 publisherName: publisherName,
1895 extensionName: extensionName,
1896 questionId: questionId
1897 };
1898 try {
1899 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "6d1d9741-eca8-4701-a3a5-235afc82dfa4", routeValues);
1900 let url = verData.requestUrl;
1901 let options = this.createRequestOptions('application/json', verData.apiVersion);
1902 let res;
1903 res = yield this.rest.del(url, options);
1904 let ret = this.formatResponse(res.result, null, false);
1905 resolve(ret);
1906 }
1907 catch (err) {
1908 reject(err);
1909 }
1910 }));
1911 });
1912 }
1913 /**
1914 * Updates an existing question for an extension.
1915 *
1916 * @param {GalleryInterfaces.Question} question - Updated question to be set for the extension.
1917 * @param {string} publisherName - Name of the publisher who published the extension.
1918 * @param {string} extensionName - Name of the extension.
1919 * @param {number} questionId - Identifier of the question to be updated for the extension.
1920 */
1921 updateQuestion(question, publisherName, extensionName, questionId) {
1922 return __awaiter(this, void 0, void 0, function* () {
1923 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1924 let routeValues = {
1925 publisherName: publisherName,
1926 extensionName: extensionName,
1927 questionId: questionId
1928 };
1929 try {
1930 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "6d1d9741-eca8-4701-a3a5-235afc82dfa4", routeValues);
1931 let url = verData.requestUrl;
1932 let options = this.createRequestOptions('application/json', verData.apiVersion);
1933 let res;
1934 res = yield this.rest.update(url, question, options);
1935 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Question, false);
1936 resolve(ret);
1937 }
1938 catch (err) {
1939 reject(err);
1940 }
1941 }));
1942 });
1943 }
1944 /**
1945 * Creates a new response for a given question for an extension.
1946 *
1947 * @param {GalleryInterfaces.Response} response - Response to be created for the extension.
1948 * @param {string} publisherName - Name of the publisher who published the extension.
1949 * @param {string} extensionName - Name of the extension.
1950 * @param {number} questionId - Identifier of the question for which response is to be created for the extension.
1951 */
1952 createResponse(response, publisherName, extensionName, questionId) {
1953 return __awaiter(this, void 0, void 0, function* () {
1954 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1955 let routeValues = {
1956 publisherName: publisherName,
1957 extensionName: extensionName,
1958 questionId: questionId
1959 };
1960 try {
1961 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7f8ae5e0-46b0-438f-b2e8-13e8513517bd", routeValues);
1962 let url = verData.requestUrl;
1963 let options = this.createRequestOptions('application/json', verData.apiVersion);
1964 let res;
1965 res = yield this.rest.create(url, response, options);
1966 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Response, false);
1967 resolve(ret);
1968 }
1969 catch (err) {
1970 reject(err);
1971 }
1972 }));
1973 });
1974 }
1975 /**
1976 * Deletes a response for an extension. (soft delete)
1977 *
1978 * @param {string} publisherName - Name of the publisher who published the extension.
1979 * @param {string} extensionName - Name of the extension.
1980 * @param {number} questionId - Identifies the question whose response is to be deleted.
1981 * @param {number} responseId - Identifies the response to be deleted.
1982 */
1983 deleteResponse(publisherName, extensionName, questionId, responseId) {
1984 return __awaiter(this, void 0, void 0, function* () {
1985 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
1986 let routeValues = {
1987 publisherName: publisherName,
1988 extensionName: extensionName,
1989 questionId: questionId,
1990 responseId: responseId
1991 };
1992 try {
1993 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7f8ae5e0-46b0-438f-b2e8-13e8513517bd", routeValues);
1994 let url = verData.requestUrl;
1995 let options = this.createRequestOptions('application/json', verData.apiVersion);
1996 let res;
1997 res = yield this.rest.del(url, options);
1998 let ret = this.formatResponse(res.result, null, false);
1999 resolve(ret);
2000 }
2001 catch (err) {
2002 reject(err);
2003 }
2004 }));
2005 });
2006 }
2007 /**
2008 * Updates an existing response for a given question for an extension.
2009 *
2010 * @param {GalleryInterfaces.Response} response - Updated response to be set for the extension.
2011 * @param {string} publisherName - Name of the publisher who published the extension.
2012 * @param {string} extensionName - Name of the extension.
2013 * @param {number} questionId - Identifier of the question for which response is to be updated for the extension.
2014 * @param {number} responseId - Identifier of the response which has to be updated.
2015 */
2016 updateResponse(response, publisherName, extensionName, questionId, responseId) {
2017 return __awaiter(this, void 0, void 0, function* () {
2018 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2019 let routeValues = {
2020 publisherName: publisherName,
2021 extensionName: extensionName,
2022 questionId: questionId,
2023 responseId: responseId
2024 };
2025 try {
2026 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7f8ae5e0-46b0-438f-b2e8-13e8513517bd", routeValues);
2027 let url = verData.requestUrl;
2028 let options = this.createRequestOptions('application/json', verData.apiVersion);
2029 let res;
2030 res = yield this.rest.update(url, response, options);
2031 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Response, false);
2032 resolve(ret);
2033 }
2034 catch (err) {
2035 reject(err);
2036 }
2037 }));
2038 });
2039 }
2040 /**
2041 * Returns extension reports
2042 *
2043 * @param {string} publisherName - Name of the publisher who published the extension
2044 * @param {string} extensionName - Name of the extension
2045 * @param {number} days - Last n days report. If afterDate and days are specified, days will take priority
2046 * @param {number} count - Number of events to be returned
2047 * @param {Date} afterDate - Use if you want to fetch events newer than the specified date
2048 */
2049 getExtensionReports(publisherName, extensionName, days, count, afterDate) {
2050 return __awaiter(this, void 0, void 0, function* () {
2051 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2052 let routeValues = {
2053 publisherName: publisherName,
2054 extensionName: extensionName
2055 };
2056 let queryValues = {
2057 days: days,
2058 count: count,
2059 afterDate: afterDate,
2060 };
2061 try {
2062 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "79e0c74f-157f-437e-845f-74fbb4121d4c", routeValues, queryValues);
2063 let url = verData.requestUrl;
2064 let options = this.createRequestOptions('application/json', verData.apiVersion);
2065 let res;
2066 res = yield this.rest.get(url, options);
2067 let ret = this.formatResponse(res.result, null, false);
2068 resolve(ret);
2069 }
2070 catch (err) {
2071 reject(err);
2072 }
2073 }));
2074 });
2075 }
2076 /**
2077 * Returns a list of reviews associated with an extension
2078 *
2079 * @param {string} publisherName - Name of the publisher who published the extension
2080 * @param {string} extensionName - Name of the extension
2081 * @param {number} count - Number of reviews to retrieve (defaults to 5)
2082 * @param {GalleryInterfaces.ReviewFilterOptions} filterOptions - FilterOptions to filter out empty reviews etcetera, defaults to none
2083 * @param {Date} beforeDate - Use if you want to fetch reviews older than the specified date, defaults to null
2084 * @param {Date} afterDate - Use if you want to fetch reviews newer than the specified date, defaults to null
2085 */
2086 getReviews(publisherName, extensionName, count, filterOptions, beforeDate, afterDate) {
2087 return __awaiter(this, void 0, void 0, function* () {
2088 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2089 let routeValues = {
2090 publisherName: publisherName,
2091 extensionName: extensionName
2092 };
2093 let queryValues = {
2094 count: count,
2095 filterOptions: filterOptions,
2096 beforeDate: beforeDate,
2097 afterDate: afterDate,
2098 };
2099 try {
2100 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "5b3f819f-f247-42ad-8c00-dd9ab9ab246d", routeValues, queryValues);
2101 let url = verData.requestUrl;
2102 let options = this.createRequestOptions('application/json', verData.apiVersion);
2103 let res;
2104 res = yield this.rest.get(url, options);
2105 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ReviewsResult, false);
2106 resolve(ret);
2107 }
2108 catch (err) {
2109 reject(err);
2110 }
2111 }));
2112 });
2113 }
2114 /**
2115 * Returns a summary of the reviews
2116 *
2117 * @param {string} pubName - Name of the publisher who published the extension
2118 * @param {string} extName - Name of the extension
2119 * @param {Date} beforeDate - Use if you want to fetch summary of reviews older than the specified date, defaults to null
2120 * @param {Date} afterDate - Use if you want to fetch summary of reviews newer than the specified date, defaults to null
2121 */
2122 getReviewsSummary(pubName, extName, beforeDate, afterDate) {
2123 return __awaiter(this, void 0, void 0, function* () {
2124 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2125 let routeValues = {
2126 pubName: pubName,
2127 extName: extName
2128 };
2129 let queryValues = {
2130 beforeDate: beforeDate,
2131 afterDate: afterDate,
2132 };
2133 try {
2134 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b7b44e21-209e-48f0-ae78-04727fc37d77", routeValues, queryValues);
2135 let url = verData.requestUrl;
2136 let options = this.createRequestOptions('application/json', verData.apiVersion);
2137 let res;
2138 res = yield this.rest.get(url, options);
2139 let ret = this.formatResponse(res.result, null, false);
2140 resolve(ret);
2141 }
2142 catch (err) {
2143 reject(err);
2144 }
2145 }));
2146 });
2147 }
2148 /**
2149 * Creates a new review for an extension
2150 *
2151 * @param {GalleryInterfaces.Review} review - Review to be created for the extension
2152 * @param {string} pubName - Name of the publisher who published the extension
2153 * @param {string} extName - Name of the extension
2154 */
2155 createReview(review, pubName, extName) {
2156 return __awaiter(this, void 0, void 0, function* () {
2157 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2158 let routeValues = {
2159 pubName: pubName,
2160 extName: extName
2161 };
2162 try {
2163 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3", routeValues);
2164 let url = verData.requestUrl;
2165 let options = this.createRequestOptions('application/json', verData.apiVersion);
2166 let res;
2167 res = yield this.rest.create(url, review, options);
2168 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Review, false);
2169 resolve(ret);
2170 }
2171 catch (err) {
2172 reject(err);
2173 }
2174 }));
2175 });
2176 }
2177 /**
2178 * Deletes a review
2179 *
2180 * @param {string} pubName - Name of the publisher who published the extension
2181 * @param {string} extName - Name of the extension
2182 * @param {number} reviewId - Id of the review which needs to be updated
2183 */
2184 deleteReview(pubName, extName, reviewId) {
2185 return __awaiter(this, void 0, void 0, function* () {
2186 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2187 let routeValues = {
2188 pubName: pubName,
2189 extName: extName,
2190 reviewId: reviewId
2191 };
2192 try {
2193 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3", routeValues);
2194 let url = verData.requestUrl;
2195 let options = this.createRequestOptions('application/json', verData.apiVersion);
2196 let res;
2197 res = yield this.rest.del(url, options);
2198 let ret = this.formatResponse(res.result, null, false);
2199 resolve(ret);
2200 }
2201 catch (err) {
2202 reject(err);
2203 }
2204 }));
2205 });
2206 }
2207 /**
2208 * Updates or Flags a review
2209 *
2210 * @param {GalleryInterfaces.ReviewPatch} reviewPatch - ReviewPatch object which contains the changes to be applied to the review
2211 * @param {string} pubName - Name of the publisher who published the extension
2212 * @param {string} extName - Name of the extension
2213 * @param {number} reviewId - Id of the review which needs to be updated
2214 */
2215 updateReview(reviewPatch, pubName, extName, reviewId) {
2216 return __awaiter(this, void 0, void 0, function* () {
2217 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2218 let routeValues = {
2219 pubName: pubName,
2220 extName: extName,
2221 reviewId: reviewId
2222 };
2223 try {
2224 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3", routeValues);
2225 let url = verData.requestUrl;
2226 let options = this.createRequestOptions('application/json', verData.apiVersion);
2227 let res;
2228 res = yield this.rest.update(url, reviewPatch, options);
2229 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ReviewPatch, false);
2230 resolve(ret);
2231 }
2232 catch (err) {
2233 reject(err);
2234 }
2235 }));
2236 });
2237 }
2238 /**
2239 * @param {GalleryInterfaces.ExtensionCategory} category
2240 */
2241 createCategory(category) {
2242 return __awaiter(this, void 0, void 0, function* () {
2243 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2244 let routeValues = {};
2245 try {
2246 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "476531a3-7024-4516-a76a-ed64d3008ad6", routeValues);
2247 let url = verData.requestUrl;
2248 let options = this.createRequestOptions('application/json', verData.apiVersion);
2249 let res;
2250 res = yield this.rest.create(url, category, options);
2251 let ret = this.formatResponse(res.result, null, false);
2252 resolve(ret);
2253 }
2254 catch (err) {
2255 reject(err);
2256 }
2257 }));
2258 });
2259 }
2260 /**
2261 * Get all setting entries for the given user/all-users scope
2262 *
2263 * @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
2264 * @param {string} key - Optional key under which to filter all the entries
2265 */
2266 getGalleryUserSettings(userScope, key) {
2267 return __awaiter(this, void 0, void 0, function* () {
2268 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2269 let routeValues = {
2270 userScope: userScope,
2271 key: key
2272 };
2273 try {
2274 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "9b75ece3-7960-401c-848b-148ac01ca350", routeValues);
2275 let url = verData.requestUrl;
2276 let options = this.createRequestOptions('application/json', verData.apiVersion);
2277 let res;
2278 res = yield this.rest.get(url, options);
2279 let ret = this.formatResponse(res.result, null, true);
2280 resolve(ret);
2281 }
2282 catch (err) {
2283 reject(err);
2284 }
2285 }));
2286 });
2287 }
2288 /**
2289 * Set all setting entries for the given user/all-users scope
2290 *
2291 * @param {{ [key: string] : any; }} entries - A key-value pair of all settings that need to be set
2292 * @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users.
2293 */
2294 setGalleryUserSettings(entries, userScope) {
2295 return __awaiter(this, void 0, void 0, function* () {
2296 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2297 let routeValues = {
2298 userScope: userScope
2299 };
2300 try {
2301 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "9b75ece3-7960-401c-848b-148ac01ca350", routeValues);
2302 let url = verData.requestUrl;
2303 let options = this.createRequestOptions('application/json', verData.apiVersion);
2304 let res;
2305 res = yield this.rest.update(url, entries, options);
2306 let ret = this.formatResponse(res.result, null, false);
2307 resolve(ret);
2308 }
2309 catch (err) {
2310 reject(err);
2311 }
2312 }));
2313 });
2314 }
2315 /**
2316 * @param {string} keyType
2317 * @param {number} expireCurrentSeconds
2318 */
2319 generateKey(keyType, expireCurrentSeconds) {
2320 return __awaiter(this, void 0, void 0, function* () {
2321 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2322 let routeValues = {
2323 keyType: keyType
2324 };
2325 let queryValues = {
2326 expireCurrentSeconds: expireCurrentSeconds,
2327 };
2328 try {
2329 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "92ed5cf4-c38b-465a-9059-2f2fb7c624b5", routeValues, queryValues);
2330 let url = verData.requestUrl;
2331 let options = this.createRequestOptions('application/json', verData.apiVersion);
2332 let res;
2333 res = yield this.rest.create(url, null, options);
2334 let ret = this.formatResponse(res.result, null, false);
2335 resolve(ret);
2336 }
2337 catch (err) {
2338 reject(err);
2339 }
2340 }));
2341 });
2342 }
2343 /**
2344 * @param {string} keyType
2345 */
2346 getSigningKey(keyType) {
2347 return __awaiter(this, void 0, void 0, function* () {
2348 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2349 let routeValues = {
2350 keyType: keyType
2351 };
2352 try {
2353 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "92ed5cf4-c38b-465a-9059-2f2fb7c624b5", routeValues);
2354 let url = verData.requestUrl;
2355 let options = this.createRequestOptions('application/json', verData.apiVersion);
2356 let res;
2357 res = yield this.rest.get(url, options);
2358 let ret = this.formatResponse(res.result, null, false);
2359 resolve(ret);
2360 }
2361 catch (err) {
2362 reject(err);
2363 }
2364 }));
2365 });
2366 }
2367 /**
2368 * @param {GalleryInterfaces.ExtensionStatisticUpdate} extensionStatisticsUpdate
2369 * @param {string} publisherName
2370 * @param {string} extensionName
2371 */
2372 updateExtensionStatistics(extensionStatisticsUpdate, publisherName, extensionName) {
2373 return __awaiter(this, void 0, void 0, function* () {
2374 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2375 let routeValues = {
2376 publisherName: publisherName,
2377 extensionName: extensionName
2378 };
2379 try {
2380 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "a0ea3204-11e9-422d-a9ca-45851cc41400", routeValues);
2381 let url = verData.requestUrl;
2382 let options = this.createRequestOptions('application/json', verData.apiVersion);
2383 let res;
2384 res = yield this.rest.update(url, extensionStatisticsUpdate, options);
2385 let ret = this.formatResponse(res.result, null, false);
2386 resolve(ret);
2387 }
2388 catch (err) {
2389 reject(err);
2390 }
2391 }));
2392 });
2393 }
2394 /**
2395 * @param {string} publisherName
2396 * @param {string} extensionName
2397 * @param {number} days
2398 * @param {GalleryInterfaces.ExtensionStatsAggregateType} aggregate
2399 * @param {Date} afterDate
2400 */
2401 getExtensionDailyStats(publisherName, extensionName, days, aggregate, afterDate) {
2402 return __awaiter(this, void 0, void 0, function* () {
2403 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2404 let routeValues = {
2405 publisherName: publisherName,
2406 extensionName: extensionName
2407 };
2408 let queryValues = {
2409 days: days,
2410 aggregate: aggregate,
2411 afterDate: afterDate,
2412 };
2413 try {
2414 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "ae06047e-51c5-4fb4-ab65-7be488544416", routeValues, queryValues);
2415 let url = verData.requestUrl;
2416 let options = this.createRequestOptions('application/json', verData.apiVersion);
2417 let res;
2418 res = yield this.rest.get(url, options);
2419 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDailyStats, false);
2420 resolve(ret);
2421 }
2422 catch (err) {
2423 reject(err);
2424 }
2425 }));
2426 });
2427 }
2428 /**
2429 * This route/location id only supports HTTP POST anonymously, so that the page view daily stat can be incremented from Marketplace client. Trying to call GET on this route should result in an exception. Without this explicit implementation, calling GET on this public route invokes the above GET implementation GetExtensionDailyStats.
2430 *
2431 * @param {string} publisherName - Name of the publisher
2432 * @param {string} extensionName - Name of the extension
2433 * @param {string} version - Version of the extension
2434 */
2435 getExtensionDailyStatsAnonymous(publisherName, extensionName, version) {
2436 return __awaiter(this, void 0, void 0, function* () {
2437 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2438 let routeValues = {
2439 publisherName: publisherName,
2440 extensionName: extensionName,
2441 version: version
2442 };
2443 try {
2444 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4fa7adb6-ca65-4075-a232-5f28323288ea", routeValues);
2445 let url = verData.requestUrl;
2446 let options = this.createRequestOptions('application/json', verData.apiVersion);
2447 let res;
2448 res = yield this.rest.get(url, options);
2449 let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDailyStats, false);
2450 resolve(ret);
2451 }
2452 catch (err) {
2453 reject(err);
2454 }
2455 }));
2456 });
2457 }
2458 /**
2459 * Increments a daily statistic associated with the extension
2460 *
2461 * @param {string} publisherName - Name of the publisher
2462 * @param {string} extensionName - Name of the extension
2463 * @param {string} version - Version of the extension
2464 * @param {string} statType - Type of stat to increment
2465 * @param {string} targetPlatform
2466 */
2467 incrementExtensionDailyStat(publisherName, extensionName, version, statType, targetPlatform) {
2468 return __awaiter(this, void 0, void 0, function* () {
2469 if (statType == null) {
2470 throw new TypeError('statType can not be null or undefined');
2471 }
2472 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2473 let routeValues = {
2474 publisherName: publisherName,
2475 extensionName: extensionName,
2476 version: version
2477 };
2478 let queryValues = {
2479 statType: statType,
2480 targetPlatform: targetPlatform,
2481 };
2482 try {
2483 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4fa7adb6-ca65-4075-a232-5f28323288ea", routeValues, queryValues);
2484 let url = verData.requestUrl;
2485 let options = this.createRequestOptions('application/json', verData.apiVersion);
2486 let res;
2487 res = yield this.rest.create(url, null, options);
2488 let ret = this.formatResponse(res.result, null, false);
2489 resolve(ret);
2490 }
2491 catch (err) {
2492 reject(err);
2493 }
2494 }));
2495 });
2496 }
2497 /**
2498 * @param {string} publisherName
2499 * @param {string} extensionName
2500 * @param {string} version
2501 * @param {string} targetPlatform
2502 */
2503 getVerificationLog(publisherName, extensionName, version, targetPlatform) {
2504 return __awaiter(this, void 0, void 0, function* () {
2505 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2506 let routeValues = {
2507 publisherName: publisherName,
2508 extensionName: extensionName,
2509 version: version
2510 };
2511 let queryValues = {
2512 targetPlatform: targetPlatform,
2513 };
2514 try {
2515 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "c5523abe-b843-437f-875b-5833064efe4d", routeValues, queryValues);
2516 let url = verData.requestUrl;
2517 let apiVersion = verData.apiVersion;
2518 let accept = this.createAcceptHeader("application/octet-stream", apiVersion);
2519 resolve((yield this.http.get(url, { "Accept": accept })).message);
2520 }
2521 catch (err) {
2522 reject(err);
2523 }
2524 }));
2525 });
2526 }
2527 /**
2528 * @param {string} itemName
2529 * @param {string} version
2530 * @param {GalleryInterfaces.VSCodeWebExtensionStatisicsType} statType
2531 */
2532 updateVSCodeWebExtensionStatistics(itemName, version, statType) {
2533 return __awaiter(this, void 0, void 0, function* () {
2534 return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
2535 let routeValues = {
2536 itemName: itemName,
2537 version: version,
2538 statType: statType
2539 };
2540 try {
2541 let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "205c91a8-7841-4fd3-ae4f-5a745d5a8df5", routeValues);
2542 let url = verData.requestUrl;
2543 let options = this.createRequestOptions('application/json', verData.apiVersion);
2544 let res;
2545 res = yield this.rest.create(url, null, options);
2546 let ret = this.formatResponse(res.result, null, false);
2547 resolve(ret);
2548 }
2549 catch (err) {
2550 reject(err);
2551 }
2552 }));
2553 });
2554 }
2555}
2556exports.GalleryApi = GalleryApi;
2557GalleryApi.RESOURCE_AREA_ID = "69d21c00-f135-441b-b5ce-3626378e0819";