@doist/comms-sdk 0.1.0-alpha.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.
Files changed (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +143 -0
  3. package/dist/cjs/authentication.js +211 -0
  4. package/dist/cjs/clients/add-comment-helper.js +53 -0
  5. package/dist/cjs/clients/base-client.js +27 -0
  6. package/dist/cjs/clients/channels-client.js +83 -0
  7. package/dist/cjs/clients/comments-client.js +93 -0
  8. package/dist/cjs/clients/conversation-messages-client.js +87 -0
  9. package/dist/cjs/clients/conversations-client.js +103 -0
  10. package/dist/cjs/clients/groups-client.js +71 -0
  11. package/dist/cjs/clients/inbox-client.js +98 -0
  12. package/dist/cjs/clients/reactions-client.js +59 -0
  13. package/dist/cjs/clients/search-client.js +88 -0
  14. package/dist/cjs/clients/threads-client.js +135 -0
  15. package/dist/cjs/clients/users-client.js +199 -0
  16. package/dist/cjs/clients/workspace-users-client.js +140 -0
  17. package/dist/cjs/clients/workspaces-client.js +93 -0
  18. package/dist/cjs/comms-api.js +65 -0
  19. package/dist/cjs/consts/endpoints.js +27 -0
  20. package/dist/cjs/index.js +48 -0
  21. package/dist/cjs/package.json +1 -0
  22. package/dist/cjs/testUtils/msw-handlers.js +51 -0
  23. package/dist/cjs/testUtils/msw-setup.js +21 -0
  24. package/dist/cjs/testUtils/obsidian-fetch-adapter.js +53 -0
  25. package/dist/cjs/testUtils/test-defaults.js +102 -0
  26. package/dist/cjs/transport/fetch-with-retry.js +136 -0
  27. package/dist/cjs/transport/http-client.js +56 -0
  28. package/dist/cjs/transport/http-dispatcher.js +143 -0
  29. package/dist/cjs/types/entities.js +411 -0
  30. package/dist/cjs/types/enums.js +37 -0
  31. package/dist/cjs/types/errors.js +12 -0
  32. package/dist/cjs/types/http.js +4 -0
  33. package/dist/cjs/types/index.js +21 -0
  34. package/dist/cjs/types/requests.js +117 -0
  35. package/dist/cjs/utils/case-conversion.js +54 -0
  36. package/dist/cjs/utils/index.js +19 -0
  37. package/dist/cjs/utils/timestamp-conversion.js +49 -0
  38. package/dist/cjs/utils/url-helpers.js +131 -0
  39. package/dist/cjs/utils/uuidv7.js +174 -0
  40. package/dist/esm/authentication.js +203 -0
  41. package/dist/esm/clients/add-comment-helper.js +50 -0
  42. package/dist/esm/clients/base-client.js +23 -0
  43. package/dist/esm/clients/channels-client.js +79 -0
  44. package/dist/esm/clients/comments-client.js +89 -0
  45. package/dist/esm/clients/conversation-messages-client.js +83 -0
  46. package/dist/esm/clients/conversations-client.js +99 -0
  47. package/dist/esm/clients/groups-client.js +67 -0
  48. package/dist/esm/clients/inbox-client.js +94 -0
  49. package/dist/esm/clients/reactions-client.js +55 -0
  50. package/dist/esm/clients/search-client.js +84 -0
  51. package/dist/esm/clients/threads-client.js +131 -0
  52. package/dist/esm/clients/users-client.js +195 -0
  53. package/dist/esm/clients/workspace-users-client.js +136 -0
  54. package/dist/esm/clients/workspaces-client.js +89 -0
  55. package/dist/esm/comms-api.js +61 -0
  56. package/dist/esm/consts/endpoints.js +23 -0
  57. package/dist/esm/index.js +17 -0
  58. package/dist/esm/testUtils/msw-handlers.js +45 -0
  59. package/dist/esm/testUtils/msw-setup.js +18 -0
  60. package/dist/esm/testUtils/obsidian-fetch-adapter.js +50 -0
  61. package/dist/esm/testUtils/test-defaults.js +99 -0
  62. package/dist/esm/transport/fetch-with-retry.js +133 -0
  63. package/dist/esm/transport/http-client.js +51 -0
  64. package/dist/esm/transport/http-dispatcher.js +104 -0
  65. package/dist/esm/types/entities.js +408 -0
  66. package/dist/esm/types/enums.js +34 -0
  67. package/dist/esm/types/errors.js +8 -0
  68. package/dist/esm/types/http.js +1 -0
  69. package/dist/esm/types/index.js +5 -0
  70. package/dist/esm/types/requests.js +114 -0
  71. package/dist/esm/utils/case-conversion.js +47 -0
  72. package/dist/esm/utils/index.js +3 -0
  73. package/dist/esm/utils/timestamp-conversion.js +45 -0
  74. package/dist/esm/utils/url-helpers.js +112 -0
  75. package/dist/esm/utils/uuidv7.js +163 -0
  76. package/dist/types/authentication.d.ts +160 -0
  77. package/dist/types/clients/add-comment-helper.d.ts +12 -0
  78. package/dist/types/clients/base-client.d.ts +24 -0
  79. package/dist/types/clients/channels-client.d.ts +91 -0
  80. package/dist/types/clients/comments-client.d.ts +157 -0
  81. package/dist/types/clients/conversation-messages-client.d.ts +127 -0
  82. package/dist/types/clients/conversations-client.d.ts +206 -0
  83. package/dist/types/clients/groups-client.d.ts +55 -0
  84. package/dist/types/clients/inbox-client.d.ts +20 -0
  85. package/dist/types/clients/reactions-client.d.ts +19 -0
  86. package/dist/types/clients/search-client.d.ts +20 -0
  87. package/dist/types/clients/threads-client.d.ts +344 -0
  88. package/dist/types/clients/users-client.d.ts +123 -0
  89. package/dist/types/clients/workspace-users-client.d.ts +47 -0
  90. package/dist/types/clients/workspaces-client.d.ts +79 -0
  91. package/dist/types/comms-api.d.ts +59 -0
  92. package/dist/types/consts/endpoints.d.ts +19 -0
  93. package/dist/types/index.d.ts +18 -0
  94. package/dist/types/testUtils/msw-handlers.d.ts +28 -0
  95. package/dist/types/testUtils/msw-setup.d.ts +1 -0
  96. package/dist/types/testUtils/obsidian-fetch-adapter.d.ts +29 -0
  97. package/dist/types/testUtils/test-defaults.d.ts +16 -0
  98. package/dist/types/transport/fetch-with-retry.d.ts +4 -0
  99. package/dist/types/transport/http-client.d.ts +13 -0
  100. package/dist/types/transport/http-dispatcher.d.ts +10 -0
  101. package/dist/types/types/entities.d.ts +1288 -0
  102. package/dist/types/types/enums.d.ts +55 -0
  103. package/dist/types/types/errors.d.ts +6 -0
  104. package/dist/types/types/http.d.ts +54 -0
  105. package/dist/types/types/index.d.ts +5 -0
  106. package/dist/types/types/requests.d.ts +385 -0
  107. package/dist/types/utils/case-conversion.d.ts +8 -0
  108. package/dist/types/utils/index.d.ts +3 -0
  109. package/dist/types/utils/timestamp-conversion.d.ts +13 -0
  110. package/dist/types/utils/url-helpers.d.ts +88 -0
  111. package/dist/types/utils/uuidv7.d.ts +40 -0
  112. package/package.json +93 -0
@@ -0,0 +1,157 @@
1
+ import { z } from 'zod';
2
+ import { type Comment, type StatusOk } from '../types/entities.js';
3
+ import type { CreateCommentArgs, GetCommentsArgs, MarkCommentPositionArgs, UpdateCommentArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
+ export declare const CommentListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
6
+ id: z.ZodString;
7
+ content: z.ZodString;
8
+ creator: z.ZodNumber;
9
+ threadId: z.ZodString;
10
+ workspaceId: z.ZodNumber;
11
+ conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ posted: z.ZodDate;
13
+ lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
14
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
15
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
16
+ systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
17
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
18
+ attachmentId: z.ZodString;
19
+ urlType: z.ZodString;
20
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
24
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
28
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
29
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
34
+ }, z.core.$loose>>>>;
35
+ reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
36
+ objIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
37
+ creatorName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ channelId: z.ZodString;
39
+ recipients: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
40
+ groups: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
41
+ toEmails: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
42
+ deleted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
43
+ deletedBy: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
44
+ version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
45
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
46
+ }, z.core.$strip>, z.ZodTransform<{
47
+ url: string;
48
+ id: string;
49
+ content: string;
50
+ creator: number;
51
+ threadId: string;
52
+ workspaceId: number;
53
+ posted: Date;
54
+ channelId: string;
55
+ conversationId?: string | null | undefined;
56
+ lastEdited?: Date | null | undefined;
57
+ directMentions?: number[] | null | undefined;
58
+ directGroupMentions?: string[] | null | undefined;
59
+ systemMessage?: unknown;
60
+ attachments?: {
61
+ [x: string]: unknown;
62
+ attachmentId: string;
63
+ urlType: string;
64
+ title?: string | null | undefined;
65
+ url?: string | null | undefined;
66
+ fileName?: string | null | undefined;
67
+ fileSize?: number | null | undefined;
68
+ underlyingType?: string | null | undefined;
69
+ description?: string | null | undefined;
70
+ image?: string | null | undefined;
71
+ imageWidth?: number | null | undefined;
72
+ imageHeight?: number | null | undefined;
73
+ duration?: string | null | undefined;
74
+ uploadState?: string | null | undefined;
75
+ video?: string | null | undefined;
76
+ videoType?: string | null | undefined;
77
+ videoAutoPlay?: boolean | null | undefined;
78
+ }[] | null | undefined;
79
+ reactions?: Record<string, unknown> | null | undefined;
80
+ objIndex?: number | null | undefined;
81
+ creatorName?: string | null | undefined;
82
+ recipients?: number[] | null | undefined;
83
+ groups?: string[] | null | undefined;
84
+ toEmails?: string[] | null | undefined;
85
+ deleted?: boolean | null | undefined;
86
+ deletedBy?: number | null | undefined;
87
+ version?: number | null | undefined;
88
+ actions?: unknown[] | null | undefined;
89
+ }, {
90
+ id: string;
91
+ content: string;
92
+ creator: number;
93
+ threadId: string;
94
+ workspaceId: number;
95
+ posted: Date;
96
+ channelId: string;
97
+ conversationId?: string | null | undefined;
98
+ lastEdited?: Date | null | undefined;
99
+ directMentions?: number[] | null | undefined;
100
+ directGroupMentions?: string[] | null | undefined;
101
+ systemMessage?: unknown;
102
+ attachments?: {
103
+ [x: string]: unknown;
104
+ attachmentId: string;
105
+ urlType: string;
106
+ title?: string | null | undefined;
107
+ url?: string | null | undefined;
108
+ fileName?: string | null | undefined;
109
+ fileSize?: number | null | undefined;
110
+ underlyingType?: string | null | undefined;
111
+ description?: string | null | undefined;
112
+ image?: string | null | undefined;
113
+ imageWidth?: number | null | undefined;
114
+ imageHeight?: number | null | undefined;
115
+ duration?: string | null | undefined;
116
+ uploadState?: string | null | undefined;
117
+ video?: string | null | undefined;
118
+ videoType?: string | null | undefined;
119
+ videoAutoPlay?: boolean | null | undefined;
120
+ }[] | null | undefined;
121
+ reactions?: Record<string, unknown> | null | undefined;
122
+ objIndex?: number | null | undefined;
123
+ creatorName?: string | null | undefined;
124
+ recipients?: number[] | null | undefined;
125
+ groups?: string[] | null | undefined;
126
+ toEmails?: string[] | null | undefined;
127
+ deleted?: boolean | null | undefined;
128
+ deletedBy?: number | null | undefined;
129
+ version?: number | null | undefined;
130
+ actions?: unknown[] | null | undefined;
131
+ }>>>;
132
+ /**
133
+ * Client for `/api/v1/comments/`. The SDK auto-generates the comment `id`
134
+ * on `createComment` when the caller doesn't supply one.
135
+ */
136
+ export declare class CommentsClient extends BaseClient {
137
+ /**
138
+ * Lists comments in a thread. `newerThan` / `olderThan` (`Date`) are
139
+ * converted to `newer_than_ts` / `older_than_ts` epoch seconds on the
140
+ * wire.
141
+ */
142
+ getComments(args: GetCommentsArgs): Promise<Comment[]>;
143
+ /** Fetches a single comment by ID. The API wraps it in `{comment: ...}`. */
144
+ getComment(id: string): Promise<Comment>;
145
+ /**
146
+ * Creates a new comment. `id` is auto-generated if not supplied.
147
+ */
148
+ createComment(args: CreateCommentArgs): Promise<Comment>;
149
+ /** Updates a comment. */
150
+ updateComment(args: UpdateCommentArgs): Promise<Comment>;
151
+ /** Permanently deletes a comment. */
152
+ deleteComment(id: string): Promise<StatusOk>;
153
+ /**
154
+ * Marks the user's read position in a thread. Comment IDs are strings.
155
+ */
156
+ markPosition(args: MarkCommentPositionArgs): Promise<StatusOk>;
157
+ }
@@ -0,0 +1,127 @@
1
+ import { z } from 'zod';
2
+ import { type ConversationMessage, type StatusOk } from '../types/entities.js';
3
+ import type { CreateConversationMessageArgs, GetConversationMessagesArgs, UpdateConversationMessageArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
+ export declare const ConversationMessageListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
6
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
7
+ content: z.ZodString;
8
+ creator: z.ZodNumber;
9
+ conversationId: z.ZodString;
10
+ posted: z.ZodDate;
11
+ systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
12
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
13
+ attachmentId: z.ZodString;
14
+ urlType: z.ZodString;
15
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
19
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
23
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
24
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
29
+ }, z.core.$loose>>>>;
30
+ reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodNumber>>>>;
31
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
32
+ objIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
33
+ lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
34
+ isDeleted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
35
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
36
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
37
+ version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
38
+ workspaceId: z.ZodNumber;
39
+ }, z.core.$strip>, z.ZodTransform<{
40
+ url: string;
41
+ id: string;
42
+ content: string;
43
+ creator: number;
44
+ conversationId: string;
45
+ posted: Date;
46
+ workspaceId: number;
47
+ systemMessage?: unknown;
48
+ attachments?: {
49
+ [x: string]: unknown;
50
+ attachmentId: string;
51
+ urlType: string;
52
+ title?: string | null | undefined;
53
+ url?: string | null | undefined;
54
+ fileName?: string | null | undefined;
55
+ fileSize?: number | null | undefined;
56
+ underlyingType?: string | null | undefined;
57
+ description?: string | null | undefined;
58
+ image?: string | null | undefined;
59
+ imageWidth?: number | null | undefined;
60
+ imageHeight?: number | null | undefined;
61
+ duration?: string | null | undefined;
62
+ uploadState?: string | null | undefined;
63
+ video?: string | null | undefined;
64
+ videoType?: string | null | undefined;
65
+ videoAutoPlay?: boolean | null | undefined;
66
+ }[] | null | undefined;
67
+ reactions?: Record<string, number[]> | null | undefined;
68
+ actions?: unknown[] | null | undefined;
69
+ objIndex?: number | null | undefined;
70
+ lastEdited?: Date | null | undefined;
71
+ isDeleted?: boolean | null | undefined;
72
+ directGroupMentions?: string[] | null | undefined;
73
+ directMentions?: number[] | null | undefined;
74
+ version?: number | null | undefined;
75
+ }, {
76
+ id: string;
77
+ content: string;
78
+ creator: number;
79
+ conversationId: string;
80
+ posted: Date;
81
+ workspaceId: number;
82
+ systemMessage?: unknown;
83
+ attachments?: {
84
+ [x: string]: unknown;
85
+ attachmentId: string;
86
+ urlType: string;
87
+ title?: string | null | undefined;
88
+ url?: string | null | undefined;
89
+ fileName?: string | null | undefined;
90
+ fileSize?: number | null | undefined;
91
+ underlyingType?: string | null | undefined;
92
+ description?: string | null | undefined;
93
+ image?: string | null | undefined;
94
+ imageWidth?: number | null | undefined;
95
+ imageHeight?: number | null | undefined;
96
+ duration?: string | null | undefined;
97
+ uploadState?: string | null | undefined;
98
+ video?: string | null | undefined;
99
+ videoType?: string | null | undefined;
100
+ videoAutoPlay?: boolean | null | undefined;
101
+ }[] | null | undefined;
102
+ reactions?: Record<string, number[]> | null | undefined;
103
+ actions?: unknown[] | null | undefined;
104
+ objIndex?: number | null | undefined;
105
+ lastEdited?: Date | null | undefined;
106
+ isDeleted?: boolean | null | undefined;
107
+ directGroupMentions?: string[] | null | undefined;
108
+ directMentions?: number[] | null | undefined;
109
+ version?: number | null | undefined;
110
+ }>>>;
111
+ /**
112
+ * Client for `/api/v1/conversation_messages/`. The SDK auto-generates the
113
+ * message `id` on `createMessage` when the caller doesn't supply one.
114
+ */
115
+ export declare class ConversationMessagesClient extends BaseClient {
116
+ /** Lists messages in a conversation. */
117
+ getMessages(args: GetConversationMessagesArgs): Promise<ConversationMessage[]>;
118
+ /** Fetches a single message by ID. */
119
+ getMessage(id: string): Promise<ConversationMessage>;
120
+ /** Creates a new message. `id` is auto-generated if not supplied. */
121
+ createMessage(args: CreateConversationMessageArgs): Promise<ConversationMessage>;
122
+ /** Updates a message. */
123
+ updateMessage(args: UpdateConversationMessageArgs): Promise<ConversationMessage>;
124
+ /** Permanently deletes a message. */
125
+ deleteMessage(id: string): Promise<StatusOk>;
126
+ private simple;
127
+ }
@@ -0,0 +1,206 @@
1
+ import { z } from 'zod';
2
+ import { type Conversation, type StatusOk, type UnreadConversation } from '../types/entities.js';
3
+ import type { AddConversationUserArgs, AddConversationUsersArgs, GetConversationsArgs, GetOrCreateConversationArgs, MuteConversationArgs, RemoveConversationUserArgs, RemoveConversationUsersArgs, UpdateConversationArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
+ export declare const ConversationListSchema: z.ZodArray<z.ZodPipe<z.ZodObject<{
6
+ id: z.ZodString;
7
+ workspaceId: z.ZodNumber;
8
+ userIds: z.ZodArray<z.ZodNumber>;
9
+ messageCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
10
+ lastObjIndex: z.ZodNumber;
11
+ snippet: z.ZodString;
12
+ snippetCreators: z.ZodArray<z.ZodNumber>;
13
+ lastActive: z.ZodDate;
14
+ mutedUntil: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
15
+ archived: z.ZodBoolean;
16
+ created: z.ZodDate;
17
+ creator: z.ZodNumber;
18
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ private: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
20
+ lastMessage: z.ZodOptional<z.ZodNullable<z.ZodObject<{
21
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
22
+ content: z.ZodString;
23
+ creator: z.ZodNumber;
24
+ conversationId: z.ZodString;
25
+ posted: z.ZodDate;
26
+ systemMessage: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnknown]>>>;
27
+ attachments: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
28
+ attachmentId: z.ZodString;
29
+ urlType: z.ZodString;
30
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
34
+ underlyingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
38
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
39
+ duration: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ video: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ videoType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ videoAutoPlay: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
44
+ }, z.core.$loose>>>>;
45
+ reactions: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodNumber>>>>;
46
+ actions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
47
+ objIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
48
+ lastEdited: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
49
+ deleted: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
50
+ directGroupMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
51
+ directMentions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
52
+ version: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
53
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
54
+ }, z.core.$strip>>>;
55
+ }, z.core.$strip>, z.ZodTransform<{
56
+ url: string;
57
+ id: string;
58
+ workspaceId: number;
59
+ userIds: number[];
60
+ lastObjIndex: number;
61
+ snippet: string;
62
+ snippetCreators: number[];
63
+ lastActive: Date;
64
+ archived: boolean;
65
+ created: Date;
66
+ creator: number;
67
+ messageCount?: number | null | undefined;
68
+ mutedUntil?: Date | null | undefined;
69
+ title?: string | null | undefined;
70
+ private?: boolean | null | undefined;
71
+ lastMessage?: {
72
+ id: string;
73
+ content: string;
74
+ creator: number;
75
+ conversationId: string;
76
+ posted: Date;
77
+ systemMessage?: unknown;
78
+ attachments?: {
79
+ [x: string]: unknown;
80
+ attachmentId: string;
81
+ urlType: string;
82
+ title?: string | null | undefined;
83
+ url?: string | null | undefined;
84
+ fileName?: string | null | undefined;
85
+ fileSize?: number | null | undefined;
86
+ underlyingType?: string | null | undefined;
87
+ description?: string | null | undefined;
88
+ image?: string | null | undefined;
89
+ imageWidth?: number | null | undefined;
90
+ imageHeight?: number | null | undefined;
91
+ duration?: string | null | undefined;
92
+ uploadState?: string | null | undefined;
93
+ video?: string | null | undefined;
94
+ videoType?: string | null | undefined;
95
+ videoAutoPlay?: boolean | null | undefined;
96
+ }[] | null | undefined;
97
+ reactions?: Record<string, number[]> | null | undefined;
98
+ actions?: unknown[] | null | undefined;
99
+ objIndex?: number | null | undefined;
100
+ lastEdited?: Date | null | undefined;
101
+ deleted?: boolean | null | undefined;
102
+ directGroupMentions?: string[] | null | undefined;
103
+ directMentions?: number[] | null | undefined;
104
+ version?: number | null | undefined;
105
+ workspaceId?: number | null | undefined;
106
+ } | null | undefined;
107
+ }, {
108
+ id: string;
109
+ workspaceId: number;
110
+ userIds: number[];
111
+ lastObjIndex: number;
112
+ snippet: string;
113
+ snippetCreators: number[];
114
+ lastActive: Date;
115
+ archived: boolean;
116
+ created: Date;
117
+ creator: number;
118
+ messageCount?: number | null | undefined;
119
+ mutedUntil?: Date | null | undefined;
120
+ title?: string | null | undefined;
121
+ private?: boolean | null | undefined;
122
+ lastMessage?: {
123
+ id: string;
124
+ content: string;
125
+ creator: number;
126
+ conversationId: string;
127
+ posted: Date;
128
+ systemMessage?: unknown;
129
+ attachments?: {
130
+ [x: string]: unknown;
131
+ attachmentId: string;
132
+ urlType: string;
133
+ title?: string | null | undefined;
134
+ url?: string | null | undefined;
135
+ fileName?: string | null | undefined;
136
+ fileSize?: number | null | undefined;
137
+ underlyingType?: string | null | undefined;
138
+ description?: string | null | undefined;
139
+ image?: string | null | undefined;
140
+ imageWidth?: number | null | undefined;
141
+ imageHeight?: number | null | undefined;
142
+ duration?: string | null | undefined;
143
+ uploadState?: string | null | undefined;
144
+ video?: string | null | undefined;
145
+ videoType?: string | null | undefined;
146
+ videoAutoPlay?: boolean | null | undefined;
147
+ }[] | null | undefined;
148
+ reactions?: Record<string, number[]> | null | undefined;
149
+ actions?: unknown[] | null | undefined;
150
+ objIndex?: number | null | undefined;
151
+ lastEdited?: Date | null | undefined;
152
+ deleted?: boolean | null | undefined;
153
+ directGroupMentions?: string[] | null | undefined;
154
+ directMentions?: number[] | null | undefined;
155
+ version?: number | null | undefined;
156
+ workspaceId?: number | null | undefined;
157
+ } | null | undefined;
158
+ }>>>;
159
+ /**
160
+ * Client for `/api/v1/conversations/`. `getOrCreate` requires an `id` (the
161
+ * SDK auto-generates one for new conversations); the backend dedupes on
162
+ * `userIds`, so an existing conversation will be returned with its own
163
+ * already-assigned `id` and your generated one is silently dropped.
164
+ */
165
+ export declare class ConversationsClient extends BaseClient {
166
+ /** Lists conversations in a workspace. */
167
+ getConversations(args: GetConversationsArgs): Promise<Conversation[]>;
168
+ /** Fetches a single conversation by ID. */
169
+ getConversation(id: string): Promise<Conversation>;
170
+ /**
171
+ * Gets an existing 1:1 / group conversation with `userIds`, or creates a
172
+ * new one. `id` is auto-generated if not supplied — on dedupe, the
173
+ * backend returns the existing conversation's `id` instead.
174
+ */
175
+ getOrCreateConversation(args: GetOrCreateConversationArgs): Promise<Conversation>;
176
+ /** Updates a conversation's title. */
177
+ updateConversation(args: UpdateConversationArgs): Promise<Conversation>;
178
+ archiveConversation(id: string): Promise<Conversation>;
179
+ unarchiveConversation(id: string): Promise<Conversation>;
180
+ addUser(args: AddConversationUserArgs): Promise<Conversation>;
181
+ addUsers(args: AddConversationUsersArgs): Promise<Conversation>;
182
+ removeUser(args: RemoveConversationUserArgs): Promise<Conversation>;
183
+ removeUsers(args: RemoveConversationUsersArgs): Promise<Conversation>;
184
+ markRead(args: {
185
+ id: string;
186
+ objIndex?: number;
187
+ messageId?: string;
188
+ }): Promise<StatusOk>;
189
+ markUnread(args: {
190
+ id: string;
191
+ objIndex?: number;
192
+ messageId?: string;
193
+ }): Promise<StatusOk>;
194
+ /**
195
+ * Returns unread conversations for a workspace, paired with the unread
196
+ * version counter.
197
+ */
198
+ getUnread(workspaceId: number): Promise<{
199
+ data: UnreadConversation[];
200
+ version: number;
201
+ }>;
202
+ clearUnread(workspaceId: number): Promise<StatusOk>;
203
+ muteConversation(args: MuteConversationArgs): Promise<Conversation>;
204
+ unmuteConversation(id: string): Promise<Conversation>;
205
+ private simple;
206
+ }
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ import { type Group, type StatusOk } from '../types/entities.js';
3
+ import type { AddGroupUserArgs, AddGroupUsersArgs, RemoveGroupUserArgs, RemoveGroupUsersArgs } from '../types/requests.js';
4
+ import { BaseClient } from './base-client.js';
5
+ export declare const GroupListSchema: z.ZodArray<z.ZodObject<{
6
+ id: z.ZodString;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
9
+ workspaceId: z.ZodNumber;
10
+ userIds: z.ZodArray<z.ZodNumber>;
11
+ version: z.ZodNumber;
12
+ }, z.core.$strip>>;
13
+ /**
14
+ * Client for `/api/v1/groups/`. The broadcast markers `EVERYONE` /
15
+ * `EVERYONE_IN_THREAD` are NOT addressable through these endpoints — they
16
+ * only appear as members of `direct_group_mentions` / `groups` lists on
17
+ * thread/comment writes.
18
+ *
19
+ * `getone` / `update` / `remove` and the member-management ops all require
20
+ * `workspace_id` alongside the group `id`.
21
+ */
22
+ export declare class GroupsClient extends BaseClient {
23
+ /** Lists groups in a workspace. */
24
+ getGroups(workspaceId: number): Promise<Group[]>;
25
+ /** Fetches a single group by ID (requires `workspaceId`). */
26
+ getGroup(args: {
27
+ id: string;
28
+ workspaceId: number;
29
+ }): Promise<Group>;
30
+ /** Creates a new group. `id` is auto-generated if not supplied. */
31
+ createGroup(args: {
32
+ workspaceId: number;
33
+ name: string;
34
+ id?: string;
35
+ description?: string;
36
+ userIds?: number[];
37
+ }): Promise<Group>;
38
+ /** Updates a group. Requires `workspaceId`. */
39
+ updateGroup(args: {
40
+ id: string;
41
+ workspaceId: number;
42
+ name?: string;
43
+ description?: string;
44
+ }): Promise<Group>;
45
+ /** Permanently deletes a group. Requires `workspaceId`. */
46
+ deleteGroup(args: {
47
+ id: string;
48
+ workspaceId: number;
49
+ }): Promise<StatusOk>;
50
+ addUser(args: AddGroupUserArgs): Promise<StatusOk>;
51
+ addUsers(args: AddGroupUsersArgs): Promise<StatusOk>;
52
+ removeUser(args: RemoveGroupUserArgs): Promise<StatusOk>;
53
+ removeUsers(args: RemoveGroupUsersArgs): Promise<StatusOk>;
54
+ private simple;
55
+ }
@@ -0,0 +1,20 @@
1
+ import { type InboxThread } from '../types/entities.js';
2
+ import type { ArchiveAllArgs, GetInboxArgs } from '../types/requests.js';
3
+ import { BaseClient } from './base-client.js';
4
+ /** Client for `/api/v1/inbox/`. */
5
+ export declare class InboxClient extends BaseClient {
6
+ /**
7
+ * Gets inbox items (threads).
8
+ */
9
+ getInbox(args: GetInboxArgs): Promise<InboxThread[]>;
10
+ /** Gets unread count for inbox. */
11
+ getCount(workspaceId: number): Promise<number>;
12
+ /** Archives a thread in the inbox. */
13
+ archiveThread(id: string): Promise<void>;
14
+ /** Unarchives a thread in the inbox. */
15
+ unarchiveThread(id: string): Promise<void>;
16
+ /** Marks all inbox items as read in a workspace. */
17
+ markAllRead(workspaceId: number): Promise<void>;
18
+ /** Archives all inbox items in a workspace. */
19
+ archiveAll(args: ArchiveAllArgs): Promise<void>;
20
+ }
@@ -0,0 +1,19 @@
1
+ import type { ReactionObject } from '../types/entities.js';
2
+ import type { AddReactionArgs, GetReactionsArgs, RemoveReactionArgs } from '../types/requests.js';
3
+ import { BaseClient } from './base-client.js';
4
+ /**
5
+ * Client for interacting with Comms reaction endpoints.
6
+ */
7
+ export declare class ReactionsClient extends BaseClient {
8
+ /** Adds an emoji reaction to a thread, comment, or conversation message. */
9
+ add(args: AddReactionArgs): Promise<void>;
10
+ /**
11
+ * Gets reactions for a thread, comment, or conversation message.
12
+ *
13
+ * Returns an object with emoji reactions as keys and arrays of user IDs as
14
+ * values, or null if no reactions.
15
+ */
16
+ get(args: GetReactionsArgs): Promise<ReactionObject>;
17
+ /** Removes an emoji reaction from a thread, comment, or conversation message. */
18
+ remove(args: RemoveReactionArgs): Promise<void>;
19
+ }
@@ -0,0 +1,20 @@
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
+ search(args: SearchArgs): Promise<SearchResponse>;
12
+ /**
13
+ * Searches within comments of a specific thread.
14
+ */
15
+ searchThread(args: SearchThreadArgs): Promise<SearchThreadResponse>;
16
+ /**
17
+ * Searches within messages of a specific conversation.
18
+ */
19
+ searchConversation(args: SearchConversationArgs): Promise<SearchConversationResponse>;
20
+ }