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