@vendit-dev/thirdparty-adapters 0.2.1 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,6 +57,10 @@ export default class SmartAccessAdapter {
57
57
  method?: string | undefined;
58
58
  headers?: any;
59
59
  }) => Promise<any>;
60
+ getRoomInfo: ({ accommodationId, roomId }: {
61
+ accommodationId: string;
62
+ roomId: string;
63
+ }) => Promise<SmartAccessRoom>;
60
64
  getRooms: (accommodationId: string) => Promise<SmartAccessRoom[]>;
61
65
  getDevices: (accommodationId: string) => Promise<any>;
62
66
  getRoomsWithDevices: (accommodationId: string) => Promise<SmartAccessRoom[]>;
@@ -88,5 +92,9 @@ export default class SmartAccessAdapter {
88
92
  getAccommodationCallbacks: ({ accommodationId }: {
89
93
  accommodationId: string;
90
94
  }) => Promise<boolean>;
95
+ getRoomByThirdPartyId: ({ accommodationId, thirdPartyId }: {
96
+ accommodationId: string;
97
+ thirdPartyId: string;
98
+ }) => Promise<any>;
91
99
  }
92
100
  export {};
@@ -217,6 +217,24 @@ var SmartAccessAdapter = /** @class */ (function () {
217
217
  });
218
218
  });
219
219
  };
220
+ this.getRoomInfo = function (_a) {
221
+ var accommodationId = _a.accommodationId, roomId = _a.roomId;
222
+ return __awaiter(_this, void 0, void 0, function () {
223
+ var roomResponse;
224
+ return __generator(this, function (_b) {
225
+ switch (_b.label) {
226
+ case 0: return [4 /*yield*/, this.callSmartAccessApi({
227
+ accommodationId: accommodationId,
228
+ method: 'get',
229
+ route: "v1/room/" + roomId + "/roominfo",
230
+ })];
231
+ case 1:
232
+ roomResponse = _b.sent();
233
+ return [2 /*return*/, roomResponse];
234
+ }
235
+ });
236
+ });
237
+ };
220
238
  this.getRooms = function (accommodationId) { return __awaiter(_this, void 0, void 0, function () {
221
239
  var roomResponse;
222
240
  return __generator(this, function (_a) {
@@ -422,6 +440,27 @@ var SmartAccessAdapter = /** @class */ (function () {
422
440
  });
423
441
  });
424
442
  };
443
+ this.getRoomByThirdPartyId = function (_a) {
444
+ var accommodationId = _a.accommodationId, thirdPartyId = _a.thirdPartyId;
445
+ return __awaiter(_this, void 0, void 0, function () {
446
+ var foundRoomProperty;
447
+ return __generator(this, function (_b) {
448
+ switch (_b.label) {
449
+ case 0: return [4 /*yield*/, this.authenticator.getThirdPartyPropertyByThirdPartyId({
450
+ accommodationId: accommodationId,
451
+ provider: this.PROVIDER_KEY,
452
+ thirdPartyId: thirdPartyId,
453
+ type: 'room',
454
+ })];
455
+ case 1:
456
+ foundRoomProperty = _b.sent();
457
+ if (!(foundRoomProperty === null || foundRoomProperty === void 0 ? void 0 : foundRoomProperty.result))
458
+ return [2 /*return*/, false];
459
+ return [2 /*return*/, JSON.parse(foundRoomProperty.data)];
460
+ }
461
+ });
462
+ });
463
+ };
425
464
  this.authenticator = authenticator;
426
465
  this.redis = redis;
427
466
  this.mutexLock = new MutexLock({ hashPrefix: 'RES_SMARTACCESS_MUTEX_', mutexLockInterval: 50, redis: redis });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendit-dev/thirdparty-adapters",
3
- "version": "0.2.1",
3
+ "version": "0.2.4",
4
4
  "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {