@doist/comms-sdk 0.0.1 → 0.2.0
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/LICENSE +21 -0
- package/README.md +143 -45
- package/dist/cjs/authentication.js +211 -0
- package/dist/cjs/clients/add-comment-helper.js +70 -0
- package/dist/cjs/clients/base-client.js +25 -0
- package/dist/cjs/clients/channels-client.js +200 -0
- package/dist/cjs/clients/comments-client.js +159 -0
- package/dist/cjs/clients/conversation-messages-client.js +158 -0
- package/dist/cjs/clients/conversations-client.js +243 -0
- package/dist/cjs/clients/groups-client.js +164 -0
- package/dist/cjs/clients/inbox-client.js +171 -0
- package/dist/cjs/clients/reactions-client.js +97 -0
- package/dist/cjs/clients/search-client.js +138 -0
- package/dist/cjs/clients/threads-client.js +330 -0
- package/dist/cjs/clients/users-client.js +326 -0
- package/dist/cjs/clients/workspace-users-client.js +240 -0
- package/dist/cjs/clients/workspaces-client.js +166 -0
- package/dist/cjs/comms-api.js +66 -0
- package/dist/cjs/consts/endpoints.js +32 -0
- package/dist/cjs/index.js +48 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/testUtils/msw-handlers.js +51 -0
- package/dist/cjs/testUtils/msw-setup.js +21 -0
- package/dist/cjs/testUtils/obsidian-fetch-adapter.js +53 -0
- package/dist/cjs/testUtils/test-defaults.js +104 -0
- package/dist/cjs/transport/fetch-with-retry.js +136 -0
- package/dist/cjs/transport/http-client.js +56 -0
- package/dist/cjs/transport/http-dispatcher.js +143 -0
- package/dist/cjs/types/api-version.js +8 -0
- package/dist/cjs/types/entities.js +411 -0
- package/dist/cjs/types/enums.js +37 -0
- package/dist/cjs/types/errors.js +12 -0
- package/dist/cjs/types/http.js +4 -0
- package/dist/cjs/types/index.js +22 -0
- package/dist/cjs/types/requests.js +116 -0
- package/dist/cjs/utils/case-conversion.js +54 -0
- package/dist/cjs/utils/index.js +19 -0
- package/dist/cjs/utils/timestamp-conversion.js +49 -0
- package/dist/cjs/utils/url-helpers.js +131 -0
- package/dist/cjs/utils/uuidv7.js +174 -0
- package/dist/esm/authentication.js +203 -0
- package/dist/esm/clients/add-comment-helper.js +67 -0
- package/dist/esm/clients/base-client.js +21 -0
- package/dist/esm/clients/channels-client.js +196 -0
- package/dist/esm/clients/comments-client.js +155 -0
- package/dist/esm/clients/conversation-messages-client.js +154 -0
- package/dist/esm/clients/conversations-client.js +239 -0
- package/dist/esm/clients/groups-client.js +160 -0
- package/dist/esm/clients/inbox-client.js +167 -0
- package/dist/esm/clients/reactions-client.js +93 -0
- package/dist/esm/clients/search-client.js +134 -0
- package/dist/esm/clients/threads-client.js +326 -0
- package/dist/esm/clients/users-client.js +322 -0
- package/dist/esm/clients/workspace-users-client.js +236 -0
- package/dist/esm/clients/workspaces-client.js +162 -0
- package/dist/esm/comms-api.js +62 -0
- package/dist/esm/consts/endpoints.js +28 -0
- package/dist/esm/index.js +17 -0
- package/dist/esm/testUtils/msw-handlers.js +45 -0
- package/dist/esm/testUtils/msw-setup.js +18 -0
- package/dist/esm/testUtils/obsidian-fetch-adapter.js +50 -0
- package/dist/esm/testUtils/test-defaults.js +101 -0
- package/dist/esm/transport/fetch-with-retry.js +133 -0
- package/dist/esm/transport/http-client.js +51 -0
- package/dist/esm/transport/http-dispatcher.js +104 -0
- package/dist/esm/types/api-version.js +5 -0
- package/dist/esm/types/entities.js +408 -0
- package/dist/esm/types/enums.js +34 -0
- package/dist/esm/types/errors.js +8 -0
- package/dist/esm/types/http.js +1 -0
- package/dist/esm/types/index.js +6 -0
- package/dist/esm/types/requests.js +113 -0
- package/dist/esm/utils/case-conversion.js +47 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/timestamp-conversion.js +45 -0
- package/dist/esm/utils/url-helpers.js +112 -0
- package/dist/esm/utils/uuidv7.js +163 -0
- package/dist/types/authentication.d.ts +160 -0
- package/dist/types/clients/add-comment-helper.d.ts +29 -0
- package/dist/types/clients/base-client.d.ts +28 -0
- package/dist/types/clients/channels-client.d.ts +208 -0
- package/dist/types/clients/comments-client.d.ts +224 -0
- package/dist/types/clients/conversation-messages-client.d.ts +198 -0
- package/dist/types/clients/conversations-client.d.ts +346 -0
- package/dist/types/clients/groups-client.d.ts +148 -0
- package/dist/types/clients/inbox-client.d.ts +96 -0
- package/dist/types/clients/reactions-client.d.ts +57 -0
- package/dist/types/clients/search-client.d.ts +70 -0
- package/dist/types/clients/threads-client.d.ts +536 -0
- package/dist/types/clients/users-client.d.ts +250 -0
- package/dist/types/clients/workspace-users-client.d.ts +147 -0
- package/dist/types/clients/workspaces-client.d.ts +152 -0
- package/dist/types/comms-api.d.ts +62 -0
- package/dist/types/consts/endpoints.d.ts +24 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/testUtils/msw-handlers.d.ts +28 -0
- package/dist/types/testUtils/msw-setup.d.ts +1 -0
- package/dist/types/testUtils/obsidian-fetch-adapter.d.ts +29 -0
- package/dist/types/testUtils/test-defaults.d.ts +17 -0
- package/dist/types/transport/fetch-with-retry.d.ts +4 -0
- package/dist/types/transport/http-client.d.ts +13 -0
- package/dist/types/transport/http-dispatcher.d.ts +10 -0
- package/dist/types/types/api-version.d.ts +6 -0
- package/dist/types/types/entities.d.ts +1288 -0
- package/dist/types/types/enums.d.ts +55 -0
- package/dist/types/types/errors.d.ts +6 -0
- package/dist/types/types/http.d.ts +54 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/requests.d.ts +366 -0
- package/dist/types/utils/case-conversion.d.ts +8 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/timestamp-conversion.d.ts +13 -0
- package/dist/types/utils/url-helpers.d.ts +88 -0
- package/dist/types/utils/uuidv7.d.ts +40 -0
- package/package.json +91 -8
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type SearchConversationResponse, type SearchResponse, type SearchThreadResponse } from '../types/entities.js';
|
|
2
|
+
import type { SearchArgs, SearchConversationArgs, SearchThreadArgs } from '../types/requests.js';
|
|
3
|
+
import { BaseClient } from './base-client.js';
|
|
4
|
+
/**
|
|
5
|
+
* Client for interacting with Comms search endpoints.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SearchClient extends BaseClient {
|
|
8
|
+
/**
|
|
9
|
+
* Searches across all threads and conversations in a workspace.
|
|
10
|
+
*
|
|
11
|
+
* @param args - The arguments for searching.
|
|
12
|
+
* @param args.query - The search query string. Optional when `mentionSelf: true` is set; required otherwise.
|
|
13
|
+
* @param args.workspaceId - The workspace ID to search in.
|
|
14
|
+
* @param args.channelIds - Optional array of channel IDs to filter by.
|
|
15
|
+
* @param args.authorIds - Optional array of author user IDs to filter by.
|
|
16
|
+
* @param args.mentionSelf - Optional flag to filter by mentions of the current user. When true, `query` may be omitted.
|
|
17
|
+
* @param args.dateFrom - Optional start date for filtering (YYYY-MM-DD).
|
|
18
|
+
* @param args.dateTo - Optional end date for filtering (YYYY-MM-DD).
|
|
19
|
+
* @param args.limit - Optional limit on number of results returned.
|
|
20
|
+
* @param args.cursor - Optional cursor for pagination.
|
|
21
|
+
* @returns Search results with pagination.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const results = await api.search.search({
|
|
26
|
+
* query: 'important meeting',
|
|
27
|
+
* workspaceId: 123,
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
search(args: SearchArgs): Promise<SearchResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Searches within comments of a specific thread.
|
|
34
|
+
*
|
|
35
|
+
* @param args - The arguments for searching within a thread.
|
|
36
|
+
* @param args.query - The search query string.
|
|
37
|
+
* @param args.threadId - The thread ID to search in.
|
|
38
|
+
* @param args.limit - Optional limit on number of results returned.
|
|
39
|
+
* @param args.cursor - Optional cursor for pagination.
|
|
40
|
+
* @returns Comment IDs that match the search query.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const results = await api.search.searchThread({
|
|
45
|
+
* query: 'deadline',
|
|
46
|
+
* threadId: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
|
|
47
|
+
* })
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
searchThread(args: SearchThreadArgs): Promise<SearchThreadResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Searches within messages of a specific conversation.
|
|
53
|
+
*
|
|
54
|
+
* @param args - The arguments for searching within a conversation.
|
|
55
|
+
* @param args.query - The search query string.
|
|
56
|
+
* @param args.conversationId - The conversation ID to search in.
|
|
57
|
+
* @param args.limit - Optional limit on number of results returned.
|
|
58
|
+
* @param args.cursor - Optional cursor for pagination.
|
|
59
|
+
* @returns Message IDs that match the search query.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const results = await api.search.searchConversation({
|
|
64
|
+
* query: 'budget',
|
|
65
|
+
* conversationId: '7YpL3oZ4kZ9vP7Q1tR2sX42',
|
|
66
|
+
* })
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
searchConversation(args: SearchConversationArgs): Promise<SearchConversationResponse>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Comment, type StatusOk, type Thread, type UnreadThread } from '../types/entities.js';
|
|
3
|
+
import type { CloseThreadArgs, CreateThreadArgs, GetThreadsArgs, MarkThreadReadArgs, MarkThreadUnreadArgs, MarkThreadUnreadForOthersArgs, MoveThreadToChannelArgs, MuteThreadArgs, ReopenThreadArgs, UpdateThreadArgs } from '../types/requests.js';
|
|
4
|
+
import { BaseClient } from './base-client.js';
|
|
5
|
+
export declare const ThreadListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
title: z.ZodString;
|
|
8
|
+
content: z.ZodString;
|
|
9
|
+
creator: z.ZodNumber;
|
|
10
|
+
creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
channelId: z.ZodString;
|
|
12
|
+
workspaceId: z.ZodNumber;
|
|
13
|
+
actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
|
|
14
|
+
attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
15
|
+
attachmentId: z.ZodString;
|
|
16
|
+
urlType: z.ZodString;
|
|
17
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
|
+
fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
21
|
+
underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
24
|
+
imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
|
+
imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
26
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
31
|
+
}, z.core.$loose>>>>;
|
|
32
|
+
commentCount: z.ZodNumber;
|
|
33
|
+
closed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
34
|
+
directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
35
|
+
directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
36
|
+
groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
37
|
+
lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
38
|
+
lastObjIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
39
|
+
lastUpdated: z.ZodDate;
|
|
40
|
+
mutedUntil: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
41
|
+
participants: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
42
|
+
pinned: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
pinnedTs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
44
|
+
posted: z.ZodDate;
|
|
45
|
+
reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
46
|
+
recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
47
|
+
responders: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
48
|
+
snippet: z.ZodString;
|
|
49
|
+
snippetCreator: z.ZodNumber;
|
|
50
|
+
snippetMaskAvatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
snippetMaskPoster: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
|
|
53
|
+
toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
54
|
+
isArchived: z.ZodBoolean;
|
|
55
|
+
isSaved: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
56
|
+
inInbox: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
57
|
+
lastComment: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
content: z.ZodString;
|
|
60
|
+
creator: z.ZodNumber;
|
|
61
|
+
creatorName: z.ZodString;
|
|
62
|
+
threadId: z.ZodString;
|
|
63
|
+
channelId: z.ZodString;
|
|
64
|
+
posted: z.ZodDate;
|
|
65
|
+
systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
|
|
66
|
+
attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
67
|
+
attachmentId: z.ZodString;
|
|
68
|
+
urlType: z.ZodString;
|
|
69
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
70
|
+
url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
|
+
fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
|
+
fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
73
|
+
underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
77
|
+
imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
78
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
80
|
+
video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
81
|
+
videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
83
|
+
}, z.core.$loose>>>>;
|
|
84
|
+
reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodNumber>>>>;
|
|
85
|
+
actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
|
|
86
|
+
objIndex: z.ZodNumber;
|
|
87
|
+
lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
88
|
+
deleted: z.ZodBoolean;
|
|
89
|
+
deletedBy: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
90
|
+
directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
91
|
+
directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
92
|
+
groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
93
|
+
recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
|
94
|
+
toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
95
|
+
version: z.ZodNumber;
|
|
96
|
+
workspaceId: z.ZodNumber;
|
|
97
|
+
}, z.core.$strip>>>;
|
|
98
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
99
|
+
url: string;
|
|
100
|
+
id: string;
|
|
101
|
+
title: string;
|
|
102
|
+
content: string;
|
|
103
|
+
creator: number;
|
|
104
|
+
channelId: string;
|
|
105
|
+
workspaceId: number;
|
|
106
|
+
commentCount: number;
|
|
107
|
+
lastUpdated: Date;
|
|
108
|
+
posted: Date;
|
|
109
|
+
snippet: string;
|
|
110
|
+
snippetCreator: number;
|
|
111
|
+
isArchived: boolean;
|
|
112
|
+
creatorName?: string | null | undefined;
|
|
113
|
+
actions?: unknown[] | null | undefined;
|
|
114
|
+
attachments?: {
|
|
115
|
+
[x: string]: unknown;
|
|
116
|
+
attachmentId: string;
|
|
117
|
+
urlType: string;
|
|
118
|
+
title?: string | null | undefined;
|
|
119
|
+
url?: string | null | undefined;
|
|
120
|
+
fileName?: string | null | undefined;
|
|
121
|
+
fileSize?: number | null | undefined;
|
|
122
|
+
underlyingType?: string | null | undefined;
|
|
123
|
+
description?: string | null | undefined;
|
|
124
|
+
image?: string | null | undefined;
|
|
125
|
+
imageWidth?: number | null | undefined;
|
|
126
|
+
imageHeight?: number | null | undefined;
|
|
127
|
+
duration?: string | null | undefined;
|
|
128
|
+
uploadState?: string | null | undefined;
|
|
129
|
+
video?: string | null | undefined;
|
|
130
|
+
videoType?: string | null | undefined;
|
|
131
|
+
videoAutoPlay?: boolean | null | undefined;
|
|
132
|
+
}[] | null | undefined;
|
|
133
|
+
closed?: boolean | null | undefined;
|
|
134
|
+
directGroupMentions?: string[] | null | undefined;
|
|
135
|
+
directMentions?: number[] | null | undefined;
|
|
136
|
+
groups?: string[] | null | undefined;
|
|
137
|
+
lastEdited?: Date | null | undefined;
|
|
138
|
+
lastObjIndex?: number | null | undefined;
|
|
139
|
+
mutedUntil?: Date | null | undefined;
|
|
140
|
+
participants?: number[] | null | undefined;
|
|
141
|
+
pinned?: boolean | undefined;
|
|
142
|
+
pinnedTs?: number | null | undefined;
|
|
143
|
+
reactions?: Record<string, unknown> | null | undefined;
|
|
144
|
+
recipients?: number[] | null | undefined;
|
|
145
|
+
responders?: number[] | null | undefined;
|
|
146
|
+
snippetMaskAvatarUrl?: string | null | undefined;
|
|
147
|
+
snippetMaskPoster?: string | null | undefined;
|
|
148
|
+
systemMessage?: unknown;
|
|
149
|
+
toEmails?: string[] | null | undefined;
|
|
150
|
+
isSaved?: boolean | null | undefined;
|
|
151
|
+
inInbox?: boolean | null | undefined;
|
|
152
|
+
lastComment?: {
|
|
153
|
+
id: string;
|
|
154
|
+
content: string;
|
|
155
|
+
creator: number;
|
|
156
|
+
creatorName: string;
|
|
157
|
+
threadId: string;
|
|
158
|
+
channelId: string;
|
|
159
|
+
posted: Date;
|
|
160
|
+
objIndex: number;
|
|
161
|
+
deleted: boolean;
|
|
162
|
+
version: number;
|
|
163
|
+
workspaceId: number;
|
|
164
|
+
systemMessage?: unknown;
|
|
165
|
+
attachments?: {
|
|
166
|
+
[x: string]: unknown;
|
|
167
|
+
attachmentId: string;
|
|
168
|
+
urlType: string;
|
|
169
|
+
title?: string | null | undefined;
|
|
170
|
+
url?: string | null | undefined;
|
|
171
|
+
fileName?: string | null | undefined;
|
|
172
|
+
fileSize?: number | null | undefined;
|
|
173
|
+
underlyingType?: string | null | undefined;
|
|
174
|
+
description?: string | null | undefined;
|
|
175
|
+
image?: string | null | undefined;
|
|
176
|
+
imageWidth?: number | null | undefined;
|
|
177
|
+
imageHeight?: number | null | undefined;
|
|
178
|
+
duration?: string | null | undefined;
|
|
179
|
+
uploadState?: string | null | undefined;
|
|
180
|
+
video?: string | null | undefined;
|
|
181
|
+
videoType?: string | null | undefined;
|
|
182
|
+
videoAutoPlay?: boolean | null | undefined;
|
|
183
|
+
}[] | null | undefined;
|
|
184
|
+
reactions?: Record<string, number[]> | null | undefined;
|
|
185
|
+
actions?: unknown[] | null | undefined;
|
|
186
|
+
lastEdited?: Date | null | undefined;
|
|
187
|
+
deletedBy?: number | null | undefined;
|
|
188
|
+
directGroupMentions?: string[] | null | undefined;
|
|
189
|
+
directMentions?: number[] | null | undefined;
|
|
190
|
+
groups?: string[] | null | undefined;
|
|
191
|
+
recipients?: number[] | null | undefined;
|
|
192
|
+
toEmails?: string[] | null | undefined;
|
|
193
|
+
} | null | undefined;
|
|
194
|
+
}, {
|
|
195
|
+
id: string;
|
|
196
|
+
title: string;
|
|
197
|
+
content: string;
|
|
198
|
+
creator: number;
|
|
199
|
+
channelId: string;
|
|
200
|
+
workspaceId: number;
|
|
201
|
+
commentCount: number;
|
|
202
|
+
lastUpdated: Date;
|
|
203
|
+
posted: Date;
|
|
204
|
+
snippet: string;
|
|
205
|
+
snippetCreator: number;
|
|
206
|
+
isArchived: boolean;
|
|
207
|
+
creatorName?: string | null | undefined;
|
|
208
|
+
actions?: unknown[] | null | undefined;
|
|
209
|
+
attachments?: {
|
|
210
|
+
[x: string]: unknown;
|
|
211
|
+
attachmentId: string;
|
|
212
|
+
urlType: string;
|
|
213
|
+
title?: string | null | undefined;
|
|
214
|
+
url?: string | null | undefined;
|
|
215
|
+
fileName?: string | null | undefined;
|
|
216
|
+
fileSize?: number | null | undefined;
|
|
217
|
+
underlyingType?: string | null | undefined;
|
|
218
|
+
description?: string | null | undefined;
|
|
219
|
+
image?: string | null | undefined;
|
|
220
|
+
imageWidth?: number | null | undefined;
|
|
221
|
+
imageHeight?: number | null | undefined;
|
|
222
|
+
duration?: string | null | undefined;
|
|
223
|
+
uploadState?: string | null | undefined;
|
|
224
|
+
video?: string | null | undefined;
|
|
225
|
+
videoType?: string | null | undefined;
|
|
226
|
+
videoAutoPlay?: boolean | null | undefined;
|
|
227
|
+
}[] | null | undefined;
|
|
228
|
+
closed?: boolean | null | undefined;
|
|
229
|
+
directGroupMentions?: string[] | null | undefined;
|
|
230
|
+
directMentions?: number[] | null | undefined;
|
|
231
|
+
groups?: string[] | null | undefined;
|
|
232
|
+
lastEdited?: Date | null | undefined;
|
|
233
|
+
lastObjIndex?: number | null | undefined;
|
|
234
|
+
mutedUntil?: Date | null | undefined;
|
|
235
|
+
participants?: number[] | null | undefined;
|
|
236
|
+
pinned?: boolean | undefined;
|
|
237
|
+
pinnedTs?: number | null | undefined;
|
|
238
|
+
reactions?: Record<string, unknown> | null | undefined;
|
|
239
|
+
recipients?: number[] | null | undefined;
|
|
240
|
+
responders?: number[] | null | undefined;
|
|
241
|
+
snippetMaskAvatarUrl?: string | null | undefined;
|
|
242
|
+
snippetMaskPoster?: string | null | undefined;
|
|
243
|
+
systemMessage?: unknown;
|
|
244
|
+
toEmails?: string[] | null | undefined;
|
|
245
|
+
isSaved?: boolean | null | undefined;
|
|
246
|
+
inInbox?: boolean | null | undefined;
|
|
247
|
+
lastComment?: {
|
|
248
|
+
id: string;
|
|
249
|
+
content: string;
|
|
250
|
+
creator: number;
|
|
251
|
+
creatorName: string;
|
|
252
|
+
threadId: string;
|
|
253
|
+
channelId: string;
|
|
254
|
+
posted: Date;
|
|
255
|
+
objIndex: number;
|
|
256
|
+
deleted: boolean;
|
|
257
|
+
version: number;
|
|
258
|
+
workspaceId: number;
|
|
259
|
+
systemMessage?: unknown;
|
|
260
|
+
attachments?: {
|
|
261
|
+
[x: string]: unknown;
|
|
262
|
+
attachmentId: string;
|
|
263
|
+
urlType: string;
|
|
264
|
+
title?: string | null | undefined;
|
|
265
|
+
url?: string | null | undefined;
|
|
266
|
+
fileName?: string | null | undefined;
|
|
267
|
+
fileSize?: number | null | undefined;
|
|
268
|
+
underlyingType?: string | null | undefined;
|
|
269
|
+
description?: string | null | undefined;
|
|
270
|
+
image?: string | null | undefined;
|
|
271
|
+
imageWidth?: number | null | undefined;
|
|
272
|
+
imageHeight?: number | null | undefined;
|
|
273
|
+
duration?: string | null | undefined;
|
|
274
|
+
uploadState?: string | null | undefined;
|
|
275
|
+
video?: string | null | undefined;
|
|
276
|
+
videoType?: string | null | undefined;
|
|
277
|
+
videoAutoPlay?: boolean | null | undefined;
|
|
278
|
+
}[] | null | undefined;
|
|
279
|
+
reactions?: Record<string, number[]> | null | undefined;
|
|
280
|
+
actions?: unknown[] | null | undefined;
|
|
281
|
+
lastEdited?: Date | null | undefined;
|
|
282
|
+
deletedBy?: number | null | undefined;
|
|
283
|
+
directGroupMentions?: string[] | null | undefined;
|
|
284
|
+
directMentions?: number[] | null | undefined;
|
|
285
|
+
groups?: string[] | null | undefined;
|
|
286
|
+
recipients?: number[] | null | undefined;
|
|
287
|
+
toEmails?: string[] | null | undefined;
|
|
288
|
+
} | null | undefined;
|
|
289
|
+
}>>>;
|
|
290
|
+
/**
|
|
291
|
+
* Client for `/api/v1/threads/`. The SDK auto-generates the thread `id` on
|
|
292
|
+
* `createThread` when the caller doesn't supply one.
|
|
293
|
+
*/
|
|
294
|
+
export declare class ThreadsClient extends BaseClient {
|
|
295
|
+
/**
|
|
296
|
+
* Gets threads. At least one of `channelId` / `workspaceId` is required.
|
|
297
|
+
* `newerThan` / `olderThan` (`Date`) are converted to the
|
|
298
|
+
* `newer_than_ts` / `older_than_ts` epoch-second params on the wire.
|
|
299
|
+
*
|
|
300
|
+
* @param args - The arguments for getting threads.
|
|
301
|
+
* @param args.workspaceId - The workspace ID.
|
|
302
|
+
* @param args.channelId - Optional channel ID to narrow to a single channel.
|
|
303
|
+
* @param args.archived - Optional flag to include archived threads.
|
|
304
|
+
* @param args.newerThan - Optional date to get threads newer than.
|
|
305
|
+
* @param args.olderThan - Optional date to get threads older than.
|
|
306
|
+
* @param args.limit - Optional limit on number of threads returned.
|
|
307
|
+
* @returns An array of thread objects.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* const threads = await api.threads.getThreads({
|
|
312
|
+
* workspaceId: 123,
|
|
313
|
+
* channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44',
|
|
314
|
+
* })
|
|
315
|
+
* threads.forEach(t => console.log(t.title))
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
getThreads(args: GetThreadsArgs): Promise<Thread[]>;
|
|
319
|
+
/**
|
|
320
|
+
* Gets a single thread object by id.
|
|
321
|
+
*
|
|
322
|
+
* @param id - The thread ID.
|
|
323
|
+
* @returns The thread object.
|
|
324
|
+
*/
|
|
325
|
+
getThread(id: string): Promise<Thread>;
|
|
326
|
+
/**
|
|
327
|
+
* Creates a new thread in a channel. `id` is auto-generated if not supplied.
|
|
328
|
+
*
|
|
329
|
+
* @param args - The arguments for creating a thread.
|
|
330
|
+
* @param args.channelId - The channel ID.
|
|
331
|
+
* @param args.title - Optional thread title.
|
|
332
|
+
* @param args.content - The thread content.
|
|
333
|
+
* @param args.recipients - Optional array of user IDs to notify.
|
|
334
|
+
* @param args.groups - Optional array of custom group IDs to notify.
|
|
335
|
+
* @returns The created thread object.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* const thread = await api.threads.createThread({
|
|
340
|
+
* channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44',
|
|
341
|
+
* title: 'New Feature Discussion',
|
|
342
|
+
* content: 'Let\'s discuss the new feature...',
|
|
343
|
+
* })
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
createThread(args: CreateThreadArgs): Promise<Thread>;
|
|
347
|
+
/**
|
|
348
|
+
* Partial update of an existing thread.
|
|
349
|
+
*
|
|
350
|
+
* @param args - The arguments for updating a thread.
|
|
351
|
+
* @param args.id - The thread ID.
|
|
352
|
+
* @param args.title - Optional new thread title.
|
|
353
|
+
* @param args.content - Optional new thread content.
|
|
354
|
+
* @returns The updated thread object.
|
|
355
|
+
*/
|
|
356
|
+
updateThread(args: UpdateThreadArgs): Promise<Thread>;
|
|
357
|
+
/**
|
|
358
|
+
* Permanently deletes a thread.
|
|
359
|
+
*
|
|
360
|
+
* @param id - The thread ID.
|
|
361
|
+
*/
|
|
362
|
+
deleteThread(id: string): Promise<StatusOk>;
|
|
363
|
+
/**
|
|
364
|
+
* Saves a thread (formerly "star").
|
|
365
|
+
*
|
|
366
|
+
* @param id - The thread ID.
|
|
367
|
+
*/
|
|
368
|
+
saveThread(id: string): Promise<StatusOk>;
|
|
369
|
+
/**
|
|
370
|
+
* Unsaves a thread (formerly "unstar").
|
|
371
|
+
*
|
|
372
|
+
* @param id - The thread ID.
|
|
373
|
+
*/
|
|
374
|
+
unsaveThread(id: string): Promise<StatusOk>;
|
|
375
|
+
/**
|
|
376
|
+
* Pins a thread.
|
|
377
|
+
*
|
|
378
|
+
* @param id - The thread ID.
|
|
379
|
+
*/
|
|
380
|
+
pinThread(id: string): Promise<StatusOk>;
|
|
381
|
+
/**
|
|
382
|
+
* Unpins a thread.
|
|
383
|
+
*
|
|
384
|
+
* @param id - The thread ID.
|
|
385
|
+
*/
|
|
386
|
+
unpinThread(id: string): Promise<StatusOk>;
|
|
387
|
+
/**
|
|
388
|
+
* Moves a thread to another channel.
|
|
389
|
+
*
|
|
390
|
+
* @param args - The arguments for moving a thread.
|
|
391
|
+
* @param args.id - The thread ID.
|
|
392
|
+
* @param args.toChannel - The target channel ID.
|
|
393
|
+
* @returns The updated thread object.
|
|
394
|
+
*/
|
|
395
|
+
moveToChannel(args: MoveThreadToChannelArgs): Promise<Thread>;
|
|
396
|
+
/**
|
|
397
|
+
* Marks a thread as read.
|
|
398
|
+
*
|
|
399
|
+
* @param args - The arguments for marking a thread as read.
|
|
400
|
+
* @param args.id - The thread ID.
|
|
401
|
+
* @param args.objIndex - The index of the last known read message.
|
|
402
|
+
*/
|
|
403
|
+
markRead(args: MarkThreadReadArgs): Promise<StatusOk>;
|
|
404
|
+
/**
|
|
405
|
+
* Marks a thread as unread.
|
|
406
|
+
*
|
|
407
|
+
* @param args - The arguments for marking a thread as unread.
|
|
408
|
+
* @param args.id - The thread ID.
|
|
409
|
+
* @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
|
|
410
|
+
*/
|
|
411
|
+
markUnread(args: MarkThreadUnreadArgs): Promise<StatusOk>;
|
|
412
|
+
/**
|
|
413
|
+
* Marks a thread as unread for others. Useful to notify others about thread changes.
|
|
414
|
+
*
|
|
415
|
+
* @param args - The arguments for marking a thread as unread for others.
|
|
416
|
+
* @param args.id - The thread ID.
|
|
417
|
+
* @param args.objIndex - The index of the last unread message. Use -1 to mark the whole thread as unread.
|
|
418
|
+
*/
|
|
419
|
+
markUnreadForOthers(args: MarkThreadUnreadForOthersArgs): Promise<StatusOk>;
|
|
420
|
+
/**
|
|
421
|
+
* Marks every thread in a workspace or channel as read. Exactly one of
|
|
422
|
+
* `workspaceId` / `channelId` should be set.
|
|
423
|
+
*
|
|
424
|
+
* @param args - Either workspaceId or channelId (one is required).
|
|
425
|
+
* @param args.workspaceId - The workspace ID.
|
|
426
|
+
* @param args.channelId - The channel ID.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* // Mark all in workspace
|
|
431
|
+
* await api.threads.markAllRead({ workspaceId: 123 })
|
|
432
|
+
*
|
|
433
|
+
* // Mark all in channel
|
|
434
|
+
* await api.threads.markAllRead({ channelId: '7YpL3oZ4kZ9vP7Q1tR2sX44' })
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
markAllRead(args: {
|
|
438
|
+
workspaceId?: number;
|
|
439
|
+
channelId?: string;
|
|
440
|
+
}): Promise<StatusOk>;
|
|
441
|
+
/**
|
|
442
|
+
* Clears unread threads in a workspace.
|
|
443
|
+
*
|
|
444
|
+
* @param workspaceId - The workspace ID.
|
|
445
|
+
*/
|
|
446
|
+
clearUnread(workspaceId: number): Promise<StatusOk>;
|
|
447
|
+
/**
|
|
448
|
+
* Returns unread threads for a workspace, paired with the unread version
|
|
449
|
+
* counter and (optionally) the inbox unread count.
|
|
450
|
+
*
|
|
451
|
+
* @param workspaceId - The workspace ID.
|
|
452
|
+
* @returns Object containing the array of unread thread references, a version counter, and optionally the inbox unread count.
|
|
453
|
+
*/
|
|
454
|
+
getUnread(workspaceId: number): Promise<{
|
|
455
|
+
data: UnreadThread[];
|
|
456
|
+
version: number;
|
|
457
|
+
inboxUnread?: number | null;
|
|
458
|
+
}>;
|
|
459
|
+
/**
|
|
460
|
+
* Mutes a thread for a specified number of minutes.
|
|
461
|
+
* When muted, you will not get notified in your inbox about new comments.
|
|
462
|
+
*
|
|
463
|
+
* @param args - The arguments for muting a thread.
|
|
464
|
+
* @param args.id - The thread ID.
|
|
465
|
+
* @param args.minutes - Number of minutes to mute the thread.
|
|
466
|
+
* @returns The updated thread object.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```typescript
|
|
470
|
+
* const thread = await api.threads.muteThread({ id: '7YpL3oZ4kZ9vP7Q1tR2sX3z', minutes: 30 })
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
muteThread(args: MuteThreadArgs): Promise<Thread>;
|
|
474
|
+
/**
|
|
475
|
+
* Unmutes a thread.
|
|
476
|
+
* You will start to see notifications in your inbox again when new comments are added.
|
|
477
|
+
*
|
|
478
|
+
* @param id - The thread ID.
|
|
479
|
+
* @returns The updated thread object.
|
|
480
|
+
*/
|
|
481
|
+
unmuteThread(id: string): Promise<Thread>;
|
|
482
|
+
/**
|
|
483
|
+
* Closes a thread by adding a comment with a close action.
|
|
484
|
+
*
|
|
485
|
+
* @param args - The arguments for closing a thread.
|
|
486
|
+
* @param args.id - The thread ID.
|
|
487
|
+
* @param args.content - The comment content.
|
|
488
|
+
* @param args.attachments - Optional array of {@link Attachment} objects.
|
|
489
|
+
* @param args.actions - Optional array of action objects.
|
|
490
|
+
* @param args.recipients - Optional array of user IDs to notify directly.
|
|
491
|
+
* @param args.groups - Optional array of custom group IDs to notify.
|
|
492
|
+
* @param args.directMentions - Optional array of user IDs that were @-mentioned in
|
|
493
|
+
* `content`.
|
|
494
|
+
* @param args.notifyAudience - Optional broader audience to notify in addition to
|
|
495
|
+
* `recipients` and `groups`. `'channel'` notifies everyone in the channel;
|
|
496
|
+
* `'thread'` notifies everyone who has interacted with the thread.
|
|
497
|
+
* @returns The created comment object.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```typescript
|
|
501
|
+
* const comment = await api.threads.closeThread({
|
|
502
|
+
* id: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
|
|
503
|
+
* content: 'Closing this thread — resolved.',
|
|
504
|
+
* })
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
closeThread(args: CloseThreadArgs): Promise<Comment>;
|
|
508
|
+
/**
|
|
509
|
+
* Reopens a thread by adding a comment with a reopen action.
|
|
510
|
+
*
|
|
511
|
+
* @param args - The arguments for reopening a thread.
|
|
512
|
+
* @param args.id - The thread ID.
|
|
513
|
+
* @param args.content - The comment content.
|
|
514
|
+
* @param args.attachments - Optional array of {@link Attachment} objects.
|
|
515
|
+
* @param args.actions - Optional array of action objects.
|
|
516
|
+
* @param args.recipients - Optional array of user IDs to notify directly.
|
|
517
|
+
* @param args.groups - Optional array of custom group IDs to notify.
|
|
518
|
+
* @param args.directMentions - Optional array of user IDs that were @-mentioned in
|
|
519
|
+
* `content`.
|
|
520
|
+
* @param args.notifyAudience - Optional broader audience to notify in addition to
|
|
521
|
+
* `recipients` and `groups`. `'channel'` notifies everyone in the channel;
|
|
522
|
+
* `'thread'` notifies everyone who has interacted with the thread.
|
|
523
|
+
* @returns The created comment object.
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```typescript
|
|
527
|
+
* const comment = await api.threads.reopenThread({
|
|
528
|
+
* id: '7YpL3oZ4kZ9vP7Q1tR2sX3z',
|
|
529
|
+
* content: 'Reopening — need further discussion.',
|
|
530
|
+
* })
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
reopenThread(args: ReopenThreadArgs): Promise<Comment>;
|
|
534
|
+
private addCommentWithAction;
|
|
535
|
+
private simple;
|
|
536
|
+
}
|