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.FeatureManagementApi = void 0;
|
22 | const basem = require("./ClientApiBases");
|
23 | const FeatureManagementInterfaces = require("./interfaces/FeatureManagementInterfaces");
|
24 | class FeatureManagementApi extends basem.ClientApiBase {
|
25 | constructor(baseUrl, handlers, options) {
|
26 | super(baseUrl, handlers, 'node-FeatureManagement-api', options);
|
27 | }
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 | getFeature(featureId) {
|
34 | return __awaiter(this, void 0, void 0, function* () {
|
35 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
36 | let routeValues = {
|
37 | featureId: featureId
|
38 | };
|
39 | try {
|
40 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "c4209f25-7a27-41dd-9f04-06080c7b6afd", routeValues);
|
41 | let url = verData.requestUrl;
|
42 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
43 | let res;
|
44 | res = yield this.rest.get(url, 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 |
|
56 |
|
57 |
|
58 |
|
59 | getFeatures(targetContributionId) {
|
60 | return __awaiter(this, void 0, void 0, function* () {
|
61 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
62 | let routeValues = {};
|
63 | let queryValues = {
|
64 | targetContributionId: targetContributionId,
|
65 | };
|
66 | try {
|
67 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "c4209f25-7a27-41dd-9f04-06080c7b6afd", routeValues, queryValues);
|
68 | let url = verData.requestUrl;
|
69 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
70 | let res;
|
71 | res = yield this.rest.get(url, options);
|
72 | let ret = this.formatResponse(res.result, null, true);
|
73 | resolve(ret);
|
74 | }
|
75 | catch (err) {
|
76 | reject(err);
|
77 | }
|
78 | }));
|
79 | });
|
80 | }
|
81 | |
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | getFeatureState(featureId, userScope) {
|
88 | return __awaiter(this, void 0, void 0, function* () {
|
89 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
90 | let routeValues = {
|
91 | featureId: featureId,
|
92 | userScope: userScope
|
93 | };
|
94 | try {
|
95 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "98911314-3f9b-4eaf-80e8-83900d8e85d9", routeValues);
|
96 | let url = verData.requestUrl;
|
97 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
98 | let res;
|
99 | res = yield this.rest.get(url, options);
|
100 | let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false);
|
101 | resolve(ret);
|
102 | }
|
103 | catch (err) {
|
104 | reject(err);
|
105 | }
|
106 | }));
|
107 | });
|
108 | }
|
109 | |
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | setFeatureState(feature, featureId, userScope, reason, reasonCode) {
|
119 | return __awaiter(this, void 0, void 0, function* () {
|
120 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
121 | let routeValues = {
|
122 | featureId: featureId,
|
123 | userScope: userScope
|
124 | };
|
125 | let queryValues = {
|
126 | reason: reason,
|
127 | reasonCode: reasonCode,
|
128 | };
|
129 | try {
|
130 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "98911314-3f9b-4eaf-80e8-83900d8e85d9", routeValues, queryValues);
|
131 | let url = verData.requestUrl;
|
132 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
133 | let res;
|
134 | res = yield this.rest.update(url, feature, options);
|
135 | let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false);
|
136 | resolve(ret);
|
137 | }
|
138 | catch (err) {
|
139 | reject(err);
|
140 | }
|
141 | }));
|
142 | });
|
143 | }
|
144 | |
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 | getFeatureStateForScope(featureId, userScope, scopeName, scopeValue) {
|
153 | return __awaiter(this, void 0, void 0, function* () {
|
154 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
155 | let routeValues = {
|
156 | featureId: featureId,
|
157 | userScope: userScope,
|
158 | scopeName: scopeName,
|
159 | scopeValue: scopeValue
|
160 | };
|
161 | try {
|
162 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "dd291e43-aa9f-4cee-8465-a93c78e414a4", routeValues);
|
163 | let url = verData.requestUrl;
|
164 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
165 | let res;
|
166 | res = yield this.rest.get(url, options);
|
167 | let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false);
|
168 | resolve(ret);
|
169 | }
|
170 | catch (err) {
|
171 | reject(err);
|
172 | }
|
173 | }));
|
174 | });
|
175 | }
|
176 | |
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 | setFeatureStateForScope(feature, featureId, userScope, scopeName, scopeValue, reason, reasonCode) {
|
188 | return __awaiter(this, void 0, void 0, function* () {
|
189 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
190 | let routeValues = {
|
191 | featureId: featureId,
|
192 | userScope: userScope,
|
193 | scopeName: scopeName,
|
194 | scopeValue: scopeValue
|
195 | };
|
196 | let queryValues = {
|
197 | reason: reason,
|
198 | reasonCode: reasonCode,
|
199 | };
|
200 | try {
|
201 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "dd291e43-aa9f-4cee-8465-a93c78e414a4", routeValues, queryValues);
|
202 | let url = verData.requestUrl;
|
203 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
204 | let res;
|
205 | res = yield this.rest.update(url, feature, options);
|
206 | let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false);
|
207 | resolve(ret);
|
208 | }
|
209 | catch (err) {
|
210 | reject(err);
|
211 | }
|
212 | }));
|
213 | });
|
214 | }
|
215 | |
216 |
|
217 |
|
218 |
|
219 |
|
220 | queryFeatureStates(query) {
|
221 | return __awaiter(this, void 0, void 0, function* () {
|
222 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
223 | let routeValues = {};
|
224 | try {
|
225 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "2b4486ad-122b-400c-ae65-17b6672c1f9d", routeValues);
|
226 | let url = verData.requestUrl;
|
227 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
228 | let res;
|
229 | res = yield this.rest.create(url, query, options);
|
230 | let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery, false);
|
231 | resolve(ret);
|
232 | }
|
233 | catch (err) {
|
234 | reject(err);
|
235 | }
|
236 | }));
|
237 | });
|
238 | }
|
239 | |
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 | queryFeatureStatesForDefaultScope(query, userScope) {
|
246 | return __awaiter(this, void 0, void 0, function* () {
|
247 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
248 | let routeValues = {
|
249 | userScope: userScope
|
250 | };
|
251 | try {
|
252 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "3f810f28-03e2-4239-b0bc-788add3005e5", routeValues);
|
253 | let url = verData.requestUrl;
|
254 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
255 | let res;
|
256 | res = yield this.rest.create(url, query, options);
|
257 | let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery, false);
|
258 | resolve(ret);
|
259 | }
|
260 | catch (err) {
|
261 | reject(err);
|
262 | }
|
263 | }));
|
264 | });
|
265 | }
|
266 | |
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 | queryFeatureStatesForNamedScope(query, userScope, scopeName, scopeValue) {
|
275 | return __awaiter(this, void 0, void 0, function* () {
|
276 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
277 | let routeValues = {
|
278 | userScope: userScope,
|
279 | scopeName: scopeName,
|
280 | scopeValue: scopeValue
|
281 | };
|
282 | try {
|
283 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "f29e997b-c2da-4d15-8380-765788a1a74c", routeValues);
|
284 | let url = verData.requestUrl;
|
285 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
286 | let res;
|
287 | res = yield this.rest.create(url, query, options);
|
288 | let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery, false);
|
289 | resolve(ret);
|
290 | }
|
291 | catch (err) {
|
292 | reject(err);
|
293 | }
|
294 | }));
|
295 | });
|
296 | }
|
297 | }
|
298 | exports.FeatureManagementApi = FeatureManagementApi;
|