@resira/sdk 0.4.6 → 0.4.8
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/CHANGELOG.md +60 -51
- package/README.md +210 -210
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -5
- package/dist/index.d.ts +93 -5
- package/dist/index.js.map +1 -1
- package/package.json +47 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,52 +1,61 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable SDK and public API tracking updates are documented here.
|
|
4
|
-
|
|
5
|
-
## 0.
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- Added
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- Added
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
## 0.
|
|
51
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable SDK and public API tracking updates are documented here.
|
|
4
|
+
|
|
5
|
+
## 0.4.8
|
|
6
|
+
|
|
7
|
+
- Added `ProductCategory` type for category-grouped product display.
|
|
8
|
+
- Updated `ProductListResponse` with optional `categories` array.
|
|
9
|
+
- Added category grouping fields to `Product`: `category`, `categoryName`, `categorySortOrder`, `categoryDescription`, `categoryColor`.
|
|
10
|
+
- Added new display metadata fields to `Product`: `includesChampagne`, `departureTimes`, `driverMinAge`, `licenceRestriction`, `fuelIncludedMaxMinutes`.
|
|
11
|
+
- Added `ProductImage` type for multi-image product galleries.
|
|
12
|
+
- Added `images` field to `Product` for ordered image galleries with display settings.
|
|
13
|
+
|
|
14
|
+
## 0.3.1
|
|
15
|
+
|
|
16
|
+
- Removed client-side 50/50 origin selection, sticky routing, and browser storage writes.
|
|
17
|
+
- Defaulted production routing to a single deterministic API origin for server-side balancing setups.
|
|
18
|
+
- Kept `baseUrl` and ordered `baseUrls` support for explicit override/failover control.
|
|
19
|
+
- Added `getBaseUrl()` on the SDK client for easier inspection/debugging.
|
|
20
|
+
|
|
21
|
+
## 0.3.0
|
|
22
|
+
|
|
23
|
+
- Added `Dish`, `DishModel`, `DishResponse`, and `DishListResponse` types for 3D model / AR dish data.
|
|
24
|
+
- Added `listDishes()` method to fetch all dishes with 3D model URLs for the organisation.
|
|
25
|
+
- Added `getDish(dishId)` method to fetch a single dish by ID.
|
|
26
|
+
- New public endpoints: `GET /v1/public/dishes` and `GET /v1/public/dishes/:id`.
|
|
27
|
+
|
|
28
|
+
## 0.2.7
|
|
29
|
+
|
|
30
|
+
- Updated SDK routing to ignore ambient host-app env API overrides by default.
|
|
31
|
+
- Kept explicit `baseUrl` and `baseUrls` support for integrator-controlled routing.
|
|
32
|
+
- Added DOM libs to the SDK package tsconfig so standalone typechecking passes cleanly.
|
|
33
|
+
|
|
34
|
+
## 0.2.5
|
|
35
|
+
|
|
36
|
+
- Added weighted-origin session stickiness so a browser session stays pinned to the same API origin instead of re-randomizing on every request.
|
|
37
|
+
- Added lightweight client-side routing telemetry helpers for monitoring origin assignments during rollout.
|
|
38
|
+
|
|
39
|
+
## 0.2.3
|
|
40
|
+
|
|
41
|
+
- Current workspace release for the public reservation API package.
|
|
42
|
+
- Tracks the typed payment intent, payment confirmation, promo-code validation, product catalog, and product-availability flows exposed by the SDK.
|
|
43
|
+
- Keeps the SDK aligned with the current `v1/public` endpoints plus reservation creation via `v2/api/reservations`.
|
|
44
|
+
|
|
45
|
+
## 0.2.1
|
|
46
|
+
|
|
47
|
+
- Published package update after the initial TypeScript SDK rollout.
|
|
48
|
+
- Stabilized the package metadata for the public reservation API client.
|
|
49
|
+
|
|
50
|
+
## 0.2.0
|
|
51
|
+
|
|
52
|
+
- Introduced the first public TypeScript SDK for Resira reservations.
|
|
53
|
+
- Added typed availability, reservation creation, reservation lookup, and retry-aware error handling.
|
|
54
|
+
|
|
55
|
+
## 0.1.1
|
|
56
|
+
|
|
57
|
+
- Internal follow-up release used to align the early SDK package with the UI package work.
|
|
58
|
+
|
|
59
|
+
## 0.1.0
|
|
60
|
+
|
|
52
61
|
- Initial SDK package scaffold.
|
package/README.md
CHANGED
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
# @resira/sdk v0.3.1
|
|
2
|
-
|
|
3
|
-
TypeScript SDK for the Resira public reservation API.
|
|
4
|
-
|
|
5
|
-
Version history lives in [CHANGELOG.md](./CHANGELOG.md).
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @resira/sdk@0.3.1
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Quick start
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { Resira } from "@resira/sdk";
|
|
17
|
-
|
|
18
|
-
const resira = new Resira({
|
|
19
|
-
apiKey: "resira_live_your_api_key_here",
|
|
20
|
-
});
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Client config
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
const resira = new Resira({
|
|
27
|
-
apiKey: "resira_live_your_api_key_here",
|
|
28
|
-
maxRetries: 3,
|
|
29
|
-
retryBaseDelay: 500,
|
|
30
|
-
});
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
| Option | Type | Default | Description |
|
|
34
|
-
| --- | --- | --- | --- |
|
|
35
|
-
| `apiKey` | `string` | required | Public Resira API key |
|
|
36
|
-
| `baseUrl` | `string` | unset | Pin all SDK requests to one origin |
|
|
37
|
-
| `baseUrls` | `Array<string \| { url: string; weight?: number }>` | unset | Ordered fallback origin list; first valid origin is used |
|
|
38
|
-
| `maxRetries` | `number` | `3` | Retry attempts for 429 and 5xx responses |
|
|
39
|
-
| `retryBaseDelay` | `number` | `500` | Base exponential backoff delay in ms |
|
|
40
|
-
| `fetch` | `typeof fetch` | `globalThis.fetch` | Custom fetch implementation |
|
|
41
|
-
|
|
42
|
-
## Routing behavior
|
|
43
|
-
|
|
44
|
-
- The SDK no longer performs client-side 50/50 routing or writes routing state into browser storage.
|
|
45
|
-
- Only explicit SDK config via `baseUrl` or `baseUrls` overrides the default routing behavior.
|
|
46
|
-
- `baseUrls` is treated as an ordered fallback list; the first valid origin is used.
|
|
47
|
-
- In development, the SDK defaults to `http://localhost:3001`.
|
|
48
|
-
- In production, the SDK defaults to `https://api.resira.app`.
|
|
49
|
-
|
|
50
|
-
## Core methods
|
|
51
|
-
|
|
52
|
-
### `resira.getConfig()`
|
|
53
|
-
|
|
54
|
-
Fetch non-sensitive public property config such as Stripe publishable key, deposit percentage, currency, and branding.
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
const config = await resira.getConfig();
|
|
58
|
-
console.log(config.stripePublishableKey);
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### `resira.validatePromoCode(code)`
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
const promo = await resira.validatePromoCode("SUMMER20");
|
|
65
|
-
if (promo.valid) {
|
|
66
|
-
console.log(promo.discountType, promo.discountValue);
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### `resira.getAvailability(resourceId, params?)`
|
|
71
|
-
|
|
72
|
-
```ts
|
|
73
|
-
const availability = await resira.getAvailability("prop-1", {
|
|
74
|
-
startDate: "2026-07-01",
|
|
75
|
-
endDate: "2026-07-07",
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
const slots = await resira.getAvailability("table-5", {
|
|
81
|
-
date: "2026-07-01",
|
|
82
|
-
partySize: 4,
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### `resira.listResources()`
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
const { resources } = await resira.listResources();
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### `resira.listProducts()`
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
const { products } = await resira.listProducts();
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### `resira.listDishes()`
|
|
99
|
-
|
|
100
|
-
Fetch all dishes with 3D model data for the organisation.
|
|
101
|
-
|
|
102
|
-
```ts
|
|
103
|
-
const { dishes } = await resira.listDishes();
|
|
104
|
-
dishes.forEach((dish) => {
|
|
105
|
-
console.log(dish.name, dish.model?.glbUrl);
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### `resira.getDish(dishId)`
|
|
110
|
-
|
|
111
|
-
Fetch a single dish by ID.
|
|
112
|
-
|
|
113
|
-
```ts
|
|
114
|
-
const { dish } = await resira.getDish("dish-uuid");
|
|
115
|
-
console.log(dish.name, dish.model?.glbUrl, dish.model?.usdzUrl);
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### `resira.createPaymentIntent(payload, options?)`
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
const paymentIntent = await resira.createPaymentIntent({
|
|
122
|
-
productId: "prod-123",
|
|
123
|
-
resourceId: "res-456",
|
|
124
|
-
partySize: 2,
|
|
125
|
-
startDate: "2026-07-01",
|
|
126
|
-
startTime: "2026-07-01T10:00:00Z",
|
|
127
|
-
endTime: "2026-07-01T11:00:00Z",
|
|
128
|
-
guestName: "Jane Doe",
|
|
129
|
-
guestEmail: "jane@example.com",
|
|
130
|
-
});
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### `resira.confirmPayment(payload)`
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
const confirmation = await resira.confirmPayment({
|
|
137
|
-
paymentIntentId: "pi_xxx",
|
|
138
|
-
reservationId: "res_123",
|
|
139
|
-
});
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### `resira.createReservation(payload, options?)`
|
|
143
|
-
|
|
144
|
-
Creates a reservation via the public booking flow. An idempotency key is automatically generated unless you pass one explicitly.
|
|
145
|
-
|
|
146
|
-
```ts
|
|
147
|
-
const { reservation } = await resira.createReservation({
|
|
148
|
-
resourceId: "prop-1",
|
|
149
|
-
guestName: "Jane Doe",
|
|
150
|
-
guestEmail: "jane@example.com",
|
|
151
|
-
startDate: "2026-07-01",
|
|
152
|
-
endDate: "2026-07-07",
|
|
153
|
-
partySize: 3,
|
|
154
|
-
});
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### `resira.listReservations(resourceId, params?)`
|
|
158
|
-
|
|
159
|
-
```ts
|
|
160
|
-
const page = await resira.listReservations("prop-1", {
|
|
161
|
-
status: "confirmed",
|
|
162
|
-
page: 1,
|
|
163
|
-
limit: 50,
|
|
164
|
-
});
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### `resira.getReservation(resourceId, reservationId)`
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
const result = await resira.getReservation("prop-1", "res-uuid");
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Error handling
|
|
174
|
-
|
|
175
|
-
All SDK errors extend `ResiraError`.
|
|
176
|
-
|
|
177
|
-
```ts
|
|
178
|
-
import {
|
|
179
|
-
ResiraApiError,
|
|
180
|
-
ResiraNetworkError,
|
|
181
|
-
ResiraRateLimitError,
|
|
182
|
-
} from "@resira/sdk";
|
|
183
|
-
|
|
184
|
-
try {
|
|
185
|
-
await resira.createReservation(payload);
|
|
186
|
-
} catch (error) {
|
|
187
|
-
if (error instanceof ResiraRateLimitError) {
|
|
188
|
-
console.log(error.retryAfter);
|
|
189
|
-
} else if (error instanceof ResiraApiError) {
|
|
190
|
-
console.log(error.status, error.message);
|
|
191
|
-
} else if (error instanceof ResiraNetworkError) {
|
|
192
|
-
console.log(error.message);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
| Error class | Meaning |
|
|
198
|
-
| --- | --- |
|
|
199
|
-
| `ResiraRateLimitError` | 429 response after retry handling |
|
|
200
|
-
| `ResiraApiError` | Non-2xx API response |
|
|
201
|
-
| `ResiraNetworkError` | Network/DNS/TLS failure |
|
|
202
|
-
|
|
203
|
-
## Requirements
|
|
204
|
-
|
|
205
|
-
- Node.js >= 18
|
|
206
|
-
- No runtime dependencies
|
|
207
|
-
|
|
208
|
-
## Release notes
|
|
209
|
-
|
|
210
|
-
See [CHANGELOG.md](./CHANGELOG.md) for release-by-release details.
|
|
1
|
+
# @resira/sdk v0.3.1
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the Resira public reservation API.
|
|
4
|
+
|
|
5
|
+
Version history lives in [CHANGELOG.md](./CHANGELOG.md).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @resira/sdk@0.3.1
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Resira } from "@resira/sdk";
|
|
17
|
+
|
|
18
|
+
const resira = new Resira({
|
|
19
|
+
apiKey: "resira_live_your_api_key_here",
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Client config
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const resira = new Resira({
|
|
27
|
+
apiKey: "resira_live_your_api_key_here",
|
|
28
|
+
maxRetries: 3,
|
|
29
|
+
retryBaseDelay: 500,
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
| Option | Type | Default | Description |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| `apiKey` | `string` | required | Public Resira API key |
|
|
36
|
+
| `baseUrl` | `string` | unset | Pin all SDK requests to one origin |
|
|
37
|
+
| `baseUrls` | `Array<string \| { url: string; weight?: number }>` | unset | Ordered fallback origin list; first valid origin is used |
|
|
38
|
+
| `maxRetries` | `number` | `3` | Retry attempts for 429 and 5xx responses |
|
|
39
|
+
| `retryBaseDelay` | `number` | `500` | Base exponential backoff delay in ms |
|
|
40
|
+
| `fetch` | `typeof fetch` | `globalThis.fetch` | Custom fetch implementation |
|
|
41
|
+
|
|
42
|
+
## Routing behavior
|
|
43
|
+
|
|
44
|
+
- The SDK no longer performs client-side 50/50 routing or writes routing state into browser storage.
|
|
45
|
+
- Only explicit SDK config via `baseUrl` or `baseUrls` overrides the default routing behavior.
|
|
46
|
+
- `baseUrls` is treated as an ordered fallback list; the first valid origin is used.
|
|
47
|
+
- In development, the SDK defaults to `http://localhost:3001`.
|
|
48
|
+
- In production, the SDK defaults to `https://api.resira.app`.
|
|
49
|
+
|
|
50
|
+
## Core methods
|
|
51
|
+
|
|
52
|
+
### `resira.getConfig()`
|
|
53
|
+
|
|
54
|
+
Fetch non-sensitive public property config such as Stripe publishable key, deposit percentage, currency, and branding.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const config = await resira.getConfig();
|
|
58
|
+
console.log(config.stripePublishableKey);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `resira.validatePromoCode(code)`
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const promo = await resira.validatePromoCode("SUMMER20");
|
|
65
|
+
if (promo.valid) {
|
|
66
|
+
console.log(promo.discountType, promo.discountValue);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### `resira.getAvailability(resourceId, params?)`
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
const availability = await resira.getAvailability("prop-1", {
|
|
74
|
+
startDate: "2026-07-01",
|
|
75
|
+
endDate: "2026-07-07",
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
const slots = await resira.getAvailability("table-5", {
|
|
81
|
+
date: "2026-07-01",
|
|
82
|
+
partySize: 4,
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### `resira.listResources()`
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
const { resources } = await resira.listResources();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### `resira.listProducts()`
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const { products } = await resira.listProducts();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `resira.listDishes()`
|
|
99
|
+
|
|
100
|
+
Fetch all dishes with 3D model data for the organisation.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
const { dishes } = await resira.listDishes();
|
|
104
|
+
dishes.forEach((dish) => {
|
|
105
|
+
console.log(dish.name, dish.model?.glbUrl);
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `resira.getDish(dishId)`
|
|
110
|
+
|
|
111
|
+
Fetch a single dish by ID.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
const { dish } = await resira.getDish("dish-uuid");
|
|
115
|
+
console.log(dish.name, dish.model?.glbUrl, dish.model?.usdzUrl);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### `resira.createPaymentIntent(payload, options?)`
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
const paymentIntent = await resira.createPaymentIntent({
|
|
122
|
+
productId: "prod-123",
|
|
123
|
+
resourceId: "res-456",
|
|
124
|
+
partySize: 2,
|
|
125
|
+
startDate: "2026-07-01",
|
|
126
|
+
startTime: "2026-07-01T10:00:00Z",
|
|
127
|
+
endTime: "2026-07-01T11:00:00Z",
|
|
128
|
+
guestName: "Jane Doe",
|
|
129
|
+
guestEmail: "jane@example.com",
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `resira.confirmPayment(payload)`
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
const confirmation = await resira.confirmPayment({
|
|
137
|
+
paymentIntentId: "pi_xxx",
|
|
138
|
+
reservationId: "res_123",
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `resira.createReservation(payload, options?)`
|
|
143
|
+
|
|
144
|
+
Creates a reservation via the public booking flow. An idempotency key is automatically generated unless you pass one explicitly.
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
const { reservation } = await resira.createReservation({
|
|
148
|
+
resourceId: "prop-1",
|
|
149
|
+
guestName: "Jane Doe",
|
|
150
|
+
guestEmail: "jane@example.com",
|
|
151
|
+
startDate: "2026-07-01",
|
|
152
|
+
endDate: "2026-07-07",
|
|
153
|
+
partySize: 3,
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### `resira.listReservations(resourceId, params?)`
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
const page = await resira.listReservations("prop-1", {
|
|
161
|
+
status: "confirmed",
|
|
162
|
+
page: 1,
|
|
163
|
+
limit: 50,
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### `resira.getReservation(resourceId, reservationId)`
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
const result = await resira.getReservation("prop-1", "res-uuid");
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Error handling
|
|
174
|
+
|
|
175
|
+
All SDK errors extend `ResiraError`.
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
import {
|
|
179
|
+
ResiraApiError,
|
|
180
|
+
ResiraNetworkError,
|
|
181
|
+
ResiraRateLimitError,
|
|
182
|
+
} from "@resira/sdk";
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
await resira.createReservation(payload);
|
|
186
|
+
} catch (error) {
|
|
187
|
+
if (error instanceof ResiraRateLimitError) {
|
|
188
|
+
console.log(error.retryAfter);
|
|
189
|
+
} else if (error instanceof ResiraApiError) {
|
|
190
|
+
console.log(error.status, error.message);
|
|
191
|
+
} else if (error instanceof ResiraNetworkError) {
|
|
192
|
+
console.log(error.message);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
| Error class | Meaning |
|
|
198
|
+
| --- | --- |
|
|
199
|
+
| `ResiraRateLimitError` | 429 response after retry handling |
|
|
200
|
+
| `ResiraApiError` | Non-2xx API response |
|
|
201
|
+
| `ResiraNetworkError` | Network/DNS/TLS failure |
|
|
202
|
+
|
|
203
|
+
## Requirements
|
|
204
|
+
|
|
205
|
+
- Node.js >= 18
|
|
206
|
+
- No runtime dependencies
|
|
207
|
+
|
|
208
|
+
## Release notes
|
|
209
|
+
|
|
210
|
+
See [CHANGELOG.md](./CHANGELOG.md) for release-by-release details.
|