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.DashboardApi = void 0;
|
22 | const basem = require("./ClientApiBases");
|
23 | const DashboardInterfaces = require("./interfaces/DashboardInterfaces");
|
24 | class DashboardApi extends basem.ClientApiBase {
|
25 | constructor(baseUrl, handlers, options) {
|
26 | super(baseUrl, handlers, 'node-Dashboard-api', options);
|
27 | }
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | createDashboard(dashboard, teamContext) {
|
35 | return __awaiter(this, void 0, void 0, function* () {
|
36 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
37 | let project = null;
|
38 | let team = null;
|
39 | if (teamContext) {
|
40 | project = teamContext.projectId || teamContext.project;
|
41 | team = teamContext.teamId || teamContext.team;
|
42 | }
|
43 | let routeValues = {
|
44 | project: project,
|
45 | team: team
|
46 | };
|
47 | try {
|
48 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues);
|
49 | let url = verData.requestUrl;
|
50 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
51 | let res;
|
52 | res = yield this.rest.create(url, dashboard, options);
|
53 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false);
|
54 | resolve(ret);
|
55 | }
|
56 | catch (err) {
|
57 | reject(err);
|
58 | }
|
59 | }));
|
60 | });
|
61 | }
|
62 | |
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | deleteDashboard(teamContext, dashboardId) {
|
69 | return __awaiter(this, void 0, void 0, function* () {
|
70 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
71 | let project = null;
|
72 | let team = null;
|
73 | if (teamContext) {
|
74 | project = teamContext.projectId || teamContext.project;
|
75 | team = teamContext.teamId || teamContext.team;
|
76 | }
|
77 | let routeValues = {
|
78 | project: project,
|
79 | team: team,
|
80 | dashboardId: dashboardId
|
81 | };
|
82 | try {
|
83 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues);
|
84 | let url = verData.requestUrl;
|
85 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
86 | let res;
|
87 | res = yield this.rest.del(url, options);
|
88 | let ret = this.formatResponse(res.result, null, false);
|
89 | resolve(ret);
|
90 | }
|
91 | catch (err) {
|
92 | reject(err);
|
93 | }
|
94 | }));
|
95 | });
|
96 | }
|
97 | |
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 | getDashboard(teamContext, dashboardId) {
|
104 | return __awaiter(this, void 0, void 0, function* () {
|
105 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
106 | let project = null;
|
107 | let team = null;
|
108 | if (teamContext) {
|
109 | project = teamContext.projectId || teamContext.project;
|
110 | team = teamContext.teamId || teamContext.team;
|
111 | }
|
112 | let routeValues = {
|
113 | project: project,
|
114 | team: team,
|
115 | dashboardId: dashboardId
|
116 | };
|
117 | try {
|
118 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues);
|
119 | let url = verData.requestUrl;
|
120 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
121 | let res;
|
122 | res = yield this.rest.get(url, options);
|
123 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false);
|
124 | resolve(ret);
|
125 | }
|
126 | catch (err) {
|
127 | reject(err);
|
128 | }
|
129 | }));
|
130 | });
|
131 | }
|
132 | |
133 |
|
134 |
|
135 |
|
136 |
|
137 | getDashboardsByProject(teamContext) {
|
138 | return __awaiter(this, void 0, void 0, function* () {
|
139 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
140 | let project = null;
|
141 | let team = null;
|
142 | if (teamContext) {
|
143 | project = teamContext.projectId || teamContext.project;
|
144 | team = teamContext.teamId || teamContext.team;
|
145 | }
|
146 | let routeValues = {
|
147 | project: project,
|
148 | team: team
|
149 | };
|
150 | try {
|
151 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues);
|
152 | let url = verData.requestUrl;
|
153 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
154 | let res;
|
155 | res = yield this.rest.get(url, options);
|
156 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, true);
|
157 | resolve(ret);
|
158 | }
|
159 | catch (err) {
|
160 | reject(err);
|
161 | }
|
162 | }));
|
163 | });
|
164 | }
|
165 | |
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | replaceDashboard(dashboard, teamContext, dashboardId) {
|
173 | return __awaiter(this, void 0, void 0, function* () {
|
174 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
175 | let project = null;
|
176 | let team = null;
|
177 | if (teamContext) {
|
178 | project = teamContext.projectId || teamContext.project;
|
179 | team = teamContext.teamId || teamContext.team;
|
180 | }
|
181 | let routeValues = {
|
182 | project: project,
|
183 | team: team,
|
184 | dashboardId: dashboardId
|
185 | };
|
186 | try {
|
187 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues);
|
188 | let url = verData.requestUrl;
|
189 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
190 | let res;
|
191 | res = yield this.rest.replace(url, dashboard, options);
|
192 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false);
|
193 | resolve(ret);
|
194 | }
|
195 | catch (err) {
|
196 | reject(err);
|
197 | }
|
198 | }));
|
199 | });
|
200 | }
|
201 | |
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 | replaceDashboards(group, teamContext) {
|
208 | return __awaiter(this, void 0, void 0, function* () {
|
209 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
210 | let project = null;
|
211 | let team = null;
|
212 | if (teamContext) {
|
213 | project = teamContext.projectId || teamContext.project;
|
214 | team = teamContext.teamId || teamContext.team;
|
215 | }
|
216 | let routeValues = {
|
217 | project: project,
|
218 | team: team
|
219 | };
|
220 | try {
|
221 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues);
|
222 | let url = verData.requestUrl;
|
223 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
224 | let res;
|
225 | res = yield this.rest.replace(url, group, options);
|
226 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.DashboardGroup, false);
|
227 | resolve(ret);
|
228 | }
|
229 | catch (err) {
|
230 | reject(err);
|
231 | }
|
232 | }));
|
233 | });
|
234 | }
|
235 | |
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 | createWidget(widget, teamContext, dashboardId) {
|
243 | return __awaiter(this, void 0, void 0, function* () {
|
244 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
245 | let project = null;
|
246 | let team = null;
|
247 | if (teamContext) {
|
248 | project = teamContext.projectId || teamContext.project;
|
249 | team = teamContext.teamId || teamContext.team;
|
250 | }
|
251 | let routeValues = {
|
252 | project: project,
|
253 | team: team,
|
254 | dashboardId: dashboardId
|
255 | };
|
256 | try {
|
257 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues);
|
258 | let url = verData.requestUrl;
|
259 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
260 | let res;
|
261 | res = yield this.rest.create(url, widget, options);
|
262 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false);
|
263 | resolve(ret);
|
264 | }
|
265 | catch (err) {
|
266 | reject(err);
|
267 | }
|
268 | }));
|
269 | });
|
270 | }
|
271 | |
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 | deleteWidget(teamContext, dashboardId, widgetId) {
|
279 | return __awaiter(this, void 0, void 0, function* () {
|
280 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
281 | let project = null;
|
282 | let team = null;
|
283 | if (teamContext) {
|
284 | project = teamContext.projectId || teamContext.project;
|
285 | team = teamContext.teamId || teamContext.team;
|
286 | }
|
287 | let routeValues = {
|
288 | project: project,
|
289 | team: team,
|
290 | dashboardId: dashboardId,
|
291 | widgetId: widgetId
|
292 | };
|
293 | try {
|
294 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues);
|
295 | let url = verData.requestUrl;
|
296 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
297 | let res;
|
298 | res = yield this.rest.del(url, options);
|
299 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false);
|
300 | resolve(ret);
|
301 | }
|
302 | catch (err) {
|
303 | reject(err);
|
304 | }
|
305 | }));
|
306 | });
|
307 | }
|
308 | |
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 | getWidget(teamContext, dashboardId, widgetId) {
|
316 | return __awaiter(this, void 0, void 0, function* () {
|
317 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
318 | let project = null;
|
319 | let team = null;
|
320 | if (teamContext) {
|
321 | project = teamContext.projectId || teamContext.project;
|
322 | team = teamContext.teamId || teamContext.team;
|
323 | }
|
324 | let routeValues = {
|
325 | project: project,
|
326 | team: team,
|
327 | dashboardId: dashboardId,
|
328 | widgetId: widgetId
|
329 | };
|
330 | try {
|
331 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues);
|
332 | let url = verData.requestUrl;
|
333 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
334 | let res;
|
335 | res = yield this.rest.get(url, options);
|
336 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false);
|
337 | resolve(ret);
|
338 | }
|
339 | catch (err) {
|
340 | reject(err);
|
341 | }
|
342 | }));
|
343 | });
|
344 | }
|
345 | |
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 | replaceWidget(widget, teamContext, dashboardId, widgetId) {
|
354 | return __awaiter(this, void 0, void 0, function* () {
|
355 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
356 | let project = null;
|
357 | let team = null;
|
358 | if (teamContext) {
|
359 | project = teamContext.projectId || teamContext.project;
|
360 | team = teamContext.teamId || teamContext.team;
|
361 | }
|
362 | let routeValues = {
|
363 | project: project,
|
364 | team: team,
|
365 | dashboardId: dashboardId,
|
366 | widgetId: widgetId
|
367 | };
|
368 | try {
|
369 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues);
|
370 | let url = verData.requestUrl;
|
371 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
372 | let res;
|
373 | res = yield this.rest.replace(url, widget, options);
|
374 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false);
|
375 | resolve(ret);
|
376 | }
|
377 | catch (err) {
|
378 | reject(err);
|
379 | }
|
380 | }));
|
381 | });
|
382 | }
|
383 | |
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 | updateWidget(widget, teamContext, dashboardId, widgetId) {
|
392 | return __awaiter(this, void 0, void 0, function* () {
|
393 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
394 | let project = null;
|
395 | let team = null;
|
396 | if (teamContext) {
|
397 | project = teamContext.projectId || teamContext.project;
|
398 | team = teamContext.teamId || teamContext.team;
|
399 | }
|
400 | let routeValues = {
|
401 | project: project,
|
402 | team: team,
|
403 | dashboardId: dashboardId,
|
404 | widgetId: widgetId
|
405 | };
|
406 | try {
|
407 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues);
|
408 | let url = verData.requestUrl;
|
409 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
410 | let res;
|
411 | res = yield this.rest.update(url, widget, options);
|
412 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false);
|
413 | resolve(ret);
|
414 | }
|
415 | catch (err) {
|
416 | reject(err);
|
417 | }
|
418 | }));
|
419 | });
|
420 | }
|
421 | |
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 | getWidgetMetadata(contributionId, project) {
|
428 | return __awaiter(this, void 0, void 0, function* () {
|
429 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
430 | let routeValues = {
|
431 | project: project,
|
432 | contributionId: contributionId
|
433 | };
|
434 | try {
|
435 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Dashboard", "6b3628d3-e96f-4fc7-b176-50240b03b515", routeValues);
|
436 | let url = verData.requestUrl;
|
437 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
438 | let res;
|
439 | res = yield this.rest.get(url, options);
|
440 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.WidgetMetadataResponse, false);
|
441 | resolve(ret);
|
442 | }
|
443 | catch (err) {
|
444 | reject(err);
|
445 | }
|
446 | }));
|
447 | });
|
448 | }
|
449 | |
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 | getWidgetTypes(scope, project) {
|
456 | return __awaiter(this, void 0, void 0, function* () {
|
457 | if (scope == null) {
|
458 | throw new TypeError('scope can not be null or undefined');
|
459 | }
|
460 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
461 | let routeValues = {
|
462 | project: project
|
463 | };
|
464 | let queryValues = {
|
465 | '$scope': scope,
|
466 | };
|
467 | try {
|
468 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Dashboard", "6b3628d3-e96f-4fc7-b176-50240b03b515", routeValues, queryValues);
|
469 | let url = verData.requestUrl;
|
470 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
471 | let res;
|
472 | res = yield this.rest.get(url, options);
|
473 | let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.WidgetTypesResponse, false);
|
474 | resolve(ret);
|
475 | }
|
476 | catch (err) {
|
477 | reject(err);
|
478 | }
|
479 | }));
|
480 | });
|
481 | }
|
482 | }
|
483 | exports.DashboardApi = DashboardApi;
|
484 | DashboardApi.RESOURCE_AREA_ID = "31c84e0a-3ece-48fd-a29d-100849af99ba";
|