@seshn/sdk 0.1.0

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.
@@ -0,0 +1,823 @@
1
+ type BookingStatus = 'pending' | 'confirmed' | 'held' | 'checked_in' | 'completed' | 'cancelled' | 'no_show';
2
+ type SlotStatus = 'available' | 'full' | 'cancelled';
3
+ type EntitlementStatus = 'active' | 'exhausted' | 'expired' | 'revoked';
4
+ type WaitlistStatus = 'waiting' | 'promoted' | 'expired' | 'cancelled';
5
+ type WebhookDeliveryStatus = 'pending' | 'delivered' | 'failed';
6
+ type TransactionType = 'issued' | 'redeemed' | 'expired' | 'refunded' | 'adjusted';
7
+ type CreditType = 'count' | 'minutes' | 'currency' | 'unlimited';
8
+ type PricingType = 'per_seat' | 'flat' | 'tiered' | 'per_duration';
9
+ type PaymentStatus = 'pending' | 'succeeded' | 'failed' | 'refunded' | 'partially_refunded';
10
+ type BookingSeriesStatus = 'active' | 'cancelled' | 'completed';
11
+ type RecurrenceFrequency = 'weekly' | 'biweekly' | 'monthly';
12
+ type WebhookEvent = 'booking.created' | 'booking.confirmed' | 'booking.cancelled' | 'booking.rescheduled' | 'booking.checked_in' | 'booking.hold_expired' | 'booking.series_created' | 'booking.series_cancelled' | 'payment.succeeded' | 'payment.failed' | 'payment.refunded' | 'entitlement.issued' | 'entitlement.expired' | 'waitlist.joined' | 'waitlist.promoted' | 'waitlist.expired';
13
+ interface Organization {
14
+ id: string;
15
+ name: string;
16
+ slug: string;
17
+ timezone: string;
18
+ config: Record<string, unknown>;
19
+ createdAt: string;
20
+ updatedAt: string;
21
+ }
22
+ interface Location {
23
+ id: string;
24
+ organizationId: string;
25
+ name: string;
26
+ address: string | null;
27
+ timezone: string | null;
28
+ metadata: Record<string, unknown>;
29
+ isActive: boolean;
30
+ createdAt: string;
31
+ updatedAt: string;
32
+ }
33
+ interface LocationWithResources extends Location {
34
+ resources: Resource[];
35
+ }
36
+ interface Resource {
37
+ id: string;
38
+ locationId: string;
39
+ name: string;
40
+ capacity: number;
41
+ metadata: Record<string, unknown>;
42
+ isActive: boolean;
43
+ createdAt: string;
44
+ updatedAt: string;
45
+ }
46
+ interface PricingRule {
47
+ id: string;
48
+ serviceId: string;
49
+ name: string | null;
50
+ type: PricingType;
51
+ rules: Record<string, unknown>;
52
+ currency: string;
53
+ isDefault: boolean;
54
+ isActive: boolean;
55
+ createdAt: string;
56
+ updatedAt: string;
57
+ }
58
+ interface ScheduleRule {
59
+ id: string;
60
+ scheduleId: string;
61
+ dayOfWeek: number;
62
+ startTime: string;
63
+ endTime: string;
64
+ intervalMinutes: number | null;
65
+ }
66
+ interface ScheduleOverride {
67
+ id: string;
68
+ scheduleId: string;
69
+ date: string;
70
+ isClosed: boolean;
71
+ startTime: string | null;
72
+ endTime: string | null;
73
+ intervalMinutes: number | null;
74
+ reason: string | null;
75
+ createdAt: string;
76
+ }
77
+ interface Schedule {
78
+ id: string;
79
+ serviceId: string;
80
+ resourceId: string;
81
+ effectiveFrom: string | null;
82
+ effectiveUntil: string | null;
83
+ isActive: boolean;
84
+ createdAt: string;
85
+ updatedAt: string;
86
+ rules: ScheduleRule[];
87
+ overrides?: ScheduleOverride[];
88
+ }
89
+ interface ServiceResource {
90
+ id: string;
91
+ serviceId: string;
92
+ resourceId: string;
93
+ }
94
+ interface Service {
95
+ id: string;
96
+ organizationId: string;
97
+ name: string;
98
+ description: string | null;
99
+ durationMinutes: number;
100
+ bufferMinutes: number;
101
+ maxCapacity: number | null;
102
+ minParticipants: number;
103
+ cancellationDeadlineMinutes: number | null;
104
+ holdDurationMinutes: number | null;
105
+ metadata: Record<string, unknown>;
106
+ isActive: boolean;
107
+ createdAt: string;
108
+ updatedAt: string;
109
+ pricingRules?: PricingRule[];
110
+ serviceResources?: ServiceResource[];
111
+ schedules?: Schedule[];
112
+ }
113
+ interface Slot {
114
+ id: string;
115
+ resourceId: string;
116
+ serviceId: string;
117
+ startTime: string;
118
+ endTime: string;
119
+ totalCapacity: number;
120
+ bookedCapacity: number;
121
+ status: SlotStatus;
122
+ availableCapacity: number;
123
+ belowMinimum?: boolean;
124
+ createdAt: string;
125
+ updatedAt: string;
126
+ }
127
+ interface Contact {
128
+ id: string;
129
+ organizationId: string;
130
+ email: string | null;
131
+ phone: string | null;
132
+ name: string | null;
133
+ metadata: Record<string, unknown>;
134
+ createdAt: string;
135
+ updatedAt: string;
136
+ }
137
+ interface CheckIn {
138
+ id: string;
139
+ bookingId: string;
140
+ checkedInAt: string;
141
+ checkedOutAt: string | null;
142
+ createdAt: string;
143
+ }
144
+ interface EntitlementTransaction {
145
+ id: string;
146
+ entitlementId: string;
147
+ bookingId: string | null;
148
+ type: TransactionType;
149
+ amount: number;
150
+ balanceAfter: number;
151
+ description: string | null;
152
+ createdAt: string;
153
+ }
154
+ interface Booking {
155
+ id: string;
156
+ organizationId: string;
157
+ slotId: string;
158
+ contactId: string;
159
+ seats: number;
160
+ status: BookingStatus;
161
+ priceCents: number | null;
162
+ currency: string | null;
163
+ cancellationReason: string | null;
164
+ cancelledAt: string | null;
165
+ holdExpiresAt: string | null;
166
+ metadata: Record<string, unknown>;
167
+ createdAt: string;
168
+ updatedAt: string;
169
+ }
170
+ interface BookingWithDetails extends Booking {
171
+ slot?: Slot;
172
+ contact?: Contact;
173
+ checkIn?: CheckIn;
174
+ entitlementTransactions?: EntitlementTransaction[];
175
+ }
176
+ interface EntitlementType {
177
+ id: string;
178
+ organizationId: string;
179
+ name: string;
180
+ creditType: CreditType;
181
+ initialBalance: number | null;
182
+ validityDays: number | null;
183
+ maxPerBooking: number | null;
184
+ eligibleServiceIds: string[] | null;
185
+ priceCents: number | null;
186
+ currency: string;
187
+ metadata: Record<string, unknown>;
188
+ isActive: boolean;
189
+ createdAt: string;
190
+ updatedAt: string;
191
+ }
192
+ interface Entitlement {
193
+ id: string;
194
+ entitlementTypeId: string;
195
+ contactId: string;
196
+ organizationId: string;
197
+ balance: number | null;
198
+ status: EntitlementStatus;
199
+ issuedAt: string;
200
+ expiresAt: string | null;
201
+ createdAt: string;
202
+ updatedAt: string;
203
+ }
204
+ interface EntitlementWithDetails extends Entitlement {
205
+ entitlementType?: EntitlementType;
206
+ transactions?: EntitlementTransaction[];
207
+ }
208
+ interface WaitlistEntry {
209
+ id: string;
210
+ organizationId: string;
211
+ slotId: string;
212
+ contactId: string;
213
+ seatsRequested: number;
214
+ status: WaitlistStatus;
215
+ promotedBookingId: string | null;
216
+ createdAt: string;
217
+ updatedAt: string;
218
+ contact?: Contact;
219
+ slot?: Slot;
220
+ }
221
+ interface WebhookEndpoint {
222
+ id: string;
223
+ url: string;
224
+ events: string[];
225
+ secret?: string;
226
+ isActive: boolean;
227
+ createdAt: string;
228
+ }
229
+ interface WebhookDelivery {
230
+ id: string;
231
+ event: string;
232
+ status: WebhookDeliveryStatus;
233
+ responseStatus: number | null;
234
+ attempts: number;
235
+ createdAt: string;
236
+ deliveredAt: string | null;
237
+ nextRetryAt: string | null;
238
+ }
239
+ interface CreateOrganizationRequest {
240
+ name: string;
241
+ slug: string;
242
+ timezone?: string;
243
+ }
244
+ interface CreateLocationRequest {
245
+ name: string;
246
+ address?: string;
247
+ timezone?: string;
248
+ metadata?: Record<string, unknown>;
249
+ }
250
+ interface CreateResourceRequest {
251
+ locationId: string;
252
+ name: string;
253
+ capacity: number;
254
+ metadata?: Record<string, unknown>;
255
+ }
256
+ interface CreateServiceRequest {
257
+ name: string;
258
+ description?: string;
259
+ durationMinutes: number;
260
+ bufferMinutes?: number;
261
+ maxCapacity?: number;
262
+ minParticipants?: number;
263
+ holdDurationMinutes?: number;
264
+ metadata?: Record<string, unknown>;
265
+ }
266
+ interface UpdateServiceRequest {
267
+ name?: string;
268
+ description?: string;
269
+ durationMinutes?: number;
270
+ bufferMinutes?: number;
271
+ cancellationDeadlineMinutes?: number | null;
272
+ holdDurationMinutes?: number | null;
273
+ }
274
+ interface LinkResourceRequest {
275
+ resourceId: string;
276
+ }
277
+ interface CreatePricingRuleRequest {
278
+ name?: string;
279
+ type: PricingType;
280
+ rules: Record<string, unknown>;
281
+ currency?: string;
282
+ isDefault?: boolean;
283
+ }
284
+ interface CreateScheduleRequest {
285
+ resourceId: string;
286
+ effectiveFrom?: string;
287
+ effectiveUntil?: string;
288
+ rules: {
289
+ dayOfWeek: number;
290
+ startTime: string;
291
+ endTime: string;
292
+ intervalMinutes?: number;
293
+ }[];
294
+ }
295
+ interface CreateOverrideRequest {
296
+ date: string;
297
+ isClosed?: boolean;
298
+ startTime?: string;
299
+ endTime?: string;
300
+ intervalMinutes?: number;
301
+ reason?: string;
302
+ }
303
+ interface QueryAvailabilityRequest {
304
+ serviceId: string;
305
+ from: string;
306
+ to: string;
307
+ minSeats?: number;
308
+ cursor?: string;
309
+ limit?: number;
310
+ }
311
+ interface GenerateSlotsRequest {
312
+ fromDate: string;
313
+ toDate: string;
314
+ }
315
+ interface CreateBookingRequest {
316
+ slotId: string;
317
+ contactId: string;
318
+ seats?: number;
319
+ hold?: boolean;
320
+ entitlementId?: string;
321
+ metadata?: Record<string, unknown>;
322
+ }
323
+ interface ConfirmBookingRequest {
324
+ entitlementId?: string;
325
+ }
326
+ interface ConfirmBookingResponse {
327
+ booking: Booking;
328
+ entitlementTransaction?: EntitlementTransaction;
329
+ }
330
+ interface CancelBookingRequest {
331
+ reason?: string;
332
+ }
333
+ interface RescheduleBookingRequest {
334
+ slotId: string;
335
+ }
336
+ interface RescheduleBookingResponse extends BookingWithDetails {
337
+ oldSlotId: string;
338
+ waitlistPromoted: number;
339
+ }
340
+ interface ListBookingsRequest {
341
+ contactId?: string;
342
+ slotId?: string;
343
+ status?: BookingStatus;
344
+ cursor?: string;
345
+ limit?: number;
346
+ }
347
+ interface CreateContactRequest {
348
+ email?: string;
349
+ phone?: string;
350
+ name?: string;
351
+ metadata?: Record<string, unknown>;
352
+ }
353
+ interface UpdateContactRequest {
354
+ email?: string;
355
+ phone?: string;
356
+ name?: string;
357
+ metadata?: Record<string, unknown>;
358
+ }
359
+ interface ListContactsRequest {
360
+ cursor?: string;
361
+ limit?: number;
362
+ }
363
+ interface CreateEntitlementTypeRequest {
364
+ name: string;
365
+ creditType: CreditType;
366
+ initialBalance?: number;
367
+ validityDays?: number;
368
+ maxPerBooking?: number;
369
+ eligibleServiceIds?: string[];
370
+ priceCents?: number;
371
+ currency?: string;
372
+ metadata?: Record<string, unknown>;
373
+ }
374
+ interface IssueEntitlementRequest {
375
+ entitlementTypeId: string;
376
+ contactId: string;
377
+ }
378
+ interface ListEntitlementsRequest {
379
+ contactId: string;
380
+ serviceId?: string;
381
+ cursor?: string;
382
+ limit?: number;
383
+ }
384
+ interface JoinWaitlistRequest {
385
+ slotId: string;
386
+ contactId: string;
387
+ seatsRequested?: number;
388
+ }
389
+ interface ListWaitlistRequest {
390
+ slotId?: string;
391
+ contactId?: string;
392
+ status?: WaitlistStatus;
393
+ cursor?: string;
394
+ limit?: number;
395
+ }
396
+ interface CreateWebhookRequest {
397
+ url: string;
398
+ events: WebhookEvent[];
399
+ }
400
+ interface ListDeliveriesRequest {
401
+ cursor?: string;
402
+ limit?: number;
403
+ }
404
+ interface CreateOrganizationResponse {
405
+ organization: Organization;
406
+ apiKey: string;
407
+ }
408
+ interface CreateBookingResponse {
409
+ booking: Booking;
410
+ entitlementTransaction?: EntitlementTransaction;
411
+ }
412
+ interface CancelBookingResponse {
413
+ status: 'cancelled';
414
+ waitlistPromoted: number;
415
+ }
416
+ interface CheckInResponse {
417
+ checkedIn: boolean;
418
+ checkedOut: boolean;
419
+ checkedInAt?: string;
420
+ checkedOutAt?: string;
421
+ }
422
+ interface IssueEntitlementResponse {
423
+ id: string;
424
+ balance: number | null;
425
+ expiresAt: string | null;
426
+ }
427
+ interface GenerateSlotsResponse {
428
+ generated: number;
429
+ }
430
+ interface PaginatedResponse<T> {
431
+ data: T[];
432
+ cursor: string | null;
433
+ hasMore: boolean;
434
+ }
435
+ interface PaginationParams {
436
+ cursor?: string;
437
+ limit?: number;
438
+ }
439
+ interface Payment {
440
+ id: string;
441
+ organizationId: string;
442
+ bookingId: string;
443
+ stripePaymentIntentId: string | null;
444
+ amount: number;
445
+ currency: string;
446
+ status: PaymentStatus;
447
+ refundedAmount: number;
448
+ metadata: Record<string, unknown>;
449
+ createdAt: string;
450
+ updatedAt: string;
451
+ }
452
+ interface RefundPaymentResponse {
453
+ refundedAmount: number;
454
+ }
455
+ interface RecurrenceRule {
456
+ frequency: RecurrenceFrequency;
457
+ dayOfWeek: number;
458
+ time: string;
459
+ count: number;
460
+ }
461
+ interface BookingSeriesBase {
462
+ id: string;
463
+ organizationId: string;
464
+ contactId: string;
465
+ serviceId: string;
466
+ resourceId: string;
467
+ recurrenceRule: RecurrenceRule;
468
+ seats: number;
469
+ totalOccurrences: number;
470
+ status: BookingSeriesStatus;
471
+ metadata: Record<string, unknown>;
472
+ createdAt: string;
473
+ updatedAt: string;
474
+ }
475
+ interface BookingSeriesWithDetails extends BookingSeriesBase {
476
+ bookings?: Booking[];
477
+ service?: Service;
478
+ resource?: Resource;
479
+ contact?: Contact;
480
+ }
481
+ interface CreateBookingSeriesRequest {
482
+ contactId: string;
483
+ serviceId: string;
484
+ resourceId: string;
485
+ seats?: number;
486
+ recurrence: RecurrenceRule;
487
+ entitlementId?: string;
488
+ metadata?: Record<string, unknown>;
489
+ }
490
+ interface CreateBookingSeriesResponse {
491
+ series: {
492
+ id: string;
493
+ status: string;
494
+ totalOccurrences: number;
495
+ recurrenceRule: RecurrenceRule;
496
+ };
497
+ bookings: Array<{
498
+ id: string;
499
+ slotId: string;
500
+ occurrenceIndex: number;
501
+ startTime: string;
502
+ status: string;
503
+ }>;
504
+ }
505
+ interface CancelBookingSeriesResponse {
506
+ cancelledCount: number;
507
+ }
508
+ interface ListBookingSeriesRequest {
509
+ contactId?: string;
510
+ serviceId?: string;
511
+ status?: BookingSeriesStatus;
512
+ cursor?: string;
513
+ limit?: number;
514
+ }
515
+ type UserRole = 'owner' | 'admin' | 'staff' | 'readonly';
516
+ interface User {
517
+ id: string;
518
+ email: string;
519
+ name: string;
520
+ role: UserRole;
521
+ isActive: boolean;
522
+ createdAt: string;
523
+ updatedAt: string;
524
+ }
525
+ interface CreateUserRequest {
526
+ email: string;
527
+ name: string;
528
+ password: string;
529
+ role?: UserRole;
530
+ }
531
+ interface UpdateUserRequest {
532
+ name?: string;
533
+ email?: string;
534
+ role?: UserRole;
535
+ isActive?: boolean;
536
+ }
537
+ interface ListUsersRequest {
538
+ cursor?: string;
539
+ limit?: number;
540
+ }
541
+ interface ApiKey {
542
+ id: string;
543
+ name: string;
544
+ keyPrefix: string;
545
+ role: UserRole;
546
+ isActive: boolean;
547
+ lastUsedAt: string | null;
548
+ expiresAt: string | null;
549
+ createdAt: string;
550
+ }
551
+ interface ApiKeyWithSecret extends ApiKey {
552
+ apiKey: string;
553
+ }
554
+ interface CreateApiKeyRequest {
555
+ name: string;
556
+ role?: UserRole;
557
+ }
558
+ interface ListApiKeysRequest {
559
+ cursor?: string;
560
+ limit?: number;
561
+ }
562
+ interface AuditLogEntry {
563
+ id: string;
564
+ userId: string | null;
565
+ apiKeyId: string | null;
566
+ action: string;
567
+ resourceType: string;
568
+ resourceId: string | null;
569
+ metadata: Record<string, unknown>;
570
+ ipAddress: string | null;
571
+ createdAt: string;
572
+ }
573
+ interface ListAuditLogRequest {
574
+ action?: string;
575
+ resourceType?: string;
576
+ userId?: string;
577
+ cursor?: string;
578
+ limit?: number;
579
+ }
580
+ interface ClientOptions {
581
+ apiKey: string;
582
+ baseUrl?: string;
583
+ }
584
+
585
+ declare class HttpClient {
586
+ private readonly apiKey;
587
+ private readonly baseUrl;
588
+ constructor(options: ClientOptions);
589
+ request<T>(method: string, path: string, body?: unknown): Promise<T>;
590
+ get<T>(path: string): Promise<T>;
591
+ post<T>(path: string, body?: unknown): Promise<T>;
592
+ put<T>(path: string, body?: unknown): Promise<T>;
593
+ delete<T>(path: string): Promise<T>;
594
+ }
595
+
596
+ declare class ApiKeys {
597
+ private readonly client;
598
+ constructor(client: HttpClient);
599
+ create(data: CreateApiKeyRequest): Promise<ApiKeyWithSecret>;
600
+ list(params?: ListApiKeysRequest): Promise<PaginatedResponse<ApiKey>>;
601
+ revoke(id: string): Promise<{
602
+ deleted: boolean;
603
+ }>;
604
+ }
605
+
606
+ declare class AuditLog {
607
+ private readonly client;
608
+ constructor(client: HttpClient);
609
+ list(params?: ListAuditLogRequest): Promise<PaginatedResponse<AuditLogEntry>>;
610
+ }
611
+
612
+ declare class Availability {
613
+ private readonly client;
614
+ constructor(client: HttpClient);
615
+ query(params: QueryAvailabilityRequest): Promise<PaginatedResponse<Slot>>;
616
+ generate(data: GenerateSlotsRequest): Promise<GenerateSlotsResponse>;
617
+ }
618
+
619
+ declare class Bookings {
620
+ private readonly client;
621
+ constructor(client: HttpClient);
622
+ create(data: CreateBookingRequest): Promise<CreateBookingResponse>;
623
+ list(params?: ListBookingsRequest): Promise<PaginatedResponse<BookingWithDetails>>;
624
+ get(id: string): Promise<BookingWithDetails>;
625
+ confirm(id: string, data?: ConfirmBookingRequest): Promise<ConfirmBookingResponse>;
626
+ cancel(id: string, data?: CancelBookingRequest): Promise<CancelBookingResponse>;
627
+ reschedule(id: string, data: RescheduleBookingRequest): Promise<RescheduleBookingResponse>;
628
+ checkIn(id: string): Promise<CheckInResponse>;
629
+ }
630
+
631
+ declare class BookingSeries {
632
+ private readonly client;
633
+ constructor(client: HttpClient);
634
+ create(data: CreateBookingSeriesRequest): Promise<CreateBookingSeriesResponse>;
635
+ list(params?: ListBookingSeriesRequest): Promise<PaginatedResponse<BookingSeriesWithDetails>>;
636
+ get(id: string): Promise<BookingSeriesWithDetails>;
637
+ cancel(id: string, scope?: 'all' | 'future'): Promise<CancelBookingSeriesResponse>;
638
+ cancelOccurrence(seriesId: string, index: number): Promise<{
639
+ status: string;
640
+ bookingId: string;
641
+ }>;
642
+ }
643
+
644
+ declare class Contacts {
645
+ private readonly client;
646
+ constructor(client: HttpClient);
647
+ create(data: CreateContactRequest): Promise<Contact>;
648
+ list(params?: ListContactsRequest): Promise<PaginatedResponse<Contact>>;
649
+ get(id: string): Promise<Contact>;
650
+ update(id: string, data: UpdateContactRequest): Promise<Contact>;
651
+ }
652
+
653
+ declare class Entitlements {
654
+ private readonly client;
655
+ constructor(client: HttpClient);
656
+ createType(data: CreateEntitlementTypeRequest): Promise<EntitlementType>;
657
+ listTypes(params?: {
658
+ cursor?: string;
659
+ limit?: number;
660
+ }): Promise<PaginatedResponse<EntitlementType>>;
661
+ issue(data: IssueEntitlementRequest): Promise<IssueEntitlementResponse>;
662
+ list(params: ListEntitlementsRequest): Promise<PaginatedResponse<Entitlement>>;
663
+ get(id: string): Promise<EntitlementWithDetails>;
664
+ }
665
+
666
+ declare class Locations {
667
+ private readonly client;
668
+ constructor(client: HttpClient);
669
+ create(data: CreateLocationRequest): Promise<Location>;
670
+ list(params?: PaginationParams): Promise<PaginatedResponse<LocationWithResources>>;
671
+ }
672
+
673
+ declare class Organizations {
674
+ private readonly client;
675
+ private readonly baseUrl;
676
+ constructor(client: HttpClient, baseUrl: string);
677
+ create(data: CreateOrganizationRequest): Promise<CreateOrganizationResponse>;
678
+ }
679
+
680
+ declare class Payments {
681
+ private readonly client;
682
+ constructor(client: HttpClient);
683
+ list(params?: PaginationParams): Promise<PaginatedResponse<Payment>>;
684
+ get(id: string): Promise<Payment>;
685
+ refund(id: string, amount?: number): Promise<RefundPaymentResponse>;
686
+ }
687
+
688
+ declare class Resources {
689
+ private readonly client;
690
+ constructor(client: HttpClient);
691
+ create(data: CreateResourceRequest): Promise<Resource>;
692
+ }
693
+
694
+ declare class Services {
695
+ private readonly client;
696
+ constructor(client: HttpClient);
697
+ create(data: CreateServiceRequest): Promise<Service>;
698
+ list(params?: PaginationParams): Promise<PaginatedResponse<Service>>;
699
+ get(id: string): Promise<Service>;
700
+ update(id: string, data: UpdateServiceRequest): Promise<Service>;
701
+ delete(id: string): Promise<{
702
+ deleted: boolean;
703
+ }>;
704
+ linkResource(serviceId: string, data: LinkResourceRequest): Promise<ServiceResource>;
705
+ addPricing(serviceId: string, data: CreatePricingRuleRequest): Promise<PricingRule>;
706
+ createSchedule(serviceId: string, data: CreateScheduleRequest): Promise<Schedule>;
707
+ addOverride(serviceId: string, scheduleId: string, data: CreateOverrideRequest): Promise<ScheduleOverride>;
708
+ }
709
+
710
+ declare class Users {
711
+ private readonly client;
712
+ constructor(client: HttpClient);
713
+ create(data: CreateUserRequest): Promise<User>;
714
+ list(params?: ListUsersRequest): Promise<PaginatedResponse<User>>;
715
+ get(id: string): Promise<User>;
716
+ update(id: string, data: UpdateUserRequest): Promise<User>;
717
+ delete(id: string): Promise<{
718
+ deleted: boolean;
719
+ }>;
720
+ }
721
+
722
+ declare class Waitlist {
723
+ private readonly client;
724
+ constructor(client: HttpClient);
725
+ join(data: JoinWaitlistRequest): Promise<{
726
+ id: string;
727
+ }>;
728
+ list(params?: ListWaitlistRequest): Promise<PaginatedResponse<WaitlistEntry>>;
729
+ cancel(id: string): Promise<{
730
+ status: 'cancelled';
731
+ }>;
732
+ }
733
+
734
+ declare class Webhooks {
735
+ private readonly client;
736
+ constructor(client: HttpClient);
737
+ create(data: CreateWebhookRequest): Promise<WebhookEndpoint>;
738
+ list(params?: PaginationParams): Promise<PaginatedResponse<WebhookEndpoint>>;
739
+ delete(id: string): Promise<{
740
+ deleted: boolean;
741
+ }>;
742
+ listDeliveries(webhookId: string, params?: ListDeliveriesRequest): Promise<PaginatedResponse<WebhookDelivery>>;
743
+ }
744
+
745
+ interface ApiErrorBody {
746
+ error: string;
747
+ code: string;
748
+ details?: {
749
+ path: string;
750
+ message: string;
751
+ }[];
752
+ }
753
+ declare class SeshnError extends Error {
754
+ readonly status: number;
755
+ readonly code: string;
756
+ readonly details?: {
757
+ path: string;
758
+ message: string;
759
+ }[];
760
+ constructor(status: number, body: ApiErrorBody);
761
+ }
762
+ declare class NotFoundError extends SeshnError {
763
+ constructor(body: ApiErrorBody);
764
+ }
765
+ declare class ValidationError extends SeshnError {
766
+ constructor(body: ApiErrorBody);
767
+ }
768
+ declare class UnauthorizedError extends SeshnError {
769
+ constructor(body: ApiErrorBody);
770
+ }
771
+ declare class ConflictError extends SeshnError {
772
+ constructor(body: ApiErrorBody);
773
+ }
774
+ declare class InsufficientCapacityError extends ConflictError {
775
+ constructor(body: ApiErrorBody);
776
+ }
777
+ declare class InsufficientCreditsError extends ConflictError {
778
+ constructor(body: ApiErrorBody);
779
+ }
780
+ declare class InvalidStateError extends SeshnError {
781
+ constructor(body: ApiErrorBody);
782
+ }
783
+ declare class CancellationDeadlineError extends InvalidStateError {
784
+ constructor(body: ApiErrorBody);
785
+ }
786
+ declare class ForbiddenError extends SeshnError {
787
+ constructor(body: ApiErrorBody);
788
+ }
789
+ declare class RateLimitError extends SeshnError {
790
+ constructor(body: ApiErrorBody);
791
+ }
792
+ declare class PaymentProviderError extends SeshnError {
793
+ constructor(body: ApiErrorBody);
794
+ }
795
+ declare function createError(status: number, body: ApiErrorBody): SeshnError;
796
+ /** @deprecated Use `SeshnError` instead */
797
+ declare const HeadlessBookingError: typeof SeshnError;
798
+
799
+ declare class Seshn {
800
+ readonly apiKeys: ApiKeys;
801
+ readonly auditLog: AuditLog;
802
+ readonly availability: Availability;
803
+ readonly bookings: Bookings;
804
+ readonly bookingSeries: BookingSeries;
805
+ readonly contacts: Contacts;
806
+ readonly entitlements: Entitlements;
807
+ readonly locations: Locations;
808
+ readonly organizations: Organizations;
809
+ readonly payments: Payments;
810
+ readonly resources: Resources;
811
+ readonly services: Services;
812
+ readonly users: Users;
813
+ readonly waitlist: Waitlist;
814
+ readonly webhooks: Webhooks;
815
+ constructor(apiKey: string, options?: {
816
+ baseUrl?: string;
817
+ });
818
+ }
819
+
820
+ /** @deprecated Use `Seshn` instead */
821
+ declare const HeadlessBooking: typeof Seshn;
822
+
823
+ export { type ApiErrorBody, type ApiKey, type ApiKeyWithSecret, ApiKeys, AuditLog, type AuditLogEntry, Availability, type Booking, BookingSeries, type BookingSeriesBase, type BookingSeriesStatus, type BookingSeriesWithDetails, type BookingStatus, type BookingWithDetails, Bookings, type CancelBookingRequest, type CancelBookingResponse, type CancelBookingSeriesResponse, CancellationDeadlineError, type CheckIn, type CheckInResponse, type ClientOptions, type ConfirmBookingRequest, type ConfirmBookingResponse, ConflictError, type Contact, Contacts, type CreateApiKeyRequest, type CreateBookingRequest, type CreateBookingResponse, type CreateBookingSeriesRequest, type CreateBookingSeriesResponse, type CreateContactRequest, type CreateEntitlementTypeRequest, type CreateLocationRequest, type CreateOrganizationRequest, type CreateOrganizationResponse, type CreateOverrideRequest, type CreatePricingRuleRequest, type CreateResourceRequest, type CreateScheduleRequest, type CreateServiceRequest, type CreateUserRequest, type CreateWebhookRequest, type CreditType, type Entitlement, type EntitlementStatus, type EntitlementTransaction, type EntitlementType, type EntitlementWithDetails, Entitlements, ForbiddenError, type GenerateSlotsRequest, type GenerateSlotsResponse, HeadlessBooking, HeadlessBookingError, HttpClient, InsufficientCapacityError, InsufficientCreditsError, InvalidStateError, type IssueEntitlementRequest, type IssueEntitlementResponse, type JoinWaitlistRequest, type LinkResourceRequest, type ListApiKeysRequest, type ListAuditLogRequest, type ListBookingSeriesRequest, type ListBookingsRequest, type ListContactsRequest, type ListDeliveriesRequest, type ListEntitlementsRequest, type ListUsersRequest, type ListWaitlistRequest, type Location, type LocationWithResources, Locations, NotFoundError, type Organization, Organizations, type PaginatedResponse, type PaginationParams, type Payment, PaymentProviderError, type PaymentStatus, Payments, type PricingRule, type PricingType, type QueryAvailabilityRequest, RateLimitError, type RecurrenceFrequency, type RecurrenceRule, type RefundPaymentResponse, type RescheduleBookingRequest, type RescheduleBookingResponse, type Resource, Resources, type Schedule, type ScheduleOverride, type ScheduleRule, type Service, type ServiceResource, Services, Seshn, SeshnError, type Slot, type SlotStatus, type TransactionType, UnauthorizedError, type UpdateContactRequest, type UpdateServiceRequest, type UpdateUserRequest, type User, type UserRole, Users, ValidationError, Waitlist, type WaitlistEntry, type WaitlistStatus, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEvent, Webhooks, createError };