@medalsocial/sdk 1.8.0 → 1.9.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.
package/README.md CHANGED
@@ -272,6 +272,29 @@ if (summary.can_reschedule) {
272
272
 
273
273
  `update(id, input)` requires at least one of `notes` / `internal_notes`; `update(id, {})` is a compile error, matching the API's own 400.
274
274
 
275
+ #### Persons, relations and events
276
+
277
+ `medal.bookings.persons` are the children, pets, or employees a contact books for — no login of their own. `medal.bookings.relations` links two contacts directionally (guardian, employer, partner, and so on). `medal.bookings.events` are arrangementer — scheduled group sessions bookings register against; registering a booking *to* an event ships in a later release, so this is a read/create surface today.
278
+
279
+ ```ts
280
+ // Persons a contact books for (active-only unless include_inactive)
281
+ const { data: persons } = await medal.bookings.persons.list(contact.id);
282
+
283
+ // Add a person under a contact
284
+ const { data: person } = await medal.bookings.persons.create({
285
+ contact_id: contact.id,
286
+ name: 'Ola',
287
+ birth_year: 2018,
288
+ relation_type: 'guardian',
289
+ });
290
+
291
+ // Events in a date range (yyyy-mm-dd, inclusive) — one month
292
+ const { data: events } = await medal.bookings.events.list({
293
+ from: '2026-09-01',
294
+ to: '2026-09-30',
295
+ });
296
+ ```
297
+
275
298
  ### Customer portal
276
299
 
277
300
  Self-service for the workspace's own customers: they sign in with an e-mailed one-time code, then see and change their profile, list their bookings, export their data, or erase their account. The API key needs `read:portal` and `write:portal`.
@@ -291,6 +314,8 @@ const { data: session } = await medal.portal.login.verify({ email: 'ida@example.
291
314
 
292
315
  // 3. Session-bound calls, from your server, with the token read back from the cookie
293
316
  const { data: me } = await medal.portal.me(session.session_token);
317
+ // me.persons (the contact's bookings.persons) and me.labels (the workspace's own
318
+ // words for the person concept, e.g. { person: 'Barn', persons: 'Barn' }) are new
294
319
  const { data: bookings } = await medal.portal.myBookings(session.session_token);
295
320
  // bookings.upcoming[i].manage_token is set while the booking is still manageable —
296
321
  // it opens your site's manage page (medal.bookings.manage.*); past bookings carry null