whitelabel-db 1.0.52 → 1.0.53
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.
- package/README.md +11 -0
- package/dist/libs/liteapiv3.d.ts +3 -1
- package/dist/libs/liteapiv3.js +13 -9
- package/dist/models/Project.d.ts +1 -1
- package/dist/models/Project.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/libs/liteapiv3.d.ts
CHANGED
|
@@ -195,7 +195,9 @@ export interface CancelBookingV3 {
|
|
|
195
195
|
}
|
|
196
196
|
export declare class LiteApiClientV3 {
|
|
197
197
|
private apiKey;
|
|
198
|
-
|
|
198
|
+
private baseUrl;
|
|
199
|
+
private bookingBaseUrl;
|
|
200
|
+
constructor(apiKey: string, useProduction?: boolean);
|
|
199
201
|
getHotels(options: HotelsRequestV3): Promise<AvailabilityResultV3[]>;
|
|
200
202
|
getHotelById(hotelId: string): Promise<AvailabilityResultV3>;
|
|
201
203
|
getHotelsFullRate(options: HotelsRequestV3): Promise<FullRateAvailabilityResultV3[]>;
|
package/dist/libs/liteapiv3.js
CHANGED
|
@@ -14,16 +14,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.LiteApiClientV3 = void 0;
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const baseUrl = 'https://api.liteapi.travel';
|
|
18
|
-
const bookingBaseUrl = 'https://book.liteapi.travel';
|
|
19
17
|
class LiteApiClientV3 {
|
|
20
|
-
constructor(apiKey) {
|
|
18
|
+
constructor(apiKey, useProduction = true) {
|
|
21
19
|
this.apiKey = apiKey;
|
|
20
|
+
this.baseUrl = useProduction
|
|
21
|
+
? 'https://api.liteapi.travel'
|
|
22
|
+
: 'https://api.dev.liteapi.travel';
|
|
23
|
+
this.bookingBaseUrl = useProduction
|
|
24
|
+
? 'https://book.liteapi.travel'
|
|
25
|
+
: 'https://book.dev.liteapi.travel';
|
|
22
26
|
}
|
|
23
27
|
getHotels(options) {
|
|
24
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
29
|
return (yield (0, axios_1.default)({
|
|
26
|
-
url: `${baseUrl}/v3.0/hotels`,
|
|
30
|
+
url: `${this.baseUrl}/v3.0/hotels`,
|
|
27
31
|
params: options,
|
|
28
32
|
headers: {
|
|
29
33
|
'X-API-Key': this.apiKey,
|
|
@@ -34,7 +38,7 @@ class LiteApiClientV3 {
|
|
|
34
38
|
getHotelById(hotelId) {
|
|
35
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
40
|
return (yield (0, axios_1.default)({
|
|
37
|
-
url: `${baseUrl}/v3.0/hotels/${hotelId}`,
|
|
41
|
+
url: `${this.baseUrl}/v3.0/hotels/${hotelId}`,
|
|
38
42
|
headers: {
|
|
39
43
|
'X-API-Key': this.apiKey,
|
|
40
44
|
},
|
|
@@ -46,7 +50,7 @@ class LiteApiClientV3 {
|
|
|
46
50
|
const query = options.rm ? `rm=${options.rm}` : ``;
|
|
47
51
|
return (yield (0, axios_1.default)({
|
|
48
52
|
method: 'post',
|
|
49
|
-
url: `${baseUrl}/v3.0/hotels/rates?${query}`,
|
|
53
|
+
url: `${this.baseUrl}/v3.0/hotels/rates?${query}`,
|
|
50
54
|
data: options,
|
|
51
55
|
headers: {
|
|
52
56
|
'X-API-Key': this.apiKey,
|
|
@@ -58,7 +62,7 @@ class LiteApiClientV3 {
|
|
|
58
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
63
|
return (yield (0, axios_1.default)({
|
|
60
64
|
method: 'post',
|
|
61
|
-
url: `${bookingBaseUrl}/v3.0/rates/prebook`,
|
|
65
|
+
url: `${this.bookingBaseUrl}/v3.0/rates/prebook`,
|
|
62
66
|
data: options,
|
|
63
67
|
headers: {
|
|
64
68
|
'X-API-Key': this.apiKey,
|
|
@@ -71,7 +75,7 @@ class LiteApiClientV3 {
|
|
|
71
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
76
|
return (yield (0, axios_1.default)({
|
|
73
77
|
method: 'post',
|
|
74
|
-
url: `${bookingBaseUrl}/v3.0/rates/book`,
|
|
78
|
+
url: `${this.bookingBaseUrl}/v3.0/rates/book`,
|
|
75
79
|
data: options,
|
|
76
80
|
headers: {
|
|
77
81
|
'X-API-Key': this.apiKey,
|
|
@@ -84,7 +88,7 @@ class LiteApiClientV3 {
|
|
|
84
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
89
|
return (yield (0, axios_1.default)({
|
|
86
90
|
method: 'put',
|
|
87
|
-
url: `${bookingBaseUrl}/v3.0/bookings/${bookingId}`,
|
|
91
|
+
url: `${this.bookingBaseUrl}/v3.0/bookings/${bookingId}`,
|
|
88
92
|
headers: {
|
|
89
93
|
'X-API-Key': this.apiKey,
|
|
90
94
|
'content-type': 'application/json',
|
package/dist/models/Project.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export declare class Project extends Model<Partial<Project>> {
|
|
|
16
16
|
appearance?: object;
|
|
17
17
|
generateSession(secret: string): string;
|
|
18
18
|
getLiteApiClient(): LiteApiClient;
|
|
19
|
-
getLiteApiClientV3(): LiteApiClientV3;
|
|
19
|
+
getLiteApiClientV3(useProduction?: boolean): LiteApiClientV3;
|
|
20
20
|
}
|
package/dist/models/Project.js
CHANGED
|
@@ -44,14 +44,14 @@ let Project = class Project extends sequelize_typescript_1.Model {
|
|
|
44
44
|
throw err;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
getLiteApiClientV3() {
|
|
47
|
+
getLiteApiClientV3(useProduction = true) {
|
|
48
48
|
try {
|
|
49
49
|
let key = this.settings.liteApiKey;
|
|
50
50
|
if (!key || !key.length) {
|
|
51
51
|
key = process.env.LITEAPI_KEY;
|
|
52
52
|
}
|
|
53
53
|
if (!clientV3[key]) {
|
|
54
|
-
clientV3[key] = new liteapiv3_1.LiteApiClientV3(key);
|
|
54
|
+
clientV3[key] = new liteapiv3_1.LiteApiClientV3(key, useProduction);
|
|
55
55
|
}
|
|
56
56
|
return clientV3[key];
|
|
57
57
|
}
|