@blazeo.com/calendar-client 1.0.0 → 1.0.2

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/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @blazeo.com/calendar-client
2
+
3
+ **Private package** – for Blazeo internal teams only. TypeScript/JavaScript client for the Blazeo Calendar / Appointment API. Use it in React (or any JS app) to call calendar and event endpoints, with optional MobX State Tree models.
4
+
5
+ ## Install
6
+
7
+ From your npm registry (internal teams; ensure you're logged in to the scope):
8
+
9
+ ```bash
10
+ npm install @blazeo.com/calendar-client
11
+ ```
12
+
13
+ Or link locally:
14
+
15
+ ```bash
16
+ cd calendar-client && npm run build && npm link
17
+ cd your-app && npm link @blazeo.com/calendar-client
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```ts
23
+ import { AppointmentClient } from '@blazeo.com/calendar-client';
24
+
25
+ const client = new AppointmentClient({
26
+ baseUrl: 'https://your-appointment-api.example.com',
27
+ getDefaultOffset: () => new Date().getTimezoneOffset(), // optional
28
+ });
29
+
30
+ // Get calendar
31
+ const cal = await client.getCalendar('calendar-guid');
32
+ if (cal.status === 'success' && cal.data) {
33
+ console.log(cal.data.name);
34
+ }
35
+
36
+ // Get availability for a day (optional participant_id)
37
+ const slots = await client.getAvailability({
38
+ calendarId: 'calendar-guid',
39
+ participantId: 'participant-guid', // optional
40
+ year: 2026,
41
+ month: 2,
42
+ day: 15,
43
+ offset: new Date().getTimezoneOffset(),
44
+ });
45
+
46
+ // Create event (flexible input – snake_case or camelCase)
47
+ const created = await client.createEvent({
48
+ calendarId: 'calendar-guid',
49
+ visitor_email: 'visitor@example.com',
50
+ visitor_name: 'Jane',
51
+ start_date: '2026-02-15',
52
+ startTime: '14:30',
53
+ }, new Date().getTimezoneOffset());
54
+ ```
55
+
56
+ ## MobX State Tree models
57
+
58
+ The package also exports MST models (`CalendarModel`, `EventModel`, `RootStore`, etc.). Create a store with your API client in env:
59
+
60
+ ```ts
61
+ import { AppointmentClient, RootStore } from '@blazeo.com/calendar-client';
62
+
63
+ const api = new AppointmentClient({ baseUrl: 'https://...' });
64
+ const store = RootStore.create({}, { env: { api } });
65
+
66
+ const cal = store.addCalendar({ calendarId: 'my-cal', name: 'My Calendar' });
67
+ await cal.create(); // POST to backend
68
+ ```
69
+
70
+ ## API overview
71
+
72
+ - **Event:** `getEvent`, `getAvailability`, `getDaySelectable`, `getEarliestAvailableDays`, `getExistingEventsByVisitorEmail`, `getExistingEventsByVisitorPhone`, `createEvent`, `cancelEvent`, `getCancellable`, `getRoundRobinParticipant`, `setAttendeeStatus`, `setEventReminder`
73
+ - **Calendar:** `getCalendar`, `createCalendar`, `removeCalendar`, `getCalendarsByCompany`, `getTimeZones`, `getTimeZone`
74
+
75
+ All methods return `Promise<ApiResponse<T>>`. Check `response.status === 'success'` and use `response.data`. On failure, `response.message` contains the error.
76
+
77
+ ## Sample
78
+
79
+ See the `sample` folder for a minimal React app that uses this package.