@atzentis/booking-sdk 0.1.9 → 0.1.10
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/dist/index.cjs +306 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +713 -2
- package/dist/index.d.ts +713 -2
- package/dist/index.js +302 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
CategoriesService: () => CategoriesService,
|
|
38
38
|
ConflictError: () => ConflictError,
|
|
39
39
|
DEFAULT_MODULES: () => DEFAULT_MODULES,
|
|
40
|
+
DiscountsService: () => DiscountsService,
|
|
40
41
|
DistributionService: () => DistributionService,
|
|
41
42
|
FinanceService: () => FinanceService,
|
|
42
43
|
ForbiddenError: () => ForbiddenError,
|
|
@@ -52,11 +53,14 @@ __export(index_exports, {
|
|
|
52
53
|
PropertiesService: () => PropertiesService,
|
|
53
54
|
RateLimitError: () => RateLimitError,
|
|
54
55
|
RatePlansService: () => RatePlansService,
|
|
56
|
+
ReviewsService: () => ReviewsService,
|
|
55
57
|
SPACE_STATUSES: () => SPACE_STATUSES,
|
|
56
58
|
SPACE_TYPES: () => SPACE_TYPES,
|
|
57
59
|
ServerError: () => ServerError,
|
|
58
60
|
SpacesService: () => SpacesService,
|
|
59
61
|
StaffService: () => StaffService,
|
|
62
|
+
SupplyService: () => SupplyService,
|
|
63
|
+
TasksService: () => TasksService,
|
|
60
64
|
TimeoutError: () => TimeoutError,
|
|
61
65
|
VERSION: () => VERSION,
|
|
62
66
|
ValidationError: () => ValidationError,
|
|
@@ -1100,6 +1104,78 @@ var CategoriesService = class extends BaseService {
|
|
|
1100
1104
|
}
|
|
1101
1105
|
};
|
|
1102
1106
|
|
|
1107
|
+
// src/services/discounts.ts
|
|
1108
|
+
var DiscountsService = class extends BaseService {
|
|
1109
|
+
constructor() {
|
|
1110
|
+
super(...arguments);
|
|
1111
|
+
this.basePath = "/guest/v1";
|
|
1112
|
+
}
|
|
1113
|
+
// ---------------------------------------------------------------------------
|
|
1114
|
+
// Rule CRUD
|
|
1115
|
+
// ---------------------------------------------------------------------------
|
|
1116
|
+
/** Create a discount rule */
|
|
1117
|
+
createRule(input) {
|
|
1118
|
+
return this._post(this._buildPath("discounts"), input);
|
|
1119
|
+
}
|
|
1120
|
+
/** Get a discount rule by ID */
|
|
1121
|
+
getRule(ruleId) {
|
|
1122
|
+
return this._get(this._buildPath("discounts", ruleId));
|
|
1123
|
+
}
|
|
1124
|
+
/** List discount rules with optional filters */
|
|
1125
|
+
listRules(params) {
|
|
1126
|
+
const query = {};
|
|
1127
|
+
query.propertyId = params.propertyId;
|
|
1128
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1129
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1130
|
+
if (params.enabled !== void 0) query.enabled = params.enabled;
|
|
1131
|
+
if (params.validOn !== void 0) query.validOn = params.validOn;
|
|
1132
|
+
if (params.sortBy !== void 0) query.sortBy = params.sortBy;
|
|
1133
|
+
if (params.sortOrder !== void 0) query.sortOrder = params.sortOrder;
|
|
1134
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1135
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1136
|
+
return this._get(this._buildPath("discounts"), query);
|
|
1137
|
+
}
|
|
1138
|
+
/** Update a discount rule */
|
|
1139
|
+
updateRule(ruleId, input) {
|
|
1140
|
+
return this._patch(this._buildPath("discounts", ruleId), input);
|
|
1141
|
+
}
|
|
1142
|
+
/** Delete a discount rule */
|
|
1143
|
+
deleteRule(ruleId) {
|
|
1144
|
+
return this._delete(this._buildPath("discounts", ruleId));
|
|
1145
|
+
}
|
|
1146
|
+
// ---------------------------------------------------------------------------
|
|
1147
|
+
// Coupons
|
|
1148
|
+
// ---------------------------------------------------------------------------
|
|
1149
|
+
/** Generate coupon codes for a discount rule */
|
|
1150
|
+
generateCoupons(ruleId, input) {
|
|
1151
|
+
return this._post(this._buildPath("discounts", ruleId, "coupons"), input ?? {});
|
|
1152
|
+
}
|
|
1153
|
+
/** Validate a coupon code against booking context */
|
|
1154
|
+
validateCoupon(input) {
|
|
1155
|
+
return this._post(this._buildPath("discounts", "validate"), input);
|
|
1156
|
+
}
|
|
1157
|
+
// ---------------------------------------------------------------------------
|
|
1158
|
+
// Application
|
|
1159
|
+
// ---------------------------------------------------------------------------
|
|
1160
|
+
/** Apply a discount to a booking */
|
|
1161
|
+
applyDiscount(input) {
|
|
1162
|
+
return this._post(this._buildPath("discounts", "apply"), input);
|
|
1163
|
+
}
|
|
1164
|
+
// ---------------------------------------------------------------------------
|
|
1165
|
+
// Usage tracking
|
|
1166
|
+
// ---------------------------------------------------------------------------
|
|
1167
|
+
/** Get usage statistics and redemption history for a discount rule */
|
|
1168
|
+
getUsage(ruleId, params) {
|
|
1169
|
+
if (!params) return this._get(this._buildPath("discounts", ruleId, "usage"));
|
|
1170
|
+
const query = {};
|
|
1171
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1172
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1173
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1174
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1175
|
+
return this._get(this._buildPath("discounts", ruleId, "usage"), query);
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
|
|
1103
1179
|
// src/services/distribution.ts
|
|
1104
1180
|
var DistributionService = class extends BaseService {
|
|
1105
1181
|
constructor() {
|
|
@@ -2045,6 +2121,91 @@ var RatePlansService = class extends BaseService {
|
|
|
2045
2121
|
}
|
|
2046
2122
|
};
|
|
2047
2123
|
|
|
2124
|
+
// src/services/reviews.ts
|
|
2125
|
+
var ReviewsService = class extends BaseService {
|
|
2126
|
+
constructor() {
|
|
2127
|
+
super(...arguments);
|
|
2128
|
+
this.basePath = "/guest/v1";
|
|
2129
|
+
}
|
|
2130
|
+
// ---------------------------------------------------------------------------
|
|
2131
|
+
// Review CRUD
|
|
2132
|
+
// ---------------------------------------------------------------------------
|
|
2133
|
+
/** Create a review */
|
|
2134
|
+
createReview(input) {
|
|
2135
|
+
return this._post(this._buildPath("reviews"), input);
|
|
2136
|
+
}
|
|
2137
|
+
/** Get a review by ID */
|
|
2138
|
+
getReview(reviewId) {
|
|
2139
|
+
return this._get(this._buildPath("reviews", reviewId));
|
|
2140
|
+
}
|
|
2141
|
+
/** List reviews with optional filters */
|
|
2142
|
+
listReviews(params) {
|
|
2143
|
+
const query = {};
|
|
2144
|
+
query.propertyId = params.propertyId;
|
|
2145
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2146
|
+
if (params.guestId !== void 0) query.guestId = params.guestId;
|
|
2147
|
+
if (params.bookingId !== void 0) query.bookingId = params.bookingId;
|
|
2148
|
+
if (params.minRating !== void 0) query.minRating = params.minRating;
|
|
2149
|
+
if (params.maxRating !== void 0) query.maxRating = params.maxRating;
|
|
2150
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2151
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2152
|
+
if (params.sortBy !== void 0) query.sortBy = params.sortBy;
|
|
2153
|
+
if (params.sortOrder !== void 0) query.sortOrder = params.sortOrder;
|
|
2154
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2155
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2156
|
+
return this._get(this._buildPath("reviews"), query);
|
|
2157
|
+
}
|
|
2158
|
+
/** Update a review */
|
|
2159
|
+
updateReview(reviewId, input) {
|
|
2160
|
+
return this._patch(this._buildPath("reviews", reviewId), input);
|
|
2161
|
+
}
|
|
2162
|
+
/** Delete a review */
|
|
2163
|
+
deleteReview(reviewId) {
|
|
2164
|
+
return this._delete(this._buildPath("reviews", reviewId));
|
|
2165
|
+
}
|
|
2166
|
+
// ---------------------------------------------------------------------------
|
|
2167
|
+
// Moderation
|
|
2168
|
+
// ---------------------------------------------------------------------------
|
|
2169
|
+
/** Moderate a review (approve, reject, or flag) */
|
|
2170
|
+
moderateReview(reviewId, input) {
|
|
2171
|
+
return this._post(this._buildPath("reviews", reviewId, "moderate"), input);
|
|
2172
|
+
}
|
|
2173
|
+
// ---------------------------------------------------------------------------
|
|
2174
|
+
// Owner responses
|
|
2175
|
+
// ---------------------------------------------------------------------------
|
|
2176
|
+
/** Create an owner response to a review */
|
|
2177
|
+
createResponse(reviewId, input) {
|
|
2178
|
+
return this._post(this._buildPath("reviews", reviewId, "response"), input);
|
|
2179
|
+
}
|
|
2180
|
+
/** Update an owner response */
|
|
2181
|
+
updateResponse(reviewId, input) {
|
|
2182
|
+
return this._patch(this._buildPath("reviews", reviewId, "response"), input);
|
|
2183
|
+
}
|
|
2184
|
+
/** Delete an owner response */
|
|
2185
|
+
deleteResponse(reviewId) {
|
|
2186
|
+
return this._delete(this._buildPath("reviews", reviewId, "response"));
|
|
2187
|
+
}
|
|
2188
|
+
// ---------------------------------------------------------------------------
|
|
2189
|
+
// Analytics
|
|
2190
|
+
// ---------------------------------------------------------------------------
|
|
2191
|
+
/** Get review analytics for a property */
|
|
2192
|
+
getAnalytics(params) {
|
|
2193
|
+
const query = {};
|
|
2194
|
+
query.propertyId = params.propertyId;
|
|
2195
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2196
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2197
|
+
if (params.period !== void 0) query.period = params.period;
|
|
2198
|
+
return this._get(this._buildPath("reviews", "analytics"), query);
|
|
2199
|
+
}
|
|
2200
|
+
// ---------------------------------------------------------------------------
|
|
2201
|
+
// Review requests
|
|
2202
|
+
// ---------------------------------------------------------------------------
|
|
2203
|
+
/** Send a review request to a guest */
|
|
2204
|
+
sendReviewRequest(input) {
|
|
2205
|
+
return this._post(this._buildPath("reviews", "request"), input);
|
|
2206
|
+
}
|
|
2207
|
+
};
|
|
2208
|
+
|
|
2048
2209
|
// src/services/spaces.ts
|
|
2049
2210
|
var SpacesService = class extends BaseService {
|
|
2050
2211
|
constructor() {
|
|
@@ -2237,6 +2398,127 @@ var StaffService = class extends BaseService {
|
|
|
2237
2398
|
}
|
|
2238
2399
|
};
|
|
2239
2400
|
|
|
2401
|
+
// src/services/supply.ts
|
|
2402
|
+
var SupplyService = class extends BaseService {
|
|
2403
|
+
constructor() {
|
|
2404
|
+
super(...arguments);
|
|
2405
|
+
this.basePath = "/operations/v1";
|
|
2406
|
+
}
|
|
2407
|
+
// ---------------------------------------------------------------------------
|
|
2408
|
+
// Item CRUD
|
|
2409
|
+
// ---------------------------------------------------------------------------
|
|
2410
|
+
/** Create a supply item */
|
|
2411
|
+
createItem(input) {
|
|
2412
|
+
return this._post(this._buildPath("supply-items"), input);
|
|
2413
|
+
}
|
|
2414
|
+
/** Get a supply item by ID */
|
|
2415
|
+
getItem(itemId) {
|
|
2416
|
+
return this._get(this._buildPath("supply-items", itemId));
|
|
2417
|
+
}
|
|
2418
|
+
/** List supply items with optional filters */
|
|
2419
|
+
listItems(params) {
|
|
2420
|
+
const query = {};
|
|
2421
|
+
query.propertyId = params.propertyId;
|
|
2422
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2423
|
+
if (params.search !== void 0) query.search = params.search;
|
|
2424
|
+
if (params.lowStockOnly !== void 0) query.lowStockOnly = params.lowStockOnly;
|
|
2425
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2426
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2427
|
+
return this._get(this._buildPath("supply-items"), query);
|
|
2428
|
+
}
|
|
2429
|
+
/** Update a supply item */
|
|
2430
|
+
updateItem(itemId, input) {
|
|
2431
|
+
return this._patch(this._buildPath("supply-items", itemId), input);
|
|
2432
|
+
}
|
|
2433
|
+
/** Delete a supply item */
|
|
2434
|
+
deleteItem(itemId) {
|
|
2435
|
+
return this._delete(this._buildPath("supply-items", itemId));
|
|
2436
|
+
}
|
|
2437
|
+
// ---------------------------------------------------------------------------
|
|
2438
|
+
// Stock levels
|
|
2439
|
+
// ---------------------------------------------------------------------------
|
|
2440
|
+
/** Get the current stock level for a supply item */
|
|
2441
|
+
getLevel(itemId) {
|
|
2442
|
+
return this._get(this._buildPath("supply-levels", itemId));
|
|
2443
|
+
}
|
|
2444
|
+
/** List stock levels with optional filters */
|
|
2445
|
+
listLevels(params) {
|
|
2446
|
+
const query = {};
|
|
2447
|
+
query.propertyId = params.propertyId;
|
|
2448
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2449
|
+
if (params.lowStockOnly !== void 0) query.lowStockOnly = params.lowStockOnly;
|
|
2450
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2451
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2452
|
+
return this._get(this._buildPath("supply-levels"), query);
|
|
2453
|
+
}
|
|
2454
|
+
/** Update a stock level manually */
|
|
2455
|
+
updateLevel(itemId, input) {
|
|
2456
|
+
return this._patch(this._buildPath("supply-levels", itemId), input);
|
|
2457
|
+
}
|
|
2458
|
+
// ---------------------------------------------------------------------------
|
|
2459
|
+
// Movements
|
|
2460
|
+
// ---------------------------------------------------------------------------
|
|
2461
|
+
/** Record a stock movement */
|
|
2462
|
+
createMovement(input) {
|
|
2463
|
+
return this._post(this._buildPath("supply-movements"), input);
|
|
2464
|
+
}
|
|
2465
|
+
/** List supply movements with optional filters */
|
|
2466
|
+
listMovements(params) {
|
|
2467
|
+
const query = {};
|
|
2468
|
+
query.propertyId = params.propertyId;
|
|
2469
|
+
if (params.itemId !== void 0) query.itemId = params.itemId;
|
|
2470
|
+
if (params.type !== void 0) query.type = params.type;
|
|
2471
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2472
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2473
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2474
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2475
|
+
return this._get(this._buildPath("supply-movements"), query);
|
|
2476
|
+
}
|
|
2477
|
+
// ---------------------------------------------------------------------------
|
|
2478
|
+
// Low-stock alerts
|
|
2479
|
+
// ---------------------------------------------------------------------------
|
|
2480
|
+
/** List items whose stock is at or below reorder threshold */
|
|
2481
|
+
listLowStock(params) {
|
|
2482
|
+
const query = {};
|
|
2483
|
+
query.propertyId = params.propertyId;
|
|
2484
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2485
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2486
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2487
|
+
return this._get(this._buildPath("supply-items", "low-stock"), query);
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
|
|
2491
|
+
// src/services/tasks.ts
|
|
2492
|
+
var TasksService = class extends BaseService {
|
|
2493
|
+
constructor() {
|
|
2494
|
+
super(...arguments);
|
|
2495
|
+
this.basePath = "/operations/v1/tasks";
|
|
2496
|
+
}
|
|
2497
|
+
/** Create an operational task */
|
|
2498
|
+
create(input) {
|
|
2499
|
+
return this._post(this.basePath, input);
|
|
2500
|
+
}
|
|
2501
|
+
/** List operational tasks with optional filters */
|
|
2502
|
+
list(params) {
|
|
2503
|
+
if (!params) return this._get(this.basePath);
|
|
2504
|
+
const query = {};
|
|
2505
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
2506
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2507
|
+
if (params.priority !== void 0) query.priority = params.priority;
|
|
2508
|
+
if (params.assignedTo !== void 0) query.assignedTo = params.assignedTo;
|
|
2509
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2510
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2511
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2512
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2513
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2514
|
+
return this._get(this.basePath, query);
|
|
2515
|
+
}
|
|
2516
|
+
/** Update an operational task */
|
|
2517
|
+
update(taskId, input) {
|
|
2518
|
+
return this._patch(this._buildPath(taskId), input);
|
|
2519
|
+
}
|
|
2520
|
+
};
|
|
2521
|
+
|
|
2240
2522
|
// src/client.ts
|
|
2241
2523
|
var BookingClient = class {
|
|
2242
2524
|
constructor(config) {
|
|
@@ -2314,6 +2596,16 @@ var BookingClient = class {
|
|
|
2314
2596
|
this._categories ?? (this._categories = new CategoriesService(this.httpClient));
|
|
2315
2597
|
return this._categories;
|
|
2316
2598
|
}
|
|
2599
|
+
/** Discounts service — lazy-initialized on first access */
|
|
2600
|
+
get discounts() {
|
|
2601
|
+
this._discounts ?? (this._discounts = new DiscountsService(this.httpClient));
|
|
2602
|
+
return this._discounts;
|
|
2603
|
+
}
|
|
2604
|
+
/** Reviews service — lazy-initialized on first access */
|
|
2605
|
+
get reviews() {
|
|
2606
|
+
this._reviews ?? (this._reviews = new ReviewsService(this.httpClient));
|
|
2607
|
+
return this._reviews;
|
|
2608
|
+
}
|
|
2317
2609
|
/** Spaces service — lazy-initialized on first access */
|
|
2318
2610
|
get spaces() {
|
|
2319
2611
|
this._spaces ?? (this._spaces = new SpacesService(this.httpClient));
|
|
@@ -2324,6 +2616,16 @@ var BookingClient = class {
|
|
|
2324
2616
|
this._staff ?? (this._staff = new StaffService(this.httpClient));
|
|
2325
2617
|
return this._staff;
|
|
2326
2618
|
}
|
|
2619
|
+
/** Supply service — lazy-initialized on first access */
|
|
2620
|
+
get supply() {
|
|
2621
|
+
this._supply ?? (this._supply = new SupplyService(this.httpClient));
|
|
2622
|
+
return this._supply;
|
|
2623
|
+
}
|
|
2624
|
+
/** Tasks service — lazy-initialized on first access */
|
|
2625
|
+
get tasks() {
|
|
2626
|
+
this._tasks ?? (this._tasks = new TasksService(this.httpClient));
|
|
2627
|
+
return this._tasks;
|
|
2628
|
+
}
|
|
2327
2629
|
setApiKey(key) {
|
|
2328
2630
|
if (!key || key.trim().length === 0) {
|
|
2329
2631
|
throw new Error("apiKey must be a non-empty string");
|
|
@@ -2442,6 +2744,7 @@ var VERSION = "0.1.0";
|
|
|
2442
2744
|
CategoriesService,
|
|
2443
2745
|
ConflictError,
|
|
2444
2746
|
DEFAULT_MODULES,
|
|
2747
|
+
DiscountsService,
|
|
2445
2748
|
DistributionService,
|
|
2446
2749
|
FinanceService,
|
|
2447
2750
|
ForbiddenError,
|
|
@@ -2457,11 +2760,14 @@ var VERSION = "0.1.0";
|
|
|
2457
2760
|
PropertiesService,
|
|
2458
2761
|
RateLimitError,
|
|
2459
2762
|
RatePlansService,
|
|
2763
|
+
ReviewsService,
|
|
2460
2764
|
SPACE_STATUSES,
|
|
2461
2765
|
SPACE_TYPES,
|
|
2462
2766
|
ServerError,
|
|
2463
2767
|
SpacesService,
|
|
2464
2768
|
StaffService,
|
|
2769
|
+
SupplyService,
|
|
2770
|
+
TasksService,
|
|
2465
2771
|
TimeoutError,
|
|
2466
2772
|
VERSION,
|
|
2467
2773
|
ValidationError,
|