@skilder-ai/smoobu 0.1.1 → 0.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.
package/README.md CHANGED
@@ -6,8 +6,8 @@ Typed TypeScript client for the [Smoobu API](https://docs.smoobu.com/).
6
6
  nonce on every retry.
7
7
  - **Validated responses** (zod). Smoobu's documentation and its real payloads differ, and the
8
8
  schemas accept the real ones.
9
- - **Clean domain model**: `Message`, `ConversationSummary`, and one page envelope everywhere
10
- (`items/page/pageSize/pageCount/total`).
9
+ - **Clean domain model**: `Property`, `Reservation`, `Guest`, `Message`, `ConversationSummary`,
10
+ and one page envelope everywhere (`items/page/pageSize/pageCount/total`).
11
11
  - **Robust transport**: timeouts, and retries on 429/5xx/network errors for GET requests only.
12
12
  Rate-limit waits follow Smoobu's reset time.
13
13
  - **Typed errors**: `SmoobuApiError` carries `status`, `code`
@@ -21,7 +21,7 @@ npm install @skilder-ai/smoobu zod
21
21
  ```
22
22
 
23
23
  ```ts
24
- import { Smoobu, SmoobuApiError } from '@skilder-ai/smoobu';
24
+ import { paginate, Smoobu, SmoobuApiError } from '@skilder-ai/smoobu';
25
25
 
26
26
  const smoobu = new Smoobu({
27
27
  apiKey: process.env.SMOOBU_API_KEY!,
@@ -29,6 +29,17 @@ const smoobu = new Smoobu({
29
29
  });
30
30
 
31
31
  const account = await smoobu.getAccount();
32
+
33
+ const properties = await smoobu.properties.list(); // [{ id, name }]
34
+ const chalet = await smoobu.properties.get(properties[0].id); // location, timeZone, capacity…
35
+ const staying = await smoobu.reservations.list({ stayFrom: '2026-12-24', stayTo: '2026-12-24' });
36
+ const booking = await smoobu.reservations.get(123456789); // status, stay, guest, notes, payment
37
+ const guest = await smoobu.guests.get(booking.guest.id!); // needs "Guest Data (PII)"
38
+
39
+ for await (const r of paginate((page) => smoobu.reservations.list({ page, pageSize: 100 }))) {
40
+ /* every reservation */
41
+ }
42
+
32
43
  const conversations = await smoobu.messages.listConversations({ pageSize: 20 });
33
44
  const thread = await smoobu.messages.list(123456789);
34
45
  await smoobu.messages.send({ reservationId: 123456789, body: 'Welcome!', audience: 'guest' });
@@ -56,3 +67,9 @@ endpoint and returns raw `wire` types.
56
67
  - Without the key's **"Guest Data (PII)"** permission, guest names and message bodies come back as
57
68
  empty strings.
58
69
  - Sending returns no message id.
70
+ - Reservation filters: `from`/`to` select stays overlapping the range; `arrivalFrom` and
71
+ `modifiedFrom` are camelCase but `created_from` is snake_case. A `pageSize` above 100 silently
72
+ falls back to 25, so the client rejects it.
73
+ - Bookings mix hyphenated keys (`guest-name`), `"Yes"`/`"No"` strings and minute-precision dates.
74
+ `Reservation` normalises them, and derives `status` (`confirmed | modified | cancelled | blocked`).
75
+ - `/api/guests` answers 403 without the "Guest Data (PII)" permission.