@roundtable-bb/sdk 0.1.28 → 0.1.33

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
@@ -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 `AcpClient` (all operations) and `TenantClient` (tenant-callable operations only) classes with one method per `operationId`.
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
 
@@ -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 AcpClient {
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
  }