@roundtable-bb/sdk 0.1.28 → 0.1.32
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 +1 -1
- package/dist/generated/client.js +135 -237
- package/dist/index.d.ts +199 -177
- package/dist/index.js +1 -1
- package/dist/request.js +25 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ codegen/generate.ts → src/generated/client.ts ← generated, do not edi
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
1. **extract-spec.ts** — boots the Fastify app in memory (no real DB/Redis), calls `app.swagger()`, and writes the result to `openapi.json`.
|
|
18
|
-
2. **generate.ts** — reads `openapi.json`, matches request/response schemas against Zod types exported from `@roundtable-bb/types`, and emits typed `
|
|
18
|
+
2. **generate.ts** — reads `openapi.json`, matches request/response schemas against Zod types exported from `@roundtable-bb/types`, and emits typed `RoundtableClient` (tenant-callable operations only) classes with one method per `operationId`.
|
|
19
19
|
|
|
20
20
|
## Updating the SDK
|
|
21
21
|
|
package/dist/generated/client.js
CHANGED
|
@@ -1,367 +1,265 @@
|
|
|
1
1
|
// AUTO-GENERATED — do not edit manually.
|
|
2
2
|
// Run `nx run @roundtable-bb/sdk:codegen` to regenerate.
|
|
3
3
|
import { request } from '../request.js';
|
|
4
|
-
export class
|
|
4
|
+
export class RoundtableClient {
|
|
5
5
|
opts;
|
|
6
6
|
constructor(opts) {
|
|
7
7
|
this.opts = opts;
|
|
8
8
|
}
|
|
9
9
|
/** Export a signed tenant backup (platform owners only) */
|
|
10
|
-
backupTenant(params, query) {
|
|
11
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/backup`, { query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
10
|
+
backupTenant(params, query, options) {
|
|
11
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/backup`, { ...options, query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
12
12
|
}
|
|
13
13
|
/** Count read and unread notifications */
|
|
14
|
-
countNotifications() {
|
|
15
|
-
return request(this.opts, 'GET', '/notifications/count', { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
14
|
+
countNotifications(options) {
|
|
15
|
+
return request(this.opts, 'GET', '/notifications/count', { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
16
16
|
}
|
|
17
17
|
/** Create a platform-scoped API key (returned once in full) */
|
|
18
|
-
createApiKey(body) {
|
|
19
|
-
return request(this.opts, 'POST', '/platform/api-keys', { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
18
|
+
createApiKey(body, options) {
|
|
19
|
+
return request(this.opts, 'POST', '/platform/api-keys', { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
20
20
|
}
|
|
21
21
|
/** Create a category (requires category.manage permission) */
|
|
22
|
-
createCategory(params, body) {
|
|
23
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/categories`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
22
|
+
createCategory(params, body, options) {
|
|
23
|
+
return request(this.opts, 'POST', `/tenants/${params.tenantId}/categories`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
24
24
|
}
|
|
25
25
|
/** Create a forum (requires forum.manage permission) */
|
|
26
|
-
createForum(params, body) {
|
|
27
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/forums`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
26
|
+
createForum(params, body, options) {
|
|
27
|
+
return request(this.opts, 'POST', `/tenants/${params.tenantId}/forums`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
28
28
|
}
|
|
29
29
|
/** Create a group (requires group.manage permission) */
|
|
30
|
-
createGroup(params, body) {
|
|
31
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/groups`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
30
|
+
createGroup(params, body, options) {
|
|
31
|
+
return request(this.opts, 'POST', `/tenants/${params.tenantId}/groups`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
32
32
|
}
|
|
33
33
|
/** Create a post in a thread */
|
|
34
|
-
createPost(params, body) {
|
|
35
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/threads/${params.threadId}/posts`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
34
|
+
createPost(params, body, options) {
|
|
35
|
+
return request(this.opts, 'POST', `/tenants/${params.tenantId}/threads/${params.threadId}/posts`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
36
36
|
}
|
|
37
37
|
/** Create a new tenant (requires allow_tenant_creation platform setting or platform owner) */
|
|
38
|
-
createTenant(body) {
|
|
39
|
-
return request(this.opts, 'POST', '/tenants', { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
38
|
+
createTenant(body, options) {
|
|
39
|
+
return request(this.opts, 'POST', '/tenants', { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
40
40
|
}
|
|
41
41
|
/** Create a thread (and its first post) */
|
|
42
|
-
createThread(params, body) {
|
|
43
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/forums/${params.forumId}/threads`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
42
|
+
createThread(params, body, options) {
|
|
43
|
+
return request(this.opts, 'POST', `/tenants/${params.tenantId}/forums/${params.forumId}/threads`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
44
44
|
}
|
|
45
45
|
/** Delete a platform-scoped API key */
|
|
46
|
-
deleteApiKey(params) {
|
|
47
|
-
return request(this.opts, 'DELETE', `/platform/api-keys/${params.keyId}`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
46
|
+
deleteApiKey(params, options) {
|
|
47
|
+
return request(this.opts, 'DELETE', `/platform/api-keys/${params.keyId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
48
48
|
}
|
|
49
49
|
/** Delete a category (requires category.manage permission) */
|
|
50
|
-
deleteCategory(params) {
|
|
51
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/categories/${params.categoryId}`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
50
|
+
deleteCategory(params, options) {
|
|
51
|
+
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/categories/${params.categoryId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
52
52
|
}
|
|
53
53
|
/** Delete a forum (requires forum.manage permission) */
|
|
54
|
-
deleteForum(params) {
|
|
55
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/forums/${params.forumId}`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
54
|
+
deleteForum(params, options) {
|
|
55
|
+
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/forums/${params.forumId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
56
56
|
}
|
|
57
57
|
/** Delete a group (requires group.manage permission) */
|
|
58
|
-
deleteGroup(params) {
|
|
59
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/groups/${params.groupId}`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
58
|
+
deleteGroup(params, options) {
|
|
59
|
+
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/groups/${params.groupId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
60
60
|
}
|
|
61
61
|
/** Delete a notification */
|
|
62
|
-
deleteNotification(params) {
|
|
63
|
-
return request(this.opts, 'DELETE', `/notifications/${params.notificationId}`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
62
|
+
deleteNotification(params, options) {
|
|
63
|
+
return request(this.opts, 'DELETE', `/notifications/${params.notificationId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
64
64
|
}
|
|
65
65
|
/** Soft-delete a post */
|
|
66
|
-
deletePost(params) {
|
|
67
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/posts/${params.postId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
66
|
+
deletePost(params, options) {
|
|
67
|
+
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/posts/${params.postId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
68
68
|
}
|
|
69
69
|
/** Delete a thread */
|
|
70
|
-
deleteThread(params) {
|
|
71
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/threads/${params.threadId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
70
|
+
deleteThread(params, options) {
|
|
71
|
+
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/threads/${params.threadId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
72
72
|
}
|
|
73
73
|
/** Exchange session cookie for a short-lived tenant JWT */
|
|
74
|
-
exchangeTenantToken() {
|
|
75
|
-
return request(this.opts, 'POST', '/tenant-token', { routeAuth: { acceptsBetterAuth: true } });
|
|
74
|
+
exchangeTenantToken(options) {
|
|
75
|
+
return request(this.opts, 'POST', '/tenant-token', { ...options, routeAuth: { acceptsBetterAuth: true } });
|
|
76
76
|
}
|
|
77
77
|
/** Get a single category */
|
|
78
|
-
getCategory(params) {
|
|
79
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/categories/${params.categoryId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
78
|
+
getCategory(params, options) {
|
|
79
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/categories/${params.categoryId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
80
80
|
}
|
|
81
81
|
/** Get a single forum */
|
|
82
|
-
getForum(params) {
|
|
83
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums/${params.forumId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
82
|
+
getForum(params, options) {
|
|
83
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums/${params.forumId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
84
84
|
}
|
|
85
85
|
/** Get a group */
|
|
86
|
-
getGroup(params) {
|
|
87
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups/${params.groupId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
86
|
+
getGroup(params, options) {
|
|
87
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups/${params.groupId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
88
88
|
}
|
|
89
89
|
/** Get own profile */
|
|
90
|
-
getMe() {
|
|
91
|
-
return request(this.opts, 'GET', '/users/me', { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
90
|
+
getMe(options) {
|
|
91
|
+
return request(this.opts, 'GET', '/users/me', { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
92
|
+
}
|
|
93
|
+
/** Get tenant options and unsafe methods allowed */
|
|
94
|
+
getTenantOptions(params, options) {
|
|
95
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/options`, { ...options });
|
|
92
96
|
}
|
|
93
97
|
/** Get the current owner of a tenant */
|
|
94
|
-
getTenantOwner(params) {
|
|
95
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/owner`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
98
|
+
getTenantOwner(params, options) {
|
|
99
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/owner`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
96
100
|
}
|
|
97
101
|
/** Get a single thread */
|
|
98
|
-
getThread(params) {
|
|
99
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
102
|
+
getThread(params, options) {
|
|
103
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
100
104
|
}
|
|
101
105
|
/** Get read status for the current user in a thread */
|
|
102
|
-
getThreadReadStatus(params) {
|
|
103
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}/read-status`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
106
|
+
getThreadReadStatus(params, options) {
|
|
107
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}/read-status`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
104
108
|
}
|
|
105
109
|
/** Get a user profile by ID */
|
|
106
|
-
getUser(params) {
|
|
107
|
-
return request(this.opts, 'GET', `/users/${params.userId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
110
|
+
getUser(params, options) {
|
|
111
|
+
return request(this.opts, 'GET', `/users/${params.userId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
108
112
|
}
|
|
109
113
|
/** Get user group memberships in the current tenant */
|
|
110
|
-
getUserMembership(params) {
|
|
111
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/users/${params.userId}/membership`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
114
|
+
getUserMembership(params, options) {
|
|
115
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/users/${params.userId}/membership`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
112
116
|
}
|
|
113
117
|
/** Grant platform owner status to a user (platform owners only) */
|
|
114
|
-
grantPlatformOwner(body) {
|
|
115
|
-
return request(this.opts, 'POST', '/platform/owners', { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
118
|
+
grantPlatformOwner(body, options) {
|
|
119
|
+
return request(this.opts, 'POST', '/platform/owners', { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
116
120
|
}
|
|
117
121
|
/** List your platform-scoped API keys */
|
|
118
|
-
listApiKeys() {
|
|
119
|
-
return request(this.opts, 'GET', '/platform/api-keys', { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
122
|
+
listApiKeys(options) {
|
|
123
|
+
return request(this.opts, 'GET', '/platform/api-keys', { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
120
124
|
}
|
|
121
125
|
/** List visible categories for the requesting user */
|
|
122
|
-
listCategories(params) {
|
|
123
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/categories`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
126
|
+
listCategories(params, options) {
|
|
127
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/categories`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
124
128
|
}
|
|
125
129
|
/** List visible forums for the requesting user */
|
|
126
|
-
listForums(params) {
|
|
127
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
130
|
+
listForums(params, options) {
|
|
131
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
128
132
|
}
|
|
129
133
|
/** List members of a group */
|
|
130
|
-
listGroupMembers(params) {
|
|
131
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups/${params.groupId}/members`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
134
|
+
listGroupMembers(params, options) {
|
|
135
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups/${params.groupId}/members`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
132
136
|
}
|
|
133
137
|
/** List groups */
|
|
134
|
-
listGroups(params) {
|
|
135
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
138
|
+
listGroups(params, options) {
|
|
139
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
136
140
|
}
|
|
137
141
|
/** Get unified notification inbox */
|
|
138
|
-
listNotifications(query) {
|
|
139
|
-
return request(this.opts, 'GET', '/notifications', { query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
142
|
+
listNotifications(query, options) {
|
|
143
|
+
return request(this.opts, 'GET', '/notifications', { ...options, query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
140
144
|
}
|
|
141
145
|
/** List platform owner user IDs (platform owners only) */
|
|
142
|
-
listPlatformOwners() {
|
|
143
|
-
return request(this.opts, 'GET', '/platform/owners', { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
146
|
+
listPlatformOwners(options) {
|
|
147
|
+
return request(this.opts, 'GET', '/platform/owners', { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
144
148
|
}
|
|
145
149
|
/** List all platform settings (platform owners only) */
|
|
146
|
-
listPlatformSettings() {
|
|
147
|
-
return request(this.opts, 'GET', '/platform/settings', { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
150
|
+
listPlatformSettings(options) {
|
|
151
|
+
return request(this.opts, 'GET', '/platform/settings', { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
148
152
|
}
|
|
149
153
|
/** List posts in a thread — cursor pagination or anchor via ?from=postId */
|
|
150
|
-
listPosts(params, query) {
|
|
151
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}/posts`, { query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
154
|
+
listPosts(params, query, options) {
|
|
155
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}/posts`, { ...options, query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
152
156
|
}
|
|
153
157
|
/** List tenants owned by the current user (platform owners see all) */
|
|
154
|
-
listTenants(query) {
|
|
155
|
-
return request(this.opts, 'GET', '/tenants', { query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
158
|
+
listTenants(query, options) {
|
|
159
|
+
return request(this.opts, 'GET', '/tenants', { ...options, query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
156
160
|
}
|
|
157
161
|
/** List threads in a forum */
|
|
158
|
-
listThreads(params, query) {
|
|
159
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums/${params.forumId}/threads`, { query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
162
|
+
listThreads(params, query, options) {
|
|
163
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums/${params.forumId}/threads`, { ...options, query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
164
|
+
}
|
|
165
|
+
/** Mark all notifications as read */
|
|
166
|
+
markAllNotificationRead(options) {
|
|
167
|
+
return request(this.opts, 'POST', '/notifications/read-all', { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
160
168
|
}
|
|
161
169
|
/** Mark a notification as read */
|
|
162
|
-
markNotificationRead(params) {
|
|
163
|
-
return request(this.opts, 'PATCH', `/notifications/${params.notificationId}/read`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
170
|
+
markNotificationRead(params, options) {
|
|
171
|
+
return request(this.opts, 'PATCH', `/notifications/${params.notificationId}/read`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
172
|
+
}
|
|
173
|
+
/** Set tenant options */
|
|
174
|
+
putTenantOptions(params, body, options) {
|
|
175
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/options`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
164
176
|
}
|
|
165
177
|
/** Set the position of each category (requires category.manage permission) */
|
|
166
|
-
reorderCategories(params, body) {
|
|
167
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/categories/reorder`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
178
|
+
reorderCategories(params, body, options) {
|
|
179
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/categories/reorder`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
168
180
|
}
|
|
169
181
|
/** Set the position of each forum (requires forum.manage permission) */
|
|
170
|
-
reorderForums(params, body) {
|
|
171
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/forums/reorder`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
182
|
+
reorderForums(params, body, options) {
|
|
183
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/forums/reorder`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
172
184
|
}
|
|
173
185
|
/** Set the position of each group (requires group.manage permission) */
|
|
174
|
-
reorderGroups(params, body) {
|
|
175
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/groups/reorder`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
186
|
+
reorderGroups(params, body, options) {
|
|
187
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/groups/reorder`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
176
188
|
}
|
|
177
189
|
/** Restore a tenant from a signed backup (platform owners only) */
|
|
178
|
-
restoreTenant(params, body) {
|
|
179
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/restore`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
190
|
+
restoreTenant(params, body, options) {
|
|
191
|
+
return request(this.opts, 'POST', `/tenants/${params.tenantId}/restore`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
180
192
|
}
|
|
181
193
|
/** Revoke platform owner status from a user (platform owners only) */
|
|
182
|
-
revokePlatformOwner(params) {
|
|
183
|
-
return request(this.opts, 'DELETE', `/platform/owners/${params.userId}`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
194
|
+
revokePlatformOwner(params, options) {
|
|
195
|
+
return request(this.opts, 'DELETE', `/platform/owners/${params.userId}`, { ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
184
196
|
}
|
|
185
197
|
/** Full-text search across threads and posts (visible categories only) */
|
|
186
|
-
search(params, query) {
|
|
187
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/search`, { query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
198
|
+
search(params, query, options) {
|
|
199
|
+
return request(this.opts, 'GET', `/tenants/${params.tenantId}/search`, { ...options, query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
188
200
|
}
|
|
189
201
|
/** Search users by display name or email (case-insensitive) */
|
|
190
|
-
searchUsers(query) {
|
|
191
|
-
return request(this.opts, 'GET', '/users/search', { query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
202
|
+
searchUsers(query, options) {
|
|
203
|
+
return request(this.opts, 'GET', '/users/search', { ...options, query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
192
204
|
}
|
|
193
205
|
/** Set forum visibility for a group (requires group.manage or group.manage_protected permission) */
|
|
194
|
-
setGroupForums(params, body) {
|
|
195
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/groups/${params.groupId}/forums`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
206
|
+
setGroupForums(params, body, options) {
|
|
207
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/groups/${params.groupId}/forums`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
196
208
|
}
|
|
197
209
|
/** Replace all permissions for a group (requires group.manage permission) */
|
|
198
|
-
setGroupPermissions(params, body) {
|
|
199
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/groups/${params.groupId}/permissions`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
210
|
+
setGroupPermissions(params, body, options) {
|
|
211
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/groups/${params.groupId}/permissions`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
200
212
|
}
|
|
201
213
|
/** Set or remove the custom domain for a tenant */
|
|
202
|
-
setTenantCustomDomain(params, body) {
|
|
203
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/custom-domain`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
214
|
+
setTenantCustomDomain(params, body, options) {
|
|
215
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/custom-domain`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
204
216
|
}
|
|
205
217
|
/** Mark a thread as read up to a given post */
|
|
206
|
-
setThreadReadStatus(params, body) {
|
|
207
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/threads/${params.threadId}/read-status`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
218
|
+
setThreadReadStatus(params, body, options) {
|
|
219
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/threads/${params.threadId}/read-status`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
208
220
|
}
|
|
209
221
|
/** Replace user group assignments in the current tenant (requires group.manage permission) */
|
|
210
|
-
setUserGroups(params, body) {
|
|
211
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/users/${params.userId}/membership`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
222
|
+
setUserGroups(params, body, options) {
|
|
223
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/users/${params.userId}/membership`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
212
224
|
}
|
|
213
225
|
/** Subscribe to a thread */
|
|
214
|
-
subscribeThread(params) {
|
|
215
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/threads/${params.threadId}/subscribe`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
226
|
+
subscribeThread(params, options) {
|
|
227
|
+
return request(this.opts, 'POST', `/tenants/${params.tenantId}/threads/${params.threadId}/subscribe`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
216
228
|
}
|
|
217
229
|
/** Transfer tenant ownership to another existing user (only the current owner can do this) */
|
|
218
|
-
transferTenantOwner(params, body) {
|
|
219
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/owner`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
230
|
+
transferTenantOwner(params, body, options) {
|
|
231
|
+
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/owner`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
220
232
|
}
|
|
221
233
|
/** Unsubscribe from a thread */
|
|
222
|
-
unsubscribeThread(params) {
|
|
223
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/threads/${params.threadId}/subscribe`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
234
|
+
unsubscribeThread(params, options) {
|
|
235
|
+
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/threads/${params.threadId}/subscribe`, { ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
224
236
|
}
|
|
225
237
|
/** Update a category (requires category.manage permission) */
|
|
226
|
-
updateCategory(params, body) {
|
|
227
|
-
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/categories/${params.categoryId}`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
238
|
+
updateCategory(params, body, options) {
|
|
239
|
+
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/categories/${params.categoryId}`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
228
240
|
}
|
|
229
241
|
/** Update a forum (requires forum.manage permission) */
|
|
230
|
-
updateForum(params, body) {
|
|
231
|
-
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/forums/${params.forumId}`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
242
|
+
updateForum(params, body, options) {
|
|
243
|
+
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/forums/${params.forumId}`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
232
244
|
}
|
|
233
245
|
/** Update a group (requires group.manage permission) */
|
|
234
|
-
updateGroup(params, body) {
|
|
235
|
-
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/groups/${params.groupId}`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
246
|
+
updateGroup(params, body, options) {
|
|
247
|
+
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/groups/${params.groupId}`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
236
248
|
}
|
|
237
249
|
/** Update own profile */
|
|
238
|
-
updateMe(body) {
|
|
239
|
-
return request(this.opts, 'PATCH', '/users/me', { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
250
|
+
updateMe(body, options) {
|
|
251
|
+
return request(this.opts, 'PATCH', '/users/me', { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
240
252
|
}
|
|
241
253
|
/** Update a platform setting (platform owners only) */
|
|
242
|
-
updatePlatformSetting(params, body) {
|
|
243
|
-
return request(this.opts, 'PATCH', `/platform/settings/${params.key}`, { body, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
244
|
-
}
|
|
245
|
-
/** Edit a post (author or post.edit permission) */
|
|
246
|
-
updatePost(params, body) {
|
|
247
|
-
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/posts/${params.postId}`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
248
|
-
}
|
|
249
|
-
/** Update a thread (title, pin, lock, move) */
|
|
250
|
-
updateThread(params, body) {
|
|
251
|
-
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/threads/${params.threadId}`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
export class TenantClient {
|
|
255
|
-
opts;
|
|
256
|
-
constructor(opts) {
|
|
257
|
-
this.opts = opts;
|
|
258
|
-
}
|
|
259
|
-
/** Count read and unread notifications */
|
|
260
|
-
countNotifications() {
|
|
261
|
-
return request(this.opts, 'GET', '/notifications/count', { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
262
|
-
}
|
|
263
|
-
/** Create a post in a thread */
|
|
264
|
-
createPost(params, body) {
|
|
265
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/threads/${params.threadId}/posts`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
266
|
-
}
|
|
267
|
-
/** Create a thread (and its first post) */
|
|
268
|
-
createThread(params, body) {
|
|
269
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/forums/${params.forumId}/threads`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
270
|
-
}
|
|
271
|
-
/** Soft-delete a post */
|
|
272
|
-
deletePost(params) {
|
|
273
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/posts/${params.postId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
274
|
-
}
|
|
275
|
-
/** Delete a thread */
|
|
276
|
-
deleteThread(params) {
|
|
277
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/threads/${params.threadId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
278
|
-
}
|
|
279
|
-
/** Exchange session cookie for a short-lived tenant JWT */
|
|
280
|
-
exchangeTenantToken() {
|
|
281
|
-
return request(this.opts, 'POST', '/tenant-token', { routeAuth: { acceptsBetterAuth: true, tenantUseCredentials: true } });
|
|
282
|
-
}
|
|
283
|
-
/** Get a single category */
|
|
284
|
-
getCategory(params) {
|
|
285
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/categories/${params.categoryId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
286
|
-
}
|
|
287
|
-
/** Get a single forum */
|
|
288
|
-
getForum(params) {
|
|
289
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums/${params.forumId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
290
|
-
}
|
|
291
|
-
/** Get a group */
|
|
292
|
-
getGroup(params) {
|
|
293
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups/${params.groupId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
294
|
-
}
|
|
295
|
-
/** Get own profile */
|
|
296
|
-
getMe() {
|
|
297
|
-
return request(this.opts, 'GET', '/users/me', { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
298
|
-
}
|
|
299
|
-
/** Get a single thread */
|
|
300
|
-
getThread(params) {
|
|
301
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
302
|
-
}
|
|
303
|
-
/** Get read status for the current user in a thread */
|
|
304
|
-
getThreadReadStatus(params) {
|
|
305
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}/read-status`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
306
|
-
}
|
|
307
|
-
/** Get a user profile by ID */
|
|
308
|
-
getUser(params) {
|
|
309
|
-
return request(this.opts, 'GET', `/users/${params.userId}`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
310
|
-
}
|
|
311
|
-
/** Get user group memberships in the current tenant */
|
|
312
|
-
getUserMembership(params) {
|
|
313
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/users/${params.userId}/membership`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
314
|
-
}
|
|
315
|
-
/** List visible categories for the requesting user */
|
|
316
|
-
listCategories(params) {
|
|
317
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/categories`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
318
|
-
}
|
|
319
|
-
/** List visible forums for the requesting user */
|
|
320
|
-
listForums(params) {
|
|
321
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
322
|
-
}
|
|
323
|
-
/** List members of a group */
|
|
324
|
-
listGroupMembers(params) {
|
|
325
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups/${params.groupId}/members`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
326
|
-
}
|
|
327
|
-
/** List groups */
|
|
328
|
-
listGroups(params) {
|
|
329
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/groups`, { routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
330
|
-
}
|
|
331
|
-
/** List posts in a thread — cursor pagination or anchor via ?from=postId */
|
|
332
|
-
listPosts(params, query) {
|
|
333
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/threads/${params.threadId}/posts`, { query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
334
|
-
}
|
|
335
|
-
/** List threads in a forum */
|
|
336
|
-
listThreads(params, query) {
|
|
337
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/forums/${params.forumId}/threads`, { query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
338
|
-
}
|
|
339
|
-
/** Full-text search across threads and posts (visible categories only) */
|
|
340
|
-
search(params, query) {
|
|
341
|
-
return request(this.opts, 'GET', `/tenants/${params.tenantId}/search`, { query, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
342
|
-
}
|
|
343
|
-
/** Search users by display name or email (case-insensitive) */
|
|
344
|
-
searchUsers(query) {
|
|
345
|
-
return request(this.opts, 'GET', '/users/search', { query, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true, acceptsTenantJwt: true } });
|
|
346
|
-
}
|
|
347
|
-
/** Mark a thread as read up to a given post */
|
|
348
|
-
setThreadReadStatus(params, body) {
|
|
349
|
-
return request(this.opts, 'PUT', `/tenants/${params.tenantId}/threads/${params.threadId}/read-status`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
350
|
-
}
|
|
351
|
-
/** Subscribe to a thread */
|
|
352
|
-
subscribeThread(params) {
|
|
353
|
-
return request(this.opts, 'POST', `/tenants/${params.tenantId}/threads/${params.threadId}/subscribe`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
354
|
-
}
|
|
355
|
-
/** Unsubscribe from a thread */
|
|
356
|
-
unsubscribeThread(params) {
|
|
357
|
-
return request(this.opts, 'DELETE', `/tenants/${params.tenantId}/threads/${params.threadId}/subscribe`, { routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
254
|
+
updatePlatformSetting(params, body, options) {
|
|
255
|
+
return request(this.opts, 'PATCH', `/platform/settings/${params.key}`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsBetterAuth: true } });
|
|
358
256
|
}
|
|
359
257
|
/** Edit a post (author or post.edit permission) */
|
|
360
|
-
updatePost(params, body) {
|
|
361
|
-
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/posts/${params.postId}`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
258
|
+
updatePost(params, body, options) {
|
|
259
|
+
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/posts/${params.postId}`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
362
260
|
}
|
|
363
261
|
/** Update a thread (title, pin, lock, move) */
|
|
364
|
-
updateThread(params, body) {
|
|
365
|
-
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/threads/${params.threadId}`, { body, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
262
|
+
updateThread(params, body, options) {
|
|
263
|
+
return request(this.opts, 'PATCH', `/tenants/${params.tenantId}/threads/${params.threadId}`, { body, ...options, routeAuth: { acceptsApiKey: true, acceptsTenantJwt: true } });
|
|
366
264
|
}
|
|
367
265
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -86,7 +86,6 @@ declare const UserProfileSchema: z.ZodObject<{
|
|
|
86
86
|
userId: z.ZodUUID;
|
|
87
87
|
displayName: z.ZodString;
|
|
88
88
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
89
|
-
bio: z.ZodNullable<z.ZodString>;
|
|
90
89
|
updatedAt: z.ZodISODateTime;
|
|
91
90
|
}, z.core.$strip>;
|
|
92
91
|
declare const UserMembershipSchema: z.ZodObject<{
|
|
@@ -99,7 +98,11 @@ declare const UserMembershipSchema: z.ZodObject<{
|
|
|
99
98
|
declare const UpdateUserProfileSchema: z.ZodObject<{
|
|
100
99
|
displayName: z.ZodOptional<z.ZodString>;
|
|
101
100
|
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
102
|
-
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
declare const UserSummarySchema: z.ZodObject<{
|
|
103
|
+
userId: z.ZodUUID;
|
|
104
|
+
displayName: z.ZodString;
|
|
105
|
+
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
103
106
|
}, z.core.$strip>;
|
|
104
107
|
declare const GroupMemberSchema: z.ZodObject<{
|
|
105
108
|
userId: z.ZodUUID;
|
|
@@ -107,10 +110,17 @@ declare const GroupMemberSchema: z.ZodObject<{
|
|
|
107
110
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
108
111
|
joinedAt: z.ZodISODateTime;
|
|
109
112
|
}, z.core.$strip>;
|
|
113
|
+
declare const UserSearchResultSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodUUID;
|
|
115
|
+
displayName: z.ZodString;
|
|
116
|
+
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
117
|
+
}, z.core.$strip>;
|
|
110
118
|
type UserProfile = z.infer<typeof UserProfileSchema>;
|
|
119
|
+
type UserSummary = z.infer<typeof UserSummarySchema>;
|
|
111
120
|
type UserMembership = z.infer<typeof UserMembershipSchema>;
|
|
112
121
|
type UpdateUserProfile = z.infer<typeof UpdateUserProfileSchema>;
|
|
113
122
|
type GroupMember = z.infer<typeof GroupMemberSchema>;
|
|
123
|
+
type UserSearchResult = z.infer<typeof UserSearchResultSchema>;
|
|
114
124
|
|
|
115
125
|
declare const CategorySchema: z.ZodObject<{
|
|
116
126
|
id: z.ZodUUID;
|
|
@@ -175,8 +185,6 @@ declare const ThreadSchema: z.ZodObject<{
|
|
|
175
185
|
userId: z.ZodUUID;
|
|
176
186
|
displayName: z.ZodString;
|
|
177
187
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
178
|
-
bio: z.ZodNullable<z.ZodString>;
|
|
179
|
-
updatedAt: z.ZodISODateTime;
|
|
180
188
|
}, z.core.$strip>;
|
|
181
189
|
postCount: z.ZodNumber;
|
|
182
190
|
isPinned: z.ZodBoolean;
|
|
@@ -214,8 +222,6 @@ declare const PostSchema: z.ZodObject<{
|
|
|
214
222
|
userId: z.ZodUUID;
|
|
215
223
|
displayName: z.ZodString;
|
|
216
224
|
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
217
|
-
bio: z.ZodNullable<z.ZodString>;
|
|
218
|
-
updatedAt: z.ZodISODateTime;
|
|
219
225
|
}, z.core.$strip>;
|
|
220
226
|
content: z.ZodNullable<z.ZodString>;
|
|
221
227
|
deletedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
@@ -438,6 +444,16 @@ declare const OwnedTenantSchema: z.ZodObject<{
|
|
|
438
444
|
slug: z.ZodString;
|
|
439
445
|
customDomain: z.ZodNullable<z.ZodString>;
|
|
440
446
|
}, z.core.$strip>;
|
|
447
|
+
declare const TenantOptionsSchema: z.ZodObject<{
|
|
448
|
+
allowedUnsafeMethods: z.ZodObject<{
|
|
449
|
+
notifications: z.ZodBoolean;
|
|
450
|
+
profile: z.ZodBoolean;
|
|
451
|
+
}, z.core.$strip>;
|
|
452
|
+
customOptions: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
453
|
+
}, z.core.$strip>;
|
|
454
|
+
declare const SetTenantOptionsSchema: z.ZodObject<{
|
|
455
|
+
customOptions: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
456
|
+
}, z.core.$strip>;
|
|
441
457
|
declare const TenantTokenSchema: z.ZodObject<{
|
|
442
458
|
token: z.ZodString;
|
|
443
459
|
expiresIn: z.ZodNumber;
|
|
@@ -451,6 +467,8 @@ type Tenant = z.infer<typeof TenantSchema>;
|
|
|
451
467
|
type CreateTenant = z.infer<typeof CreateTenantSchema>;
|
|
452
468
|
type SetCustomDomain = z.infer<typeof SetCustomDomainSchema>;
|
|
453
469
|
type TenantToken = z.infer<typeof TenantTokenSchema>;
|
|
470
|
+
type TenantOptions = z.infer<typeof TenantOptionsSchema>;
|
|
471
|
+
type SetTenantOptions = z.infer<typeof SetTenantOptionsSchema>;
|
|
454
472
|
|
|
455
473
|
declare const TenantOwnerSchema: z.ZodObject<{
|
|
456
474
|
userId: z.ZodNullable<z.ZodString>;
|
|
@@ -719,12 +737,14 @@ type PlatformSetting = z.infer<typeof PlatformSettingSchema>;
|
|
|
719
737
|
type UpdatePlatformSetting = z.infer<typeof UpdatePlatformSettingSchema>;
|
|
720
738
|
type GrantPlatformOwner = z.infer<typeof GrantPlatformOwnerSchema>;
|
|
721
739
|
|
|
740
|
+
type AuthMethod = 'apiKey' | 'tenantToken' | 'betterAuth';
|
|
722
741
|
interface RoundtableClientOpts {
|
|
723
742
|
baseURL: string;
|
|
724
|
-
|
|
743
|
+
apiKey?: string;
|
|
744
|
+
tenantToken?: string;
|
|
725
745
|
}
|
|
726
746
|
|
|
727
|
-
declare class
|
|
747
|
+
declare class RoundtableClient {
|
|
728
748
|
private readonly opts;
|
|
729
749
|
constructor(opts: RoundtableClientOpts);
|
|
730
750
|
/** Export a signed tenant backup (platform owners only) */
|
|
@@ -732,141 +752,217 @@ declare class AcpClient {
|
|
|
732
752
|
tenantId: string;
|
|
733
753
|
}, query?: {
|
|
734
754
|
includeContent?: boolean;
|
|
755
|
+
}, options?: {
|
|
756
|
+
authMethod?: AuthMethod;
|
|
735
757
|
}): Promise<BackupPayload>;
|
|
736
758
|
/** Count read and unread notifications */
|
|
737
|
-
countNotifications(
|
|
759
|
+
countNotifications(options?: {
|
|
760
|
+
authMethod?: AuthMethod;
|
|
761
|
+
}): Promise<NotificationCount>;
|
|
738
762
|
/** Create a platform-scoped API key (returned once in full) */
|
|
739
|
-
createApiKey(body: CreateApiKey
|
|
763
|
+
createApiKey(body: CreateApiKey, options?: {
|
|
764
|
+
authMethod?: AuthMethod;
|
|
765
|
+
}): Promise<CreatedApiKey>;
|
|
740
766
|
/** Create a category (requires category.manage permission) */
|
|
741
767
|
createCategory(params: {
|
|
742
768
|
tenantId: string;
|
|
743
|
-
}, body: CreateCategory
|
|
769
|
+
}, body: CreateCategory, options?: {
|
|
770
|
+
authMethod?: AuthMethod;
|
|
771
|
+
}): Promise<Category>;
|
|
744
772
|
/** Create a forum (requires forum.manage permission) */
|
|
745
773
|
createForum(params: {
|
|
746
774
|
tenantId: string;
|
|
747
|
-
}, body: CreateForum
|
|
775
|
+
}, body: CreateForum, options?: {
|
|
776
|
+
authMethod?: AuthMethod;
|
|
777
|
+
}): Promise<Forum>;
|
|
748
778
|
/** Create a group (requires group.manage permission) */
|
|
749
779
|
createGroup(params: {
|
|
750
780
|
tenantId: string;
|
|
751
|
-
}, body: CreateGroup
|
|
781
|
+
}, body: CreateGroup, options?: {
|
|
782
|
+
authMethod?: AuthMethod;
|
|
783
|
+
}): Promise<Group>;
|
|
752
784
|
/** Create a post in a thread */
|
|
753
785
|
createPost(params: {
|
|
754
786
|
tenantId: string;
|
|
755
787
|
threadId: string;
|
|
756
|
-
}, body: CreatePost
|
|
788
|
+
}, body: CreatePost, options?: {
|
|
789
|
+
authMethod?: AuthMethod;
|
|
790
|
+
}): Promise<Post>;
|
|
757
791
|
/** Create a new tenant (requires allow_tenant_creation platform setting or platform owner) */
|
|
758
|
-
createTenant(body: CreateTenant
|
|
792
|
+
createTenant(body: CreateTenant, options?: {
|
|
793
|
+
authMethod?: AuthMethod;
|
|
794
|
+
}): Promise<Tenant>;
|
|
759
795
|
/** Create a thread (and its first post) */
|
|
760
796
|
createThread(params: {
|
|
761
797
|
tenantId: string;
|
|
762
798
|
forumId: string;
|
|
763
|
-
}, body: CreateThread
|
|
799
|
+
}, body: CreateThread, options?: {
|
|
800
|
+
authMethod?: AuthMethod;
|
|
801
|
+
}): Promise<Thread>;
|
|
764
802
|
/** Delete a platform-scoped API key */
|
|
765
803
|
deleteApiKey(params: {
|
|
766
804
|
keyId: string;
|
|
805
|
+
}, options?: {
|
|
806
|
+
authMethod?: AuthMethod;
|
|
767
807
|
}): Promise<void>;
|
|
768
808
|
/** Delete a category (requires category.manage permission) */
|
|
769
809
|
deleteCategory(params: {
|
|
770
810
|
tenantId: string;
|
|
771
811
|
categoryId: string;
|
|
812
|
+
}, options?: {
|
|
813
|
+
authMethod?: AuthMethod;
|
|
772
814
|
}): Promise<void>;
|
|
773
815
|
/** Delete a forum (requires forum.manage permission) */
|
|
774
816
|
deleteForum(params: {
|
|
775
817
|
tenantId: string;
|
|
776
818
|
forumId: string;
|
|
819
|
+
}, options?: {
|
|
820
|
+
authMethod?: AuthMethod;
|
|
777
821
|
}): Promise<void>;
|
|
778
822
|
/** Delete a group (requires group.manage permission) */
|
|
779
823
|
deleteGroup(params: {
|
|
780
824
|
tenantId: string;
|
|
781
825
|
groupId: string;
|
|
826
|
+
}, options?: {
|
|
827
|
+
authMethod?: AuthMethod;
|
|
782
828
|
}): Promise<void>;
|
|
783
829
|
/** Delete a notification */
|
|
784
830
|
deleteNotification(params: {
|
|
785
831
|
notificationId: string;
|
|
832
|
+
}, options?: {
|
|
833
|
+
authMethod?: AuthMethod;
|
|
786
834
|
}): Promise<void>;
|
|
787
835
|
/** Soft-delete a post */
|
|
788
836
|
deletePost(params: {
|
|
789
837
|
tenantId: string;
|
|
790
838
|
postId: string;
|
|
839
|
+
}, options?: {
|
|
840
|
+
authMethod?: AuthMethod;
|
|
791
841
|
}): Promise<void>;
|
|
792
842
|
/** Delete a thread */
|
|
793
843
|
deleteThread(params: {
|
|
794
844
|
tenantId: string;
|
|
795
845
|
threadId: string;
|
|
846
|
+
}, options?: {
|
|
847
|
+
authMethod?: AuthMethod;
|
|
796
848
|
}): Promise<void>;
|
|
797
849
|
/** Exchange session cookie for a short-lived tenant JWT */
|
|
798
|
-
exchangeTenantToken(
|
|
850
|
+
exchangeTenantToken(options?: {
|
|
851
|
+
authMethod?: AuthMethod;
|
|
852
|
+
}): Promise<TenantToken>;
|
|
799
853
|
/** Get a single category */
|
|
800
854
|
getCategory(params: {
|
|
801
855
|
tenantId: string;
|
|
802
856
|
categoryId: string;
|
|
857
|
+
}, options?: {
|
|
858
|
+
authMethod?: AuthMethod;
|
|
803
859
|
}): Promise<Category>;
|
|
804
860
|
/** Get a single forum */
|
|
805
861
|
getForum(params: {
|
|
806
862
|
tenantId: string;
|
|
807
863
|
forumId: string;
|
|
864
|
+
}, options?: {
|
|
865
|
+
authMethod?: AuthMethod;
|
|
808
866
|
}): Promise<Forum>;
|
|
809
867
|
/** Get a group */
|
|
810
868
|
getGroup(params: {
|
|
811
869
|
tenantId: string;
|
|
812
870
|
groupId: string;
|
|
871
|
+
}, options?: {
|
|
872
|
+
authMethod?: AuthMethod;
|
|
813
873
|
}): Promise<Group>;
|
|
814
874
|
/** Get own profile */
|
|
815
|
-
getMe(
|
|
875
|
+
getMe(options?: {
|
|
876
|
+
authMethod?: AuthMethod;
|
|
877
|
+
}): Promise<UserProfile>;
|
|
878
|
+
/** Get tenant options and unsafe methods allowed */
|
|
879
|
+
getTenantOptions(params: {
|
|
880
|
+
tenantId: string;
|
|
881
|
+
}, options?: {
|
|
882
|
+
authMethod?: AuthMethod;
|
|
883
|
+
}): Promise<TenantOptions>;
|
|
816
884
|
/** Get the current owner of a tenant */
|
|
817
885
|
getTenantOwner(params: {
|
|
818
886
|
tenantId: string;
|
|
887
|
+
}, options?: {
|
|
888
|
+
authMethod?: AuthMethod;
|
|
819
889
|
}): Promise<TenantOwner>;
|
|
820
890
|
/** Get a single thread */
|
|
821
891
|
getThread(params: {
|
|
822
892
|
tenantId: string;
|
|
823
893
|
threadId: string;
|
|
894
|
+
}, options?: {
|
|
895
|
+
authMethod?: AuthMethod;
|
|
824
896
|
}): Promise<Thread>;
|
|
825
897
|
/** Get read status for the current user in a thread */
|
|
826
898
|
getThreadReadStatus(params: {
|
|
827
899
|
tenantId: string;
|
|
828
900
|
threadId: string;
|
|
901
|
+
}, options?: {
|
|
902
|
+
authMethod?: AuthMethod;
|
|
829
903
|
}): Promise<ThreadReadStatus>;
|
|
830
904
|
/** Get a user profile by ID */
|
|
831
905
|
getUser(params: {
|
|
832
906
|
userId: string;
|
|
907
|
+
}, options?: {
|
|
908
|
+
authMethod?: AuthMethod;
|
|
833
909
|
}): Promise<UserProfile>;
|
|
834
910
|
/** Get user group memberships in the current tenant */
|
|
835
911
|
getUserMembership(params: {
|
|
836
912
|
tenantId: string;
|
|
837
913
|
userId: string;
|
|
914
|
+
}, options?: {
|
|
915
|
+
authMethod?: AuthMethod;
|
|
838
916
|
}): Promise<UserMembership>;
|
|
839
917
|
/** Grant platform owner status to a user (platform owners only) */
|
|
840
|
-
grantPlatformOwner(body: GrantPlatformOwner
|
|
918
|
+
grantPlatformOwner(body: GrantPlatformOwner, options?: {
|
|
919
|
+
authMethod?: AuthMethod;
|
|
920
|
+
}): Promise<void>;
|
|
841
921
|
/** List your platform-scoped API keys */
|
|
842
|
-
listApiKeys(
|
|
922
|
+
listApiKeys(options?: {
|
|
923
|
+
authMethod?: AuthMethod;
|
|
924
|
+
}): Promise<ApiKey[]>;
|
|
843
925
|
/** List visible categories for the requesting user */
|
|
844
926
|
listCategories(params: {
|
|
845
927
|
tenantId: string;
|
|
928
|
+
}, options?: {
|
|
929
|
+
authMethod?: AuthMethod;
|
|
846
930
|
}): Promise<Category[]>;
|
|
847
931
|
/** List visible forums for the requesting user */
|
|
848
932
|
listForums(params: {
|
|
849
933
|
tenantId: string;
|
|
934
|
+
}, options?: {
|
|
935
|
+
authMethod?: AuthMethod;
|
|
850
936
|
}): Promise<Forum[]>;
|
|
851
937
|
/** List members of a group */
|
|
852
938
|
listGroupMembers(params: {
|
|
853
939
|
tenantId: string;
|
|
854
940
|
groupId: string;
|
|
941
|
+
}, options?: {
|
|
942
|
+
authMethod?: AuthMethod;
|
|
855
943
|
}): Promise<GroupMember[]>;
|
|
856
944
|
/** List groups */
|
|
857
945
|
listGroups(params: {
|
|
858
946
|
tenantId: string;
|
|
947
|
+
}, options?: {
|
|
948
|
+
authMethod?: AuthMethod;
|
|
859
949
|
}): Promise<Group[]>;
|
|
860
950
|
/** Get unified notification inbox */
|
|
861
951
|
listNotifications(query?: {
|
|
862
952
|
cursor?: Id;
|
|
863
953
|
limit?: number;
|
|
864
954
|
unreadOnly?: boolean;
|
|
955
|
+
}, options?: {
|
|
956
|
+
authMethod?: AuthMethod;
|
|
865
957
|
}): Promise<PaginatedResponse<Notification>>;
|
|
866
958
|
/** List platform owner user IDs (platform owners only) */
|
|
867
|
-
listPlatformOwners(
|
|
959
|
+
listPlatformOwners(options?: {
|
|
960
|
+
authMethod?: AuthMethod;
|
|
961
|
+
}): Promise<string[]>;
|
|
868
962
|
/** List all platform settings (platform owners only) */
|
|
869
|
-
listPlatformSettings(
|
|
963
|
+
listPlatformSettings(options?: {
|
|
964
|
+
authMethod?: AuthMethod;
|
|
965
|
+
}): Promise<PlatformSetting[]>;
|
|
870
966
|
/** List posts in a thread — cursor pagination or anchor via ?from=postId */
|
|
871
967
|
listPosts(params: {
|
|
872
968
|
tenantId: string;
|
|
@@ -875,10 +971,14 @@ declare class AcpClient {
|
|
|
875
971
|
cursor?: Id;
|
|
876
972
|
limit?: number;
|
|
877
973
|
from?: Id;
|
|
974
|
+
}, options?: {
|
|
975
|
+
authMethod?: AuthMethod;
|
|
878
976
|
}): Promise<PaginatedResponse<Post>>;
|
|
879
977
|
/** List tenants owned by the current user (platform owners see all) */
|
|
880
978
|
listTenants(query?: {
|
|
881
979
|
search?: string;
|
|
980
|
+
}, options?: {
|
|
981
|
+
authMethod?: AuthMethod;
|
|
882
982
|
}): Promise<OwnedTenant[]>;
|
|
883
983
|
/** List threads in a forum */
|
|
884
984
|
listThreads(params: {
|
|
@@ -887,30 +987,54 @@ declare class AcpClient {
|
|
|
887
987
|
}, query?: {
|
|
888
988
|
cursor?: Id;
|
|
889
989
|
limit?: number;
|
|
990
|
+
}, options?: {
|
|
991
|
+
authMethod?: AuthMethod;
|
|
890
992
|
}): Promise<PaginatedResponse<Thread>>;
|
|
993
|
+
/** Mark all notifications as read */
|
|
994
|
+
markAllNotificationRead(options?: {
|
|
995
|
+
authMethod?: AuthMethod;
|
|
996
|
+
}): Promise<void>;
|
|
891
997
|
/** Mark a notification as read */
|
|
892
998
|
markNotificationRead(params: {
|
|
893
999
|
notificationId: string;
|
|
1000
|
+
}, options?: {
|
|
1001
|
+
authMethod?: AuthMethod;
|
|
894
1002
|
}): Promise<Notification>;
|
|
1003
|
+
/** Set tenant options */
|
|
1004
|
+
putTenantOptions(params: {
|
|
1005
|
+
tenantId: string;
|
|
1006
|
+
}, body: SetTenantOptions, options?: {
|
|
1007
|
+
authMethod?: AuthMethod;
|
|
1008
|
+
}): Promise<void>;
|
|
895
1009
|
/** Set the position of each category (requires category.manage permission) */
|
|
896
1010
|
reorderCategories(params: {
|
|
897
1011
|
tenantId: string;
|
|
898
|
-
}, body: ReorderCategory
|
|
1012
|
+
}, body: ReorderCategory, options?: {
|
|
1013
|
+
authMethod?: AuthMethod;
|
|
1014
|
+
}): Promise<void>;
|
|
899
1015
|
/** Set the position of each forum (requires forum.manage permission) */
|
|
900
1016
|
reorderForums(params: {
|
|
901
1017
|
tenantId: string;
|
|
902
|
-
}, body: ReorderCategory
|
|
1018
|
+
}, body: ReorderCategory, options?: {
|
|
1019
|
+
authMethod?: AuthMethod;
|
|
1020
|
+
}): Promise<void>;
|
|
903
1021
|
/** Set the position of each group (requires group.manage permission) */
|
|
904
1022
|
reorderGroups(params: {
|
|
905
1023
|
tenantId: string;
|
|
906
|
-
}, body: ReorderCategory
|
|
1024
|
+
}, body: ReorderCategory, options?: {
|
|
1025
|
+
authMethod?: AuthMethod;
|
|
1026
|
+
}): Promise<void>;
|
|
907
1027
|
/** Restore a tenant from a signed backup (platform owners only) */
|
|
908
1028
|
restoreTenant(params: {
|
|
909
1029
|
tenantId: string;
|
|
910
|
-
}, body: RestoreTenant
|
|
1030
|
+
}, body: RestoreTenant, options?: {
|
|
1031
|
+
authMethod?: AuthMethod;
|
|
1032
|
+
}): Promise<RestoreTenantResponse>;
|
|
911
1033
|
/** Revoke platform owner status from a user (platform owners only) */
|
|
912
1034
|
revokePlatformOwner(params: {
|
|
913
1035
|
userId: string;
|
|
1036
|
+
}, options?: {
|
|
1037
|
+
authMethod?: AuthMethod;
|
|
914
1038
|
}): Promise<void>;
|
|
915
1039
|
/** Full-text search across threads and posts (visible categories only) */
|
|
916
1040
|
search(params: {
|
|
@@ -920,217 +1044,115 @@ declare class AcpClient {
|
|
|
920
1044
|
type?: SearchResultType;
|
|
921
1045
|
categoryId?: Id;
|
|
922
1046
|
limit?: number;
|
|
1047
|
+
}, options?: {
|
|
1048
|
+
authMethod?: AuthMethod;
|
|
923
1049
|
}): Promise<SearchResponse>;
|
|
924
1050
|
/** Search users by display name or email (case-insensitive) */
|
|
925
1051
|
searchUsers(query?: {
|
|
926
1052
|
q: string;
|
|
927
|
-
}
|
|
1053
|
+
}, options?: {
|
|
1054
|
+
authMethod?: AuthMethod;
|
|
1055
|
+
}): Promise<UserSearchResult[]>;
|
|
928
1056
|
/** Set forum visibility for a group (requires group.manage or group.manage_protected permission) */
|
|
929
1057
|
setGroupForums(params: {
|
|
930
1058
|
tenantId: string;
|
|
931
1059
|
groupId: string;
|
|
932
|
-
}, body: SetGroupForums
|
|
1060
|
+
}, body: SetGroupForums, options?: {
|
|
1061
|
+
authMethod?: AuthMethod;
|
|
1062
|
+
}): Promise<Group>;
|
|
933
1063
|
/** Replace all permissions for a group (requires group.manage permission) */
|
|
934
1064
|
setGroupPermissions(params: {
|
|
935
1065
|
tenantId: string;
|
|
936
1066
|
groupId: string;
|
|
937
|
-
}, body: SetGroupPermissions
|
|
1067
|
+
}, body: SetGroupPermissions, options?: {
|
|
1068
|
+
authMethod?: AuthMethod;
|
|
1069
|
+
}): Promise<Group>;
|
|
938
1070
|
/** Set or remove the custom domain for a tenant */
|
|
939
1071
|
setTenantCustomDomain(params: {
|
|
940
1072
|
tenantId: string;
|
|
941
|
-
}, body: SetCustomDomain
|
|
1073
|
+
}, body: SetCustomDomain, options?: {
|
|
1074
|
+
authMethod?: AuthMethod;
|
|
1075
|
+
}): Promise<void>;
|
|
942
1076
|
/** Mark a thread as read up to a given post */
|
|
943
1077
|
setThreadReadStatus(params: {
|
|
944
1078
|
tenantId: string;
|
|
945
1079
|
threadId: string;
|
|
946
|
-
}, body: SetThreadReadStatus
|
|
1080
|
+
}, body: SetThreadReadStatus, options?: {
|
|
1081
|
+
authMethod?: AuthMethod;
|
|
1082
|
+
}): Promise<void>;
|
|
947
1083
|
/** Replace user group assignments in the current tenant (requires group.manage permission) */
|
|
948
1084
|
setUserGroups(params: {
|
|
949
1085
|
tenantId: string;
|
|
950
1086
|
userId: string;
|
|
951
|
-
}, body: SetUserGroups
|
|
1087
|
+
}, body: SetUserGroups, options?: {
|
|
1088
|
+
authMethod?: AuthMethod;
|
|
1089
|
+
}): Promise<UserMembership>;
|
|
952
1090
|
/** Subscribe to a thread */
|
|
953
1091
|
subscribeThread(params: {
|
|
954
1092
|
tenantId: string;
|
|
955
1093
|
threadId: string;
|
|
1094
|
+
}, options?: {
|
|
1095
|
+
authMethod?: AuthMethod;
|
|
956
1096
|
}): Promise<void>;
|
|
957
1097
|
/** Transfer tenant ownership to another existing user (only the current owner can do this) */
|
|
958
1098
|
transferTenantOwner(params: {
|
|
959
1099
|
tenantId: string;
|
|
960
|
-
}, body: TransferTenantOwner
|
|
1100
|
+
}, body: TransferTenantOwner, options?: {
|
|
1101
|
+
authMethod?: AuthMethod;
|
|
1102
|
+
}): Promise<void>;
|
|
961
1103
|
/** Unsubscribe from a thread */
|
|
962
1104
|
unsubscribeThread(params: {
|
|
963
1105
|
tenantId: string;
|
|
964
1106
|
threadId: string;
|
|
1107
|
+
}, options?: {
|
|
1108
|
+
authMethod?: AuthMethod;
|
|
965
1109
|
}): Promise<void>;
|
|
966
1110
|
/** Update a category (requires category.manage permission) */
|
|
967
1111
|
updateCategory(params: {
|
|
968
1112
|
tenantId: string;
|
|
969
1113
|
categoryId: string;
|
|
970
|
-
}, body: UpdateCategory
|
|
1114
|
+
}, body: UpdateCategory, options?: {
|
|
1115
|
+
authMethod?: AuthMethod;
|
|
1116
|
+
}): Promise<Category>;
|
|
971
1117
|
/** Update a forum (requires forum.manage permission) */
|
|
972
1118
|
updateForum(params: {
|
|
973
1119
|
tenantId: string;
|
|
974
1120
|
forumId: string;
|
|
975
|
-
}, body: UpdateForum
|
|
1121
|
+
}, body: UpdateForum, options?: {
|
|
1122
|
+
authMethod?: AuthMethod;
|
|
1123
|
+
}): Promise<Forum>;
|
|
976
1124
|
/** Update a group (requires group.manage permission) */
|
|
977
1125
|
updateGroup(params: {
|
|
978
1126
|
tenantId: string;
|
|
979
1127
|
groupId: string;
|
|
980
|
-
}, body: UpdateGroup
|
|
1128
|
+
}, body: UpdateGroup, options?: {
|
|
1129
|
+
authMethod?: AuthMethod;
|
|
1130
|
+
}): Promise<Group>;
|
|
981
1131
|
/** Update own profile */
|
|
982
|
-
updateMe(body: UpdateUserProfile
|
|
1132
|
+
updateMe(body: UpdateUserProfile, options?: {
|
|
1133
|
+
authMethod?: AuthMethod;
|
|
1134
|
+
}): Promise<UserProfile>;
|
|
983
1135
|
/** Update a platform setting (platform owners only) */
|
|
984
1136
|
updatePlatformSetting(params: {
|
|
985
1137
|
key: string;
|
|
986
|
-
}, body: UpdatePlatformSetting
|
|
1138
|
+
}, body: UpdatePlatformSetting, options?: {
|
|
1139
|
+
authMethod?: AuthMethod;
|
|
1140
|
+
}): Promise<PlatformSetting>;
|
|
987
1141
|
/** Edit a post (author or post.edit permission) */
|
|
988
1142
|
updatePost(params: {
|
|
989
1143
|
tenantId: string;
|
|
990
1144
|
postId: string;
|
|
991
|
-
}, body: CreatePost
|
|
1145
|
+
}, body: CreatePost, options?: {
|
|
1146
|
+
authMethod?: AuthMethod;
|
|
1147
|
+
}): Promise<Post>;
|
|
992
1148
|
/** Update a thread (title, pin, lock, move) */
|
|
993
1149
|
updateThread(params: {
|
|
994
1150
|
tenantId: string;
|
|
995
1151
|
threadId: string;
|
|
996
|
-
}, body: UpdateThread
|
|
997
|
-
|
|
998
|
-
declare class TenantClient {
|
|
999
|
-
private readonly opts;
|
|
1000
|
-
constructor(opts: RoundtableClientOpts);
|
|
1001
|
-
/** Count read and unread notifications */
|
|
1002
|
-
countNotifications(): Promise<NotificationCount>;
|
|
1003
|
-
/** Create a post in a thread */
|
|
1004
|
-
createPost(params: {
|
|
1005
|
-
tenantId: string;
|
|
1006
|
-
threadId: string;
|
|
1007
|
-
}, body: CreatePost): Promise<Post>;
|
|
1008
|
-
/** Create a thread (and its first post) */
|
|
1009
|
-
createThread(params: {
|
|
1010
|
-
tenantId: string;
|
|
1011
|
-
forumId: string;
|
|
1012
|
-
}, body: CreateThread): Promise<Thread>;
|
|
1013
|
-
/** Soft-delete a post */
|
|
1014
|
-
deletePost(params: {
|
|
1015
|
-
tenantId: string;
|
|
1016
|
-
postId: string;
|
|
1017
|
-
}): Promise<void>;
|
|
1018
|
-
/** Delete a thread */
|
|
1019
|
-
deleteThread(params: {
|
|
1020
|
-
tenantId: string;
|
|
1021
|
-
threadId: string;
|
|
1022
|
-
}): Promise<void>;
|
|
1023
|
-
/** Exchange session cookie for a short-lived tenant JWT */
|
|
1024
|
-
exchangeTenantToken(): Promise<TenantToken>;
|
|
1025
|
-
/** Get a single category */
|
|
1026
|
-
getCategory(params: {
|
|
1027
|
-
tenantId: string;
|
|
1028
|
-
categoryId: string;
|
|
1029
|
-
}): Promise<Category>;
|
|
1030
|
-
/** Get a single forum */
|
|
1031
|
-
getForum(params: {
|
|
1032
|
-
tenantId: string;
|
|
1033
|
-
forumId: string;
|
|
1034
|
-
}): Promise<Forum>;
|
|
1035
|
-
/** Get a group */
|
|
1036
|
-
getGroup(params: {
|
|
1037
|
-
tenantId: string;
|
|
1038
|
-
groupId: string;
|
|
1039
|
-
}): Promise<Group>;
|
|
1040
|
-
/** Get own profile */
|
|
1041
|
-
getMe(): Promise<UserProfile>;
|
|
1042
|
-
/** Get a single thread */
|
|
1043
|
-
getThread(params: {
|
|
1044
|
-
tenantId: string;
|
|
1045
|
-
threadId: string;
|
|
1152
|
+
}, body: UpdateThread, options?: {
|
|
1153
|
+
authMethod?: AuthMethod;
|
|
1046
1154
|
}): Promise<Thread>;
|
|
1047
|
-
/** Get read status for the current user in a thread */
|
|
1048
|
-
getThreadReadStatus(params: {
|
|
1049
|
-
tenantId: string;
|
|
1050
|
-
threadId: string;
|
|
1051
|
-
}): Promise<ThreadReadStatus>;
|
|
1052
|
-
/** Get a user profile by ID */
|
|
1053
|
-
getUser(params: {
|
|
1054
|
-
userId: string;
|
|
1055
|
-
}): Promise<UserProfile>;
|
|
1056
|
-
/** Get user group memberships in the current tenant */
|
|
1057
|
-
getUserMembership(params: {
|
|
1058
|
-
tenantId: string;
|
|
1059
|
-
userId: string;
|
|
1060
|
-
}): Promise<UserMembership>;
|
|
1061
|
-
/** List visible categories for the requesting user */
|
|
1062
|
-
listCategories(params: {
|
|
1063
|
-
tenantId: string;
|
|
1064
|
-
}): Promise<Category[]>;
|
|
1065
|
-
/** List visible forums for the requesting user */
|
|
1066
|
-
listForums(params: {
|
|
1067
|
-
tenantId: string;
|
|
1068
|
-
}): Promise<Forum[]>;
|
|
1069
|
-
/** List members of a group */
|
|
1070
|
-
listGroupMembers(params: {
|
|
1071
|
-
tenantId: string;
|
|
1072
|
-
groupId: string;
|
|
1073
|
-
}): Promise<GroupMember[]>;
|
|
1074
|
-
/** List groups */
|
|
1075
|
-
listGroups(params: {
|
|
1076
|
-
tenantId: string;
|
|
1077
|
-
}): Promise<Group[]>;
|
|
1078
|
-
/** List posts in a thread — cursor pagination or anchor via ?from=postId */
|
|
1079
|
-
listPosts(params: {
|
|
1080
|
-
tenantId: string;
|
|
1081
|
-
threadId: string;
|
|
1082
|
-
}, query?: {
|
|
1083
|
-
cursor?: Id;
|
|
1084
|
-
limit?: number;
|
|
1085
|
-
from?: Id;
|
|
1086
|
-
}): Promise<PaginatedResponse<Post>>;
|
|
1087
|
-
/** List threads in a forum */
|
|
1088
|
-
listThreads(params: {
|
|
1089
|
-
tenantId: string;
|
|
1090
|
-
forumId: string;
|
|
1091
|
-
}, query?: {
|
|
1092
|
-
cursor?: Id;
|
|
1093
|
-
limit?: number;
|
|
1094
|
-
}): Promise<PaginatedResponse<Thread>>;
|
|
1095
|
-
/** Full-text search across threads and posts (visible categories only) */
|
|
1096
|
-
search(params: {
|
|
1097
|
-
tenantId: string;
|
|
1098
|
-
}, query?: {
|
|
1099
|
-
q: string;
|
|
1100
|
-
type?: SearchResultType;
|
|
1101
|
-
categoryId?: Id;
|
|
1102
|
-
limit?: number;
|
|
1103
|
-
}): Promise<SearchResponse>;
|
|
1104
|
-
/** Search users by display name or email (case-insensitive) */
|
|
1105
|
-
searchUsers(query?: {
|
|
1106
|
-
q: string;
|
|
1107
|
-
}): Promise<unknown>;
|
|
1108
|
-
/** Mark a thread as read up to a given post */
|
|
1109
|
-
setThreadReadStatus(params: {
|
|
1110
|
-
tenantId: string;
|
|
1111
|
-
threadId: string;
|
|
1112
|
-
}, body: SetThreadReadStatus): Promise<void>;
|
|
1113
|
-
/** Subscribe to a thread */
|
|
1114
|
-
subscribeThread(params: {
|
|
1115
|
-
tenantId: string;
|
|
1116
|
-
threadId: string;
|
|
1117
|
-
}): Promise<void>;
|
|
1118
|
-
/** Unsubscribe from a thread */
|
|
1119
|
-
unsubscribeThread(params: {
|
|
1120
|
-
tenantId: string;
|
|
1121
|
-
threadId: string;
|
|
1122
|
-
}): Promise<void>;
|
|
1123
|
-
/** Edit a post (author or post.edit permission) */
|
|
1124
|
-
updatePost(params: {
|
|
1125
|
-
tenantId: string;
|
|
1126
|
-
postId: string;
|
|
1127
|
-
}, body: CreatePost): Promise<Post>;
|
|
1128
|
-
/** Update a thread (title, pin, lock, move) */
|
|
1129
|
-
updateThread(params: {
|
|
1130
|
-
tenantId: string;
|
|
1131
|
-
threadId: string;
|
|
1132
|
-
}, body: UpdateThread): Promise<Thread>;
|
|
1133
1155
|
}
|
|
1134
1156
|
|
|
1135
|
-
export {
|
|
1136
|
-
export type { ApiError, ApiKey, BackupCategory, BackupData, BackupGroup, BackupMembership, BackupPayload, BackupPost, BackupQuery, BackupSettings, BackupThread, Category, CreateApiKey, CreateCategory, CreateForum, CreateGroup, CreatePost, CreateTenant, CreateThread, CreatedApiKey, Forum, GrantPlatformOwner, Group, GroupMember, Id, KeyIdParams, Notification, NotificationCount, NotificationIdParams, NotificationType, OwnedTenant, PaginatedResponse, PaginationQuery, Permission, PlatformSetting, PlatformSettingKeyParams, Post, PostsQuery, ReorderCategory, ReorderForum, ReorderGroup, RestoreError, RestoreTenant, RestoreTenantResponse, RoundtableClientOpts, SearchQuery, SearchResponse, SearchResult, SearchResultType, SetCustomDomain, SetGroupForums, SetGroupPermissions, SetThreadReadStatus, SetUserGroups, Tenant, TenantBackup, TenantCategoryIdParams, TenantForumIdParams, TenantGroupIdParams, TenantIdParams, TenantOwner, TenantPostIdParams, TenantThreadIdParams, TenantThreadPostIdParams, TenantToken, TenantUserIdParams, TenantUuidParams, Thread, ThreadReadStatus, TransferTenantOwner, UpdateCategory, UpdateForum, UpdateGroup, UpdatePlatformSetting, UpdatePost, UpdateThread, UpdateUserProfile, UserIdParams, UserMembership, UserProfile };
|
|
1157
|
+
export { ApiKeySchema, AssignablePermissionSchema, BackupPayloadSchema, BackupQuerySchema, CategorySchema, CreateApiKeySchema, CreateCategorySchema, CreateForumSchema, CreateGroupSchema, CreatePostSchema, CreateTenantSchema, CreateThreadSchema, CreatedApiKeySchema, ErrorSchema, ForumSchema, GrantPlatformOwnerSchema, GroupMemberSchema, GroupSchema, IdSchema, KeyIdParamsSchema, NotificationCountSchema, NotificationIdParamsSchema, NotificationSchema, NotificationTypeSchema, OwnedTenantSchema, PERMISSIONS, PaginatedResponseSchema, PaginationQuerySchema, PermissionSchema, PlatformSettingKeyParamsSchema, PlatformSettingSchema, PostSchema, PostsQuerySchema, ReorderCategorySchema, ReorderForumSchema, ReorderGroupSchema, RestoreErrorSchema, RestoreTenantResponseSchema, RestoreTenantSchema, RoundtableClient, SearchQuerySchema, SearchResponseSchema, SearchResultSchema, SearchResultTypeSchema, SetCustomDomainSchema, SetGroupForumsSchema, SetGroupPermissionsSchema, SetTenantOptionsSchema, SetThreadReadStatusSchema, SetUserGroupsSchema, TenantBackupSchema, TenantCategoryIdParamsSchema, TenantForumIdParamsSchema, TenantGroupIdParamsSchema, TenantIdParamsSchema, TenantOptionsSchema, TenantOwnerSchema, TenantPostIdParamsSchema, TenantSchema, TenantThreadIdParamsSchema, TenantThreadPostIdParamsSchema, TenantTokenSchema, TenantUserIdParamsSchema, TenantUuidParamsSchema, ThreadReadStatusSchema, ThreadSchema, TransferTenantOwnerSchema, UpdateCategorySchema, UpdateForumSchema, UpdateGroupSchema, UpdatePlatformSettingSchema, UpdatePostSchema, UpdateThreadSchema, UpdateUserProfileSchema, UserIdParamsSchema, UserMembershipSchema, UserProfileSchema, UserSearchResultSchema, UserSummarySchema };
|
|
1158
|
+
export type { ApiError, ApiKey, BackupCategory, BackupData, BackupGroup, BackupMembership, BackupPayload, BackupPost, BackupQuery, BackupSettings, BackupThread, Category, CreateApiKey, CreateCategory, CreateForum, CreateGroup, CreatePost, CreateTenant, CreateThread, CreatedApiKey, Forum, GrantPlatformOwner, Group, GroupMember, Id, KeyIdParams, Notification, NotificationCount, NotificationIdParams, NotificationType, OwnedTenant, PaginatedResponse, PaginationQuery, Permission, PlatformSetting, PlatformSettingKeyParams, Post, PostsQuery, ReorderCategory, ReorderForum, ReorderGroup, RestoreError, RestoreTenant, RestoreTenantResponse, RoundtableClientOpts, SearchQuery, SearchResponse, SearchResult, SearchResultType, SetCustomDomain, SetGroupForums, SetGroupPermissions, SetTenantOptions, SetThreadReadStatus, SetUserGroups, Tenant, TenantBackup, TenantCategoryIdParams, TenantForumIdParams, TenantGroupIdParams, TenantIdParams, TenantOptions, TenantOwner, TenantPostIdParams, TenantThreadIdParams, TenantThreadPostIdParams, TenantToken, TenantUserIdParams, TenantUuidParams, Thread, ThreadReadStatus, TransferTenantOwner, UpdateCategory, UpdateForum, UpdateGroup, UpdatePlatformSetting, UpdatePost, UpdateThread, UpdateUserProfile, UserIdParams, UserMembership, UserProfile, UserSearchResult, UserSummary };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { RoundtableClient } from './generated/client.js';
|
package/dist/request.js
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
export async function request(opts, method, path, options) {
|
|
2
2
|
const routeAuth = options?.routeAuth;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (
|
|
3
|
+
const authMethod = options?.authMethod;
|
|
4
|
+
let token;
|
|
5
|
+
let useCredentials = false;
|
|
6
|
+
if (authMethod) {
|
|
7
|
+
if (authMethod === 'apiKey') {
|
|
8
|
+
if (!opts.apiKey)
|
|
9
|
+
throw new Error('authMethod: apiKey is not configured');
|
|
10
|
+
token = opts.apiKey;
|
|
11
|
+
}
|
|
12
|
+
else if (authMethod === 'tenantToken') {
|
|
13
|
+
if (!opts.tenantToken)
|
|
14
|
+
throw new Error('authMethod: tenantToken is not configured');
|
|
15
|
+
token = opts.tenantToken;
|
|
16
|
+
}
|
|
17
|
+
else if (authMethod === 'betterAuth') {
|
|
8
18
|
useCredentials = true;
|
|
9
19
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
}
|
|
21
|
+
else if (routeAuth) {
|
|
22
|
+
if (opts.apiKey && routeAuth.acceptsApiKey) {
|
|
23
|
+
token = opts.apiKey;
|
|
24
|
+
}
|
|
25
|
+
else if (opts.tenantToken && routeAuth.acceptsTenantJwt) {
|
|
26
|
+
token = opts.tenantToken;
|
|
13
27
|
}
|
|
14
|
-
|
|
15
|
-
else if (!opts.token && routeAuth.acceptsBetterAuth) {
|
|
28
|
+
else if (routeAuth.acceptsBetterAuth) {
|
|
16
29
|
useCredentials = true;
|
|
17
30
|
}
|
|
18
|
-
// Otherwise: make request without auth (backend will respond 401/403 if needed)
|
|
19
31
|
}
|
|
20
32
|
const url = new URL(`${opts.baseURL}${path}`);
|
|
21
33
|
if (options?.query) {
|
|
@@ -28,12 +40,8 @@ export async function request(opts, method, path, options) {
|
|
|
28
40
|
method,
|
|
29
41
|
credentials: useCredentials ? 'include' : undefined,
|
|
30
42
|
headers: {
|
|
31
|
-
...(options?.body !== undefined
|
|
32
|
-
|
|
33
|
-
: {}),
|
|
34
|
-
...(opts.token && !useCredentials
|
|
35
|
-
? { Authorization: `Bearer ${opts.token}` }
|
|
36
|
-
: {}),
|
|
43
|
+
...(options?.body !== undefined ? { 'Content-Type': 'application/json' } : {}),
|
|
44
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
37
45
|
},
|
|
38
46
|
body: options?.body !== undefined ? JSON.stringify(options.body) : undefined,
|
|
39
47
|
});
|