@withaevum/sdk 1.0.0 → 1.2.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.
@@ -1,5 +1,5 @@
1
1
  import { AevumClient } from './client';
2
- import type { GetSlotsParams, GetSlotsResponse, CheckAvailabilityParams, CheckAvailabilityResponse, GetAvailabilitySchedulesParams, AvailabilitySchedule, GetAvailabilitySlotsParams } from './types';
2
+ import type { GetSlotsParams, GetSlotsResponse, CheckAvailabilityParams, CheckAvailabilityResponse, GetAvailabilitySchedulesParams, CreateAvailabilityScheduleParams, UpdateAvailabilityScheduleParams, AvailabilitySchedule, GetAvailabilitySlotsParams } from './types';
3
3
  /**
4
4
  * Availability API methods
5
5
  */
@@ -15,6 +15,22 @@ export declare class AvailabilityAPI {
15
15
  * Get availability schedules
16
16
  */
17
17
  getSchedules(params?: GetAvailabilitySchedulesParams): Promise<AvailabilitySchedule[]>;
18
+ /**
19
+ * Create an availability schedule for a provider
20
+ */
21
+ createSchedule(params: CreateAvailabilityScheduleParams): Promise<AvailabilitySchedule>;
22
+ /**
23
+ * Get a single availability schedule by ID
24
+ */
25
+ getSchedule(scheduleId: string): Promise<AvailabilitySchedule>;
26
+ /**
27
+ * Update an availability schedule (partial update)
28
+ */
29
+ updateSchedule(scheduleId: string, params: UpdateAvailabilityScheduleParams): Promise<AvailabilitySchedule>;
30
+ /**
31
+ * Delete an availability schedule
32
+ */
33
+ deleteSchedule(scheduleId: string): Promise<void>;
18
34
  /**
19
35
  * Check if a specific time slot is available
20
36
  * This is a client-side implementation that uses getSlots()
@@ -75,6 +75,56 @@ export class AvailabilityAPI {
75
75
  throw error;
76
76
  }
77
77
  }
78
+ /**
79
+ * Create an availability schedule for a provider
80
+ */
81
+ async createSchedule(params) {
82
+ return this.client.request('POST', '/api/v1/orgs/{orgId}/availability/schedules', {
83
+ body: {
84
+ providerId: params.providerId,
85
+ name: params.name,
86
+ timezone: params.timezone,
87
+ weekly_hours: params.weekly_hours,
88
+ recurrence_preset: params.recurrence_preset,
89
+ recurrence_end_mode: params.recurrence_end_mode,
90
+ recurrence_end_date: params.recurrence_end_date,
91
+ recurrence_end_count: params.recurrence_end_count,
92
+ },
93
+ });
94
+ }
95
+ /**
96
+ * Get a single availability schedule by ID
97
+ */
98
+ async getSchedule(scheduleId) {
99
+ return this.client.request('GET', `/api/v1/orgs/{orgId}/availability/schedules/${scheduleId}`);
100
+ }
101
+ /**
102
+ * Update an availability schedule (partial update)
103
+ */
104
+ async updateSchedule(scheduleId, params) {
105
+ const body = {};
106
+ if (params.name !== undefined)
107
+ body.name = params.name;
108
+ if (params.timezone !== undefined)
109
+ body.timezone = params.timezone;
110
+ if (params.weekly_hours !== undefined)
111
+ body.weekly_hours = params.weekly_hours;
112
+ if (params.recurrence_preset !== undefined)
113
+ body.recurrence_preset = params.recurrence_preset;
114
+ if (params.recurrence_end_mode !== undefined)
115
+ body.recurrence_end_mode = params.recurrence_end_mode;
116
+ if (params.recurrence_end_date !== undefined)
117
+ body.recurrence_end_date = params.recurrence_end_date;
118
+ if (params.recurrence_end_count !== undefined)
119
+ body.recurrence_end_count = params.recurrence_end_count;
120
+ return this.client.request('PATCH', `/api/v1/orgs/{orgId}/availability/schedules/${scheduleId}`, { body });
121
+ }
122
+ /**
123
+ * Delete an availability schedule
124
+ */
125
+ async deleteSchedule(scheduleId) {
126
+ await this.client.request('DELETE', `/api/v1/orgs/{orgId}/availability/schedules/${scheduleId}`);
127
+ }
78
128
  /**
79
129
  * Check if a specific time slot is available
80
130
  * This is a client-side implementation that uses getSlots()
package/dist/types.d.ts CHANGED
@@ -567,6 +567,14 @@ export interface AvailabilitySchedule {
567
567
  providerId: string;
568
568
  name?: string | null;
569
569
  timezone?: string | null;
570
+ weekly_hours?: Record<string, Array<{
571
+ start: string;
572
+ end: string;
573
+ }>>;
574
+ recurrence_preset?: string | null;
575
+ recurrence_end_mode?: string | null;
576
+ recurrence_end_date?: string | null;
577
+ recurrence_end_count?: number | null;
570
578
  [key: string]: any;
571
579
  }
572
580
  /**
@@ -576,6 +584,52 @@ export interface GetAvailabilitySchedulesParams {
576
584
  /** Filter by provider ID */
577
585
  providerId?: string;
578
586
  }
587
+ /**
588
+ * Parameters for creating an availability schedule
589
+ */
590
+ export interface CreateAvailabilityScheduleParams {
591
+ /** Provider ID */
592
+ providerId: string;
593
+ /** Schedule name */
594
+ name: string;
595
+ /** Timezone (e.g. America/New_York). Defaults to UTC */
596
+ timezone?: string;
597
+ /** Weekly hours: day key -> array of { start, end } (e.g. "09:00", "17:00") */
598
+ weekly_hours?: Record<string, Array<{
599
+ start: string;
600
+ end: string;
601
+ }>>;
602
+ /** Recurrence pattern: daily | weekly | monthly | yearly. Defaults to weekly */
603
+ recurrence_preset?: 'daily' | 'weekly' | 'monthly' | 'yearly';
604
+ /** When recurrence stops: never | on | after */
605
+ recurrence_end_mode?: 'never' | 'on' | 'after';
606
+ /** End date (ISO) when recurrence_end_mode is 'on' */
607
+ recurrence_end_date?: string | null;
608
+ /** Number of sessions when recurrence_end_mode is 'after' */
609
+ recurrence_end_count?: number | null;
610
+ }
611
+ /**
612
+ * Parameters for updating an availability schedule (all fields optional)
613
+ */
614
+ export interface UpdateAvailabilityScheduleParams {
615
+ /** Schedule name */
616
+ name?: string;
617
+ /** Timezone (e.g. America/New_York) */
618
+ timezone?: string;
619
+ /** Weekly hours: day key -> array of { start, end }; pass null to clear */
620
+ weekly_hours?: Record<string, Array<{
621
+ start: string;
622
+ end: string;
623
+ }>> | null;
624
+ /** Recurrence pattern: daily | weekly | monthly | yearly */
625
+ recurrence_preset?: 'daily' | 'weekly' | 'monthly' | 'yearly';
626
+ /** When recurrence stops: never | on | after */
627
+ recurrence_end_mode?: 'never' | 'on' | 'after';
628
+ /** End date (ISO) when recurrence_end_mode is 'on' */
629
+ recurrence_end_date?: string | null;
630
+ /** Number of sessions when recurrence_end_mode is 'after' */
631
+ recurrence_end_count?: number | null;
632
+ }
579
633
  /**
580
634
  * Enhanced parameters for getting availability slots
581
635
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withaevum/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "TypeScript SDK for the Aevum API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",