@withaevum/sdk 0.0.1

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,687 @@
1
+ /**
2
+ * Configuration options for AevumClient
3
+ */
4
+ export interface AevumClientConfig {
5
+ /** API key for authentication */
6
+ apiKey: string;
7
+ /** Base URL for the API (default: https://withaevum.com) */
8
+ baseUrl?: string;
9
+ /** Organization ID (optional, will be resolved from API key if not provided) */
10
+ orgId?: string;
11
+ }
12
+ /**
13
+ * Organization (from GET /api/v1/orgs/:orgId)
14
+ */
15
+ export interface Org {
16
+ id: string;
17
+ name: string | null;
18
+ slug: string | null;
19
+ timezone: string | null;
20
+ clerk_org_id: string | null;
21
+ }
22
+ /**
23
+ * Booking settings for an organization
24
+ */
25
+ export interface BookingSettings {
26
+ /** Safe period in hours - no bookings allowed within this period (default: 24) */
27
+ safePeriodHours: number;
28
+ }
29
+ /**
30
+ * Parameters for updating booking settings
31
+ */
32
+ export interface UpdateBookingSettingsParams {
33
+ /** Safe period in hours (0-168, default: 24) */
34
+ safePeriodHours?: number;
35
+ }
36
+ /**
37
+ * Customer information
38
+ */
39
+ export interface Customer {
40
+ id: string | null;
41
+ name: string | null;
42
+ email: string | null;
43
+ phone?: string | null;
44
+ }
45
+ /**
46
+ * Provider information
47
+ */
48
+ export interface Provider {
49
+ id: string;
50
+ name: string | null;
51
+ }
52
+ /**
53
+ * Offering information
54
+ */
55
+ export interface Offering {
56
+ id: string;
57
+ name: string | null;
58
+ price_cents?: number | null;
59
+ }
60
+ /**
61
+ * Booking object
62
+ */
63
+ export interface Booking {
64
+ id: string;
65
+ kind: string | null;
66
+ status: string | null;
67
+ start_time: string | null;
68
+ end_time: string | null;
69
+ notes: string | null;
70
+ price_cents: number | null;
71
+ signed_up_at: string | null;
72
+ customer: Customer;
73
+ providers: Provider[];
74
+ offerings: Offering[];
75
+ }
76
+ /**
77
+ * Parameters for creating a booking
78
+ */
79
+ export interface CreateBookingParams {
80
+ /** Provider ID (will be converted to providerIds array) */
81
+ providerId?: string;
82
+ /** Offering ID (will be converted to offeringIds array) */
83
+ offeringId?: string;
84
+ /** Provider IDs array */
85
+ providerIds?: string[];
86
+ /** Offering IDs array */
87
+ offeringIds?: string[];
88
+ /** Start time in ISO 8601 format with timezone */
89
+ startTime: string;
90
+ /** End time in ISO 8601 format with timezone (optional if duration can be inferred) */
91
+ endTime?: string;
92
+ /** Customer email (will create customer if doesn't exist) */
93
+ customerEmail?: string;
94
+ /** Customer ID (if customer already exists) */
95
+ customerId?: string;
96
+ /** Customer object for inline creation */
97
+ customer?: {
98
+ name?: string;
99
+ email?: string;
100
+ phone?: string;
101
+ };
102
+ /** Price in cents */
103
+ price_cents?: number;
104
+ /** Notes for the booking */
105
+ notes?: string;
106
+ /** Booking status (default: 'pending') */
107
+ status?: string;
108
+ /** Booking kind (default: 'standard') */
109
+ kind?: string;
110
+ }
111
+ /**
112
+ * Parameters for listing bookings
113
+ */
114
+ export interface ListBookingsParams {
115
+ /** Filter by booking status */
116
+ status?: string;
117
+ /** Filter by provider ID */
118
+ providerId?: string;
119
+ /** Filter by customer ID */
120
+ customerId?: string;
121
+ /** Start date for filtering (ISO 8601 with timezone) */
122
+ startDate?: string;
123
+ /** End date for filtering (ISO 8601 with timezone) */
124
+ endDate?: string;
125
+ /** Page number (default: 1) */
126
+ page?: number;
127
+ /** Items per page (default: 20, max: 100) */
128
+ pageSize?: number;
129
+ }
130
+ /**
131
+ * Paginated response for bookings list
132
+ */
133
+ export interface ListBookingsResponse {
134
+ page: number;
135
+ pageSize: number;
136
+ total: number;
137
+ totalPages: number;
138
+ bookings: Booking[];
139
+ }
140
+ /**
141
+ * Availability slot
142
+ */
143
+ export interface AvailabilitySlot {
144
+ tz: string;
145
+ start_time_utc: string;
146
+ end_time_utc: string;
147
+ local_label: string;
148
+ scheduleId?: string;
149
+ }
150
+ /**
151
+ * Parameters for getting availability slots
152
+ */
153
+ export interface GetSlotsParams {
154
+ /** Provider ID */
155
+ providerId: string;
156
+ /** Start date (ISO 8601 with timezone, e.g., '2024-01-15T00:00:00Z') */
157
+ startDate: string;
158
+ /** End date (ISO 8601 with timezone, e.g., '2024-01-22T23:59:59Z') */
159
+ endDate: string;
160
+ }
161
+ /**
162
+ * Response for getting availability slots
163
+ */
164
+ export interface GetSlotsResponse {
165
+ slots: AvailabilitySlot[];
166
+ }
167
+ /**
168
+ * Parameters for checking availability
169
+ */
170
+ export interface CheckAvailabilityParams {
171
+ /** Provider ID */
172
+ providerId: string;
173
+ /** Start time to check (ISO 8601 with timezone) */
174
+ startTime: string;
175
+ /** Duration in minutes */
176
+ duration: number;
177
+ }
178
+ /**
179
+ * Response for checking availability
180
+ */
181
+ export interface CheckAvailabilityResponse {
182
+ available: boolean;
183
+ }
184
+ /**
185
+ * Parameters for canceling a booking
186
+ */
187
+ export interface CancelBookingParams {
188
+ /** Optional cancellation reason */
189
+ reason?: string;
190
+ /** Whether to send notification (default: false) */
191
+ sendNotification?: boolean;
192
+ }
193
+ /**
194
+ * Parameters for rescheduling a booking
195
+ */
196
+ export interface RescheduleBookingParams {
197
+ /** New start time in ISO 8601 format with timezone */
198
+ start_time: string;
199
+ /** New end time in ISO 8601 format with timezone */
200
+ end_time: string;
201
+ /** Whether to send notification (default: false) */
202
+ sendNotification?: boolean;
203
+ }
204
+ /**
205
+ * Complete offering information
206
+ */
207
+ export interface Offering {
208
+ id: string;
209
+ name: string | null;
210
+ description?: string | null;
211
+ price_cents?: number | null;
212
+ duration_minutes?: number | null;
213
+ timezone?: string | null;
214
+ is_all_day?: boolean;
215
+ attendee_mode?: '1:1' | 'group' | null;
216
+ attendee_limit?: number | null;
217
+ customer?: string | null;
218
+ status?: string | null;
219
+ type?: string | null;
220
+ time_mode?: string | null;
221
+ start_time?: string | null;
222
+ end_time?: string | null;
223
+ session_count?: number | null;
224
+ recurrence_preset?: string | null;
225
+ recurrence_interval_count?: number | null;
226
+ recurrence_interval_unit?: string | null;
227
+ recurrence_repeat_on?: string | null;
228
+ recurrence_end_mode?: string | null;
229
+ recurrence_end_date?: string | null;
230
+ recurrence_end_count?: number | null;
231
+ override_price_cents?: number | null;
232
+ min_age?: number | null;
233
+ max_age?: number | null;
234
+ window_start_time?: string | null;
235
+ window_end_time?: string | null;
236
+ cadence_minutes?: number | null;
237
+ slot_days?: string | null;
238
+ auto_confirm?: boolean;
239
+ hours?: any;
240
+ weekly_hours?: any;
241
+ monthly_recurrence?: any;
242
+ providers?: Array<{
243
+ id: string;
244
+ name: string | null;
245
+ }>;
246
+ }
247
+ /**
248
+ * Parameters for creating an offering
249
+ */
250
+ export interface CreateOfferingParams {
251
+ name: string;
252
+ description?: string;
253
+ price_cents?: number | null;
254
+ duration_minutes?: number | null;
255
+ timezone?: string;
256
+ is_all_day?: boolean;
257
+ attendee_mode?: '1:1' | 'group';
258
+ attendee_limit?: number | null;
259
+ customer?: string;
260
+ status?: string;
261
+ type?: string;
262
+ time_mode?: string;
263
+ start_time?: string;
264
+ end_time?: string;
265
+ session_count?: number | null;
266
+ recurrence_preset?: string | null;
267
+ recurrence_interval_count?: number;
268
+ recurrence_interval_unit?: string;
269
+ recurrence_repeat_on?: string | null;
270
+ recurrence_end_mode?: string | null;
271
+ recurrence_end_date?: string;
272
+ recurrence_end_count?: number | null;
273
+ override_price_cents?: number | null;
274
+ min_age?: number | null;
275
+ max_age?: number | null;
276
+ window_start_time?: string;
277
+ window_end_time?: string;
278
+ cadence_minutes?: number | null;
279
+ slot_days?: string;
280
+ auto_confirm?: boolean;
281
+ providerIds?: string[];
282
+ hours?: any;
283
+ weekly_hours?: any;
284
+ monthly_recurrence?: any;
285
+ }
286
+ /**
287
+ * Parameters for updating an offering (all fields optional)
288
+ */
289
+ export type UpdateOfferingParams = Partial<Omit<CreateOfferingParams, 'name'>> & {
290
+ name?: string;
291
+ };
292
+ /**
293
+ * Parameters for listing offerings
294
+ */
295
+ export interface ListOfferingsParams {
296
+ /** Filter by event ID */
297
+ eventId?: string;
298
+ /** Filter by provider ID */
299
+ providerId?: string;
300
+ }
301
+ /**
302
+ * Parameters for creating a simple offering (basic 1:1 offering using provider availability)
303
+ */
304
+ export interface CreateSimpleOfferingParams {
305
+ /** Offering name (required) */
306
+ name: string;
307
+ /** Duration in minutes (required) */
308
+ duration_minutes: number;
309
+ /** Price in cents (optional) */
310
+ price_cents?: number | null;
311
+ /** Description (optional) */
312
+ description?: string;
313
+ /** Timezone (optional, defaults to organization timezone) */
314
+ timezone?: string;
315
+ /** Provider IDs to associate with this offering (optional) */
316
+ providerIds?: string[];
317
+ }
318
+ /**
319
+ * Time slot for recurring offerings
320
+ */
321
+ export interface TimeSlot {
322
+ /** Start time in HH:MM format (e.g., '09:00') */
323
+ start: string;
324
+ /** End time in HH:MM format (e.g., '17:00') */
325
+ end: string;
326
+ }
327
+ /**
328
+ * Parameters for creating a weekly recurring offering
329
+ */
330
+ export interface CreateRecurringWeeklyOfferingParams {
331
+ /** Offering name (required) */
332
+ name: string;
333
+ /** Duration in minutes (required) */
334
+ duration_minutes: number;
335
+ /** Days of the week (required, e.g., ['monday', 'wednesday', 'friday'] or ['MO', 'WE', 'FR']) */
336
+ days: string[];
337
+ /** Time slots for each day (required) */
338
+ timeSlots: TimeSlot[];
339
+ /** Price in cents (optional) */
340
+ price_cents?: number | null;
341
+ /** Description (optional) */
342
+ description?: string;
343
+ /** Timezone (optional, defaults to organization timezone) */
344
+ timezone?: string;
345
+ /** Provider IDs to associate with this offering (optional) */
346
+ providerIds?: string[];
347
+ }
348
+ /**
349
+ * Parameters for creating a daily recurring offering
350
+ */
351
+ export interface CreateRecurringDailyOfferingParams {
352
+ /** Offering name (required) */
353
+ name: string;
354
+ /** Duration in minutes (required) */
355
+ duration_minutes: number;
356
+ /** Time slots for each day (required) */
357
+ timeSlots: TimeSlot[];
358
+ /** Price in cents (optional) */
359
+ price_cents?: number | null;
360
+ /** Description (optional) */
361
+ description?: string;
362
+ /** Timezone (optional, defaults to organization timezone) */
363
+ timezone?: string;
364
+ /** Provider IDs to associate with this offering (optional) */
365
+ providerIds?: string[];
366
+ }
367
+ /**
368
+ * Parameters for creating an offering via the simplified endpoint
369
+ */
370
+ export interface CreateSimpleOfferingEndpointParams {
371
+ /** Offering name (required) */
372
+ name: string;
373
+ /** Duration in minutes (required) */
374
+ duration_minutes: number;
375
+ /** Description (optional) */
376
+ description?: string;
377
+ /** Price in cents (optional) */
378
+ price_cents?: number | null;
379
+ /** Timezone (optional, defaults to organization timezone) */
380
+ timezone?: string;
381
+ /** Provider IDs to associate with this offering (optional) */
382
+ provider_ids?: string[];
383
+ /** Preset type (optional, defaults to 'simple_1on1') */
384
+ preset?: 'simple_1on1' | 'simple_group' | 'recurring_weekly' | 'recurring_daily';
385
+ /** Days of the week for weekly recurring (required if preset is 'recurring_weekly') */
386
+ weekly_days?: string[];
387
+ /** Time slots for weekly recurring (required if preset is 'recurring_weekly') */
388
+ weekly_time_slots?: TimeSlot[];
389
+ /** Time slots for daily recurring (required if preset is 'recurring_daily') */
390
+ daily_time_slots?: TimeSlot[];
391
+ /** Attendee limit for group offerings (required if preset is 'simple_group') */
392
+ attendee_limit?: number;
393
+ }
394
+ /**
395
+ * Complete customer information
396
+ */
397
+ export interface Customer {
398
+ id: string | null;
399
+ name: string | null;
400
+ email: string | null;
401
+ phone?: string | null;
402
+ user?: {
403
+ id: string | null;
404
+ } | null;
405
+ }
406
+ /**
407
+ * Parameters for creating a customer
408
+ */
409
+ export interface CreateCustomerParams {
410
+ name?: string | null;
411
+ email?: string | null;
412
+ phone?: string | null;
413
+ userId?: string | null;
414
+ }
415
+ /**
416
+ * Parameters for updating a customer
417
+ */
418
+ export interface UpdateCustomerParams {
419
+ name?: string | null;
420
+ email?: string | null;
421
+ phone?: string | null;
422
+ }
423
+ /**
424
+ * Parameters for listing customers
425
+ */
426
+ export interface ListCustomersParams {
427
+ /** Search term (name/email/phone) */
428
+ q?: string;
429
+ /** Filter by provider ID */
430
+ providerId?: string;
431
+ /** Page number (default: 1) */
432
+ page?: number;
433
+ /** Items per page (default: 50, max: 100) */
434
+ pageSize?: number;
435
+ }
436
+ /**
437
+ * Paginated response for customers list
438
+ */
439
+ export interface ListCustomersResponse {
440
+ page: number;
441
+ pageSize: number;
442
+ total: number;
443
+ totalPages: number;
444
+ customers: Customer[];
445
+ }
446
+ /**
447
+ * Customer booking history response
448
+ */
449
+ export interface CustomerHistoryResponse {
450
+ customer: {
451
+ id: string;
452
+ name: string | null;
453
+ email: string | null;
454
+ };
455
+ analytics: {
456
+ totalBookings: number;
457
+ confirmedBookings: number;
458
+ cancelledBookings: number;
459
+ totalRevenue: number;
460
+ averageBookingValue: number;
461
+ };
462
+ mostRecentBooking: {
463
+ id: string;
464
+ status: string | null;
465
+ start_time: string | null;
466
+ price_cents: number | null;
467
+ } | null;
468
+ favoriteProviders: Array<{
469
+ providerId: string;
470
+ name: string | null;
471
+ count: number;
472
+ }>;
473
+ }
474
+ /**
475
+ * Complete provider information
476
+ */
477
+ export interface Provider {
478
+ id: string;
479
+ name: string | null;
480
+ email?: string | null;
481
+ phone?: string | null;
482
+ created_at?: string | null;
483
+ user_id?: string | null;
484
+ bio?: string | null;
485
+ }
486
+ /**
487
+ * Parameters for creating a provider
488
+ */
489
+ export interface CreateProviderParams {
490
+ name: string;
491
+ email?: string;
492
+ phone?: string;
493
+ userId?: string | null;
494
+ bio?: string;
495
+ externalId?: string;
496
+ }
497
+ /**
498
+ * Parameters for listing providers
499
+ */
500
+ export interface ListProvidersParams {
501
+ /** Search term */
502
+ query?: string;
503
+ /** Page number (default: 1) */
504
+ page?: number;
505
+ /** Items per page (default: 20, max: 100) */
506
+ pageSize?: number;
507
+ }
508
+ /**
509
+ * Calendar event
510
+ */
511
+ export interface CalendarEvent {
512
+ id: string;
513
+ title: string;
514
+ status: string | null;
515
+ notes?: string | null;
516
+ start_time: string | null;
517
+ end_time: string | null;
518
+ offering?: {
519
+ id: string;
520
+ name: string | null;
521
+ } | null;
522
+ attendee_mode?: '1:1' | 'group' | null;
523
+ attendee_limit?: number | null;
524
+ }
525
+ /**
526
+ * Parameters for getting calendar events
527
+ */
528
+ export interface GetCalendarEventsParams {
529
+ /** Filter by provider ID */
530
+ providerId?: string;
531
+ /** Start date (ISO 8601 with timezone) */
532
+ start?: string;
533
+ /** End date (ISO 8601 with timezone) */
534
+ end?: string;
535
+ }
536
+ /**
537
+ * Response for getting calendar events
538
+ */
539
+ export interface GetCalendarEventsResponse {
540
+ bookings: Booking[];
541
+ events: CalendarEvent[];
542
+ }
543
+ /**
544
+ * Parameters for getting revenue analytics
545
+ */
546
+ export interface GetRevenueParams {
547
+ /** Filter by provider ID */
548
+ providerId?: string;
549
+ /** Start date (ISO 8601 datetime) */
550
+ startDate?: string;
551
+ /** End date (ISO 8601 datetime) */
552
+ endDate?: string;
553
+ /** Group by period or entity */
554
+ groupBy?: 'day' | 'week' | 'month' | 'offering' | 'provider';
555
+ }
556
+ /**
557
+ * Revenue analytics response
558
+ */
559
+ export interface RevenueResponse {
560
+ period: {
561
+ startDate: string | null;
562
+ endDate: string | null;
563
+ groupBy: string;
564
+ };
565
+ breakdown: Array<{
566
+ period: string;
567
+ revenue: number;
568
+ } | {
569
+ id: string;
570
+ name: string | null;
571
+ revenue: number;
572
+ count: number;
573
+ }>;
574
+ totalRevenue: number;
575
+ }
576
+ /**
577
+ * Parameters for getting payouts
578
+ */
579
+ export interface GetPayoutsParams {
580
+ /** Filter by provider ID */
581
+ providerId?: string;
582
+ /** Start date (ISO 8601 datetime) */
583
+ startDate?: string;
584
+ /** End date (ISO 8601 datetime) */
585
+ endDate?: string;
586
+ /** Filter by customer ID */
587
+ customerId?: string;
588
+ }
589
+ /**
590
+ * Payouts response
591
+ */
592
+ export interface PayoutsResponse {
593
+ payouts: Array<{
594
+ bookingId: string;
595
+ customerId: string | null;
596
+ amount: number;
597
+ date: string;
598
+ offeringId: string | null;
599
+ }>;
600
+ total: number;
601
+ }
602
+ /**
603
+ * Availability schedule
604
+ */
605
+ export interface AvailabilitySchedule {
606
+ id: string;
607
+ providerId: string;
608
+ name?: string | null;
609
+ timezone?: string | null;
610
+ weekly_hours?: Record<string, Array<{
611
+ start: string;
612
+ end: string;
613
+ }>>;
614
+ recurrence_preset?: string | null;
615
+ recurrence_end_mode?: string | null;
616
+ recurrence_end_date?: string | null;
617
+ recurrence_end_count?: number | null;
618
+ [key: string]: any;
619
+ }
620
+ /**
621
+ * Parameters for getting availability schedules
622
+ */
623
+ export interface GetAvailabilitySchedulesParams {
624
+ /** Filter by provider ID */
625
+ providerId?: string;
626
+ }
627
+ /**
628
+ * Parameters for creating an availability schedule
629
+ */
630
+ export interface CreateAvailabilityScheduleParams {
631
+ /** Provider ID */
632
+ providerId: string;
633
+ /** Schedule name */
634
+ name: string;
635
+ /** Timezone (e.g. America/New_York). Defaults to UTC */
636
+ timezone?: string;
637
+ /** Weekly hours: day key -> array of { start, end } (e.g. "09:00", "17:00") */
638
+ weekly_hours?: Record<string, Array<{
639
+ start: string;
640
+ end: string;
641
+ }>>;
642
+ /** Recurrence pattern: daily | weekly | monthly | yearly. Defaults to weekly */
643
+ recurrence_preset?: 'daily' | 'weekly' | 'monthly' | 'yearly';
644
+ /** When recurrence stops: never | on | after */
645
+ recurrence_end_mode?: 'never' | 'on' | 'after';
646
+ /** End date (ISO) when recurrence_end_mode is 'on' */
647
+ recurrence_end_date?: string | null;
648
+ /** Number of sessions when recurrence_end_mode is 'after' */
649
+ recurrence_end_count?: number | null;
650
+ }
651
+ /**
652
+ * Parameters for updating an availability schedule (all fields optional)
653
+ */
654
+ export interface UpdateAvailabilityScheduleParams {
655
+ /** Schedule name */
656
+ name?: string;
657
+ /** Timezone (e.g. America/New_York) */
658
+ timezone?: string;
659
+ /** Weekly hours: day key -> array of { start, end }; pass null to clear */
660
+ weekly_hours?: Record<string, Array<{
661
+ start: string;
662
+ end: string;
663
+ }>> | null;
664
+ /** Recurrence pattern: daily | weekly | monthly | yearly */
665
+ recurrence_preset?: 'daily' | 'weekly' | 'monthly' | 'yearly';
666
+ /** When recurrence stops: never | on | after */
667
+ recurrence_end_mode?: 'never' | 'on' | 'after';
668
+ /** End date (ISO) when recurrence_end_mode is 'on' */
669
+ recurrence_end_date?: string | null;
670
+ /** Number of sessions when recurrence_end_mode is 'after' */
671
+ recurrence_end_count?: number | null;
672
+ }
673
+ /**
674
+ * Enhanced parameters for getting availability slots
675
+ */
676
+ export interface GetAvailabilitySlotsParams {
677
+ /** Provider ID */
678
+ providerId?: string;
679
+ /** Offering ID */
680
+ offeringId?: string;
681
+ /** Start date (ISO 8601 with timezone) */
682
+ start?: string;
683
+ /** End date (ISO 8601 with timezone) */
684
+ end?: string;
685
+ /** Maximum number of slots to return */
686
+ limit?: number;
687
+ }
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ // packages/sdk/src/types.ts
2
+ export {};