@domu-ai/kiban-sdk 1.146.0 → 1.146.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @domu-ai/kiban-sdk
2
2
 
3
- Generated TypeScript SDK for Kiban APIs.
3
+ Generated TypeScript SDK for Kiban APIs with TanStack Query hooks.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,28 +8,51 @@ Generated TypeScript SDK for Kiban APIs.
8
8
  npm install @domu-ai/kiban-sdk
9
9
  ```
10
10
 
11
- ## Usage
11
+ TanStack Query is an optional peer dependency. Install it if you want to use the generated hooks:
12
+
13
+ ```bash
14
+ npm install @tanstack/react-query
15
+ ```
16
+
17
+ ## Setup
12
18
 
13
19
  ```ts
14
- import { getSuccessData, setApiBaseUrl, setAuthToken } from "@domu-ai/kiban-sdk";
15
- import { publicAuthMeGet } from "@domu-ai/kiban-sdk/public";
16
- import { dashboardCampaignsGet } from "@domu-ai/kiban-sdk/dashboard";
20
+ import { setApiBaseUrl, setAuthToken } from "@domu-ai/kiban-sdk";
17
21
 
18
22
  setApiBaseUrl("https://kiban.domu.ai");
19
23
  setAuthToken(() => myToken);
24
+ ```
25
+
26
+ ## React Query Hooks
27
+
28
+ ```tsx
29
+ import { useDashboardCampaignsGet } from "@domu-ai/kiban-sdk/dashboard";
30
+
31
+ function CampaignList() {
32
+ const { data, isLoading } = useDashboardCampaignsGet();
33
+ if (isLoading) return <p>Loading...</p>;
34
+ if (data?.status === 200) return <ul>{/* render data.data.data */}</ul>;
35
+ }
36
+ ```
37
+
38
+ ## Plain Fetch Functions
39
+
40
+ ```ts
41
+ import { getSuccessData } from "@domu-ai/kiban-sdk";
42
+ import { publicAuthMeGet } from "@domu-ai/kiban-sdk/public";
43
+ import { dashboardCampaignsGet } from "@domu-ai/kiban-sdk/dashboard";
20
44
 
21
45
  const me = getSuccessData(await publicAuthMeGet(), "Get authenticated user");
22
46
  const campaigns = getSuccessData(
23
47
  await dashboardCampaignsGet(),
24
48
  "List dashboard campaigns",
25
49
  );
26
-
27
- console.log(me);
28
- console.log(campaigns.data);
29
50
  ```
30
51
 
31
- Additional entrypoints:
52
+ ## Entrypoints
32
53
 
33
- - `@domu-ai/kiban-sdk/public`
34
- - `@domu-ai/kiban-sdk/internal`
35
- - `@domu-ai/kiban-sdk/dashboard`
54
+ - `@domu-ai/kiban-sdk` — public API (default) + utilities
55
+ - `@domu-ai/kiban-sdk/public` — public API
56
+ - `@domu-ai/kiban-sdk/internal` — internal API
57
+ - `@domu-ai/kiban-sdk/dashboard` — dashboard API
58
+ - `@domu-ai/kiban-sdk/fetcher` — fetcher utilities