@doist/comms-sdk 0.1.0-alpha.1 → 0.2.1
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/cjs/clients/add-comment-helper.js +18 -2
- package/dist/cjs/clients/base-client.js +11 -5
- package/dist/cjs/clients/channels-client.js +142 -14
- package/dist/cjs/clients/comments-client.js +99 -14
- package/dist/cjs/clients/conversation-messages-client.js +91 -9
- package/dist/cjs/clients/conversations-client.js +166 -15
- package/dist/cjs/clients/groups-client.js +98 -5
- package/dist/cjs/clients/inbox-client.js +102 -16
- package/dist/cjs/clients/reactions-client.js +40 -2
- package/dist/cjs/clients/search-client.js +50 -0
- package/dist/cjs/clients/threads-client.js +238 -24
- package/dist/cjs/clients/users-client.js +138 -11
- package/dist/cjs/clients/workspace-users-client.js +110 -10
- package/dist/cjs/clients/workspaces-client.js +89 -8
- package/dist/cjs/comms-api.js +1 -0
- package/dist/cjs/consts/endpoints.js +8 -3
- package/dist/cjs/testUtils/test-defaults.js +3 -1
- package/dist/cjs/types/api-version.js +8 -0
- package/dist/cjs/types/entities.js +119 -98
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/types/requests.js +0 -1
- package/dist/cjs/utils/url-helpers.js +3 -1
- package/dist/esm/clients/add-comment-helper.js +18 -2
- package/dist/esm/clients/base-client.js +11 -5
- package/dist/esm/clients/channels-client.js +143 -15
- package/dist/esm/clients/comments-client.js +100 -15
- package/dist/esm/clients/conversation-messages-client.js +92 -10
- package/dist/esm/clients/conversations-client.js +167 -16
- package/dist/esm/clients/groups-client.js +98 -5
- package/dist/esm/clients/inbox-client.js +102 -16
- package/dist/esm/clients/reactions-client.js +40 -2
- package/dist/esm/clients/search-client.js +50 -0
- package/dist/esm/clients/threads-client.js +239 -25
- package/dist/esm/clients/users-client.js +138 -11
- package/dist/esm/clients/workspace-users-client.js +110 -10
- package/dist/esm/clients/workspaces-client.js +90 -9
- package/dist/esm/comms-api.js +1 -0
- package/dist/esm/consts/endpoints.js +8 -3
- package/dist/esm/testUtils/test-defaults.js +2 -0
- package/dist/esm/types/api-version.js +5 -0
- package/dist/esm/types/entities.js +111 -97
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/requests.js +0 -1
- package/dist/esm/utils/url-helpers.js +3 -1
- package/dist/types/clients/add-comment-helper.d.ts +20 -1
- package/dist/types/clients/base-client.d.ts +10 -0
- package/dist/types/clients/channels-client.d.ts +126 -6
- package/dist/types/clients/comments-client.d.ts +77 -6
- package/dist/types/clients/conversation-messages-client.d.ts +79 -5
- package/dist/types/clients/conversations-client.d.ts +146 -3
- package/dist/types/clients/groups-client.d.ts +98 -5
- package/dist/types/clients/inbox-client.d.ts +463 -5
- package/dist/types/clients/reactions-client.d.ts +40 -2
- package/dist/types/clients/search-client.d.ts +50 -0
- package/dist/types/clients/threads-client.d.ts +204 -8
- package/dist/types/clients/users-client.d.ts +138 -11
- package/dist/types/clients/workspace-users-client.d.ts +110 -10
- package/dist/types/clients/workspaces-client.d.ts +82 -7
- package/dist/types/comms-api.d.ts +3 -0
- package/dist/types/consts/endpoints.d.ts +6 -1
- package/dist/types/testUtils/test-defaults.d.ts +1 -0
- package/dist/types/types/api-version.d.ts +6 -0
- package/dist/types/types/entities.d.ts +1654 -126
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/requests.d.ts +2 -21
- package/package.json +1 -1
|
@@ -15,7 +15,18 @@ export const GroupListSchema = z.array(GroupSchema);
|
|
|
15
15
|
* `workspace_id` alongside the group `id`.
|
|
16
16
|
*/
|
|
17
17
|
export class GroupsClient extends BaseClient {
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Gets all groups for a given workspace.
|
|
20
|
+
*
|
|
21
|
+
* @param workspaceId - The workspace ID.
|
|
22
|
+
* @returns An array of group objects.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const groups = await api.groups.getGroups(123)
|
|
27
|
+
* groups.forEach(g => console.log(g.name))
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
19
30
|
getGroups(workspaceId) {
|
|
20
31
|
return request({
|
|
21
32
|
httpMethod: 'GET',
|
|
@@ -26,31 +37,113 @@ export class GroupsClient extends BaseClient {
|
|
|
26
37
|
customFetch: this.customFetch,
|
|
27
38
|
}).then((response) => GroupListSchema.parse(response.data));
|
|
28
39
|
}
|
|
29
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Gets a single group object by id. Requires `workspaceId`.
|
|
42
|
+
*
|
|
43
|
+
* @param args - The arguments for getting a group.
|
|
44
|
+
* @param args.id - The group ID.
|
|
45
|
+
* @param args.workspaceId - The workspace ID.
|
|
46
|
+
* @returns The group object.
|
|
47
|
+
*/
|
|
30
48
|
getGroup(args) {
|
|
31
49
|
return this.simple('GET', 'getone', { ...args }, GroupSchema);
|
|
32
50
|
}
|
|
33
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new group. `id` is auto-generated if not supplied.
|
|
53
|
+
*
|
|
54
|
+
* @param args - The arguments for creating a group.
|
|
55
|
+
* @param args.workspaceId - The workspace ID.
|
|
56
|
+
* @param args.name - The group name.
|
|
57
|
+
* @param args.id - Optional caller-supplied group ID (for optimistic-UI workflows).
|
|
58
|
+
* @param args.description - Optional group description.
|
|
59
|
+
* @param args.userIds - Optional array of user IDs to add to the group.
|
|
60
|
+
* @returns The created group object.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const group = await api.groups.createGroup({
|
|
65
|
+
* workspaceId: 123,
|
|
66
|
+
* name: 'Engineering Team',
|
|
67
|
+
* userIds: [1, 2, 3],
|
|
68
|
+
* })
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
34
71
|
createGroup(args) {
|
|
35
72
|
return this.simple('POST', 'add', { ...args, id: resolveCreateId(args.id) }, GroupSchema);
|
|
36
73
|
}
|
|
37
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Updates a group's properties. Requires `workspaceId`.
|
|
76
|
+
*
|
|
77
|
+
* @param args - The arguments for updating a group.
|
|
78
|
+
* @param args.id - The group ID.
|
|
79
|
+
* @param args.workspaceId - The workspace ID.
|
|
80
|
+
* @param args.name - Optional new group name.
|
|
81
|
+
* @param args.description - Optional new group description.
|
|
82
|
+
* @returns The updated group object.
|
|
83
|
+
*/
|
|
38
84
|
updateGroup(args) {
|
|
39
85
|
return this.simple('POST', 'update', { ...args }, GroupSchema);
|
|
40
86
|
}
|
|
41
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Permanently deletes a group. Requires `workspaceId`.
|
|
89
|
+
*
|
|
90
|
+
* @param args - The arguments for deleting a group.
|
|
91
|
+
* @param args.id - The group ID.
|
|
92
|
+
* @param args.workspaceId - The workspace ID.
|
|
93
|
+
*/
|
|
42
94
|
deleteGroup(args) {
|
|
43
95
|
return this.simple('POST', 'remove', { ...args }, StatusOkSchema);
|
|
44
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Adds a user to a group.
|
|
99
|
+
*
|
|
100
|
+
* @param args - The arguments for adding a user.
|
|
101
|
+
* @param args.id - The group ID.
|
|
102
|
+
* @param args.workspaceId - The workspace ID.
|
|
103
|
+
* @param args.userId - The user ID to add.
|
|
104
|
+
*/
|
|
45
105
|
addUser(args) {
|
|
46
106
|
return this.simple('POST', 'add_user', { ...args }, StatusOkSchema);
|
|
47
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Adds multiple users to a group.
|
|
110
|
+
*
|
|
111
|
+
* @param args - The arguments for adding users.
|
|
112
|
+
* @param args.id - The group ID.
|
|
113
|
+
* @param args.workspaceId - The workspace ID.
|
|
114
|
+
* @param args.userIds - Array of user IDs to add.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* await api.groups.addUsers({
|
|
119
|
+
* id: '7YpL3oZ4kZ9vP7Q1tR2sX45',
|
|
120
|
+
* workspaceId: 123,
|
|
121
|
+
* userIds: [101, 202, 303],
|
|
122
|
+
* })
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
48
125
|
addUsers(args) {
|
|
49
126
|
return this.simple('POST', 'add_users', { ...args }, StatusOkSchema);
|
|
50
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Removes a user from a group.
|
|
130
|
+
*
|
|
131
|
+
* @param args - The arguments for removing a user.
|
|
132
|
+
* @param args.id - The group ID.
|
|
133
|
+
* @param args.workspaceId - The workspace ID.
|
|
134
|
+
* @param args.userId - The user ID to remove.
|
|
135
|
+
*/
|
|
51
136
|
removeUser(args) {
|
|
52
137
|
return this.simple('POST', 'remove_user', { ...args }, StatusOkSchema);
|
|
53
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Removes multiple users from a group.
|
|
141
|
+
*
|
|
142
|
+
* @param args - The arguments for removing users.
|
|
143
|
+
* @param args.id - The group ID.
|
|
144
|
+
* @param args.workspaceId - The workspace ID.
|
|
145
|
+
* @param args.userIds - Array of user IDs to remove.
|
|
146
|
+
*/
|
|
54
147
|
removeUsers(args) {
|
|
55
148
|
return this.simple('POST', 'remove_users', { ...args }, StatusOkSchema);
|
|
56
149
|
}
|
|
@@ -1,20 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { ENDPOINT_INBOX } from '../consts/endpoints.js';
|
|
2
3
|
import { request } from '../transport/http-client.js';
|
|
3
|
-
import { InboxThreadSchema } from '../types/entities.js';
|
|
4
|
+
import { createInboxThreadSchema, InboxThreadSchema } from '../types/entities.js';
|
|
4
5
|
import { BaseClient } from './base-client.js';
|
|
6
|
+
export const InboxThreadListSchema = z.array(InboxThreadSchema);
|
|
5
7
|
/** Client for `/api/v1/inbox/`. */
|
|
6
8
|
export class InboxClient extends BaseClient {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.linkBaseUrl = this.getLinkBaseUrl();
|
|
12
|
+
// Reuse the shared singletons when no custom base is configured.
|
|
13
|
+
this.inboxThreadSchema = this.linkBaseUrl
|
|
14
|
+
? createInboxThreadSchema(this.linkBaseUrl)
|
|
15
|
+
: InboxThreadSchema;
|
|
16
|
+
this.inboxThreadListSchema = this.linkBaseUrl
|
|
17
|
+
? z.array(this.inboxThreadSchema)
|
|
18
|
+
: InboxThreadListSchema;
|
|
19
|
+
}
|
|
7
20
|
/**
|
|
8
21
|
* Gets inbox items (threads).
|
|
22
|
+
*
|
|
23
|
+
* @param args - The arguments for getting inbox.
|
|
24
|
+
* @param args.workspaceId - The workspace ID.
|
|
25
|
+
* @param args.newerThan - Optional date to get items newer than.
|
|
26
|
+
* @param args.olderThan - Optional date to get items older than.
|
|
27
|
+
* @param args.limit - Optional limit on number of items returned.
|
|
28
|
+
* @param args.cursor - Optional cursor for pagination.
|
|
29
|
+
* @param args.archiveFilter - Optional filter: 'active' (default), 'archived', or 'all'.
|
|
30
|
+
* @returns Inbox threads.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const inbox = await api.inbox.getInbox({
|
|
35
|
+
* workspaceId: 123,
|
|
36
|
+
* newerThan: new Date('2024-01-01'),
|
|
37
|
+
* })
|
|
38
|
+
*
|
|
39
|
+
* // Include archived (done) items alongside active ones
|
|
40
|
+
* const allInbox = await api.inbox.getInbox({
|
|
41
|
+
* workspaceId: 123,
|
|
42
|
+
* archiveFilter: 'all',
|
|
43
|
+
* })
|
|
44
|
+
* ```
|
|
9
45
|
*/
|
|
10
46
|
getInbox(args) {
|
|
11
47
|
const params = { workspace_id: args.workspaceId };
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (olderThan)
|
|
17
|
-
params.older_than_ts = Math.floor(olderThan.getTime() / 1000);
|
|
48
|
+
if (args.newerThan)
|
|
49
|
+
params.newer_than_ts = Math.floor(args.newerThan.getTime() / 1000);
|
|
50
|
+
if (args.olderThan)
|
|
51
|
+
params.older_than_ts = Math.floor(args.olderThan.getTime() / 1000);
|
|
18
52
|
if (args.limit)
|
|
19
53
|
params.limit = args.limit;
|
|
20
54
|
if (args.cursor)
|
|
@@ -28,9 +62,20 @@ export class InboxClient extends BaseClient {
|
|
|
28
62
|
apiToken: this.apiToken,
|
|
29
63
|
payload: params,
|
|
30
64
|
customFetch: this.customFetch,
|
|
31
|
-
}).then((response) =>
|
|
65
|
+
}).then((response) => this.inboxThreadListSchema.parse(response.data));
|
|
32
66
|
}
|
|
33
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Gets unread count for inbox.
|
|
69
|
+
*
|
|
70
|
+
* @param workspaceId - The workspace ID.
|
|
71
|
+
* @returns The unread count.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const count = await api.inbox.getCount(123)
|
|
76
|
+
* console.log(`Unread items: ${count}`)
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
34
79
|
getCount(workspaceId) {
|
|
35
80
|
return request({
|
|
36
81
|
httpMethod: 'GET',
|
|
@@ -41,7 +86,16 @@ export class InboxClient extends BaseClient {
|
|
|
41
86
|
customFetch: this.customFetch,
|
|
42
87
|
}).then((response) => response.data.data);
|
|
43
88
|
}
|
|
44
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Archives a thread in the inbox.
|
|
91
|
+
*
|
|
92
|
+
* @param id - The thread ID.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* await api.inbox.archiveThread('7YpL3oZ4kZ9vP7Q1tR2sX3z')
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
45
99
|
archiveThread(id) {
|
|
46
100
|
return request({
|
|
47
101
|
httpMethod: 'POST',
|
|
@@ -52,7 +106,16 @@ export class InboxClient extends BaseClient {
|
|
|
52
106
|
customFetch: this.customFetch,
|
|
53
107
|
}).then(() => undefined);
|
|
54
108
|
}
|
|
55
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Unarchives a thread in the inbox.
|
|
111
|
+
*
|
|
112
|
+
* @param id - The thread ID.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* await api.inbox.unarchiveThread('7YpL3oZ4kZ9vP7Q1tR2sX3z')
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
56
119
|
unarchiveThread(id) {
|
|
57
120
|
return request({
|
|
58
121
|
httpMethod: 'POST',
|
|
@@ -63,7 +126,16 @@ export class InboxClient extends BaseClient {
|
|
|
63
126
|
customFetch: this.customFetch,
|
|
64
127
|
}).then(() => undefined);
|
|
65
128
|
}
|
|
66
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Marks all inbox items as read in a workspace.
|
|
131
|
+
*
|
|
132
|
+
* @param workspaceId - The workspace ID.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* await api.inbox.markAllRead(123)
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
67
139
|
markAllRead(workspaceId) {
|
|
68
140
|
return request({
|
|
69
141
|
httpMethod: 'POST',
|
|
@@ -74,14 +146,28 @@ export class InboxClient extends BaseClient {
|
|
|
74
146
|
customFetch: this.customFetch,
|
|
75
147
|
}).then(() => undefined);
|
|
76
148
|
}
|
|
77
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* Archives all inbox items in a workspace.
|
|
151
|
+
*
|
|
152
|
+
* @param args - The arguments for archiving all.
|
|
153
|
+
* @param args.workspaceId - The workspace ID.
|
|
154
|
+
* @param args.channelIds - Optional array of channel IDs to filter by.
|
|
155
|
+
* @param args.olderThan - Optional date to filter items older than.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* await api.inbox.archiveAll({
|
|
160
|
+
* workspaceId: 123,
|
|
161
|
+
* olderThan: new Date('2024-01-01'),
|
|
162
|
+
* })
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
78
165
|
archiveAll(args) {
|
|
79
166
|
const params = { workspace_id: args.workspaceId };
|
|
80
167
|
if (args.channelIds)
|
|
81
168
|
params.channel_ids = args.channelIds;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
params.older_than_ts = Math.floor(olderThan.getTime() / 1000);
|
|
169
|
+
if (args.olderThan)
|
|
170
|
+
params.older_than_ts = Math.floor(args.olderThan.getTime() / 1000);
|
|
85
171
|
return request({
|
|
86
172
|
httpMethod: 'POST',
|
|
87
173
|
baseUri: this.getBaseUri(),
|
|
@@ -14,7 +14,20 @@ function reactionTarget(args) {
|
|
|
14
14
|
* Client for interacting with Comms reaction endpoints.
|
|
15
15
|
*/
|
|
16
16
|
export class ReactionsClient extends BaseClient {
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Adds an emoji reaction to a thread, comment, or conversation message.
|
|
19
|
+
*
|
|
20
|
+
* @param args - The arguments for adding a reaction.
|
|
21
|
+
* @param args.threadId - Optional thread ID.
|
|
22
|
+
* @param args.commentId - Optional comment ID.
|
|
23
|
+
* @param args.messageId - Optional message ID (for conversation messages).
|
|
24
|
+
* @param args.reaction - The reaction emoji to add.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* await api.reactions.add({ threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z', reaction: '👍' })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
18
31
|
add(args) {
|
|
19
32
|
return request({
|
|
20
33
|
httpMethod: 'POST',
|
|
@@ -30,6 +43,18 @@ export class ReactionsClient extends BaseClient {
|
|
|
30
43
|
*
|
|
31
44
|
* Returns an object with emoji reactions as keys and arrays of user IDs as
|
|
32
45
|
* values, or null if no reactions.
|
|
46
|
+
*
|
|
47
|
+
* @param args - The arguments for getting reactions.
|
|
48
|
+
* @param args.threadId - Optional thread ID.
|
|
49
|
+
* @param args.commentId - Optional comment ID.
|
|
50
|
+
* @param args.messageId - Optional message ID (for conversation messages).
|
|
51
|
+
* @returns A reaction object with emoji reactions as keys and arrays of user IDs as values, or null if no reactions.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const reactions = await api.reactions.get({ threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z' })
|
|
56
|
+
* // Returns: { "👍": [101, 202, 303], "❤️": [101, 202] }
|
|
57
|
+
* ```
|
|
33
58
|
*/
|
|
34
59
|
get(args) {
|
|
35
60
|
return request({
|
|
@@ -41,7 +66,20 @@ export class ReactionsClient extends BaseClient {
|
|
|
41
66
|
customFetch: this.customFetch,
|
|
42
67
|
}).then((response) => response.data);
|
|
43
68
|
}
|
|
44
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Removes an emoji reaction from a thread, comment, or conversation message.
|
|
71
|
+
*
|
|
72
|
+
* @param args - The arguments for removing a reaction.
|
|
73
|
+
* @param args.threadId - Optional thread ID.
|
|
74
|
+
* @param args.commentId - Optional comment ID.
|
|
75
|
+
* @param args.messageId - Optional message ID (for conversation messages).
|
|
76
|
+
* @param args.reaction - The reaction emoji to remove.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* await api.reactions.remove({ threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z', reaction: '👍' })
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
45
83
|
remove(args) {
|
|
46
84
|
return request({
|
|
47
85
|
httpMethod: 'POST',
|
|
@@ -8,6 +8,26 @@ import { BaseClient } from './base-client.js';
|
|
|
8
8
|
export class SearchClient extends BaseClient {
|
|
9
9
|
/**
|
|
10
10
|
* Searches across all threads and conversations in a workspace.
|
|
11
|
+
*
|
|
12
|
+
* @param args - The arguments for searching.
|
|
13
|
+
* @param args.query - The search query string. Optional when `mentionSelf: true` is set; required otherwise.
|
|
14
|
+
* @param args.workspaceId - The workspace ID to search in.
|
|
15
|
+
* @param args.channelIds - Optional array of channel IDs to filter by.
|
|
16
|
+
* @param args.authorIds - Optional array of author user IDs to filter by.
|
|
17
|
+
* @param args.mentionSelf - Optional flag to filter by mentions of the current user. When true, `query` may be omitted.
|
|
18
|
+
* @param args.dateFrom - Optional start date for filtering (YYYY-MM-DD).
|
|
19
|
+
* @param args.dateTo - Optional end date for filtering (YYYY-MM-DD).
|
|
20
|
+
* @param args.limit - Optional limit on number of results returned.
|
|
21
|
+
* @param args.cursor - Optional cursor for pagination.
|
|
22
|
+
* @returns Search results with pagination.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const results = await api.search.search({
|
|
27
|
+
* query: 'important meeting',
|
|
28
|
+
* workspaceId: 123,
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
11
31
|
*/
|
|
12
32
|
search(args) {
|
|
13
33
|
const params = { workspace_id: args.workspaceId };
|
|
@@ -41,6 +61,21 @@ export class SearchClient extends BaseClient {
|
|
|
41
61
|
}
|
|
42
62
|
/**
|
|
43
63
|
* Searches within comments of a specific thread.
|
|
64
|
+
*
|
|
65
|
+
* @param args - The arguments for searching within a thread.
|
|
66
|
+
* @param args.query - The search query string.
|
|
67
|
+
* @param args.threadId - The thread ID to search in.
|
|
68
|
+
* @param args.limit - Optional limit on number of results returned.
|
|
69
|
+
* @param args.cursor - Optional cursor for pagination.
|
|
70
|
+
* @returns Comment IDs that match the search query.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const results = await api.search.searchThread({
|
|
75
|
+
* query: 'deadline',
|
|
76
|
+
* threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
|
|
77
|
+
* })
|
|
78
|
+
* ```
|
|
44
79
|
*/
|
|
45
80
|
searchThread(args) {
|
|
46
81
|
const params = {
|
|
@@ -62,6 +97,21 @@ export class SearchClient extends BaseClient {
|
|
|
62
97
|
}
|
|
63
98
|
/**
|
|
64
99
|
* Searches within messages of a specific conversation.
|
|
100
|
+
*
|
|
101
|
+
* @param args - The arguments for searching within a conversation.
|
|
102
|
+
* @param args.query - The search query string.
|
|
103
|
+
* @param args.conversationId - The conversation ID to search in.
|
|
104
|
+
* @param args.limit - Optional limit on number of results returned.
|
|
105
|
+
* @param args.cursor - Optional cursor for pagination.
|
|
106
|
+
* @returns Message IDs that match the search query.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* const results = await api.search.searchConversation({
|
|
111
|
+
* query: 'budget',
|
|
112
|
+
* conversationId: '7YpL3oZ4kZ9vP7Q1tR2sX42',
|
|
113
|
+
* })
|
|
114
|
+
* ```
|
|
65
115
|
*/
|
|
66
116
|
searchConversation(args) {
|
|
67
117
|
const params = {
|