@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.js
CHANGED
|
@@ -1039,6 +1039,78 @@ var CategoriesService = class extends BaseService {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
};
|
|
1041
1041
|
|
|
1042
|
+
// src/services/discounts.ts
|
|
1043
|
+
var DiscountsService = class extends BaseService {
|
|
1044
|
+
constructor() {
|
|
1045
|
+
super(...arguments);
|
|
1046
|
+
this.basePath = "/guest/v1";
|
|
1047
|
+
}
|
|
1048
|
+
// ---------------------------------------------------------------------------
|
|
1049
|
+
// Rule CRUD
|
|
1050
|
+
// ---------------------------------------------------------------------------
|
|
1051
|
+
/** Create a discount rule */
|
|
1052
|
+
createRule(input) {
|
|
1053
|
+
return this._post(this._buildPath("discounts"), input);
|
|
1054
|
+
}
|
|
1055
|
+
/** Get a discount rule by ID */
|
|
1056
|
+
getRule(ruleId) {
|
|
1057
|
+
return this._get(this._buildPath("discounts", ruleId));
|
|
1058
|
+
}
|
|
1059
|
+
/** List discount rules with optional filters */
|
|
1060
|
+
listRules(params) {
|
|
1061
|
+
const query = {};
|
|
1062
|
+
query.propertyId = params.propertyId;
|
|
1063
|
+
if (params.type !== void 0) query.type = params.type;
|
|
1064
|
+
if (params.status !== void 0) query.status = params.status;
|
|
1065
|
+
if (params.enabled !== void 0) query.enabled = params.enabled;
|
|
1066
|
+
if (params.validOn !== void 0) query.validOn = params.validOn;
|
|
1067
|
+
if (params.sortBy !== void 0) query.sortBy = params.sortBy;
|
|
1068
|
+
if (params.sortOrder !== void 0) query.sortOrder = params.sortOrder;
|
|
1069
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1070
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1071
|
+
return this._get(this._buildPath("discounts"), query);
|
|
1072
|
+
}
|
|
1073
|
+
/** Update a discount rule */
|
|
1074
|
+
updateRule(ruleId, input) {
|
|
1075
|
+
return this._patch(this._buildPath("discounts", ruleId), input);
|
|
1076
|
+
}
|
|
1077
|
+
/** Delete a discount rule */
|
|
1078
|
+
deleteRule(ruleId) {
|
|
1079
|
+
return this._delete(this._buildPath("discounts", ruleId));
|
|
1080
|
+
}
|
|
1081
|
+
// ---------------------------------------------------------------------------
|
|
1082
|
+
// Coupons
|
|
1083
|
+
// ---------------------------------------------------------------------------
|
|
1084
|
+
/** Generate coupon codes for a discount rule */
|
|
1085
|
+
generateCoupons(ruleId, input) {
|
|
1086
|
+
return this._post(this._buildPath("discounts", ruleId, "coupons"), input ?? {});
|
|
1087
|
+
}
|
|
1088
|
+
/** Validate a coupon code against booking context */
|
|
1089
|
+
validateCoupon(input) {
|
|
1090
|
+
return this._post(this._buildPath("discounts", "validate"), input);
|
|
1091
|
+
}
|
|
1092
|
+
// ---------------------------------------------------------------------------
|
|
1093
|
+
// Application
|
|
1094
|
+
// ---------------------------------------------------------------------------
|
|
1095
|
+
/** Apply a discount to a booking */
|
|
1096
|
+
applyDiscount(input) {
|
|
1097
|
+
return this._post(this._buildPath("discounts", "apply"), input);
|
|
1098
|
+
}
|
|
1099
|
+
// ---------------------------------------------------------------------------
|
|
1100
|
+
// Usage tracking
|
|
1101
|
+
// ---------------------------------------------------------------------------
|
|
1102
|
+
/** Get usage statistics and redemption history for a discount rule */
|
|
1103
|
+
getUsage(ruleId, params) {
|
|
1104
|
+
if (!params) return this._get(this._buildPath("discounts", ruleId, "usage"));
|
|
1105
|
+
const query = {};
|
|
1106
|
+
if (params.from !== void 0) query.from = params.from;
|
|
1107
|
+
if (params.to !== void 0) query.to = params.to;
|
|
1108
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
1109
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
1110
|
+
return this._get(this._buildPath("discounts", ruleId, "usage"), query);
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1042
1114
|
// src/services/distribution.ts
|
|
1043
1115
|
var DistributionService = class extends BaseService {
|
|
1044
1116
|
constructor() {
|
|
@@ -1984,6 +2056,91 @@ var RatePlansService = class extends BaseService {
|
|
|
1984
2056
|
}
|
|
1985
2057
|
};
|
|
1986
2058
|
|
|
2059
|
+
// src/services/reviews.ts
|
|
2060
|
+
var ReviewsService = class extends BaseService {
|
|
2061
|
+
constructor() {
|
|
2062
|
+
super(...arguments);
|
|
2063
|
+
this.basePath = "/guest/v1";
|
|
2064
|
+
}
|
|
2065
|
+
// ---------------------------------------------------------------------------
|
|
2066
|
+
// Review CRUD
|
|
2067
|
+
// ---------------------------------------------------------------------------
|
|
2068
|
+
/** Create a review */
|
|
2069
|
+
createReview(input) {
|
|
2070
|
+
return this._post(this._buildPath("reviews"), input);
|
|
2071
|
+
}
|
|
2072
|
+
/** Get a review by ID */
|
|
2073
|
+
getReview(reviewId) {
|
|
2074
|
+
return this._get(this._buildPath("reviews", reviewId));
|
|
2075
|
+
}
|
|
2076
|
+
/** List reviews with optional filters */
|
|
2077
|
+
listReviews(params) {
|
|
2078
|
+
const query = {};
|
|
2079
|
+
query.propertyId = params.propertyId;
|
|
2080
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2081
|
+
if (params.guestId !== void 0) query.guestId = params.guestId;
|
|
2082
|
+
if (params.bookingId !== void 0) query.bookingId = params.bookingId;
|
|
2083
|
+
if (params.minRating !== void 0) query.minRating = params.minRating;
|
|
2084
|
+
if (params.maxRating !== void 0) query.maxRating = params.maxRating;
|
|
2085
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2086
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2087
|
+
if (params.sortBy !== void 0) query.sortBy = params.sortBy;
|
|
2088
|
+
if (params.sortOrder !== void 0) query.sortOrder = params.sortOrder;
|
|
2089
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2090
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2091
|
+
return this._get(this._buildPath("reviews"), query);
|
|
2092
|
+
}
|
|
2093
|
+
/** Update a review */
|
|
2094
|
+
updateReview(reviewId, input) {
|
|
2095
|
+
return this._patch(this._buildPath("reviews", reviewId), input);
|
|
2096
|
+
}
|
|
2097
|
+
/** Delete a review */
|
|
2098
|
+
deleteReview(reviewId) {
|
|
2099
|
+
return this._delete(this._buildPath("reviews", reviewId));
|
|
2100
|
+
}
|
|
2101
|
+
// ---------------------------------------------------------------------------
|
|
2102
|
+
// Moderation
|
|
2103
|
+
// ---------------------------------------------------------------------------
|
|
2104
|
+
/** Moderate a review (approve, reject, or flag) */
|
|
2105
|
+
moderateReview(reviewId, input) {
|
|
2106
|
+
return this._post(this._buildPath("reviews", reviewId, "moderate"), input);
|
|
2107
|
+
}
|
|
2108
|
+
// ---------------------------------------------------------------------------
|
|
2109
|
+
// Owner responses
|
|
2110
|
+
// ---------------------------------------------------------------------------
|
|
2111
|
+
/** Create an owner response to a review */
|
|
2112
|
+
createResponse(reviewId, input) {
|
|
2113
|
+
return this._post(this._buildPath("reviews", reviewId, "response"), input);
|
|
2114
|
+
}
|
|
2115
|
+
/** Update an owner response */
|
|
2116
|
+
updateResponse(reviewId, input) {
|
|
2117
|
+
return this._patch(this._buildPath("reviews", reviewId, "response"), input);
|
|
2118
|
+
}
|
|
2119
|
+
/** Delete an owner response */
|
|
2120
|
+
deleteResponse(reviewId) {
|
|
2121
|
+
return this._delete(this._buildPath("reviews", reviewId, "response"));
|
|
2122
|
+
}
|
|
2123
|
+
// ---------------------------------------------------------------------------
|
|
2124
|
+
// Analytics
|
|
2125
|
+
// ---------------------------------------------------------------------------
|
|
2126
|
+
/** Get review analytics for a property */
|
|
2127
|
+
getAnalytics(params) {
|
|
2128
|
+
const query = {};
|
|
2129
|
+
query.propertyId = params.propertyId;
|
|
2130
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2131
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2132
|
+
if (params.period !== void 0) query.period = params.period;
|
|
2133
|
+
return this._get(this._buildPath("reviews", "analytics"), query);
|
|
2134
|
+
}
|
|
2135
|
+
// ---------------------------------------------------------------------------
|
|
2136
|
+
// Review requests
|
|
2137
|
+
// ---------------------------------------------------------------------------
|
|
2138
|
+
/** Send a review request to a guest */
|
|
2139
|
+
sendReviewRequest(input) {
|
|
2140
|
+
return this._post(this._buildPath("reviews", "request"), input);
|
|
2141
|
+
}
|
|
2142
|
+
};
|
|
2143
|
+
|
|
1987
2144
|
// src/services/spaces.ts
|
|
1988
2145
|
var SpacesService = class extends BaseService {
|
|
1989
2146
|
constructor() {
|
|
@@ -2176,6 +2333,127 @@ var StaffService = class extends BaseService {
|
|
|
2176
2333
|
}
|
|
2177
2334
|
};
|
|
2178
2335
|
|
|
2336
|
+
// src/services/supply.ts
|
|
2337
|
+
var SupplyService = class extends BaseService {
|
|
2338
|
+
constructor() {
|
|
2339
|
+
super(...arguments);
|
|
2340
|
+
this.basePath = "/operations/v1";
|
|
2341
|
+
}
|
|
2342
|
+
// ---------------------------------------------------------------------------
|
|
2343
|
+
// Item CRUD
|
|
2344
|
+
// ---------------------------------------------------------------------------
|
|
2345
|
+
/** Create a supply item */
|
|
2346
|
+
createItem(input) {
|
|
2347
|
+
return this._post(this._buildPath("supply-items"), input);
|
|
2348
|
+
}
|
|
2349
|
+
/** Get a supply item by ID */
|
|
2350
|
+
getItem(itemId) {
|
|
2351
|
+
return this._get(this._buildPath("supply-items", itemId));
|
|
2352
|
+
}
|
|
2353
|
+
/** List supply items with optional filters */
|
|
2354
|
+
listItems(params) {
|
|
2355
|
+
const query = {};
|
|
2356
|
+
query.propertyId = params.propertyId;
|
|
2357
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2358
|
+
if (params.search !== void 0) query.search = params.search;
|
|
2359
|
+
if (params.lowStockOnly !== void 0) query.lowStockOnly = params.lowStockOnly;
|
|
2360
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2361
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2362
|
+
return this._get(this._buildPath("supply-items"), query);
|
|
2363
|
+
}
|
|
2364
|
+
/** Update a supply item */
|
|
2365
|
+
updateItem(itemId, input) {
|
|
2366
|
+
return this._patch(this._buildPath("supply-items", itemId), input);
|
|
2367
|
+
}
|
|
2368
|
+
/** Delete a supply item */
|
|
2369
|
+
deleteItem(itemId) {
|
|
2370
|
+
return this._delete(this._buildPath("supply-items", itemId));
|
|
2371
|
+
}
|
|
2372
|
+
// ---------------------------------------------------------------------------
|
|
2373
|
+
// Stock levels
|
|
2374
|
+
// ---------------------------------------------------------------------------
|
|
2375
|
+
/** Get the current stock level for a supply item */
|
|
2376
|
+
getLevel(itemId) {
|
|
2377
|
+
return this._get(this._buildPath("supply-levels", itemId));
|
|
2378
|
+
}
|
|
2379
|
+
/** List stock levels with optional filters */
|
|
2380
|
+
listLevels(params) {
|
|
2381
|
+
const query = {};
|
|
2382
|
+
query.propertyId = params.propertyId;
|
|
2383
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2384
|
+
if (params.lowStockOnly !== void 0) query.lowStockOnly = params.lowStockOnly;
|
|
2385
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2386
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2387
|
+
return this._get(this._buildPath("supply-levels"), query);
|
|
2388
|
+
}
|
|
2389
|
+
/** Update a stock level manually */
|
|
2390
|
+
updateLevel(itemId, input) {
|
|
2391
|
+
return this._patch(this._buildPath("supply-levels", itemId), input);
|
|
2392
|
+
}
|
|
2393
|
+
// ---------------------------------------------------------------------------
|
|
2394
|
+
// Movements
|
|
2395
|
+
// ---------------------------------------------------------------------------
|
|
2396
|
+
/** Record a stock movement */
|
|
2397
|
+
createMovement(input) {
|
|
2398
|
+
return this._post(this._buildPath("supply-movements"), input);
|
|
2399
|
+
}
|
|
2400
|
+
/** List supply movements with optional filters */
|
|
2401
|
+
listMovements(params) {
|
|
2402
|
+
const query = {};
|
|
2403
|
+
query.propertyId = params.propertyId;
|
|
2404
|
+
if (params.itemId !== void 0) query.itemId = params.itemId;
|
|
2405
|
+
if (params.type !== void 0) query.type = params.type;
|
|
2406
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2407
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2408
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2409
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2410
|
+
return this._get(this._buildPath("supply-movements"), query);
|
|
2411
|
+
}
|
|
2412
|
+
// ---------------------------------------------------------------------------
|
|
2413
|
+
// Low-stock alerts
|
|
2414
|
+
// ---------------------------------------------------------------------------
|
|
2415
|
+
/** List items whose stock is at or below reorder threshold */
|
|
2416
|
+
listLowStock(params) {
|
|
2417
|
+
const query = {};
|
|
2418
|
+
query.propertyId = params.propertyId;
|
|
2419
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2420
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2421
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2422
|
+
return this._get(this._buildPath("supply-items", "low-stock"), query);
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
|
|
2426
|
+
// src/services/tasks.ts
|
|
2427
|
+
var TasksService = class extends BaseService {
|
|
2428
|
+
constructor() {
|
|
2429
|
+
super(...arguments);
|
|
2430
|
+
this.basePath = "/operations/v1/tasks";
|
|
2431
|
+
}
|
|
2432
|
+
/** Create an operational task */
|
|
2433
|
+
create(input) {
|
|
2434
|
+
return this._post(this.basePath, input);
|
|
2435
|
+
}
|
|
2436
|
+
/** List operational tasks with optional filters */
|
|
2437
|
+
list(params) {
|
|
2438
|
+
if (!params) return this._get(this.basePath);
|
|
2439
|
+
const query = {};
|
|
2440
|
+
if (params.propertyId !== void 0) query.propertyId = params.propertyId;
|
|
2441
|
+
if (params.status !== void 0) query.status = params.status;
|
|
2442
|
+
if (params.priority !== void 0) query.priority = params.priority;
|
|
2443
|
+
if (params.assignedTo !== void 0) query.assignedTo = params.assignedTo;
|
|
2444
|
+
if (params.category !== void 0) query.category = params.category;
|
|
2445
|
+
if (params.from !== void 0) query.from = params.from;
|
|
2446
|
+
if (params.to !== void 0) query.to = params.to;
|
|
2447
|
+
if (params.limit !== void 0) query.limit = params.limit;
|
|
2448
|
+
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
2449
|
+
return this._get(this.basePath, query);
|
|
2450
|
+
}
|
|
2451
|
+
/** Update an operational task */
|
|
2452
|
+
update(taskId, input) {
|
|
2453
|
+
return this._patch(this._buildPath(taskId), input);
|
|
2454
|
+
}
|
|
2455
|
+
};
|
|
2456
|
+
|
|
2179
2457
|
// src/client.ts
|
|
2180
2458
|
var BookingClient = class {
|
|
2181
2459
|
constructor(config) {
|
|
@@ -2253,6 +2531,16 @@ var BookingClient = class {
|
|
|
2253
2531
|
this._categories ?? (this._categories = new CategoriesService(this.httpClient));
|
|
2254
2532
|
return this._categories;
|
|
2255
2533
|
}
|
|
2534
|
+
/** Discounts service — lazy-initialized on first access */
|
|
2535
|
+
get discounts() {
|
|
2536
|
+
this._discounts ?? (this._discounts = new DiscountsService(this.httpClient));
|
|
2537
|
+
return this._discounts;
|
|
2538
|
+
}
|
|
2539
|
+
/** Reviews service — lazy-initialized on first access */
|
|
2540
|
+
get reviews() {
|
|
2541
|
+
this._reviews ?? (this._reviews = new ReviewsService(this.httpClient));
|
|
2542
|
+
return this._reviews;
|
|
2543
|
+
}
|
|
2256
2544
|
/** Spaces service — lazy-initialized on first access */
|
|
2257
2545
|
get spaces() {
|
|
2258
2546
|
this._spaces ?? (this._spaces = new SpacesService(this.httpClient));
|
|
@@ -2263,6 +2551,16 @@ var BookingClient = class {
|
|
|
2263
2551
|
this._staff ?? (this._staff = new StaffService(this.httpClient));
|
|
2264
2552
|
return this._staff;
|
|
2265
2553
|
}
|
|
2554
|
+
/** Supply service — lazy-initialized on first access */
|
|
2555
|
+
get supply() {
|
|
2556
|
+
this._supply ?? (this._supply = new SupplyService(this.httpClient));
|
|
2557
|
+
return this._supply;
|
|
2558
|
+
}
|
|
2559
|
+
/** Tasks service — lazy-initialized on first access */
|
|
2560
|
+
get tasks() {
|
|
2561
|
+
this._tasks ?? (this._tasks = new TasksService(this.httpClient));
|
|
2562
|
+
return this._tasks;
|
|
2563
|
+
}
|
|
2266
2564
|
setApiKey(key) {
|
|
2267
2565
|
if (!key || key.trim().length === 0) {
|
|
2268
2566
|
throw new Error("apiKey must be a non-empty string");
|
|
@@ -2380,6 +2678,7 @@ export {
|
|
|
2380
2678
|
CategoriesService,
|
|
2381
2679
|
ConflictError,
|
|
2382
2680
|
DEFAULT_MODULES,
|
|
2681
|
+
DiscountsService,
|
|
2383
2682
|
DistributionService,
|
|
2384
2683
|
FinanceService,
|
|
2385
2684
|
ForbiddenError,
|
|
@@ -2395,11 +2694,14 @@ export {
|
|
|
2395
2694
|
PropertiesService,
|
|
2396
2695
|
RateLimitError,
|
|
2397
2696
|
RatePlansService,
|
|
2697
|
+
ReviewsService,
|
|
2398
2698
|
SPACE_STATUSES,
|
|
2399
2699
|
SPACE_TYPES,
|
|
2400
2700
|
ServerError,
|
|
2401
2701
|
SpacesService,
|
|
2402
2702
|
StaffService,
|
|
2703
|
+
SupplyService,
|
|
2704
|
+
TasksService,
|
|
2403
2705
|
TimeoutError,
|
|
2404
2706
|
VERSION,
|
|
2405
2707
|
ValidationError,
|