@roundtable-bb/sdk 0.1.3 → 0.1.5
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/dist/generated/client.d.ts +193 -0
- package/dist/generated/client.d.ts.map +1 -0
- package/dist/generated/client.js +267 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/request.d.ts +10 -0
- package/dist/request.d.ts.map +1 -0
- package/dist/request.js +26 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +5 -1
- package/src/generated/client.ts +102 -40
- package/src/request.ts +2 -1
- package/codegen/bundle.mjs +0 -26
- package/codegen/extract-spec.ts +0 -27
- package/codegen/generate.ts +0 -298
- package/openapi.json +0 -13603
- package/project.json +0 -36
- package/tsconfig.json +0 -8
- package/tsconfig.lib.json +0 -20
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { ApiKey, Category, CreateApiKey, CreateCategory, CreateGroup, CreatePost, CreateTenant, CreateThread, CreatedApiKey, GrantPlatformOwner, Group, Id, Notification, PaginatedResponse, PlatformSetting, Post, ReorderCategory, SearchResponse, SearchResultType, SetGroupCategories, SetGroupPermissions, SetThreadReadStatus, SetUserGroups, Tenant, TenantToken, Thread, ThreadReadStatus, UpdateCategory, UpdateGroup, UpdatePlatformSetting, UpdateThread, UpdateUserProfile, UserMembership, UserProfile } from '@roundtable-bb/types';
|
|
2
|
+
import { type RoundtableClientOpts } from '../request.js';
|
|
3
|
+
export declare class RoundtableClient {
|
|
4
|
+
private readonly opts;
|
|
5
|
+
constructor(opts: RoundtableClientOpts);
|
|
6
|
+
/** Export a signed tenant backup (platform owners only) */
|
|
7
|
+
backupTenant(params: {
|
|
8
|
+
id: string;
|
|
9
|
+
}, query?: {
|
|
10
|
+
includeContent?: boolean;
|
|
11
|
+
}): Promise<unknown>;
|
|
12
|
+
/** Count read and unread notifications */
|
|
13
|
+
countNotifications(): Promise<unknown>;
|
|
14
|
+
/** Create a platform-scoped API key (returned once in full) */
|
|
15
|
+
createApiKey(body: CreateApiKey): Promise<CreatedApiKey>;
|
|
16
|
+
/** Create a category (requires category.create permission) */
|
|
17
|
+
createCategory(body: CreateCategory): Promise<Category>;
|
|
18
|
+
/** Create a group (requires group.create permission) */
|
|
19
|
+
createGroup(body: CreateGroup): Promise<Group>;
|
|
20
|
+
/** Create a post in a thread */
|
|
21
|
+
createPost(params: {
|
|
22
|
+
threadId: string;
|
|
23
|
+
}, body: CreatePost): Promise<Post>;
|
|
24
|
+
/** Create a new tenant (requires allow_tenant_creation platform setting or platform owner) */
|
|
25
|
+
createTenant(body: CreateTenant): Promise<Tenant>;
|
|
26
|
+
/** Create a thread (and its first post) */
|
|
27
|
+
createThread(params: {
|
|
28
|
+
categoryId: string;
|
|
29
|
+
}, body: CreateThread): Promise<Thread>;
|
|
30
|
+
/** Delete a platform-scoped API key */
|
|
31
|
+
deleteApiKey(params: {
|
|
32
|
+
id: string;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
/** Delete a category (requires category.delete permission) */
|
|
35
|
+
deleteCategory(params: {
|
|
36
|
+
id: string;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
/** Delete a group (requires group.delete permission) */
|
|
39
|
+
deleteGroup(params: {
|
|
40
|
+
id: string;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
/** Delete a notification */
|
|
43
|
+
deleteNotification(params: {
|
|
44
|
+
id: string;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
/** Soft-delete a post */
|
|
47
|
+
deletePost(params: {
|
|
48
|
+
id: string;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
/** Delete a thread */
|
|
51
|
+
deleteThread(params: {
|
|
52
|
+
id: string;
|
|
53
|
+
}): Promise<void>;
|
|
54
|
+
/** Exchange session cookie for a short-lived tenant JWT */
|
|
55
|
+
exchangeTenantToken(): Promise<TenantToken>;
|
|
56
|
+
/** Get a single category */
|
|
57
|
+
getCategory(params: {
|
|
58
|
+
id: string;
|
|
59
|
+
}): Promise<Category>;
|
|
60
|
+
/** Get a group */
|
|
61
|
+
getGroup(params: {
|
|
62
|
+
id: string;
|
|
63
|
+
}): Promise<Group>;
|
|
64
|
+
/** Get own profile */
|
|
65
|
+
getMe(): Promise<UserProfile>;
|
|
66
|
+
/** Get the current owner of a tenant */
|
|
67
|
+
getTenantOwner(params: {
|
|
68
|
+
id: string;
|
|
69
|
+
}): Promise<unknown>;
|
|
70
|
+
/** Get a single thread */
|
|
71
|
+
getThread(params: {
|
|
72
|
+
id: string;
|
|
73
|
+
}): Promise<Thread>;
|
|
74
|
+
/** Get read status for the current user in a thread */
|
|
75
|
+
getThreadReadStatus(params: {
|
|
76
|
+
id: string;
|
|
77
|
+
}): Promise<ThreadReadStatus>;
|
|
78
|
+
/** Get a user profile by ID */
|
|
79
|
+
getUser(params: {
|
|
80
|
+
id: string;
|
|
81
|
+
}): Promise<UserProfile>;
|
|
82
|
+
/** Get user group memberships in the current tenant */
|
|
83
|
+
getUserMembership(params: {
|
|
84
|
+
id: string;
|
|
85
|
+
}): Promise<UserMembership>;
|
|
86
|
+
/** Grant platform owner status to a user (platform owners only) */
|
|
87
|
+
grantPlatformOwner(body: GrantPlatformOwner): Promise<void>;
|
|
88
|
+
/** List your platform-scoped API keys */
|
|
89
|
+
listApiKeys(): Promise<ApiKey[]>;
|
|
90
|
+
/** List visible categories for the requesting user */
|
|
91
|
+
listCategories(): Promise<Category[]>;
|
|
92
|
+
/** List groups */
|
|
93
|
+
listGroups(): Promise<Group[]>;
|
|
94
|
+
/** Get unified notification inbox */
|
|
95
|
+
listNotifications(query?: {
|
|
96
|
+
cursor?: Id;
|
|
97
|
+
limit?: number;
|
|
98
|
+
unreadOnly?: boolean;
|
|
99
|
+
}): Promise<PaginatedResponse<Notification>>;
|
|
100
|
+
/** List platform owner user IDs (platform owners only) */
|
|
101
|
+
listPlatformOwners(): Promise<string[]>;
|
|
102
|
+
/** List all platform settings (platform owners only) */
|
|
103
|
+
listPlatformSettings(): Promise<PlatformSetting[]>;
|
|
104
|
+
/** List posts in a thread — cursor pagination or anchor via ?from=postId */
|
|
105
|
+
listPosts(params: {
|
|
106
|
+
threadId: string;
|
|
107
|
+
}, query?: {
|
|
108
|
+
cursor?: Id;
|
|
109
|
+
limit?: number;
|
|
110
|
+
from?: Id;
|
|
111
|
+
}): Promise<PaginatedResponse<Post>>;
|
|
112
|
+
/** List threads in a category */
|
|
113
|
+
listThreads(params: {
|
|
114
|
+
categoryId: string;
|
|
115
|
+
}, query?: {
|
|
116
|
+
cursor?: Id;
|
|
117
|
+
limit?: number;
|
|
118
|
+
}): Promise<PaginatedResponse<Thread>>;
|
|
119
|
+
/** Mark a notification as read */
|
|
120
|
+
markNotificationRead(params: {
|
|
121
|
+
id: string;
|
|
122
|
+
}): Promise<Notification>;
|
|
123
|
+
/** Set the position of each category (requires category.edit permission) */
|
|
124
|
+
reorderCategories(body: ReorderCategory): Promise<void>;
|
|
125
|
+
/** Set the position of each group (requires group.edit permission) */
|
|
126
|
+
reorderGroups(body: ReorderCategory): Promise<void>;
|
|
127
|
+
/** Restore a tenant from a signed backup (platform owners only) */
|
|
128
|
+
restoreTenant(params: {
|
|
129
|
+
id: string;
|
|
130
|
+
}, body: unknown): Promise<unknown>;
|
|
131
|
+
/** Revoke platform owner status from a user (platform owners only) */
|
|
132
|
+
revokePlatformOwner(params: {
|
|
133
|
+
userId: string;
|
|
134
|
+
}): Promise<void>;
|
|
135
|
+
/** Full-text search across threads and posts (visible categories only) */
|
|
136
|
+
search(query?: {
|
|
137
|
+
q: string;
|
|
138
|
+
type?: SearchResultType;
|
|
139
|
+
categoryId?: Id;
|
|
140
|
+
limit?: number;
|
|
141
|
+
}): Promise<SearchResponse>;
|
|
142
|
+
/** Set category visibility for a group (requires group.edit permission) */
|
|
143
|
+
setGroupCategories(params: {
|
|
144
|
+
id: string;
|
|
145
|
+
}, body: SetGroupCategories): Promise<Group>;
|
|
146
|
+
/** Replace all permissions for a group (requires group.edit permission) */
|
|
147
|
+
setGroupPermissions(params: {
|
|
148
|
+
id: string;
|
|
149
|
+
}, body: SetGroupPermissions): Promise<Group>;
|
|
150
|
+
/** Mark a thread as read up to a given post */
|
|
151
|
+
setThreadReadStatus(params: {
|
|
152
|
+
id: string;
|
|
153
|
+
}, body: SetThreadReadStatus): Promise<void>;
|
|
154
|
+
/** Replace user group assignments in the current tenant (requires group.assign permission) */
|
|
155
|
+
setUserGroups(params: {
|
|
156
|
+
id: string;
|
|
157
|
+
}, body: SetUserGroups): Promise<UserMembership>;
|
|
158
|
+
/** Subscribe to a thread */
|
|
159
|
+
subscribeThread(params: {
|
|
160
|
+
id: string;
|
|
161
|
+
}): Promise<void>;
|
|
162
|
+
/** Transfer tenant ownership to another existing user (only the current owner can do this) */
|
|
163
|
+
transferTenantOwner(params: {
|
|
164
|
+
id: string;
|
|
165
|
+
}, body: GrantPlatformOwner): Promise<void>;
|
|
166
|
+
/** Unsubscribe from a thread */
|
|
167
|
+
unsubscribeThread(params: {
|
|
168
|
+
id: string;
|
|
169
|
+
}): Promise<void>;
|
|
170
|
+
/** Update a category (requires category.edit permission) */
|
|
171
|
+
updateCategory(params: {
|
|
172
|
+
id: string;
|
|
173
|
+
}, body: UpdateCategory): Promise<Category>;
|
|
174
|
+
/** Update a group (requires group.edit permission) */
|
|
175
|
+
updateGroup(params: {
|
|
176
|
+
id: string;
|
|
177
|
+
}, body: UpdateGroup): Promise<Group>;
|
|
178
|
+
/** Update own profile */
|
|
179
|
+
updateMe(body: UpdateUserProfile): Promise<UserProfile>;
|
|
180
|
+
/** Update a platform setting (platform owners only) */
|
|
181
|
+
updatePlatformSetting(params: {
|
|
182
|
+
key: string;
|
|
183
|
+
}, body: UpdatePlatformSetting): Promise<PlatformSetting>;
|
|
184
|
+
/** Edit a post (author or post.edit permission) */
|
|
185
|
+
updatePost(params: {
|
|
186
|
+
id: string;
|
|
187
|
+
}, body: CreatePost): Promise<Post>;
|
|
188
|
+
/** Update a thread (title, pin, lock, move) */
|
|
189
|
+
updateThread(params: {
|
|
190
|
+
id: string;
|
|
191
|
+
}, body: UpdateThread): Promise<Thread>;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/generated/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACthB,OAAO,EAAW,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAElE,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,oBAAoB;IAEvD,2DAA2D;IAC3D,YAAY,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAI5F,0CAA0C;IAC1C,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IAItC,+DAA+D;IAC/D,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAIxD,8DAA8D;IAC9D,cAAc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4D;IAC5D,cAAc,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAK/E,sDAAsD;IACtD,WAAW,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;IAKtE,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC;IAKvD,uDAAuD;IACvD,qBAAqB,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC;IAIrG,mDAAmD;IACnD,UAAU,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnE,+CAA+C;IAC/C,YAAY,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;CAI1E"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// AUTO-GENERATED — do not edit manually.
|
|
2
|
+
// Run `nx run @roundtable-bb/sdk:codegen` to regenerate.
|
|
3
|
+
import { request } from '../request.js';
|
|
4
|
+
export class RoundtableClient {
|
|
5
|
+
opts;
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
this.opts = opts;
|
|
8
|
+
}
|
|
9
|
+
/** Export a signed tenant backup (platform owners only) */
|
|
10
|
+
backupTenant(params, query) {
|
|
11
|
+
return request(this.opts, 'GET', `/tenants/${params.id}/backup`, { query, useCredentials: true });
|
|
12
|
+
}
|
|
13
|
+
/** Count read and unread notifications */
|
|
14
|
+
countNotifications() {
|
|
15
|
+
return request(this.opts, 'GET', '/notifications/count', { useCredentials: true });
|
|
16
|
+
}
|
|
17
|
+
/** Create a platform-scoped API key (returned once in full) */
|
|
18
|
+
createApiKey(body) {
|
|
19
|
+
return request(this.opts, 'POST', '/platform/api-keys', { body, useCredentials: true });
|
|
20
|
+
}
|
|
21
|
+
/** Create a category (requires category.create permission) */
|
|
22
|
+
createCategory(body) {
|
|
23
|
+
return request(this.opts, 'POST', '/categories', { body, useCredentials: true });
|
|
24
|
+
}
|
|
25
|
+
/** Create a group (requires group.create permission) */
|
|
26
|
+
createGroup(body) {
|
|
27
|
+
return request(this.opts, 'POST', '/groups', { body, useCredentials: true });
|
|
28
|
+
}
|
|
29
|
+
/** Create a post in a thread */
|
|
30
|
+
createPost(params, body) {
|
|
31
|
+
if (!this.opts.token)
|
|
32
|
+
throw new Error('createPost requires a token (API key or JWT)');
|
|
33
|
+
return request(this.opts, 'POST', `/threads/${params.threadId}/posts`, { body });
|
|
34
|
+
}
|
|
35
|
+
/** Create a new tenant (requires allow_tenant_creation platform setting or platform owner) */
|
|
36
|
+
createTenant(body) {
|
|
37
|
+
return request(this.opts, 'POST', '/tenants', { body, useCredentials: true });
|
|
38
|
+
}
|
|
39
|
+
/** Create a thread (and its first post) */
|
|
40
|
+
createThread(params, body) {
|
|
41
|
+
if (!this.opts.token)
|
|
42
|
+
throw new Error('createThread requires a token (API key or JWT)');
|
|
43
|
+
return request(this.opts, 'POST', `/categories/${params.categoryId}/threads`, { body });
|
|
44
|
+
}
|
|
45
|
+
/** Delete a platform-scoped API key */
|
|
46
|
+
deleteApiKey(params) {
|
|
47
|
+
return request(this.opts, 'DELETE', `/platform/api-keys/${params.id}`, { useCredentials: true });
|
|
48
|
+
}
|
|
49
|
+
/** Delete a category (requires category.delete permission) */
|
|
50
|
+
deleteCategory(params) {
|
|
51
|
+
return request(this.opts, 'DELETE', `/categories/${params.id}`, { useCredentials: true });
|
|
52
|
+
}
|
|
53
|
+
/** Delete a group (requires group.delete permission) */
|
|
54
|
+
deleteGroup(params) {
|
|
55
|
+
return request(this.opts, 'DELETE', `/groups/${params.id}`, { useCredentials: true });
|
|
56
|
+
}
|
|
57
|
+
/** Delete a notification */
|
|
58
|
+
deleteNotification(params) {
|
|
59
|
+
return request(this.opts, 'DELETE', `/notifications/${params.id}`, { useCredentials: true });
|
|
60
|
+
}
|
|
61
|
+
/** Soft-delete a post */
|
|
62
|
+
deletePost(params) {
|
|
63
|
+
if (!this.opts.token)
|
|
64
|
+
throw new Error('deletePost requires a token (API key or JWT)');
|
|
65
|
+
return request(this.opts, 'DELETE', `/posts/${params.id}`);
|
|
66
|
+
}
|
|
67
|
+
/** Delete a thread */
|
|
68
|
+
deleteThread(params) {
|
|
69
|
+
if (!this.opts.token)
|
|
70
|
+
throw new Error('deleteThread requires a token (API key or JWT)');
|
|
71
|
+
return request(this.opts, 'DELETE', `/threads/${params.id}`);
|
|
72
|
+
}
|
|
73
|
+
/** Exchange session cookie for a short-lived tenant JWT */
|
|
74
|
+
exchangeTenantToken() {
|
|
75
|
+
return request(this.opts, 'POST', '/tenant-token', { useCredentials: true });
|
|
76
|
+
}
|
|
77
|
+
/** Get a single category */
|
|
78
|
+
getCategory(params) {
|
|
79
|
+
if (!this.opts.token)
|
|
80
|
+
throw new Error('getCategory requires a token (API key or JWT)');
|
|
81
|
+
return request(this.opts, 'GET', `/categories/${params.id}`);
|
|
82
|
+
}
|
|
83
|
+
/** Get a group */
|
|
84
|
+
getGroup(params) {
|
|
85
|
+
if (!this.opts.token)
|
|
86
|
+
throw new Error('getGroup requires a token (API key or JWT)');
|
|
87
|
+
return request(this.opts, 'GET', `/groups/${params.id}`);
|
|
88
|
+
}
|
|
89
|
+
/** Get own profile */
|
|
90
|
+
getMe() {
|
|
91
|
+
if (!this.opts.token)
|
|
92
|
+
throw new Error('getMe requires a token (API key or JWT)');
|
|
93
|
+
return request(this.opts, 'GET', '/users/me');
|
|
94
|
+
}
|
|
95
|
+
/** Get the current owner of a tenant */
|
|
96
|
+
getTenantOwner(params) {
|
|
97
|
+
return request(this.opts, 'GET', `/tenants/${params.id}/owner`, { useCredentials: true });
|
|
98
|
+
}
|
|
99
|
+
/** Get a single thread */
|
|
100
|
+
getThread(params) {
|
|
101
|
+
if (!this.opts.token)
|
|
102
|
+
throw new Error('getThread requires a token (API key or JWT)');
|
|
103
|
+
return request(this.opts, 'GET', `/threads/${params.id}`);
|
|
104
|
+
}
|
|
105
|
+
/** Get read status for the current user in a thread */
|
|
106
|
+
getThreadReadStatus(params) {
|
|
107
|
+
if (!this.opts.token)
|
|
108
|
+
throw new Error('getThreadReadStatus requires a token (API key or JWT)');
|
|
109
|
+
return request(this.opts, 'GET', `/threads/${params.id}/read-status`);
|
|
110
|
+
}
|
|
111
|
+
/** Get a user profile by ID */
|
|
112
|
+
getUser(params) {
|
|
113
|
+
if (!this.opts.token)
|
|
114
|
+
throw new Error('getUser requires a token (API key or JWT)');
|
|
115
|
+
return request(this.opts, 'GET', `/users/${params.id}`);
|
|
116
|
+
}
|
|
117
|
+
/** Get user group memberships in the current tenant */
|
|
118
|
+
getUserMembership(params) {
|
|
119
|
+
if (!this.opts.token)
|
|
120
|
+
throw new Error('getUserMembership requires a token (API key or JWT)');
|
|
121
|
+
return request(this.opts, 'GET', `/users/${params.id}/membership`);
|
|
122
|
+
}
|
|
123
|
+
/** Grant platform owner status to a user (platform owners only) */
|
|
124
|
+
grantPlatformOwner(body) {
|
|
125
|
+
return request(this.opts, 'POST', '/platform/owners', { body, useCredentials: true });
|
|
126
|
+
}
|
|
127
|
+
/** List your platform-scoped API keys */
|
|
128
|
+
listApiKeys() {
|
|
129
|
+
return request(this.opts, 'GET', '/platform/api-keys', { useCredentials: true });
|
|
130
|
+
}
|
|
131
|
+
/** List visible categories for the requesting user */
|
|
132
|
+
listCategories() {
|
|
133
|
+
if (!this.opts.token)
|
|
134
|
+
throw new Error('listCategories requires a token (API key or JWT)');
|
|
135
|
+
return request(this.opts, 'GET', '/categories');
|
|
136
|
+
}
|
|
137
|
+
/** List groups */
|
|
138
|
+
listGroups() {
|
|
139
|
+
if (!this.opts.token)
|
|
140
|
+
throw new Error('listGroups requires a token (API key or JWT)');
|
|
141
|
+
return request(this.opts, 'GET', '/groups');
|
|
142
|
+
}
|
|
143
|
+
/** Get unified notification inbox */
|
|
144
|
+
listNotifications(query) {
|
|
145
|
+
return request(this.opts, 'GET', '/notifications', { query, useCredentials: true });
|
|
146
|
+
}
|
|
147
|
+
/** List platform owner user IDs (platform owners only) */
|
|
148
|
+
listPlatformOwners() {
|
|
149
|
+
return request(this.opts, 'GET', '/platform/owners', { useCredentials: true });
|
|
150
|
+
}
|
|
151
|
+
/** List all platform settings (platform owners only) */
|
|
152
|
+
listPlatformSettings() {
|
|
153
|
+
return request(this.opts, 'GET', '/platform/settings', { useCredentials: true });
|
|
154
|
+
}
|
|
155
|
+
/** List posts in a thread — cursor pagination or anchor via ?from=postId */
|
|
156
|
+
listPosts(params, query) {
|
|
157
|
+
if (!this.opts.token)
|
|
158
|
+
throw new Error('listPosts requires a token (API key or JWT)');
|
|
159
|
+
return request(this.opts, 'GET', `/threads/${params.threadId}/posts`, { query });
|
|
160
|
+
}
|
|
161
|
+
/** List threads in a category */
|
|
162
|
+
listThreads(params, query) {
|
|
163
|
+
if (!this.opts.token)
|
|
164
|
+
throw new Error('listThreads requires a token (API key or JWT)');
|
|
165
|
+
return request(this.opts, 'GET', `/categories/${params.categoryId}/threads`, { query });
|
|
166
|
+
}
|
|
167
|
+
/** Mark a notification as read */
|
|
168
|
+
markNotificationRead(params) {
|
|
169
|
+
return request(this.opts, 'PATCH', `/notifications/${params.id}/read`, { useCredentials: true });
|
|
170
|
+
}
|
|
171
|
+
/** Set the position of each category (requires category.edit permission) */
|
|
172
|
+
reorderCategories(body) {
|
|
173
|
+
return request(this.opts, 'PUT', '/categories/reorder', { body, useCredentials: true });
|
|
174
|
+
}
|
|
175
|
+
/** Set the position of each group (requires group.edit permission) */
|
|
176
|
+
reorderGroups(body) {
|
|
177
|
+
return request(this.opts, 'PUT', '/groups/reorder', { body, useCredentials: true });
|
|
178
|
+
}
|
|
179
|
+
/** Restore a tenant from a signed backup (platform owners only) */
|
|
180
|
+
restoreTenant(params, body) {
|
|
181
|
+
return request(this.opts, 'POST', `/tenants/${params.id}/restore`, { body, useCredentials: true });
|
|
182
|
+
}
|
|
183
|
+
/** Revoke platform owner status from a user (platform owners only) */
|
|
184
|
+
revokePlatformOwner(params) {
|
|
185
|
+
return request(this.opts, 'DELETE', `/platform/owners/${params.userId}`, { useCredentials: true });
|
|
186
|
+
}
|
|
187
|
+
/** Full-text search across threads and posts (visible categories only) */
|
|
188
|
+
search(query) {
|
|
189
|
+
if (!this.opts.token)
|
|
190
|
+
throw new Error('search requires a token (API key or JWT)');
|
|
191
|
+
return request(this.opts, 'GET', '/search', { query });
|
|
192
|
+
}
|
|
193
|
+
/** Set category visibility for a group (requires group.edit permission) */
|
|
194
|
+
setGroupCategories(params, body) {
|
|
195
|
+
if (!this.opts.token)
|
|
196
|
+
throw new Error('setGroupCategories requires a token (API key or JWT)');
|
|
197
|
+
return request(this.opts, 'PUT', `/groups/${params.id}/categories`, { body });
|
|
198
|
+
}
|
|
199
|
+
/** Replace all permissions for a group (requires group.edit permission) */
|
|
200
|
+
setGroupPermissions(params, body) {
|
|
201
|
+
if (!this.opts.token)
|
|
202
|
+
throw new Error('setGroupPermissions requires a token (API key or JWT)');
|
|
203
|
+
return request(this.opts, 'PUT', `/groups/${params.id}/permissions`, { body });
|
|
204
|
+
}
|
|
205
|
+
/** Mark a thread as read up to a given post */
|
|
206
|
+
setThreadReadStatus(params, body) {
|
|
207
|
+
if (!this.opts.token)
|
|
208
|
+
throw new Error('setThreadReadStatus requires a token (API key or JWT)');
|
|
209
|
+
return request(this.opts, 'PUT', `/threads/${params.id}/read-status`, { body });
|
|
210
|
+
}
|
|
211
|
+
/** Replace user group assignments in the current tenant (requires group.assign permission) */
|
|
212
|
+
setUserGroups(params, body) {
|
|
213
|
+
if (!this.opts.token)
|
|
214
|
+
throw new Error('setUserGroups requires a token (API key or JWT)');
|
|
215
|
+
return request(this.opts, 'PUT', `/users/${params.id}/membership`, { body });
|
|
216
|
+
}
|
|
217
|
+
/** Subscribe to a thread */
|
|
218
|
+
subscribeThread(params) {
|
|
219
|
+
if (!this.opts.token)
|
|
220
|
+
throw new Error('subscribeThread requires a token (API key or JWT)');
|
|
221
|
+
return request(this.opts, 'POST', `/threads/${params.id}/subscribe`);
|
|
222
|
+
}
|
|
223
|
+
/** Transfer tenant ownership to another existing user (only the current owner can do this) */
|
|
224
|
+
transferTenantOwner(params, body) {
|
|
225
|
+
return request(this.opts, 'PUT', `/tenants/${params.id}/owner`, { body, useCredentials: true });
|
|
226
|
+
}
|
|
227
|
+
/** Unsubscribe from a thread */
|
|
228
|
+
unsubscribeThread(params) {
|
|
229
|
+
if (!this.opts.token)
|
|
230
|
+
throw new Error('unsubscribeThread requires a token (API key or JWT)');
|
|
231
|
+
return request(this.opts, 'DELETE', `/threads/${params.id}/subscribe`);
|
|
232
|
+
}
|
|
233
|
+
/** Update a category (requires category.edit permission) */
|
|
234
|
+
updateCategory(params, body) {
|
|
235
|
+
if (!this.opts.token)
|
|
236
|
+
throw new Error('updateCategory requires a token (API key or JWT)');
|
|
237
|
+
return request(this.opts, 'PATCH', `/categories/${params.id}`, { body });
|
|
238
|
+
}
|
|
239
|
+
/** Update a group (requires group.edit permission) */
|
|
240
|
+
updateGroup(params, body) {
|
|
241
|
+
if (!this.opts.token)
|
|
242
|
+
throw new Error('updateGroup requires a token (API key or JWT)');
|
|
243
|
+
return request(this.opts, 'PATCH', `/groups/${params.id}`, { body });
|
|
244
|
+
}
|
|
245
|
+
/** Update own profile */
|
|
246
|
+
updateMe(body) {
|
|
247
|
+
if (!this.opts.token)
|
|
248
|
+
throw new Error('updateMe requires a token (API key or JWT)');
|
|
249
|
+
return request(this.opts, 'PATCH', '/users/me', { body });
|
|
250
|
+
}
|
|
251
|
+
/** Update a platform setting (platform owners only) */
|
|
252
|
+
updatePlatformSetting(params, body) {
|
|
253
|
+
return request(this.opts, 'PATCH', `/platform/settings/${params.key}`, { body, useCredentials: true });
|
|
254
|
+
}
|
|
255
|
+
/** Edit a post (author or post.edit permission) */
|
|
256
|
+
updatePost(params, body) {
|
|
257
|
+
if (!this.opts.token)
|
|
258
|
+
throw new Error('updatePost requires a token (API key or JWT)');
|
|
259
|
+
return request(this.opts, 'PATCH', `/posts/${params.id}`, { body });
|
|
260
|
+
}
|
|
261
|
+
/** Update a thread (title, pin, lock, move) */
|
|
262
|
+
updateThread(params, body) {
|
|
263
|
+
if (!this.opts.token)
|
|
264
|
+
throw new Error('updateThread requires a token (API key or JWT)');
|
|
265
|
+
return request(this.opts, 'PATCH', `/threads/${params.id}`, { body });
|
|
266
|
+
}
|
|
267
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AACxD,mBAAmB,sBAAsB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RoundtableClient } from './generated/client.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface RoundtableClientOpts {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
token?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function request<T>(opts: RoundtableClientOpts, method: string, path: string, options?: {
|
|
6
|
+
body?: unknown;
|
|
7
|
+
query?: Record<string, unknown>;
|
|
8
|
+
useCredentials?: boolean;
|
|
9
|
+
}): Promise<T>;
|
|
10
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,OAAO,CAAC,CAAC,EAC7B,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,GACtF,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
|
package/dist/request.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export async function request(opts, method, path, options) {
|
|
2
|
+
const url = new URL(`${opts.baseUrl}${path}`);
|
|
3
|
+
if (options?.query) {
|
|
4
|
+
for (const [k, v] of Object.entries(options.query)) {
|
|
5
|
+
if (v !== undefined && v !== null)
|
|
6
|
+
url.searchParams.set(k, String(v));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const res = await fetch(url.toString(), {
|
|
10
|
+
method,
|
|
11
|
+
credentials: options?.useCredentials ? 'include' : undefined,
|
|
12
|
+
headers: {
|
|
13
|
+
...(options?.body !== undefined ? { 'Content-Type': 'application/json' } : {}),
|
|
14
|
+
...(opts.token ? { Authorization: `Bearer ${opts.token}` } : {}),
|
|
15
|
+
},
|
|
16
|
+
body: options?.body !== undefined ? JSON.stringify(options.body) : undefined,
|
|
17
|
+
});
|
|
18
|
+
if (res.status === 204)
|
|
19
|
+
return undefined;
|
|
20
|
+
if (!res.ok) {
|
|
21
|
+
const err = await res.json().catch(() => ({ message: res.statusText }));
|
|
22
|
+
const msg = err.message ?? res.statusText;
|
|
23
|
+
throw Object.assign(new Error(msg), { status: res.status });
|
|
24
|
+
}
|
|
25
|
+
return res.json();
|
|
26
|
+
}
|