@atzentis/booking-sdk 0.1.4 → 0.1.5
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 +268 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +429 -93
- package/dist/index.d.ts +429 -93
- package/dist/index.js +267 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -94,6 +94,277 @@ declare class HttpClient {
|
|
|
94
94
|
private buildHeaders;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* All supported space types in the v4.0 API.
|
|
99
|
+
*
|
|
100
|
+
* Grouped by vertical:
|
|
101
|
+
* - **Stays:** `room`, `sunbed`, `parking`
|
|
102
|
+
* - **Tables:** `table`, `locker`
|
|
103
|
+
* - **Services:** `service`, `meeting_room`, `desk`
|
|
104
|
+
* - **Universal:** `custom`
|
|
105
|
+
*/
|
|
106
|
+
type SpaceType = "room" | "table" | "sunbed" | "parking" | "desk" | "meeting_room" | "locker" | "service" | "custom";
|
|
107
|
+
/** All 9 space types as a readonly tuple for runtime enumeration */
|
|
108
|
+
declare const SPACE_TYPES: readonly ["room", "table", "sunbed", "parking", "desk", "meeting_room", "locker", "service", "custom"];
|
|
109
|
+
/** Space availability/lifecycle status */
|
|
110
|
+
type SpaceStatus = "available" | "occupied" | "maintenance" | "blocked" | "inactive";
|
|
111
|
+
/** All 5 space statuses as a readonly tuple for runtime enumeration */
|
|
112
|
+
declare const SPACE_STATUSES: readonly ["available", "occupied", "maintenance", "blocked", "inactive"];
|
|
113
|
+
/** A bookable space in the Atzentis Booking system */
|
|
114
|
+
interface Space {
|
|
115
|
+
id: string;
|
|
116
|
+
propertyId: string;
|
|
117
|
+
categoryId: string | null;
|
|
118
|
+
name: string;
|
|
119
|
+
type: SpaceType;
|
|
120
|
+
status: SpaceStatus;
|
|
121
|
+
/** Used for rooms (hotel floor) and desks/meeting rooms (office floor). Use string to support labels like "B1", "G", "1", "2". */
|
|
122
|
+
floor: string | null;
|
|
123
|
+
/** Used for tables (cover count) and meeting rooms (person count). Null if not applicable. */
|
|
124
|
+
capacity: number | null;
|
|
125
|
+
/** POS table reference; set via `linkPosTable()`. Tables vertical only. Null until linked. */
|
|
126
|
+
posTableId: string | null;
|
|
127
|
+
/** Open bag for vertical-specific extras not covered by standard fields. Schema is consumer-defined. */
|
|
128
|
+
metadata: Record<string, unknown> | null;
|
|
129
|
+
createdAt: string;
|
|
130
|
+
updatedAt: string;
|
|
131
|
+
}
|
|
132
|
+
/** Input for creating a new space */
|
|
133
|
+
interface CreateSpaceInput {
|
|
134
|
+
propertyId: string;
|
|
135
|
+
name: string;
|
|
136
|
+
type: SpaceType;
|
|
137
|
+
categoryId?: string;
|
|
138
|
+
/** Optional. See `Space.floor` for usage by vertical. */
|
|
139
|
+
floor?: string;
|
|
140
|
+
/** Optional. See `Space.capacity` for usage by vertical. */
|
|
141
|
+
capacity?: number;
|
|
142
|
+
/** Optional. See `Space.metadata` for usage by vertical. */
|
|
143
|
+
metadata?: Record<string, unknown>;
|
|
144
|
+
}
|
|
145
|
+
/** Input for updating an existing space — all fields optional */
|
|
146
|
+
type UpdateSpaceInput = Partial<Omit<CreateSpaceInput, "propertyId">>;
|
|
147
|
+
/** Input for bulk updating spaces — requires `id` to identify each space */
|
|
148
|
+
type BulkUpdateSpaceInput = UpdateSpaceInput & {
|
|
149
|
+
id: string;
|
|
150
|
+
};
|
|
151
|
+
/** Input for linking a space to a POS table */
|
|
152
|
+
interface LinkPosTableInput {
|
|
153
|
+
posTableId: string;
|
|
154
|
+
}
|
|
155
|
+
/** Query parameters for listing spaces — propertyId is required */
|
|
156
|
+
interface ListSpacesParams {
|
|
157
|
+
propertyId: string;
|
|
158
|
+
type?: SpaceType;
|
|
159
|
+
status?: SpaceStatus;
|
|
160
|
+
categoryId?: string;
|
|
161
|
+
floor?: number | string;
|
|
162
|
+
limit?: number;
|
|
163
|
+
cursor?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Parameters for checking availability of a specific property */
|
|
167
|
+
interface AvailabilityCheckParams {
|
|
168
|
+
/** Property to check availability for */
|
|
169
|
+
propertyId: string;
|
|
170
|
+
/** Check-in date in YYYY-MM-DD format */
|
|
171
|
+
checkIn: string;
|
|
172
|
+
/** Check-out date in YYYY-MM-DD format */
|
|
173
|
+
checkOut: string;
|
|
174
|
+
/** Filter by space category */
|
|
175
|
+
categoryId?: string;
|
|
176
|
+
/** Check a specific space */
|
|
177
|
+
spaceId?: string;
|
|
178
|
+
/** Number of guests */
|
|
179
|
+
guests?: number;
|
|
180
|
+
/** Filter by space type */
|
|
181
|
+
type?: SpaceType;
|
|
182
|
+
}
|
|
183
|
+
/** Result of an availability check */
|
|
184
|
+
interface AvailabilityResult {
|
|
185
|
+
/** Whether any spaces are available for the requested dates */
|
|
186
|
+
available: boolean;
|
|
187
|
+
/** Available spaces matching the criteria */
|
|
188
|
+
spaces: AvailableSpace[];
|
|
189
|
+
/** Pricing details for the available spaces, null if not available */
|
|
190
|
+
pricing: AvailabilityPricing | null;
|
|
191
|
+
/** Stay restrictions, null if none apply */
|
|
192
|
+
restrictions: AvailabilityRestrictions | null;
|
|
193
|
+
}
|
|
194
|
+
/** A single available space from an availability check */
|
|
195
|
+
interface AvailableSpace {
|
|
196
|
+
/** Space identifier */
|
|
197
|
+
spaceId: string;
|
|
198
|
+
/** Category the space belongs to */
|
|
199
|
+
categoryId: string | null;
|
|
200
|
+
/** Display name of the space */
|
|
201
|
+
name: string;
|
|
202
|
+
/** Space type (room, table, service, etc.) */
|
|
203
|
+
type: SpaceType;
|
|
204
|
+
/** Price in cents */
|
|
205
|
+
price: number;
|
|
206
|
+
/** Whether this specific space is available */
|
|
207
|
+
available: boolean;
|
|
208
|
+
}
|
|
209
|
+
/** Pricing breakdown from an availability check */
|
|
210
|
+
interface AvailabilityPricing {
|
|
211
|
+
/** Total price in cents */
|
|
212
|
+
total: number;
|
|
213
|
+
/** Per-night rate in cents, null for non-Stays verticals */
|
|
214
|
+
perNight: number | null;
|
|
215
|
+
/** ISO 4217 currency code (e.g., "EUR", "USD") */
|
|
216
|
+
currency: string;
|
|
217
|
+
}
|
|
218
|
+
/** Stay restriction rules */
|
|
219
|
+
interface AvailabilityRestrictions {
|
|
220
|
+
/** Minimum stay duration in nights */
|
|
221
|
+
minStay: number | null;
|
|
222
|
+
/** Maximum stay duration in nights */
|
|
223
|
+
maxStay: number | null;
|
|
224
|
+
/** Whether arrivals are blocked on this date */
|
|
225
|
+
closedToArrival: boolean;
|
|
226
|
+
/** Whether departures are blocked on this date */
|
|
227
|
+
closedToDeparture: boolean;
|
|
228
|
+
}
|
|
229
|
+
/** Parameters for searching availability across multiple properties */
|
|
230
|
+
interface AvailabilitySearchParams {
|
|
231
|
+
/** Property IDs to search across */
|
|
232
|
+
propertyIds: string[];
|
|
233
|
+
/** Check-in date in YYYY-MM-DD format */
|
|
234
|
+
checkIn: string;
|
|
235
|
+
/** Check-out date in YYYY-MM-DD format */
|
|
236
|
+
checkOut: string;
|
|
237
|
+
/** Number of guests */
|
|
238
|
+
guests?: number;
|
|
239
|
+
/** Filter by space type */
|
|
240
|
+
type?: SpaceType;
|
|
241
|
+
/** Price range filter */
|
|
242
|
+
priceRange?: PriceRange;
|
|
243
|
+
/** Filter by category IDs */
|
|
244
|
+
categoryIds?: string[];
|
|
245
|
+
/** Maximum results per page */
|
|
246
|
+
limit?: number;
|
|
247
|
+
/** Pagination cursor */
|
|
248
|
+
cursor?: string;
|
|
249
|
+
}
|
|
250
|
+
/** Price range filter with min/max in cents */
|
|
251
|
+
interface PriceRange {
|
|
252
|
+
/** Minimum price in cents */
|
|
253
|
+
min?: number;
|
|
254
|
+
/** Maximum price in cents */
|
|
255
|
+
max?: number;
|
|
256
|
+
}
|
|
257
|
+
/** Result of a multi-property availability search */
|
|
258
|
+
interface AvailabilitySearchResult {
|
|
259
|
+
/** Matching properties with availability */
|
|
260
|
+
results: AvailabilitySearchResultEntry[];
|
|
261
|
+
/** Total number of matching properties */
|
|
262
|
+
totalCount: number;
|
|
263
|
+
/** Cursor for next page, null if no more results */
|
|
264
|
+
cursor: string | null;
|
|
265
|
+
/** Whether more results are available */
|
|
266
|
+
hasMore: boolean;
|
|
267
|
+
}
|
|
268
|
+
/** A single property's availability in a search result */
|
|
269
|
+
interface AvailabilitySearchResultEntry {
|
|
270
|
+
/** Property identifier */
|
|
271
|
+
propertyId: string;
|
|
272
|
+
/** Available spaces at this property */
|
|
273
|
+
spaces: AvailableSpace[];
|
|
274
|
+
/** Lowest price in cents among available spaces */
|
|
275
|
+
bestPrice: number;
|
|
276
|
+
}
|
|
277
|
+
/** Parameters for generating a calendar view */
|
|
278
|
+
interface CalendarParams extends AvailabilityCheckParams {
|
|
279
|
+
/** Number of months to generate (default: 1). Each month is 30 days. */
|
|
280
|
+
months?: number;
|
|
281
|
+
}
|
|
282
|
+
/** A single day in a calendar view */
|
|
283
|
+
interface CalendarDay {
|
|
284
|
+
/** Date in YYYY-MM-DD format */
|
|
285
|
+
date: string;
|
|
286
|
+
/** Whether spaces are available on this date */
|
|
287
|
+
available: boolean;
|
|
288
|
+
/** Price in cents for this date, null if unavailable */
|
|
289
|
+
price: number | null;
|
|
290
|
+
/** Minimum stay requirement in nights, null if none */
|
|
291
|
+
minStay: number | null;
|
|
292
|
+
/** Whether arrivals are blocked on this date */
|
|
293
|
+
closedToArrival: boolean;
|
|
294
|
+
/** Whether departures are blocked on this date */
|
|
295
|
+
closedToDeparture: boolean;
|
|
296
|
+
/** Number of spaces available on this date */
|
|
297
|
+
spacesAvailable: number;
|
|
298
|
+
}
|
|
299
|
+
/** Parameters for querying table time slots */
|
|
300
|
+
interface TableSlotParams {
|
|
301
|
+
/** Property to query */
|
|
302
|
+
propertyId: string;
|
|
303
|
+
/** Date to check in YYYY-MM-DD format */
|
|
304
|
+
date: string;
|
|
305
|
+
/** Number of guests (filters by table capacity) */
|
|
306
|
+
guests?: number;
|
|
307
|
+
/** Filter by table category (e.g., indoor, outdoor) */
|
|
308
|
+
categoryId?: string;
|
|
309
|
+
/** Reservation duration in minutes (default: 90) */
|
|
310
|
+
duration?: number;
|
|
311
|
+
}
|
|
312
|
+
/** Parameters for querying service appointment slots */
|
|
313
|
+
interface ServiceSlotParams {
|
|
314
|
+
/** Property to query */
|
|
315
|
+
propertyId: string;
|
|
316
|
+
/** Date to check in YYYY-MM-DD format */
|
|
317
|
+
date: string;
|
|
318
|
+
/** Filter by specific provider/staff member */
|
|
319
|
+
providerId?: string;
|
|
320
|
+
/** Filter by service category */
|
|
321
|
+
categoryId?: string;
|
|
322
|
+
/** Appointment duration in minutes */
|
|
323
|
+
duration?: number;
|
|
324
|
+
}
|
|
325
|
+
/** A time slot for table reservations */
|
|
326
|
+
interface TimeSlot {
|
|
327
|
+
/** Start time in HH:MM format (24-hour) */
|
|
328
|
+
startTime: string;
|
|
329
|
+
/** End time in HH:MM format (24-hour) */
|
|
330
|
+
endTime: string;
|
|
331
|
+
/** Whether this slot is available */
|
|
332
|
+
available: boolean;
|
|
333
|
+
/** Number of tables available in this slot */
|
|
334
|
+
tablesAvailable: number;
|
|
335
|
+
/** Price in cents for this slot, null if not priced */
|
|
336
|
+
price: number | null;
|
|
337
|
+
}
|
|
338
|
+
/** A time slot for service appointments, extends TimeSlot with provider info */
|
|
339
|
+
interface ServiceTimeSlot extends TimeSlot {
|
|
340
|
+
/** Provider/staff member identifier */
|
|
341
|
+
providerId: string;
|
|
342
|
+
/** Display name of the provider */
|
|
343
|
+
providerName: string;
|
|
344
|
+
}
|
|
345
|
+
/** Parameters for pricing aggregation */
|
|
346
|
+
interface PricingParams extends AvailabilityCheckParams {
|
|
347
|
+
/** ISO 4217 currency code override (default: property currency) */
|
|
348
|
+
currency?: string;
|
|
349
|
+
}
|
|
350
|
+
/** Aggregated pricing statistics */
|
|
351
|
+
interface PricingResult {
|
|
352
|
+
/** Lowest price in cents among available spaces */
|
|
353
|
+
minPrice: number;
|
|
354
|
+
/** Highest price in cents among available spaces */
|
|
355
|
+
maxPrice: number;
|
|
356
|
+
/** Mean price in cents (rounded to integer) */
|
|
357
|
+
averagePrice: number;
|
|
358
|
+
/** Total price in cents for the full stay/booking */
|
|
359
|
+
totalPrice: number;
|
|
360
|
+
/** Per-night rate in cents, null for Tables/Services */
|
|
361
|
+
perNight: number | null;
|
|
362
|
+
/** Number of nights (date difference), 0 for same-day */
|
|
363
|
+
nights: number;
|
|
364
|
+
/** ISO 4217 currency code */
|
|
365
|
+
currency: string;
|
|
366
|
+
}
|
|
367
|
+
|
|
97
368
|
/** The standard paginated response shape returned by all v4.0 list endpoints */
|
|
98
369
|
interface Paginated<T> {
|
|
99
370
|
/** The items for this page */
|
|
@@ -113,6 +384,160 @@ interface PaginationOptions {
|
|
|
113
384
|
/** Callback type: a function that fetches one page given current cursor options */
|
|
114
385
|
type PageFetcher<T> = (options: PaginationOptions) => Promise<Paginated<T>>;
|
|
115
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Abstract base class for all SDK services.
|
|
389
|
+
* Provides typed HTTP helper methods and path construction.
|
|
390
|
+
* Not exported from the public API.
|
|
391
|
+
*/
|
|
392
|
+
declare abstract class BaseService {
|
|
393
|
+
protected readonly http: HttpClient;
|
|
394
|
+
protected abstract readonly basePath: string;
|
|
395
|
+
constructor(http: HttpClient);
|
|
396
|
+
/** Build a full path from the base path and additional segments */
|
|
397
|
+
protected _buildPath(...segments: string[]): string;
|
|
398
|
+
/** GET request returning typed response */
|
|
399
|
+
protected _get<T>(path: string, query?: Record<string, string | number | boolean | null | undefined>): Promise<T>;
|
|
400
|
+
/** POST request with body, returning typed response */
|
|
401
|
+
protected _post<T>(path: string, body: unknown): Promise<T>;
|
|
402
|
+
/** PATCH request with body, returning typed response */
|
|
403
|
+
protected _patch<T>(path: string, body: unknown): Promise<T>;
|
|
404
|
+
/** DELETE request, returning void */
|
|
405
|
+
protected _delete(path: string): Promise<void>;
|
|
406
|
+
/** GET list request with optional query params, returning paginated response */
|
|
407
|
+
protected _list<T>(params?: any): Promise<Paginated<T>>;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Service for checking and searching availability in the Atzentis Booking API.
|
|
412
|
+
*
|
|
413
|
+
* Provides two API endpoints (`check` and `search`) plus four client-side helper
|
|
414
|
+
* methods for calendar views, table time-slots, service appointment slots, and
|
|
415
|
+
* pricing aggregation.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* const booking = new BookingClient({ apiKey: "atz_io_live_xxxxx" });
|
|
420
|
+
*
|
|
421
|
+
* // Check availability for a property
|
|
422
|
+
* const result = await booking.availability.check({
|
|
423
|
+
* propertyId: "prop_abc123",
|
|
424
|
+
* checkIn: "2025-06-01",
|
|
425
|
+
* checkOut: "2025-06-05",
|
|
426
|
+
* });
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
declare class AvailabilityService extends BaseService {
|
|
430
|
+
protected readonly basePath = "/booking/v1/availability";
|
|
431
|
+
/**
|
|
432
|
+
* Check availability for a property and date range.
|
|
433
|
+
*
|
|
434
|
+
* @param params - Must include `propertyId`, `checkIn`, `checkOut`; supports optional filters
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```typescript
|
|
438
|
+
* const result = await booking.availability.check({
|
|
439
|
+
* propertyId: "prop_abc123",
|
|
440
|
+
* checkIn: "2025-06-01",
|
|
441
|
+
* checkOut: "2025-06-05",
|
|
442
|
+
* type: "room",
|
|
443
|
+
* guests: 2,
|
|
444
|
+
* });
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
check(params: AvailabilityCheckParams): Promise<AvailabilityResult>;
|
|
448
|
+
/**
|
|
449
|
+
* Search availability across multiple properties.
|
|
450
|
+
*
|
|
451
|
+
* @param params - Must include `propertyIds`, `checkIn`, `checkOut`; supports filtering and pagination
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```typescript
|
|
455
|
+
* const results = await booking.availability.search({
|
|
456
|
+
* propertyIds: ["prop_abc", "prop_def"],
|
|
457
|
+
* checkIn: "2025-06-01",
|
|
458
|
+
* checkOut: "2025-06-05",
|
|
459
|
+
* guests: 2,
|
|
460
|
+
* priceRange: { min: 5000, max: 20000 },
|
|
461
|
+
* });
|
|
462
|
+
* ```
|
|
463
|
+
*/
|
|
464
|
+
search(params: AvailabilitySearchParams): Promise<AvailabilitySearchResult>;
|
|
465
|
+
/**
|
|
466
|
+
* Generate a calendar view of daily availability for a property.
|
|
467
|
+
*
|
|
468
|
+
* Client-side helper that calls `check()` internally and transforms the result
|
|
469
|
+
* into a `CalendarDay[]` suitable for calendar UI rendering.
|
|
470
|
+
*
|
|
471
|
+
* @param params - Extends `AvailabilityCheckParams` with optional `months` (default: 1)
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* ```typescript
|
|
475
|
+
* const calendar = await booking.availability.getCalendar({
|
|
476
|
+
* propertyId: "prop_abc123",
|
|
477
|
+
* checkIn: "2025-06-01",
|
|
478
|
+
* checkOut: "2025-06-30",
|
|
479
|
+
* });
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
getCalendar(params: CalendarParams): Promise<CalendarDay[]>;
|
|
483
|
+
/**
|
|
484
|
+
* Get available table reservation time slots for a specific date.
|
|
485
|
+
*
|
|
486
|
+
* Client-side helper for the Tables vertical. Calls `check()` internally
|
|
487
|
+
* with `type: "table"` and reshapes the response into `TimeSlot[]`.
|
|
488
|
+
*
|
|
489
|
+
* @param params - Must include `propertyId` and `date`
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```typescript
|
|
493
|
+
* const slots = await booking.availability.getTableSlots({
|
|
494
|
+
* propertyId: "prop_abc123",
|
|
495
|
+
* date: "2025-06-15",
|
|
496
|
+
* guests: 4,
|
|
497
|
+
* });
|
|
498
|
+
* ```
|
|
499
|
+
*/
|
|
500
|
+
getTableSlots(params: TableSlotParams): Promise<TimeSlot[]>;
|
|
501
|
+
/**
|
|
502
|
+
* Get available service appointment slots for a specific date.
|
|
503
|
+
*
|
|
504
|
+
* Client-side helper for the Services vertical. Calls `check()` internally
|
|
505
|
+
* with `type: "service"` and reshapes the response into `ServiceTimeSlot[]`.
|
|
506
|
+
*
|
|
507
|
+
* @param params - Must include `propertyId` and `date`
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* ```typescript
|
|
511
|
+
* const slots = await booking.availability.getServiceSlots({
|
|
512
|
+
* propertyId: "prop_abc123",
|
|
513
|
+
* date: "2025-06-15",
|
|
514
|
+
* providerId: "staff_001",
|
|
515
|
+
* duration: 60,
|
|
516
|
+
* });
|
|
517
|
+
* ```
|
|
518
|
+
*/
|
|
519
|
+
getServiceSlots(params: ServiceSlotParams): Promise<ServiceTimeSlot[]>;
|
|
520
|
+
/**
|
|
521
|
+
* Get aggregated pricing statistics for a property and date range.
|
|
522
|
+
*
|
|
523
|
+
* Client-side helper that calls `check()` internally and computes
|
|
524
|
+
* min/max/average/total pricing from available spaces.
|
|
525
|
+
*
|
|
526
|
+
* @param params - Extends `AvailabilityCheckParams` with optional `currency`
|
|
527
|
+
*
|
|
528
|
+
* @example
|
|
529
|
+
* ```typescript
|
|
530
|
+
* const pricing = await booking.availability.getPricing({
|
|
531
|
+
* propertyId: "prop_abc123",
|
|
532
|
+
* checkIn: "2025-06-01",
|
|
533
|
+
* checkOut: "2025-06-05",
|
|
534
|
+
* });
|
|
535
|
+
* console.log(`From €${pricing.minPrice / 100} to €${pricing.maxPrice / 100}`);
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
getPricing(params: PricingParams): Promise<PricingResult>;
|
|
539
|
+
}
|
|
540
|
+
|
|
116
541
|
/** All supported property types in the v4.0 API */
|
|
117
542
|
type PropertyType = "hotel" | "resort" | "villa" | "apartment" | "hostel" | "bnb" | "restaurant" | "cafe" | "bar" | "beach" | "spa" | "salon" | "custom";
|
|
118
543
|
/** Property lifecycle status */
|
|
@@ -225,29 +650,6 @@ interface ListCategoriesParams {
|
|
|
225
650
|
limit?: number;
|
|
226
651
|
}
|
|
227
652
|
|
|
228
|
-
/**
|
|
229
|
-
* Abstract base class for all SDK services.
|
|
230
|
-
* Provides typed HTTP helper methods and path construction.
|
|
231
|
-
* Not exported from the public API.
|
|
232
|
-
*/
|
|
233
|
-
declare abstract class BaseService {
|
|
234
|
-
protected readonly http: HttpClient;
|
|
235
|
-
protected abstract readonly basePath: string;
|
|
236
|
-
constructor(http: HttpClient);
|
|
237
|
-
/** Build a full path from the base path and additional segments */
|
|
238
|
-
protected _buildPath(...segments: string[]): string;
|
|
239
|
-
/** GET request returning typed response */
|
|
240
|
-
protected _get<T>(path: string, query?: Record<string, string | number | boolean | null | undefined>): Promise<T>;
|
|
241
|
-
/** POST request with body, returning typed response */
|
|
242
|
-
protected _post<T>(path: string, body: unknown): Promise<T>;
|
|
243
|
-
/** PATCH request with body, returning typed response */
|
|
244
|
-
protected _patch<T>(path: string, body: unknown): Promise<T>;
|
|
245
|
-
/** DELETE request, returning void */
|
|
246
|
-
protected _delete(path: string): Promise<void>;
|
|
247
|
-
/** GET list request with optional query params, returning paginated response */
|
|
248
|
-
protected _list<T>(params?: any): Promise<Paginated<T>>;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
653
|
/**
|
|
252
654
|
* Service for managing space categories (room types) in the Atzentis Booking API.
|
|
253
655
|
*
|
|
@@ -402,75 +804,6 @@ declare class PropertiesService extends BaseService {
|
|
|
402
804
|
delete(propertyId: string): Promise<void>;
|
|
403
805
|
}
|
|
404
806
|
|
|
405
|
-
/**
|
|
406
|
-
* All supported space types in the v4.0 API.
|
|
407
|
-
*
|
|
408
|
-
* Grouped by vertical:
|
|
409
|
-
* - **Stays:** `room`, `sunbed`, `parking`
|
|
410
|
-
* - **Tables:** `table`, `locker`
|
|
411
|
-
* - **Services:** `service`, `meeting_room`, `desk`
|
|
412
|
-
* - **Universal:** `custom`
|
|
413
|
-
*/
|
|
414
|
-
type SpaceType = "room" | "table" | "sunbed" | "parking" | "desk" | "meeting_room" | "locker" | "service" | "custom";
|
|
415
|
-
/** All 9 space types as a readonly tuple for runtime enumeration */
|
|
416
|
-
declare const SPACE_TYPES: readonly ["room", "table", "sunbed", "parking", "desk", "meeting_room", "locker", "service", "custom"];
|
|
417
|
-
/** Space availability/lifecycle status */
|
|
418
|
-
type SpaceStatus = "available" | "occupied" | "maintenance" | "blocked" | "inactive";
|
|
419
|
-
/** All 5 space statuses as a readonly tuple for runtime enumeration */
|
|
420
|
-
declare const SPACE_STATUSES: readonly ["available", "occupied", "maintenance", "blocked", "inactive"];
|
|
421
|
-
/** A bookable space in the Atzentis Booking system */
|
|
422
|
-
interface Space {
|
|
423
|
-
id: string;
|
|
424
|
-
propertyId: string;
|
|
425
|
-
categoryId: string | null;
|
|
426
|
-
name: string;
|
|
427
|
-
type: SpaceType;
|
|
428
|
-
status: SpaceStatus;
|
|
429
|
-
/** Used for rooms (hotel floor) and desks/meeting rooms (office floor). Use string to support labels like "B1", "G", "1", "2". */
|
|
430
|
-
floor: string | null;
|
|
431
|
-
/** Used for tables (cover count) and meeting rooms (person count). Null if not applicable. */
|
|
432
|
-
capacity: number | null;
|
|
433
|
-
/** POS table reference; set via `linkPosTable()`. Tables vertical only. Null until linked. */
|
|
434
|
-
posTableId: string | null;
|
|
435
|
-
/** Open bag for vertical-specific extras not covered by standard fields. Schema is consumer-defined. */
|
|
436
|
-
metadata: Record<string, unknown> | null;
|
|
437
|
-
createdAt: string;
|
|
438
|
-
updatedAt: string;
|
|
439
|
-
}
|
|
440
|
-
/** Input for creating a new space */
|
|
441
|
-
interface CreateSpaceInput {
|
|
442
|
-
propertyId: string;
|
|
443
|
-
name: string;
|
|
444
|
-
type: SpaceType;
|
|
445
|
-
categoryId?: string;
|
|
446
|
-
/** Optional. See `Space.floor` for usage by vertical. */
|
|
447
|
-
floor?: string;
|
|
448
|
-
/** Optional. See `Space.capacity` for usage by vertical. */
|
|
449
|
-
capacity?: number;
|
|
450
|
-
/** Optional. See `Space.metadata` for usage by vertical. */
|
|
451
|
-
metadata?: Record<string, unknown>;
|
|
452
|
-
}
|
|
453
|
-
/** Input for updating an existing space — all fields optional */
|
|
454
|
-
type UpdateSpaceInput = Partial<Omit<CreateSpaceInput, "propertyId">>;
|
|
455
|
-
/** Input for bulk updating spaces — requires `id` to identify each space */
|
|
456
|
-
type BulkUpdateSpaceInput = UpdateSpaceInput & {
|
|
457
|
-
id: string;
|
|
458
|
-
};
|
|
459
|
-
/** Input for linking a space to a POS table */
|
|
460
|
-
interface LinkPosTableInput {
|
|
461
|
-
posTableId: string;
|
|
462
|
-
}
|
|
463
|
-
/** Query parameters for listing spaces — propertyId is required */
|
|
464
|
-
interface ListSpacesParams {
|
|
465
|
-
propertyId: string;
|
|
466
|
-
type?: SpaceType;
|
|
467
|
-
status?: SpaceStatus;
|
|
468
|
-
categoryId?: string;
|
|
469
|
-
floor?: number | string;
|
|
470
|
-
limit?: number;
|
|
471
|
-
cursor?: string;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
807
|
/**
|
|
475
808
|
* Service for managing bookable spaces in the Atzentis Booking API.
|
|
476
809
|
*
|
|
@@ -611,10 +944,13 @@ declare class SpacesService extends BaseService {
|
|
|
611
944
|
*/
|
|
612
945
|
declare class BookingClient {
|
|
613
946
|
readonly httpClient: HttpClient;
|
|
947
|
+
private _availability?;
|
|
614
948
|
private _properties?;
|
|
615
949
|
private _categories?;
|
|
616
950
|
private _spaces?;
|
|
617
951
|
constructor(config: BookingClientConfig);
|
|
952
|
+
/** Availability service — lazy-initialized on first access */
|
|
953
|
+
get availability(): AvailabilityService;
|
|
618
954
|
/** Properties service — lazy-initialized on first access */
|
|
619
955
|
get properties(): PropertiesService;
|
|
620
956
|
/** Categories service — lazy-initialized on first access */
|
|
@@ -703,4 +1039,4 @@ declare function firstPage<T>(fetcher: PageFetcher<T>, options?: PaginationOptio
|
|
|
703
1039
|
|
|
704
1040
|
declare const VERSION = "0.1.0";
|
|
705
1041
|
|
|
706
|
-
export { AuthenticationError, BookingClient, type BookingClientConfig, BookingError, type BookingErrorOptions, type BulkUpdateSpaceInput, CategoriesService, ConflictError, type Coordinates, type CreateCategoryInput, type CreatePropertyInput, type CreateSpaceInput, DEFAULT_MODULES, ForbiddenError, HttpClient, type HttpClientOptions, type HttpMethod, type HttpResponse, type LinkPosTableInput, type ListCategoriesParams, type ListPropertiesParams, type ListSpacesParams, type Logger, NotFoundError, PROPERTY_MODULES, type PageFetcher, type Paginated, type PaginationOptions, PaymentError, PropertiesService, type Property, type PropertyAddress, type PropertyModules, type PropertyStatus, type PropertyType, RateLimitError, type RequestOptions, type ResolvedBookingClientConfig, type RetryConfig, type RetryOptions, SPACE_STATUSES, SPACE_TYPES, ServerError, type Space, type SpaceCategory, type SpaceStatus, type SpaceType, SpacesService, TimeoutError, type UpdateCategoryInput, type UpdatePropertyInput, type UpdateSpaceInput, VERSION, ValidationError, bookingClientConfigSchema, createErrorFromResponse, firstPage, paginate };
|
|
1042
|
+
export { AuthenticationError, type AvailabilityCheckParams, type AvailabilityPricing, type AvailabilityRestrictions, type AvailabilityResult, type AvailabilitySearchParams, type AvailabilitySearchResult, type AvailabilitySearchResultEntry, AvailabilityService, type AvailableSpace, BookingClient, type BookingClientConfig, BookingError, type BookingErrorOptions, type BulkUpdateSpaceInput, type CalendarDay, type CalendarParams, CategoriesService, ConflictError, type Coordinates, type CreateCategoryInput, type CreatePropertyInput, type CreateSpaceInput, DEFAULT_MODULES, ForbiddenError, HttpClient, type HttpClientOptions, type HttpMethod, type HttpResponse, type LinkPosTableInput, type ListCategoriesParams, type ListPropertiesParams, type ListSpacesParams, type Logger, NotFoundError, PROPERTY_MODULES, type PageFetcher, type Paginated, type PaginationOptions, PaymentError, type PriceRange, type PricingParams, type PricingResult, PropertiesService, type Property, type PropertyAddress, type PropertyModules, type PropertyStatus, type PropertyType, RateLimitError, type RequestOptions, type ResolvedBookingClientConfig, type RetryConfig, type RetryOptions, SPACE_STATUSES, SPACE_TYPES, ServerError, type ServiceSlotParams, type ServiceTimeSlot, type Space, type SpaceCategory, type SpaceStatus, type SpaceType, SpacesService, type TableSlotParams, type TimeSlot, TimeoutError, type UpdateCategoryInput, type UpdatePropertyInput, type UpdateSpaceInput, VERSION, ValidationError, bookingClientConfigSchema, createErrorFromResponse, firstPage, paginate };
|