@jphil/bookwhen-client 0.2.1 → 0.2.3

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 +32 -18
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@jphil/bookwhen-client`
2
2
 
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. Intended for server-side environments. \[wip\]!
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\]!
4
4
 
5
5
  ## Table of Contents
6
6
 
@@ -20,7 +20,7 @@ You'll likely be at least somewhat familiar with the [Bookwhen](https://www.book
20
20
  ## Features
21
21
 
22
22
  - Provides an easy way to pull your data from Bookwhen for NodeJS environments
23
- - 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
24
24
 
25
25
  ## Installation
26
26
 
@@ -32,31 +32,45 @@ pnpm add @jphil/bookwhen-client
32
32
 
33
33
  ## Usage
34
34
 
35
- !N.B. this usage structure may change as I progress towards a 1.0.0
36
-
37
35
  ```typescript
38
36
  // import the client factory
39
37
  import { createBookwhenClient } from '@jphil/bookwhen-client';
40
38
 
41
- // create the client (optional debug param to get requests logged to console)
42
- const client = createBookwhenClient({ apiKey: 'your-API-key'[, debug = true]});
39
+ // create the client
40
+ const client = createBookwhenClient({
41
+ apiKey: 'your-API-key',
42
+ debug: true // Optional: enables request logging
43
+ });
43
44
 
44
- // use events Service method to get a single event
45
- const event = client.events.getById({eventId: 'some-id'});
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
+ });
46
50
 
47
51
  // get all events
48
- const events = client.events.getMultiple();
52
+ const events = await client.events.getMultiple();
49
53
 
50
- // get all events in 2025
51
- const events_2025 = client.events.getMultiple({
52
- filters: [
54
+ // get all events in 2025 tagged with 'workshop'
55
+ const events_2025 = await client.events.getMultiple({
56
+ filters: { // Optional: filter by various
53
57
  from: '20250101',
54
- to: '20251231'
55
- ]
58
+ to: '20251231',
59
+ tag: ['workshop']
60
+ },
61
+ includes: ['location'] // Optional: Include related resources
56
62
  });
57
63
 
58
64
  ```
59
65
 
66
+ (N.B. Ensure you wrap the above statements in try/catch blocks to catch errors which could be thrown)
67
+
68
+ 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)
69
+
70
+ Services for the other models in the API are in the pipeline.
71
+
72
+ N.B. This library is still a pre-1.0.0 WIP, please use accordingly!
73
+
60
74
  ## Configuration
61
75
 
62
76
  Required configuration options:
@@ -73,14 +87,14 @@ Please see the docs in the CONTRIBUTIONS.md file, thanks!
73
87
 
74
88
  ## Roadmap
75
89
 
76
- - Keep up with any future changes or additions to the [Bookwhen API](https://api.bookwhen.com/v2), additions will be driven mainly by this.
77
- - 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).
78
92
 
79
93
  ### Todos
94
+
95
+ - [] create e2e test suite with github action workflow
80
96
  - [] put Zod in place in more areas to strengthen runtime type guards
81
- - [] flesh out e2e tests
82
97
  - [] write services for the other models in the API
83
- - [] create e2e test github action workflow
84
98
 
85
99
  ## License
86
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jphil/bookwhen-client",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "dist/index.js",