@spoketech/hub-client 0.1.21 → 0.1.22
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 +49 -49
- package/dist/index.d.ts +40465 -55864
- package/dist/index.js +1886 -882
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/skills/spoke-hub-client/SKILL.md +2 -2
- package/skills/spoke-hub-client/references/workflows.md +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoketech/hub-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "Effect-native client for the Spoke Hub API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
"check-types": "tsc --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"effect": "^3.21.0"
|
|
34
|
+
"effect": "4.0.0-rc.112"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@spoke-hub/config": "workspace:*",
|
|
@@ -19,9 +19,9 @@ Use this skill for application code that consumes `@spoketech/hub-client`. Prefe
|
|
|
19
19
|
`makePromiseServiceHubApiClient` for `clientId` plus `privateKey`.
|
|
20
20
|
`makeHubApiClient` or `makeServiceHubApiClient` only when the caller is already Effect-native.
|
|
21
21
|
5. Build calls with the standard request object shape:
|
|
22
|
-
`
|
|
22
|
+
`params` for route params.
|
|
23
23
|
`payload` for JSON bodies.
|
|
24
|
-
`
|
|
24
|
+
`query` for query-string fields.
|
|
25
25
|
`headers` only for unusual per-request overrides.
|
|
26
26
|
6. Reuse the exported contract types instead of inventing inline request shapes.
|
|
27
27
|
7. Promise request methods return `[data, error]`; branch on `if (error !== null)` before using `data`.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
## Common Template
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
|
-
import {
|
|
13
|
+
import { makePromiseServiceHubApiClient } from "@spoketech/hub-client";
|
|
14
14
|
|
|
15
15
|
const { client } = await makePromiseServiceHubApiClient({
|
|
16
16
|
baseUrl: "https://hub.example.com",
|
|
@@ -23,12 +23,12 @@ Promise request methods return `[data, error]`. Check `error !== null` before us
|
|
|
23
23
|
|
|
24
24
|
## Request Shapes
|
|
25
25
|
|
|
26
|
-
- Use `
|
|
27
|
-
`
|
|
26
|
+
- Use `params` for route params:
|
|
27
|
+
`params: { organizationId: "org_123", memberId: "mem_123" }`
|
|
28
28
|
- Use `payload` for bodies:
|
|
29
29
|
`payload: { firstName: "Jane", lastName: "Smith" }`
|
|
30
|
-
- Use `
|
|
31
|
-
`
|
|
30
|
+
- Use `query` for query strings:
|
|
31
|
+
`query: { responseMode: "med", page: "1", pageSize: "25" }`
|
|
32
32
|
|
|
33
33
|
## Common Tasks
|
|
34
34
|
|
|
@@ -36,8 +36,8 @@ Promise request methods return `[data, error]`. Check `error !== null` before us
|
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
38
|
const [members, error] = await client.members.listOrganizationMembers({
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
params: { organizationId: "org_123" },
|
|
40
|
+
query: { responseMode: "med", page: "1", pageSize: "25" },
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
if (error !== null) {
|
|
@@ -49,7 +49,7 @@ if (error !== null) {
|
|
|
49
49
|
|
|
50
50
|
```ts
|
|
51
51
|
const [member, error] = await client.members.createOrganizationMember({
|
|
52
|
-
|
|
52
|
+
params: { organizationId: "org_123" },
|
|
53
53
|
payload: {
|
|
54
54
|
firstName: "Jane",
|
|
55
55
|
lastName: "Smith",
|
|
@@ -66,7 +66,7 @@ if (error !== null) {
|
|
|
66
66
|
|
|
67
67
|
```ts
|
|
68
68
|
const [run, error] = await client.memberSources.triggerOrganizationMemberSync({
|
|
69
|
-
|
|
69
|
+
params: { organizationId: "org_123" },
|
|
70
70
|
payload: { mode: "delta" },
|
|
71
71
|
});
|
|
72
72
|
|
|
@@ -79,7 +79,7 @@ if (error !== null) {
|
|
|
79
79
|
|
|
80
80
|
```ts
|
|
81
81
|
const [, error] = await client.guests.deleteGuest({
|
|
82
|
-
|
|
82
|
+
params: { organizationId: "org_123", guestId: "gst_123" },
|
|
83
83
|
payload: { expectedUpdatedAt: guest.updatedAt },
|
|
84
84
|
});
|
|
85
85
|
|