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.ProfileApi = void 0;
|
22 | const basem = require("./ClientApiBases");
|
23 | const ProfileInterfaces = require("./interfaces/ProfileInterfaces");
|
24 | class ProfileApi extends basem.ClientApiBase {
|
25 | constructor(baseUrl, handlers, options) {
|
26 | super(baseUrl, handlers, 'node-Profile-api', options);
|
27 | }
|
28 | |
29 |
|
30 |
|
31 |
|
32 | deleteProfileAttribute(id, descriptor) {
|
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 | id: id
|
37 | };
|
38 | let queryValues = {
|
39 | descriptor: descriptor,
|
40 | };
|
41 | try {
|
42 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues);
|
43 | let url = verData.requestUrl;
|
44 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
45 | let res;
|
46 | res = yield this.rest.del(url, options);
|
47 | let ret = this.formatResponse(res.result, null, false);
|
48 | resolve(ret);
|
49 | }
|
50 | catch (err) {
|
51 | reject(err);
|
52 | }
|
53 | }));
|
54 | });
|
55 | }
|
56 | |
57 |
|
58 |
|
59 |
|
60 | getProfileAttribute(id, descriptor) {
|
61 | return __awaiter(this, void 0, void 0, function* () {
|
62 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
63 | let routeValues = {
|
64 | id: id
|
65 | };
|
66 | let queryValues = {
|
67 | descriptor: descriptor,
|
68 | };
|
69 | try {
|
70 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues);
|
71 | let url = verData.requestUrl;
|
72 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
73 | let res;
|
74 | res = yield this.rest.get(url, options);
|
75 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.ProfileAttribute, false);
|
76 | resolve(ret);
|
77 | }
|
78 | catch (err) {
|
79 | reject(err);
|
80 | }
|
81 | }));
|
82 | });
|
83 | }
|
84 | |
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | getProfileAttributes(id, partition, modifiedSince, modifiedAfterRevision, withCoreAttributes, coreAttributes) {
|
93 | return __awaiter(this, void 0, void 0, function* () {
|
94 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
95 | let routeValues = {
|
96 | id: id
|
97 | };
|
98 | let queryValues = {
|
99 | partition: partition,
|
100 | modifiedSince: modifiedSince,
|
101 | modifiedAfterRevision: modifiedAfterRevision,
|
102 | withCoreAttributes: withCoreAttributes,
|
103 | coreAttributes: coreAttributes,
|
104 | };
|
105 | try {
|
106 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues);
|
107 | let url = verData.requestUrl;
|
108 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
109 | let res;
|
110 | res = yield this.rest.get(url, options);
|
111 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.ProfileAttribute, true);
|
112 | resolve(ret);
|
113 | }
|
114 | catch (err) {
|
115 | reject(err);
|
116 | }
|
117 | }));
|
118 | });
|
119 | }
|
120 | |
121 |
|
122 |
|
123 |
|
124 |
|
125 | setProfileAttribute(container, id, descriptor) {
|
126 | return __awaiter(this, void 0, void 0, function* () {
|
127 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
128 | let routeValues = {
|
129 | id: id
|
130 | };
|
131 | let queryValues = {
|
132 | descriptor: descriptor,
|
133 | };
|
134 | try {
|
135 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues);
|
136 | let url = verData.requestUrl;
|
137 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
138 | let res;
|
139 | res = yield this.rest.replace(url, container, options);
|
140 | let ret = this.formatResponse(res.result, null, false);
|
141 | resolve(ret);
|
142 | }
|
143 | catch (err) {
|
144 | reject(err);
|
145 | }
|
146 | }));
|
147 | });
|
148 | }
|
149 | |
150 |
|
151 |
|
152 |
|
153 | setProfileAttributes(attributesCollection, id) {
|
154 | return __awaiter(this, void 0, void 0, function* () {
|
155 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
156 | let routeValues = {
|
157 | id: id
|
158 | };
|
159 | try {
|
160 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues);
|
161 | let url = verData.requestUrl;
|
162 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
163 | let res;
|
164 | res = yield this.rest.update(url, attributesCollection, options);
|
165 | let ret = this.formatResponse(res.result, null, false);
|
166 | resolve(ret);
|
167 | }
|
168 | catch (err) {
|
169 | reject(err);
|
170 | }
|
171 | }));
|
172 | });
|
173 | }
|
174 | |
175 |
|
176 |
|
177 |
|
178 |
|
179 | getAvatar(id, size, format) {
|
180 | return __awaiter(this, void 0, void 0, function* () {
|
181 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
182 | let routeValues = {
|
183 | id: id
|
184 | };
|
185 | let queryValues = {
|
186 | size: size,
|
187 | format: format,
|
188 | };
|
189 | try {
|
190 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues, queryValues);
|
191 | let url = verData.requestUrl;
|
192 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
193 | let res;
|
194 | res = yield this.rest.get(url, options);
|
195 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Avatar, false);
|
196 | resolve(ret);
|
197 | }
|
198 | catch (err) {
|
199 | reject(err);
|
200 | }
|
201 | }));
|
202 | });
|
203 | }
|
204 | |
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 | getAvatarPreview(container, id, size, format, displayName) {
|
212 | return __awaiter(this, void 0, void 0, function* () {
|
213 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
214 | let routeValues = {
|
215 | id: id
|
216 | };
|
217 | let queryValues = {
|
218 | size: size,
|
219 | format: format,
|
220 | displayName: displayName,
|
221 | };
|
222 | try {
|
223 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues, queryValues);
|
224 | let url = verData.requestUrl;
|
225 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
226 | let res;
|
227 | res = yield this.rest.create(url, container, options);
|
228 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Avatar, false);
|
229 | resolve(ret);
|
230 | }
|
231 | catch (err) {
|
232 | reject(err);
|
233 | }
|
234 | }));
|
235 | });
|
236 | }
|
237 | |
238 |
|
239 |
|
240 | resetAvatar(id) {
|
241 | return __awaiter(this, void 0, void 0, function* () {
|
242 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
243 | let routeValues = {
|
244 | id: id
|
245 | };
|
246 | try {
|
247 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues);
|
248 | let url = verData.requestUrl;
|
249 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
250 | let res;
|
251 | res = yield this.rest.del(url, options);
|
252 | let ret = this.formatResponse(res.result, null, false);
|
253 | resolve(ret);
|
254 | }
|
255 | catch (err) {
|
256 | reject(err);
|
257 | }
|
258 | }));
|
259 | });
|
260 | }
|
261 | |
262 |
|
263 |
|
264 |
|
265 | setAvatar(container, id) {
|
266 | return __awaiter(this, void 0, void 0, function* () {
|
267 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
268 | let routeValues = {
|
269 | id: id
|
270 | };
|
271 | try {
|
272 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues);
|
273 | let url = verData.requestUrl;
|
274 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
275 | let res;
|
276 | res = yield this.rest.replace(url, container, options);
|
277 | let ret = this.formatResponse(res.result, null, false);
|
278 | resolve(ret);
|
279 | }
|
280 | catch (err) {
|
281 | reject(err);
|
282 | }
|
283 | }));
|
284 | });
|
285 | }
|
286 | |
287 |
|
288 |
|
289 |
|
290 |
|
291 | getGeoRegion(ipaddress) {
|
292 | return __awaiter(this, void 0, void 0, function* () {
|
293 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
294 | let routeValues = {};
|
295 | let queryValues = {
|
296 | ipaddress: ipaddress,
|
297 | };
|
298 | try {
|
299 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "3bcda9c0-3078-48a5-a1e0-83bd05931ad0", routeValues, queryValues);
|
300 | let url = verData.requestUrl;
|
301 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
302 | let res;
|
303 | res = yield this.rest.get(url, options);
|
304 | let ret = this.formatResponse(res.result, null, false);
|
305 | resolve(ret);
|
306 | }
|
307 | catch (err) {
|
308 | reject(err);
|
309 | }
|
310 | }));
|
311 | });
|
312 | }
|
313 | |
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 | createProfile(createProfileContext, autoCreate) {
|
320 | return __awaiter(this, void 0, void 0, function* () {
|
321 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
322 | let routeValues = {};
|
323 | let queryValues = {
|
324 | autoCreate: autoCreate,
|
325 | };
|
326 | try {
|
327 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.3", "Profile", "f83735dc-483f-4238-a291-d45f6080a9af", routeValues, queryValues);
|
328 | let url = verData.requestUrl;
|
329 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
330 | let res;
|
331 | res = yield this.rest.create(url, createProfileContext, options);
|
332 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false);
|
333 | resolve(ret);
|
334 | }
|
335 | catch (err) {
|
336 | reject(err);
|
337 | }
|
338 | }));
|
339 | });
|
340 | }
|
341 | |
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 | getProfile(id, details, withAttributes, partition, coreAttributes, forceRefresh) {
|
350 | return __awaiter(this, void 0, void 0, function* () {
|
351 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
352 | let routeValues = {
|
353 | id: id
|
354 | };
|
355 | let queryValues = {
|
356 | details: details,
|
357 | withAttributes: withAttributes,
|
358 | partition: partition,
|
359 | coreAttributes: coreAttributes,
|
360 | forceRefresh: forceRefresh,
|
361 | };
|
362 | try {
|
363 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.3", "Profile", "f83735dc-483f-4238-a291-d45f6080a9af", routeValues, queryValues);
|
364 | let url = verData.requestUrl;
|
365 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
366 | let res;
|
367 | res = yield this.rest.get(url, options);
|
368 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false);
|
369 | resolve(ret);
|
370 | }
|
371 | catch (err) {
|
372 | reject(err);
|
373 | }
|
374 | }));
|
375 | });
|
376 | }
|
377 | |
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 | updateProfile(profile, id) {
|
384 | return __awaiter(this, void 0, void 0, function* () {
|
385 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
386 | let routeValues = {
|
387 | id: id
|
388 | };
|
389 | try {
|
390 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.3", "Profile", "f83735dc-483f-4238-a291-d45f6080a9af", routeValues);
|
391 | let url = verData.requestUrl;
|
392 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
393 | let res;
|
394 | res = yield this.rest.update(url, profile, options);
|
395 | let ret = this.formatResponse(res.result, null, false);
|
396 | resolve(ret);
|
397 | }
|
398 | catch (err) {
|
399 | reject(err);
|
400 | }
|
401 | }));
|
402 | });
|
403 | }
|
404 | |
405 |
|
406 | getRegions() {
|
407 | return __awaiter(this, void 0, void 0, function* () {
|
408 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
409 | let routeValues = {};
|
410 | try {
|
411 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "92d8d1c9-26b8-4774-a929-d640a73da524", routeValues);
|
412 | let url = verData.requestUrl;
|
413 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
414 | let res;
|
415 | res = yield this.rest.get(url, options);
|
416 | let ret = this.formatResponse(res.result, null, false);
|
417 | resolve(ret);
|
418 | }
|
419 | catch (err) {
|
420 | reject(err);
|
421 | }
|
422 | }));
|
423 | });
|
424 | }
|
425 | |
426 |
|
427 | getSupportedLcids() {
|
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 | try {
|
432 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "d5bd1aa6-c269-4bcd-ad32-75fa17475584", routeValues);
|
433 | let url = verData.requestUrl;
|
434 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
435 | let res;
|
436 | res = yield this.rest.get(url, options);
|
437 | let ret = this.formatResponse(res.result, null, true);
|
438 | resolve(ret);
|
439 | }
|
440 | catch (err) {
|
441 | reject(err);
|
442 | }
|
443 | }));
|
444 | });
|
445 | }
|
446 | |
447 |
|
448 |
|
449 | getUserDefaults(includeAvatar) {
|
450 | return __awaiter(this, void 0, void 0, function* () {
|
451 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
452 | let routeValues = {};
|
453 | let queryValues = {
|
454 | includeAvatar: includeAvatar,
|
455 | };
|
456 | try {
|
457 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "b583a356-1da7-4237-9f4c-1deb2edbc7e8", routeValues, queryValues);
|
458 | let url = verData.requestUrl;
|
459 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
460 | let res;
|
461 | res = yield this.rest.get(url, options);
|
462 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false);
|
463 | resolve(ret);
|
464 | }
|
465 | catch (err) {
|
466 | reject(err);
|
467 | }
|
468 | }));
|
469 | });
|
470 | }
|
471 | |
472 |
|
473 |
|
474 | refreshUserDefaults(id) {
|
475 | return __awaiter(this, void 0, void 0, function* () {
|
476 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
477 | let routeValues = {
|
478 | id: id
|
479 | };
|
480 | try {
|
481 | let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "b583a356-1da7-4237-9f4c-1deb2edbc7e8", routeValues);
|
482 | let url = verData.requestUrl;
|
483 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
484 | let res;
|
485 | res = yield this.rest.replace(url, options);
|
486 | let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false);
|
487 | resolve(ret);
|
488 | }
|
489 | catch (err) {
|
490 | reject(err);
|
491 | }
|
492 | }));
|
493 | });
|
494 | }
|
495 | }
|
496 | exports.ProfileApi = ProfileApi;
|