@jphil/bookwhen-client 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +40 -17
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # `@jphil/bookwhen-client`
2
2
 
3
- \[wip\]!
4
-
5
- An API client library for the [Bookwhen](https://www.bookwhen.com) booking platform [API (v2)](https://api.bookwhen.com/v2), written in Typescript for NodeJS. Intended for server-side environments.
3
+ An API client library for the [Bookwhen](https://www.bookwhen.com) booking platform [API (v2)](https://api.bookwhen.com/v2), written in Typescript for NodeJS. \[wip\]!
6
4
 
7
5
  ## Table of Contents
8
6
 
@@ -22,7 +20,7 @@ You'll likely be at least somewhat familiar with the [Bookwhen](https://www.book
22
20
  ## Features
23
21
 
24
22
  - Provides an easy way to pull your data from Bookwhen for NodeJS environments
25
- - Provides fully typed methods for each model (so far just the events model) in the Bookwhen API v2
23
+ - Provides fully typed methods for each model (so far just the Events model) provided in the Bookwhen API v2
26
24
 
27
25
  ## Installation
28
26
 
@@ -34,18 +32,43 @@ pnpm add @jphil/bookwhen-client
34
32
 
35
33
  ## Usage
36
34
 
37
- !N.B. this usage structure may change as I progress towards a 1.0.0
38
-
39
35
  ```typescript
40
- import { createBookwhenClient } from 'bookwhen-client';
36
+ // import the client factory
37
+ import { createBookwhenClient } from '@jphil/bookwhen-client';
38
+
39
+ // create the client
40
+ const client = createBookwhenClient({
41
+ apiKey: 'your-API-key',
42
+ debug: true // Optional: enables request logging
43
+ });
44
+
45
+ // Get a single event
46
+ const event = await client.events.getById({
47
+ eventId: 'some-id',
48
+ includes: ['location', 'tickets'] // Optional: include related resources
49
+ });
41
50
 
42
- const client = createBookwhenClient(YOUR_API_KEY)
43
- const event = client.event.getByID({myEventId});
44
- const events = client.event.getMultiple({
45
- filters: ["filter1", "filter2"]
46
- includes: ["inc1", "inc2"]
51
+ // get all events
52
+ const events = await client.events.getMultiple();
53
+
54
+ // get all events in 2025 tagged with 'workshop'
55
+ const events_2025 = await client.events.getMultiple({
56
+ filters: { // Optional: filter by various
57
+ from: '20250101',
58
+ to: '20251231',
59
+ tag: ['workshop']
60
+ },
61
+ includes: ['location'] // Optional: Include related resources
47
62
  });
48
63
 
64
+ (N.B. Ensure you wrap the above statements in try/catch blocks to catch errors which could be thrown)
65
+
66
+ Valid filters and includes for each method are detailed in the [API v2 docs](https://petstore.swagger.io/?url=https://api.bookwhen.com/v2/openapi.yaml)
67
+
68
+ Services for the other models in the API are in the pipeline.
69
+
70
+ N.B. This library is still a pre-1.0.0 WIP, please use accordingly!
71
+
49
72
  ```
50
73
 
51
74
  ## Configuration
@@ -64,14 +87,14 @@ Please see the docs in the CONTRIBUTIONS.md file, thanks!
64
87
 
65
88
  ## Roadmap
66
89
 
67
- - Keep up with any future changes or additions to the [Bookwhen API](https://api.bookwhen.com/v2), additions will be driven mainly by this.
68
- - Possibly add a "fields" param to service methods to allow response filtering
90
+ - Proceed towards a 1.0.0 with community feedback.
91
+ - Keep up with any future changes or additions to the [Bookwhen API](https://api.bookwhen.com/v2).
69
92
 
70
93
  ### Todos
94
+
95
+ - [] create e2e test suite with github action workflow
71
96
  - [] put Zod in place in more areas to strengthen runtime type guards
72
- - [] refine error handling
73
- - [] write more integration tests
74
- - [] write services for the other integrations
97
+ - [] write services for the other models in the API
75
98
 
76
99
  ## License
77
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jphil/bookwhen-client",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "dist/index.js",