@spoketech/hub-client 0.1.9 → 0.1.11
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 +26 -2
- package/dist/index.d.ts +11656 -6561
- package/dist/index.js +309 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ if (guestsError !== null) {
|
|
|
82
82
|
|
|
83
83
|
## Live Onsite Resource Calls
|
|
84
84
|
|
|
85
|
-
For member-source and
|
|
85
|
+
For member-source, voucher, and POS points operations that must run from the venue network, use the onsite resource wrapper. It dispatches the command and waits briefly for the onsite client to complete it. If the onsite client takes longer than `waitMs`, the response includes the accepted command so callers can continue polling or observe webhooks.
|
|
86
86
|
|
|
87
87
|
```ts
|
|
88
88
|
import { makePromiseOnsiteResourceClient } from "@spoketech/hub-client";
|
|
@@ -121,6 +121,19 @@ const [voucher, voucherError] = await client.vouchers.issue({
|
|
|
121
121
|
if (voucherError !== null) {
|
|
122
122
|
throw voucherError;
|
|
123
123
|
}
|
|
124
|
+
|
|
125
|
+
const [points, pointsError] = await client.points.redeem({
|
|
126
|
+
organizationId: "org_123",
|
|
127
|
+
waitMs: 10_000,
|
|
128
|
+
payload: {
|
|
129
|
+
cardData: "2001378",
|
|
130
|
+
amount: 10,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (pointsError !== null) {
|
|
135
|
+
throw pointsError;
|
|
136
|
+
}
|
|
124
137
|
```
|
|
125
138
|
|
|
126
139
|
The full Spoke client exposes the same live onsite wrapper under `client.onsite`:
|
|
@@ -247,11 +260,22 @@ All routes below are relative to `/api/v1`. The promise client and the Effect cl
|
|
|
247
260
|
| `client.vouchers.pollOnsiteVoucherCommand({ path })` | `POST /organizations/:organizationId/onsite-voucher-commands/poll` | `path.organizationId` | `OnsiteVoucherCommand \| null` |
|
|
248
261
|
| `client.vouchers.completeOnsiteVoucherCommand({ path, payload })` | `POST /organizations/:organizationId/onsite-voucher-commands/:commandId/complete` | `path.organizationId`, `path.commandId`, `CompleteOnsiteVoucherCommandInput` | `OrganizationVoucherCommand` |
|
|
249
262
|
|
|
263
|
+
### POS Points
|
|
264
|
+
|
|
265
|
+
| Client method | Route | Request | Returns |
|
|
266
|
+
| --- | --- | --- | --- |
|
|
267
|
+
| `client.pointProviders.getOrganizationPointProvider({ path })` | `GET /organizations/:organizationId/point-provider` | `path.organizationId` | `OrganizationPointProvider \| null` |
|
|
268
|
+
| `client.pointProviders.upsertOrganizationPointProvider({ path, payload })` | `PUT /organizations/:organizationId/point-provider` | `path.organizationId`, `UpsertOrganizationPointProviderInput` | `OrganizationPointProvider` |
|
|
269
|
+
| `client.pointProviders.requestPointLookup({ path, payload })` | `POST /organizations/:organizationId/points/lookup` | `path.organizationId`, `RequestPointLookupInput` | `OrganizationPointCommand` |
|
|
270
|
+
| `client.pointProviders.requestPointAdd({ path, payload })` | `POST /organizations/:organizationId/points/add` | `path.organizationId`, `RequestPointDebitInput` | `OrganizationPointCommand` |
|
|
271
|
+
| `client.pointProviders.requestPointRedeem({ path, payload })` | `POST /organizations/:organizationId/points/redeem` | `path.organizationId`, `RequestPointDebitInput` | `OrganizationPointCommand` |
|
|
272
|
+
| `client.pointProviders.requestPointRefund({ path, payload })` | `POST /organizations/:organizationId/points/refund` | `path.organizationId`, `RequestPointDebitInput` | `OrganizationPointCommand` |
|
|
273
|
+
|
|
250
274
|
### Onsite Calls
|
|
251
275
|
|
|
252
276
|
| Client method | Route | Request | Returns |
|
|
253
277
|
| --- | --- | --- | --- |
|
|
254
|
-
| `client.onsiteCalls.callOnsiteResource({ path, payload })` | `POST /organizations/:organizationId/onsite-calls` | `OnsiteResourceCallRequest` for member create/update/renew/lookup
|
|
278
|
+
| `client.onsiteCalls.callOnsiteResource({ path, payload })` | `POST /organizations/:organizationId/onsite-calls` | `OnsiteResourceCallRequest` for member create/update/renew/lookup, voucher issue, or points lookup/add/redeem/refund | `OnsiteResourceCallResponse` |
|
|
255
279
|
|
|
256
280
|
### Onsite Agents
|
|
257
281
|
|