1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | var __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 | };
|
20 | Object.defineProperty(exports, "__esModule", { value: true });
|
21 | exports.GalleryCompatHttpClientBase = void 0;
|
22 | const basem = require("./ClientApiBases");
|
23 | const GalleryInterfaces = require("./interfaces/GalleryInterfaces");
|
24 | class GalleryCompatHttpClientBase extends basem.ClientApiBase {
|
25 | constructor(baseUrl, handlers, userAgent, options) {
|
26 | super(baseUrl, handlers, userAgent, options);
|
27 | }
|
28 | |
29 |
|
30 |
|
31 | createExtensionJson(extensionPackage) {
|
32 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
33 | let routeValues = {};
|
34 | try {
|
35 | let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues);
|
36 | let url = verData.requestUrl;
|
37 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
38 | let res;
|
39 | res = yield this.rest.create(url, extensionPackage, options);
|
40 | let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
|
41 | resolve(ret);
|
42 | }
|
43 | catch (err) {
|
44 | reject(err);
|
45 | }
|
46 | }));
|
47 | }
|
48 | |
49 |
|
50 |
|
51 |
|
52 | updateExtensionByIdJson(extensionPackage, extensionId) {
|
53 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
54 | let routeValues = {
|
55 | extensionId: extensionId
|
56 | };
|
57 | try {
|
58 | let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues);
|
59 | let url = verData.requestUrl;
|
60 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
61 | let res;
|
62 | res = yield this.rest.replace(url, extensionPackage, options);
|
63 | let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
|
64 | resolve(ret);
|
65 | }
|
66 | catch (err) {
|
67 | reject(err);
|
68 | }
|
69 | }));
|
70 | }
|
71 | |
72 |
|
73 |
|
74 |
|
75 | createExtensionWithPublisherJson(extensionPackage, publisherName) {
|
76 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
77 | let routeValues = {
|
78 | publisherName: publisherName
|
79 | };
|
80 | try {
|
81 | let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues);
|
82 | let url = verData.requestUrl;
|
83 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
84 | let res;
|
85 | res = yield this.rest.create(url, extensionPackage, options);
|
86 | let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
|
87 | resolve(ret);
|
88 | }
|
89 | catch (err) {
|
90 | reject(err);
|
91 | }
|
92 | }));
|
93 | }
|
94 | |
95 |
|
96 |
|
97 |
|
98 |
|
99 | updateExtensionJson(extensionPackage, publisherName, extensionName) {
|
100 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
101 | let routeValues = {
|
102 | publisherName: publisherName,
|
103 | extensionName: extensionName
|
104 | };
|
105 | try {
|
106 | let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues);
|
107 | let url = verData.requestUrl;
|
108 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
109 | let res;
|
110 | res = yield this.rest.replace(url, extensionPackage, options);
|
111 | let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false);
|
112 | resolve(ret);
|
113 | }
|
114 | catch (err) {
|
115 | reject(err);
|
116 | }
|
117 | }));
|
118 | }
|
119 | }
|
120 | exports.GalleryCompatHttpClientBase = GalleryCompatHttpClientBase;
|