@osdk/react 0.9.0-beta.6 → 0.9.0-beta.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.
Files changed (40) hide show
  1. package/AGENTS.md +253 -0
  2. package/CHANGELOG.md +31 -0
  3. package/build/browser/intellisense.test.js +1 -1
  4. package/build/browser/intellisense.test.js.map +1 -1
  5. package/build/browser/new/useLinks.js.map +1 -1
  6. package/build/browser/new/useOsdkAggregation.js.map +1 -1
  7. package/build/browser/new/useOsdkFunction.js +101 -0
  8. package/build/browser/new/useOsdkFunction.js.map +1 -0
  9. package/build/browser/new/useOsdkObjects.js.map +1 -1
  10. package/build/browser/public/experimental.js +1 -0
  11. package/build/browser/public/experimental.js.map +1 -1
  12. package/build/cjs/public/experimental.cjs +50 -2
  13. package/build/cjs/public/experimental.cjs.map +1 -1
  14. package/build/cjs/public/experimental.d.cts +132 -21
  15. package/build/esm/intellisense.test.js +1 -1
  16. package/build/esm/intellisense.test.js.map +1 -1
  17. package/build/esm/new/useLinks.js.map +1 -1
  18. package/build/esm/new/useOsdkAggregation.js.map +1 -1
  19. package/build/esm/new/useOsdkFunction.js +101 -0
  20. package/build/esm/new/useOsdkFunction.js.map +1 -0
  21. package/build/esm/new/useOsdkObjects.js.map +1 -1
  22. package/build/esm/public/experimental.js +1 -0
  23. package/build/esm/public/experimental.js.map +1 -1
  24. package/build/types/new/useLinks.d.ts +5 -5
  25. package/build/types/new/useLinks.d.ts.map +1 -1
  26. package/build/types/new/useOsdkAggregation.d.ts +5 -6
  27. package/build/types/new/useOsdkAggregation.d.ts.map +1 -1
  28. package/build/types/new/useOsdkFunction.d.ts +112 -0
  29. package/build/types/new/useOsdkFunction.d.ts.map +1 -0
  30. package/build/types/new/useOsdkObjects.d.ts +5 -5
  31. package/build/types/new/useOsdkObjects.d.ts.map +1 -1
  32. package/build/types/public/experimental.d.ts +2 -0
  33. package/build/types/public/experimental.d.ts.map +1 -1
  34. package/docs/actions.md +414 -0
  35. package/docs/advanced-queries.md +663 -0
  36. package/docs/cache-management.md +213 -0
  37. package/docs/getting-started.md +382 -0
  38. package/docs/platform-apis.md +203 -0
  39. package/docs/querying-data.md +648 -0
  40. package/package.json +10 -8
@@ -0,0 +1,203 @@
1
+ ---
2
+ sidebar_position: 6
3
+ ---
4
+
5
+ # Platform APIs
6
+
7
+ This guide covers available platform APIs that can used with OSDK React hooks.
8
+
9
+ ## useFoundryUser
10
+
11
+ Retrieves a specific Foundry user by their user ID.
12
+
13
+ ### Basic Usage
14
+
15
+ ```tsx
16
+ import { PalantirApiError } from "@osdk/client";
17
+ import { useFoundryUser } from "@osdk/react/experimental";
18
+
19
+ export function UserProfile({ userId }: { userId: string }) {
20
+ const { user, isLoading, error } = useFoundryUser(userId);
21
+
22
+ if (error != null) {
23
+ const errorMessage = error instanceof PalantirApiError
24
+ ? error.errorDescription
25
+ : error.message;
26
+
27
+ return <div>Failed to load user: {errorMessage}</div>;
28
+ }
29
+
30
+ return (
31
+ <div>
32
+ {isLoading && <span>Loading...</span>}
33
+ {user && (
34
+ <div>
35
+ <h2>
36
+ {user.givenName} {user.familyName}
37
+ </h2>
38
+ <p>Username: {user.username}</p>
39
+ <p>Email: {user.email}</p>
40
+ </div>
41
+ )}
42
+ </div>
43
+ );
44
+ }
45
+ ```
46
+
47
+ ### Return Values
48
+
49
+ - `user` - The user object, or undefined if not loaded
50
+ - `isLoading` - True while fetching from server
51
+ - `error` - Error object if fetch failed
52
+ - `refetch` - Function to manually refetch the user data
53
+
54
+ ### Options
55
+
56
+ - `userId` (required) - The Foundry User ID to fetch
57
+ - `enabled` - Enable/disable the query (default: `true`)
58
+ - `status` - User status filter (default: `"ACTIVE"`)
59
+
60
+ ---
61
+
62
+ ## useCurrentFoundryUser
63
+
64
+ Retrieves the currently signed-in Foundry user.
65
+
66
+ ### Basic Usage
67
+
68
+ ```tsx
69
+ import { PalantirApiError } from "@osdk/client";
70
+ import { useCurrentFoundryUser } from "@osdk/react/experimental";
71
+
72
+ export function CurrentUserBadge() {
73
+ const { currentUser, isLoading, error } = useCurrentFoundryUser();
74
+
75
+ if (error != null) {
76
+ const errorMessage = error instanceof PalantirApiError
77
+ ? error.errorDescription
78
+ : error.message;
79
+
80
+ return <div>Failed to load current user: {errorMessage}</div>;
81
+ }
82
+
83
+ return (
84
+ <div>
85
+ {isLoading && <span>Loading...</span>}
86
+ {currentUser && <span>Welcome, {currentUser.givenName}!</span>}
87
+ </div>
88
+ );
89
+ }
90
+ ```
91
+
92
+ ### Return Values
93
+
94
+ - `currentUser` - The current user object, or undefined if not loaded
95
+ - `isLoading` - True while fetching from server
96
+ - `error` - Error object if fetch failed
97
+ - `refetch` - Function to manually refetch the current user data
98
+
99
+ ### Options
100
+
101
+ - `enabled` - Enable/disable the query (default: `true`)
102
+
103
+ ---
104
+
105
+ ## useFoundryUsersList
106
+
107
+ Lists all Foundry users with pagination support.
108
+
109
+ ### Basic Usage
110
+
111
+ ```tsx
112
+ import { PalantirApiError } from "@osdk/client";
113
+ import { useFoundryUsersList } from "@osdk/react/experimental";
114
+
115
+ export function UsersList() {
116
+ const { users, isLoading, error } = useFoundryUsersList();
117
+
118
+ if (error != null) {
119
+ const errorMessage = error instanceof PalantirApiError
120
+ ? error.errorDescription
121
+ : error.message;
122
+
123
+ return <div>Failed to load user list: {errorMessage}</div>;
124
+ }
125
+
126
+ return (
127
+ <div>
128
+ {isLoading && <span>Loading users...</span>}
129
+ {users && (
130
+ <ul>
131
+ {users.map((user) => (
132
+ <li key={user.id}>
133
+ {user.username}
134
+ </li>
135
+ ))}
136
+ </ul>
137
+ )}
138
+ </div>
139
+ );
140
+ }
141
+ ```
142
+
143
+ ### Return Values
144
+
145
+ - `users` - Array of users, or undefined if not loaded
146
+ - `nextPageToken` - Page token for the next page (undefined if no more pages)
147
+ - `isLoading` - True while fetching from server
148
+ - `error` - Error object if fetch failed
149
+ - `refetch` - Function to manually refetch the users list
150
+
151
+ ### Options
152
+
153
+ - `enabled` - Enable/disable the query (default: `true`)
154
+ - `include` - User status filter (default: `"ACTIVE"`)
155
+ - `pageSize` - Preferred page size (default: `1000`)
156
+ - `pageToken` - Page token for fetching subsequent pages (omit for first page)
157
+
158
+ ### Pagination
159
+
160
+ ```tsx
161
+ import { PalantirApiError } from "@osdk/client";
162
+ import { useFoundryUsersList } from "@osdk/react/experimental";
163
+ import { useState } from "react";
164
+
165
+ export function UsersList() {
166
+ const [pageToken, setPageToken] = useState<string | undefined>(undefined);
167
+
168
+ const { users, nextPageToken, error, isLoading } = useFoundryUsersList({
169
+ pageSize: 10,
170
+ pageToken,
171
+ });
172
+
173
+ if (error != null) {
174
+ const errorMessage = error instanceof PalantirApiError
175
+ ? error.errorDescription
176
+ : error.message;
177
+
178
+ return <div>Failed to load users: {errorMessage}</div>;
179
+ }
180
+
181
+ return (
182
+ <div>
183
+ {isLoading && <span>Loading...</span>}
184
+ {users && (
185
+ <>
186
+ <ul>
187
+ {users.map((user) => <li key={user.id}>{user.username}</li>)}
188
+ </ul>
189
+
190
+ {nextPageToken && (
191
+ <button
192
+ onClick={() => setPageToken(nextPageToken)}
193
+ disabled={isLoading}
194
+ >
195
+ Next page
196
+ </button>
197
+ )}
198
+ </>
199
+ )}
200
+ </div>
201
+ );
202
+ }
203
+ ```