@noematicsllc/talk-sdk 0.0.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.
@@ -0,0 +1,2147 @@
1
+ /**
2
+ * Transport Layer - HTTP Client for Nextcloud Talk API
3
+ *
4
+ * Handles all HTTP communication with the Nextcloud OCS API,
5
+ * automatically injecting required headers and managing authentication.
6
+ */
7
+ /** Configuration options for the HTTP client */
8
+ interface HttpClientConfig {
9
+ /** Nextcloud server host URL (e.g., 'https://nextcloud.local') */
10
+ host: string;
11
+ /** Nextcloud username for authentication */
12
+ username: string;
13
+ /** App password or regular password for authentication */
14
+ password: string;
15
+ /** Optional custom fetch implementation (for testing or Node.js compatibility) */
16
+ fetch?: typeof fetch;
17
+ }
18
+ /** Standard OCS API response envelope */
19
+ interface OCSResponse<T> {
20
+ ocs: {
21
+ meta: {
22
+ status: string;
23
+ statuscode: number;
24
+ message: string;
25
+ };
26
+ data: T;
27
+ };
28
+ }
29
+ /** HTTP request options */
30
+ interface RequestOptions {
31
+ method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
32
+ body?: unknown;
33
+ params?: Record<string, string | number | boolean | undefined>;
34
+ headers?: Record<string, string>;
35
+ /** Timeout in milliseconds (default: 30000) */
36
+ timeout?: number;
37
+ }
38
+ /** Response metadata from Nextcloud headers */
39
+ interface ResponseMeta {
40
+ /** Hash for cache invalidation */
41
+ talkHash?: string;
42
+ /** Timestamp for delta sync */
43
+ modifiedBefore?: number;
44
+ /** Last message ID in chat response */
45
+ chatLastGiven?: number;
46
+ /** Last common read message ID */
47
+ chatLastCommonRead?: number;
48
+ /** Pending federation invites count */
49
+ federationInvites?: number;
50
+ }
51
+ /** Extended response with data and metadata */
52
+ interface HttpResponse<T> {
53
+ data: T;
54
+ status: number;
55
+ meta: ResponseMeta;
56
+ headers: Headers;
57
+ }
58
+ /** HTTP client error with status code and OCS details */
59
+ declare class HttpClientError extends Error {
60
+ readonly status: number;
61
+ readonly ocsStatus?: number | undefined;
62
+ readonly ocsMessage?: string | undefined;
63
+ constructor(message: string, status: number, ocsStatus?: number | undefined, ocsMessage?: string | undefined);
64
+ }
65
+ /**
66
+ * Base HTTP client for Nextcloud OCS API
67
+ *
68
+ * Automatically injects required OCS headers:
69
+ * - OCS-APIRequest: true
70
+ * - Accept: application/json
71
+ * - Content-Type: application/json
72
+ * - Authorization: Basic (base64 encoded credentials)
73
+ */
74
+ declare class HttpClient {
75
+ private readonly baseUrl;
76
+ private readonly authHeader;
77
+ private readonly fetchImpl;
78
+ constructor(config: HttpClientConfig);
79
+ /**
80
+ * Build the full URL with query parameters
81
+ */
82
+ private buildUrl;
83
+ /**
84
+ * Extract Nextcloud-specific headers from response
85
+ */
86
+ private extractMeta;
87
+ /**
88
+ * Make an HTTP request to the Nextcloud OCS API
89
+ *
90
+ * @param path - API path (e.g., '/ocs/v2.php/apps/spreed/api/v4/room')
91
+ * @param options - Request options
92
+ * @returns Promise resolving to the unwrapped OCS data
93
+ *
94
+ * @throws {HttpClientError} When the request fails or returns an error status
95
+ *
96
+ * @remarks
97
+ * OCS API returns status codes in the response body:
98
+ * - 100: Success (OCS v1)
99
+ * - 200: Success (OCS v2)
100
+ * - Other codes indicate errors specific to the endpoint
101
+ */
102
+ request<T>(path: string, options?: RequestOptions): Promise<HttpResponse<T>>;
103
+ /** GET request helper */
104
+ get<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<HttpResponse<T>>;
105
+ /** POST request helper */
106
+ post<T>(path: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<HttpResponse<T>>;
107
+ /** PUT request helper */
108
+ put<T>(path: string, body?: unknown, params?: Record<string, string | number | boolean | undefined>): Promise<HttpResponse<T>>;
109
+ /** DELETE request helper */
110
+ delete<T>(path: string, params?: Record<string, string | number | boolean | undefined>): Promise<HttpResponse<T>>;
111
+ /** Get the base URL for this client */
112
+ get host(): string;
113
+ }
114
+
115
+ /**
116
+ * Nextcloud Talk API Constants
117
+ *
118
+ * Enum values and constants used throughout the API.
119
+ */
120
+ /** Conversation/Room types */
121
+ declare enum ConversationType {
122
+ /** One-to-one private conversation */
123
+ ONE_TO_ONE = 1,
124
+ /** Group conversation (invite only) */
125
+ GROUP = 2,
126
+ /** Public conversation (anyone with link can join) */
127
+ PUBLIC = 3,
128
+ /** Changelog (system notifications) */
129
+ CHANGELOG = 4,
130
+ /** Former one-to-one (user deleted) */
131
+ ONE_TO_ONE_FORMER = 5,
132
+ /** Note to self (personal notes) */
133
+ NOTE_TO_SELF = 6
134
+ }
135
+ /** Participant role types */
136
+ declare enum ParticipantType {
137
+ /** Room owner with full permissions */
138
+ OWNER = 1,
139
+ /** Moderator with elevated permissions */
140
+ MODERATOR = 2,
141
+ /** Regular user participant */
142
+ USER = 3,
143
+ /** Guest participant (no Nextcloud account) */
144
+ GUEST = 4,
145
+ /** User who self-joined a public room */
146
+ USER_SELF_JOINED = 5,
147
+ /** Guest with moderator permissions */
148
+ GUEST_MODERATOR = 6
149
+ }
150
+ /** Permission flags (bitmask) */
151
+ declare enum Permission {
152
+ /** Inherit default permissions */
153
+ DEFAULT = 0,
154
+ /** Custom permissions set */
155
+ CUSTOM = 1,
156
+ /** Can start a call */
157
+ CALL_START = 2,
158
+ /** Can join a call */
159
+ CALL_JOIN = 4,
160
+ /** Can bypass lobby */
161
+ LOBBY_IGNORE = 8,
162
+ /** Can send audio */
163
+ PUBLISH_AUDIO = 16,
164
+ /** Can send video */
165
+ PUBLISH_VIDEO = 32,
166
+ /** Can share screen */
167
+ PUBLISH_SCREEN = 64,
168
+ /** Can post chat messages */
169
+ CHAT = 128,
170
+ /** Can share files */
171
+ FILE_SHARE = 256
172
+ }
173
+ /** In-call status flags (bitmask) */
174
+ declare enum InCallFlag {
175
+ /** Not in call */
176
+ DISCONNECTED = 0,
177
+ /** Currently in call */
178
+ IN_CALL = 1,
179
+ /** Audio enabled */
180
+ WITH_AUDIO = 2,
181
+ /** Video enabled */
182
+ WITH_VIDEO = 4,
183
+ /** Connected via phone/SIP */
184
+ WITH_PHONE = 8
185
+ }
186
+ /** Actor types for participants and message authors */
187
+ declare enum ActorType {
188
+ /** Nextcloud users */
189
+ USERS = "users",
190
+ /** Guest users */
191
+ GUESTS = "guests",
192
+ /** Email invitees */
193
+ EMAILS = "emails",
194
+ /** User groups */
195
+ GROUPS = "groups",
196
+ /** Nextcloud circles */
197
+ CIRCLES = "circles",
198
+ /** Bot accounts */
199
+ BOTS = "bots",
200
+ /** Matterbridge users */
201
+ BRIDGED = "bridged",
202
+ /** Federated users from other instances */
203
+ FEDERATED_USERS = "federated_users",
204
+ /** Phone participants (SIP) */
205
+ PHONES = "phones"
206
+ }
207
+ /** Chat message types */
208
+ declare enum MessageType {
209
+ /** Regular text message */
210
+ COMMENT = "comment",
211
+ /** System-generated message */
212
+ SYSTEM = "system",
213
+ /** Command message */
214
+ COMMAND = "command",
215
+ /** Deleted message placeholder */
216
+ COMMENT_DELETED = "comment_deleted",
217
+ /** Voice recording message */
218
+ VOICE_MESSAGE = "voice-message",
219
+ /** Audio recording */
220
+ RECORD_AUDIO = "record-audio",
221
+ /** Video recording */
222
+ RECORD_VIDEO = "record-video",
223
+ /** Poll message */
224
+ POLL = "poll"
225
+ }
226
+ /** Notification level settings */
227
+ declare enum NotificationLevel {
228
+ /** Use default notification settings */
229
+ DEFAULT = 0,
230
+ /** Always notify */
231
+ ALWAYS = 1,
232
+ /** Only notify on mentions */
233
+ MENTION = 2,
234
+ /** Never notify */
235
+ NEVER = 3
236
+ }
237
+ /** Read-only state */
238
+ declare enum ReadOnlyState {
239
+ /** Room is read-write */
240
+ READ_WRITE = 0,
241
+ /** Room is read-only */
242
+ READ_ONLY = 1
243
+ }
244
+ /** Lobby state */
245
+ declare enum LobbyState {
246
+ /** No lobby */
247
+ DISABLED = 0,
248
+ /** Lobby enabled for non-moderators */
249
+ ENABLED = 1
250
+ }
251
+ /** SIP state */
252
+ declare enum SIPState {
253
+ /** SIP disabled */
254
+ DISABLED = 0,
255
+ /** SIP enabled without PIN */
256
+ ENABLED_NO_PIN = 1,
257
+ /** SIP enabled with PIN */
258
+ ENABLED_WITH_PIN = 2
259
+ }
260
+ /** Recording status */
261
+ declare enum RecordingStatus {
262
+ /** Not recording */
263
+ NONE = 0,
264
+ /** Recording video */
265
+ VIDEO = 1,
266
+ /** Recording audio only */
267
+ AUDIO = 2,
268
+ /** Starting video recording */
269
+ STARTING_VIDEO = 3,
270
+ /** Starting audio recording */
271
+ STARTING_AUDIO = 4,
272
+ /** Recording failed */
273
+ FAILED = 5
274
+ }
275
+ /** Listable scope */
276
+ declare enum ListableScope {
277
+ /** Not listable */
278
+ NONE = 0,
279
+ /** Listable for logged-in users */
280
+ USERS = 1,
281
+ /** Listable for everyone */
282
+ EVERYONE = 2
283
+ }
284
+ /** Poll result mode */
285
+ declare enum PollResultMode {
286
+ /** Results are public */
287
+ PUBLIC = 0,
288
+ /** Results are hidden until closed */
289
+ HIDDEN = 1
290
+ }
291
+ /** Breakout room mode */
292
+ declare enum BreakoutRoomMode {
293
+ /** Not configured */
294
+ NOT_CONFIGURED = 0,
295
+ /** Automatic assignment */
296
+ AUTOMATIC = 1,
297
+ /** Manual assignment */
298
+ MANUAL = 2,
299
+ /** Free selection */
300
+ FREE = 3
301
+ }
302
+ /** Object types for shared items */
303
+ declare enum SharedObjectType {
304
+ FILE = "file",
305
+ AUDIO = "audio",
306
+ VOICE = "voice",
307
+ VIDEO = "video",
308
+ LOCATION = "location",
309
+ DECK_CARD = "deckcard",
310
+ OTHER = "other",
311
+ POLL = "poll",
312
+ RECORDING = "recording"
313
+ }
314
+
315
+ /**
316
+ * Message Types
317
+ *
318
+ * TypeScript interfaces for Nextcloud Talk chat message entities.
319
+ */
320
+ /** Rich object parameter in message */
321
+ interface TalkRichObjectParameter {
322
+ type: string;
323
+ id: string;
324
+ name: string;
325
+ [key: string]: unknown;
326
+ }
327
+ /** Message metadata for pinned messages */
328
+ interface MessageMetadata {
329
+ pinnedActorType?: string;
330
+ pinnedActorId?: string;
331
+ pinnedActorDisplayName?: string;
332
+ pinnedAt?: number;
333
+ pinnedUntil?: number;
334
+ }
335
+ /** Deleted message reference */
336
+ interface DeletedMessageRef {
337
+ id: number;
338
+ deleted: true;
339
+ }
340
+ /**
341
+ * Chat message as returned by the Nextcloud Talk API
342
+ */
343
+ interface TalkChatMessage {
344
+ /** Message ID */
345
+ id: number;
346
+ /** Room token this message belongs to */
347
+ token: string;
348
+ /** Actor type of the sender */
349
+ actorType: string;
350
+ /** Actor ID of the sender */
351
+ actorId: string;
352
+ /** Display name of the sender */
353
+ actorDisplayName: string;
354
+ /** Unix timestamp when message was sent */
355
+ timestamp: number;
356
+ /** Message content */
357
+ message: string;
358
+ /** Message type (comment, system, etc.) */
359
+ messageType: string;
360
+ /** System message type (empty for regular messages) */
361
+ systemMessage: string;
362
+ /** Rich object parameters for mentions, files, etc. */
363
+ messageParameters: Record<string, TalkRichObjectParameter>;
364
+ /** Whether the message can be replied to */
365
+ isReplyable: boolean;
366
+ /** Whether the message supports markdown */
367
+ markdown: boolean;
368
+ /** Client-generated reference ID for deduplication */
369
+ referenceId: string;
370
+ /** Unix timestamp when message expires (0 = never) */
371
+ expirationTimestamp: number;
372
+ /** Map of reaction emoji to count */
373
+ reactions: Record<string, number>;
374
+ /** Reactions by the current user */
375
+ reactionsSelf?: string[];
376
+ /** Actor type of last editor */
377
+ lastEditActorType?: string;
378
+ /** Actor ID of last editor */
379
+ lastEditActorId?: string;
380
+ /** Display name of last editor */
381
+ lastEditActorDisplayName?: string;
382
+ /** Unix timestamp of last edit */
383
+ lastEditTimestamp?: number;
384
+ /** Thread ID if part of a thread */
385
+ threadId?: number;
386
+ /** Whether this message is a thread root */
387
+ isThread?: boolean;
388
+ /** Thread title */
389
+ threadTitle?: string;
390
+ /** Number of replies in thread */
391
+ threadReplies?: number;
392
+ /** Additional metadata (pinning info, etc.) */
393
+ metaData?: MessageMetadata;
394
+ }
395
+ /** Message with optional parent for reply context */
396
+ interface TalkChatMessageWithParent extends TalkChatMessage {
397
+ /** Parent message for replies */
398
+ parent?: TalkChatMessage | DeletedMessageRef;
399
+ }
400
+ /** Options for sending a message */
401
+ interface SendMessageOptions {
402
+ /** Message content (max 32000 chars) */
403
+ message: string;
404
+ /** Display name for guests */
405
+ actorDisplayName?: string;
406
+ /** Client-generated ID for deduplication */
407
+ referenceId?: string;
408
+ /** Parent message ID for replies */
409
+ replyTo?: number;
410
+ /** Don't trigger notifications */
411
+ silent?: boolean;
412
+ /** Thread ID */
413
+ threadId?: number;
414
+ /** Thread title (creates new thread) */
415
+ threadTitle?: string;
416
+ }
417
+ /** Options for receiving messages */
418
+ interface ReceiveMessagesOptions {
419
+ /** 0 = history, 1 = new messages (polling) */
420
+ lookIntoFuture: 0 | 1;
421
+ /** Max messages to return (default 100, max 200) */
422
+ limit?: number;
423
+ /** Pagination cursor - get messages after this ID */
424
+ lastKnownMessageId?: number;
425
+ /** Long-poll timeout in seconds (max 60) */
426
+ timeout?: number;
427
+ /** Auto-update read marker */
428
+ setReadMarker?: boolean;
429
+ /** Include boundary message */
430
+ includeLastKnown?: boolean;
431
+ /** Clear notifications */
432
+ markNotificationsAsRead?: boolean;
433
+ /** Filter by thread */
434
+ threadId?: number;
435
+ }
436
+ /** Options for polling new messages */
437
+ interface PollMessagesOptions {
438
+ /** Last known message ID to poll from */
439
+ lastKnownMessageId: number;
440
+ /** Max messages to return */
441
+ limit?: number;
442
+ /** Long-poll timeout in seconds (default 30) */
443
+ timeout?: number;
444
+ /** Filter by thread */
445
+ threadId?: number;
446
+ }
447
+ /** Mention suggestion from search */
448
+ interface TalkChatMentionSuggestion {
449
+ id: string;
450
+ label: string;
451
+ source: string;
452
+ mentionId?: string;
453
+ status?: string;
454
+ statusIcon?: string;
455
+ statusMessage?: string;
456
+ }
457
+ /** Options for sharing a rich object */
458
+ interface ShareObjectOptions {
459
+ objectType: string;
460
+ objectId: string;
461
+ metaData?: string;
462
+ referenceId?: string;
463
+ threadId?: number;
464
+ }
465
+ /** Reminder for a message */
466
+ interface MessageReminder {
467
+ messageId: number;
468
+ timestamp: number;
469
+ token: string;
470
+ userId: string;
471
+ }
472
+ /** Options for scheduling a message */
473
+ interface ScheduleMessageOptions {
474
+ message: string;
475
+ scheduledAt: number;
476
+ referenceId?: string;
477
+ replyTo?: number;
478
+ silent?: boolean;
479
+ }
480
+ /** Result of chat polling with metadata */
481
+ interface ChatPollResult {
482
+ messages: TalkChatMessageWithParent[];
483
+ /** Last message ID for next poll */
484
+ lastKnownMessageId?: number;
485
+ /** Last message read by all participants */
486
+ lastCommonRead?: number;
487
+ }
488
+
489
+ /**
490
+ * Room/Conversation Types
491
+ *
492
+ * TypeScript interfaces for Nextcloud Talk room/conversation entities.
493
+ */
494
+
495
+ /**
496
+ * Raw room data as returned by the Nextcloud Talk API
497
+ *
498
+ * @remarks
499
+ * This interface matches the TalkRoom type from the API specification.
500
+ * Use the Room class from the domain layer for a higher-level abstraction.
501
+ */
502
+ interface TalkRoom {
503
+ /** Internal database ID (rarely used in API calls) */
504
+ id: number;
505
+ /** API identifier - use this for all API calls */
506
+ token: string;
507
+ /** Conversation type (1-6) */
508
+ type: number;
509
+ /** Room name */
510
+ name: string;
511
+ /** Computed display name */
512
+ displayName: string;
513
+ /** Room description (max 2000 chars) */
514
+ description: string;
515
+ /** Actor type of the current user */
516
+ actorType: string;
517
+ /** Actor ID of the current user */
518
+ actorId: string;
519
+ /** Attendee ID of the current user in this room */
520
+ attendeeId: number;
521
+ /** Participant type/role of the current user */
522
+ participantType: number;
523
+ /** Effective permissions (computed) */
524
+ permissions: number;
525
+ /** Dedicated attendee permissions */
526
+ attendeePermissions: number;
527
+ /** Whether the room has a password */
528
+ hasPassword: boolean;
529
+ /** Whether there's an active call */
530
+ hasCall: boolean;
531
+ /** Combined participant call flags */
532
+ callFlag: number;
533
+ /** Unix timestamp when call started */
534
+ callStartTime: number;
535
+ /** Current recording status */
536
+ callRecording: number;
537
+ /** Read-only state (0 = read-write, 1 = read-only) */
538
+ readOnly: number;
539
+ /** Listable scope */
540
+ listable: number;
541
+ /** Lobby state */
542
+ lobbyState: number;
543
+ /** Lobby timer (Unix timestamp) */
544
+ lobbyTimer: number;
545
+ /** SIP enabled state */
546
+ sipEnabled: number;
547
+ /** Mention permissions */
548
+ mentionPermissions: number;
549
+ /** Message expiration in seconds (0 = never) */
550
+ messageExpiration: number;
551
+ /** Recording consent requirement */
552
+ recordingConsent: number;
553
+ /** Last activity timestamp */
554
+ lastActivity: number;
555
+ /** Last message in the room (optional) */
556
+ lastMessage?: TalkChatMessage;
557
+ /** ID of last read message */
558
+ lastReadMessage: number;
559
+ /** ID of last message read by all participants */
560
+ lastCommonReadMessage: number;
561
+ /** Number of unread messages */
562
+ unreadMessages: number;
563
+ /** Whether there are unread mentions */
564
+ unreadMention: boolean;
565
+ /** Whether there are direct unread mentions */
566
+ unreadMentionDirect: boolean;
567
+ /** Whether current user can start a call */
568
+ canStartCall: boolean;
569
+ /** Whether current user can leave the conversation */
570
+ canLeaveConversation: boolean;
571
+ /** Whether current user can delete the conversation */
572
+ canDeleteConversation: boolean;
573
+ /** Whether SIP can be enabled */
574
+ canEnableSIP: boolean;
575
+ /** User status string */
576
+ status?: string;
577
+ /** User status icon */
578
+ statusIcon?: string;
579
+ /** User status message */
580
+ statusMessage?: string;
581
+ /** Unix timestamp when status clears */
582
+ statusClearAt?: number;
583
+ /** Remote server URL for federated rooms */
584
+ remoteServer?: string;
585
+ /** Remote token for federated rooms */
586
+ remoteToken?: string;
587
+ /** Whether this room is a favorite */
588
+ isFavorite: boolean;
589
+ /** Whether this room is archived */
590
+ isArchived: boolean;
591
+ /** Whether this room is marked important */
592
+ isImportant: boolean;
593
+ /** Whether this room is marked sensitive */
594
+ isSensitive: boolean;
595
+ }
596
+ /** Options for creating a new room */
597
+ interface CreateRoomOptions {
598
+ /** Room type (1-6) */
599
+ roomType: number;
600
+ /** Room name */
601
+ roomName?: string;
602
+ /** User/entity to invite */
603
+ invite?: string;
604
+ /** Source of the invite (users, groups, etc.) */
605
+ source?: string;
606
+ /** Object type for linked rooms */
607
+ objectType?: string;
608
+ /** Object ID for linked rooms */
609
+ objectId?: string;
610
+ /** Room password */
611
+ password?: string;
612
+ /** Read-only state */
613
+ readOnly?: number;
614
+ /** Listable scope */
615
+ listable?: number;
616
+ /** Message expiration in seconds */
617
+ messageExpiration?: number;
618
+ /** Lobby state */
619
+ lobbyState?: number;
620
+ /** Lobby timer (Unix timestamp) */
621
+ lobbyTimer?: number;
622
+ /** SIP enabled state */
623
+ sipEnabled?: number;
624
+ /** Default permissions */
625
+ permissions?: number;
626
+ /** Recording consent requirement */
627
+ recordingConsent?: number;
628
+ /** Mention permissions */
629
+ mentionPermissions?: number;
630
+ /** Room description */
631
+ description?: string;
632
+ }
633
+ /** Options for listing rooms */
634
+ interface ListRoomsOptions {
635
+ /** Don't update user online status */
636
+ noStatusUpdate?: boolean;
637
+ /** Include user status for 1-1 chats */
638
+ includeStatus?: boolean;
639
+ /** Unix timestamp for delta sync */
640
+ modifiedSince?: number;
641
+ /** Include last message in response */
642
+ includeLastMessage?: boolean;
643
+ }
644
+ /** Notification level setting */
645
+ interface NotificationSettings {
646
+ level: number;
647
+ }
648
+ /** Call notification setting */
649
+ interface CallNotificationSettings {
650
+ level: number;
651
+ }
652
+ /** Lobby settings */
653
+ interface LobbySettings {
654
+ state: number;
655
+ timer?: number;
656
+ }
657
+ /** Permission update modes */
658
+ type PermissionMode = 'default' | 'call';
659
+
660
+ /**
661
+ * Participant Types
662
+ *
663
+ * TypeScript interfaces for Nextcloud Talk participant entities.
664
+ */
665
+ /**
666
+ * Participant in a room as returned by the API
667
+ */
668
+ interface TalkParticipant {
669
+ /** Actor type (users, guests, etc.) */
670
+ actorType: string;
671
+ /** Actor ID */
672
+ actorId: string;
673
+ /** Display name */
674
+ displayName: string;
675
+ /** Attendee ID in this room */
676
+ attendeeId: number;
677
+ /** Participant type/role */
678
+ participantType: number;
679
+ /** Effective permissions */
680
+ permissions: number;
681
+ /** Dedicated attendee permissions */
682
+ attendeePermissions: number;
683
+ /** Attendee PIN for SIP */
684
+ attendeePin: string;
685
+ /** Room token */
686
+ roomToken: string;
687
+ /** Active session IDs */
688
+ sessionIds: string[];
689
+ /** In-call status flags */
690
+ inCall: number;
691
+ /** Last ping timestamp */
692
+ lastPing: number;
693
+ /** User status string */
694
+ status?: string;
695
+ /** User status icon */
696
+ statusIcon?: string;
697
+ /** User status message */
698
+ statusMessage?: string;
699
+ /** Unix timestamp when status clears */
700
+ statusClearAt?: number;
701
+ /** Phone number for phone participants */
702
+ phoneNumber?: string;
703
+ /** Call ID for phone participants */
704
+ callId?: string;
705
+ }
706
+ /** Options for adding a participant */
707
+ interface AddParticipantOptions {
708
+ /** User ID or identifier to add */
709
+ newParticipant: string;
710
+ /** Source of the participant */
711
+ source: 'users' | 'groups' | 'circles' | 'emails' | 'federated_users' | 'phones' | 'teams';
712
+ }
713
+ /** Options for joining a room */
714
+ interface JoinRoomOptions {
715
+ /** Room password if required */
716
+ password?: string;
717
+ /** Force join even if already in room on another device */
718
+ force?: boolean;
719
+ }
720
+ /** Session conflict response when joining */
721
+ interface SessionConflict {
722
+ sessionId: string;
723
+ inCall: number;
724
+ lastPing: number;
725
+ }
726
+ /** Permission update method */
727
+ type PermissionMethod = 'set' | 'add' | 'remove';
728
+ /** Options for setting attendee permissions */
729
+ interface SetPermissionsOptions {
730
+ attendeeId: number;
731
+ method: PermissionMethod;
732
+ permissions: number;
733
+ }
734
+ /** Session state */
735
+ interface SessionState {
736
+ /** 0 = inactive, 1 = active */
737
+ state: 0 | 1;
738
+ }
739
+
740
+ /**
741
+ * Call Types
742
+ *
743
+ * TypeScript interfaces for Nextcloud Talk call/WebRTC entities.
744
+ */
745
+ /** Peer in an active call */
746
+ interface TalkCallPeer {
747
+ /** Actor type of the peer */
748
+ actorType: string;
749
+ /** Actor ID of the peer */
750
+ actorId: string;
751
+ /** Display name of the peer */
752
+ displayName: string;
753
+ /** Session ID */
754
+ sessionId: string;
755
+ /** In-call flags */
756
+ inCall: number;
757
+ /** Last ping timestamp */
758
+ lastPing: number;
759
+ /** Token of the room */
760
+ token: string;
761
+ }
762
+ /** Options for joining a call */
763
+ interface JoinCallOptions {
764
+ /** In-call flags (bitmask) - default is 7 (IN_CALL | WITH_AUDIO | WITH_VIDEO) */
765
+ flags?: number;
766
+ /** Join silently without notifying others */
767
+ silent?: boolean;
768
+ /** Recording consent given */
769
+ recordingConsent?: boolean;
770
+ /** Array of attendee IDs to join silently for */
771
+ silentFor?: number[];
772
+ }
773
+ /** Options for leaving a call */
774
+ interface LeaveCallOptions {
775
+ /** End call for everyone (moderator only) */
776
+ all?: boolean;
777
+ }
778
+ /** Update call flags */
779
+ interface UpdateCallFlagsOptions {
780
+ flags: number;
781
+ }
782
+ /** Signaling settings response */
783
+ interface SignalingSettings {
784
+ /** Signaling mode */
785
+ signalingMode: 'internal' | 'external' | 'conversation_cluster';
786
+ /** Current user ID */
787
+ userId: string;
788
+ /** External signaling server URL */
789
+ server?: string;
790
+ /** Authentication ticket */
791
+ ticket?: string;
792
+ /** Hello auth params for external signaling */
793
+ helloAuthParams?: {
794
+ '1.0'?: {
795
+ userid: string;
796
+ ticket: string;
797
+ };
798
+ '2.0'?: {
799
+ token: string;
800
+ };
801
+ };
802
+ /** STUN servers */
803
+ stunservers: Array<{
804
+ urls: string[];
805
+ }>;
806
+ /** TURN servers */
807
+ turnservers: Array<{
808
+ urls: string[];
809
+ username: string;
810
+ credential: string;
811
+ }>;
812
+ /** SIP dial-in info */
813
+ sipDialinInfo?: string;
814
+ }
815
+
816
+ /**
817
+ * Poll Types
818
+ *
819
+ * TypeScript interfaces for Nextcloud Talk poll entities.
820
+ */
821
+ /** Vote in a poll */
822
+ interface PollVote {
823
+ actorType: string;
824
+ actorId: string;
825
+ actorDisplayName: string;
826
+ optionId: number;
827
+ }
828
+ /** Poll entity */
829
+ interface TalkPoll {
830
+ /** Poll ID */
831
+ id: number;
832
+ /** Room token */
833
+ token: string;
834
+ /** Poll question */
835
+ question: string;
836
+ /** Poll options */
837
+ options: string[];
838
+ /** Vote counts per option */
839
+ votes?: Record<string, number>;
840
+ /** Number of voters */
841
+ numVoters?: number;
842
+ /** Result mode (0 = public, 1 = hidden) */
843
+ resultMode: number;
844
+ /** Maximum votes per user */
845
+ maxVotes: number;
846
+ /** Actor type of poll creator */
847
+ actorType: string;
848
+ /** Actor ID of poll creator */
849
+ actorId: string;
850
+ /** Display name of poll creator */
851
+ actorDisplayName: string;
852
+ /** Status (0 = open, 1 = closed) */
853
+ status: number;
854
+ /** Voted options by current user */
855
+ votedSelf?: number[];
856
+ /** All votes (if public and closed or moderator) */
857
+ details?: PollVote[];
858
+ }
859
+ /** Options for creating a poll */
860
+ interface CreatePollOptions {
861
+ /** Poll question */
862
+ question: string;
863
+ /** Poll options (2-10 options) */
864
+ options: string[];
865
+ /** Result mode (0 = public, 1 = hidden) */
866
+ resultMode?: number;
867
+ /** Maximum votes per user */
868
+ maxVotes?: number;
869
+ /** Create as draft */
870
+ draft?: boolean;
871
+ /** Thread ID */
872
+ threadId?: number;
873
+ }
874
+ /** Options for voting on a poll */
875
+ interface VotePollOptions {
876
+ /** Option indices to vote for */
877
+ optionIds: number[];
878
+ }
879
+
880
+ /**
881
+ * Reaction Types
882
+ *
883
+ * TypeScript interfaces for Nextcloud Talk reaction entities.
884
+ */
885
+ /** Reaction actor */
886
+ interface ReactionActor {
887
+ actorType: string;
888
+ actorId: string;
889
+ actorDisplayName: string;
890
+ timestamp: number;
891
+ }
892
+ /** Reactions grouped by emoji */
893
+ type ReactionsByEmoji = Record<string, ReactionActor[]>;
894
+ /** Options for adding a reaction */
895
+ interface AddReactionOptions {
896
+ reaction: string;
897
+ }
898
+
899
+ /**
900
+ * Room DTO Mapper
901
+ *
902
+ * Maps raw API room data to clean domain objects,
903
+ * stripping OCS envelope and normalizing field names.
904
+ */
905
+
906
+ /**
907
+ * Normalized room data with clean property access
908
+ */
909
+ interface NormalizedRoom {
910
+ id: number;
911
+ token: string;
912
+ type: number;
913
+ name: string;
914
+ displayName: string;
915
+ description: string;
916
+ actorType: string;
917
+ actorId: string;
918
+ attendeeId: number;
919
+ participantType: number;
920
+ permissions: number;
921
+ attendeePermissions: number;
922
+ hasPassword: boolean;
923
+ hasCall: boolean;
924
+ callFlag: number;
925
+ callStartTime: number;
926
+ callRecording: number;
927
+ readOnly: number;
928
+ listable: number;
929
+ lobbyState: number;
930
+ lobbyTimer: number;
931
+ sipEnabled: number;
932
+ mentionPermissions: number;
933
+ messageExpiration: number;
934
+ recordingConsent: number;
935
+ lastActivity: number;
936
+ lastReadMessage: number;
937
+ lastCommonReadMessage: number;
938
+ unreadMessages: number;
939
+ unreadMention: boolean;
940
+ unreadMentionDirect: boolean;
941
+ canStartCall: boolean;
942
+ canLeaveConversation: boolean;
943
+ canDeleteConversation: boolean;
944
+ canEnableSIP: boolean;
945
+ isFavorite: boolean;
946
+ isArchived: boolean;
947
+ isImportant: boolean;
948
+ isSensitive: boolean;
949
+ status?: string;
950
+ statusIcon?: string;
951
+ statusMessage?: string;
952
+ statusClearAt?: number;
953
+ remoteServer?: string;
954
+ remoteToken?: string;
955
+ }
956
+ /**
957
+ * Map raw API room data to a normalized room object
958
+ *
959
+ * @param raw - Raw room data from API
960
+ * @returns Normalized room data
961
+ */
962
+ declare function normalizeRoom(raw: TalkRoom): NormalizedRoom;
963
+ /**
964
+ * Map an array of raw room data to normalized rooms
965
+ *
966
+ * @param rawRooms - Array of raw room data from API
967
+ * @returns Array of normalized room data
968
+ */
969
+ declare function normalizeRooms(rawRooms: TalkRoom[]): NormalizedRoom[];
970
+
971
+ /**
972
+ * Message DTO Mapper
973
+ *
974
+ * Maps raw API message data to clean domain objects,
975
+ * handling the parent message unwrapping for replies.
976
+ */
977
+
978
+ /**
979
+ * Normalized message data with clean property access
980
+ */
981
+ interface NormalizedMessage {
982
+ id: number;
983
+ token: string;
984
+ actorType: string;
985
+ actorId: string;
986
+ actorDisplayName: string;
987
+ timestamp: number;
988
+ message: string;
989
+ messageType: string;
990
+ systemMessage: string;
991
+ messageParameters: Record<string, TalkRichObjectParameter>;
992
+ isReplyable: boolean;
993
+ markdown: boolean;
994
+ referenceId: string;
995
+ expirationTimestamp: number;
996
+ reactions: Record<string, number>;
997
+ reactionsSelf: string[];
998
+ lastEditActorType?: string;
999
+ lastEditActorId?: string;
1000
+ lastEditActorDisplayName?: string;
1001
+ lastEditTimestamp?: number;
1002
+ threadId?: number;
1003
+ isThread: boolean;
1004
+ threadTitle?: string;
1005
+ threadReplies?: number;
1006
+ parent?: NormalizedMessage | {
1007
+ id: number;
1008
+ deleted: true;
1009
+ };
1010
+ metaData?: MessageMetadata;
1011
+ }
1012
+ /**
1013
+ * Map raw API message data to a normalized message object
1014
+ *
1015
+ * @param raw - Raw message data from API
1016
+ * @returns Normalized message data
1017
+ */
1018
+ declare function normalizeMessage(raw: TalkChatMessage): NormalizedMessage;
1019
+ /**
1020
+ * Map raw API message with parent to a normalized message
1021
+ *
1022
+ * @param raw - Raw message data with optional parent
1023
+ * @returns Normalized message with normalized parent
1024
+ */
1025
+ declare function normalizeMessageWithParent(raw: TalkChatMessageWithParent): NormalizedMessage;
1026
+ /**
1027
+ * Map an array of raw messages to normalized messages
1028
+ *
1029
+ * @param rawMessages - Array of raw message data from API
1030
+ * @returns Array of normalized message data
1031
+ */
1032
+ declare function normalizeMessages(rawMessages: TalkChatMessageWithParent[]): NormalizedMessage[];
1033
+
1034
+ /**
1035
+ * Participant DTO Mapper
1036
+ *
1037
+ * Maps raw API participant data to clean domain objects.
1038
+ */
1039
+
1040
+ /**
1041
+ * Normalized participant data
1042
+ */
1043
+ interface NormalizedParticipant {
1044
+ actorType: string;
1045
+ actorId: string;
1046
+ displayName: string;
1047
+ attendeeId: number;
1048
+ participantType: number;
1049
+ permissions: number;
1050
+ attendeePermissions: number;
1051
+ attendeePin: string;
1052
+ roomToken: string;
1053
+ sessionIds: string[];
1054
+ inCall: number;
1055
+ lastPing: number;
1056
+ status?: string;
1057
+ statusIcon?: string;
1058
+ statusMessage?: string;
1059
+ statusClearAt?: number;
1060
+ phoneNumber?: string;
1061
+ callId?: string;
1062
+ isInCall: boolean;
1063
+ hasAudio: boolean;
1064
+ hasVideo: boolean;
1065
+ isOnPhone: boolean;
1066
+ }
1067
+ /**
1068
+ * Map raw API participant data to a normalized participant object
1069
+ *
1070
+ * @param raw - Raw participant data from API
1071
+ * @returns Normalized participant data
1072
+ */
1073
+ declare function normalizeParticipant(raw: TalkParticipant): NormalizedParticipant;
1074
+ /**
1075
+ * Map an array of raw participants to normalized participants
1076
+ *
1077
+ * @param rawParticipants - Array of raw participant data from API
1078
+ * @returns Array of normalized participant data
1079
+ */
1080
+ declare function normalizeParticipants(rawParticipants: TalkParticipant[]): NormalizedParticipant[];
1081
+
1082
+ /**
1083
+ * Room Resource (API v4)
1084
+ *
1085
+ * Handles all room/conversation-related API operations.
1086
+ * Uses /ocs/v2.php/apps/spreed/api/v4/room endpoints.
1087
+ */
1088
+
1089
+ /**
1090
+ * Room resource for managing Nextcloud Talk conversations
1091
+ *
1092
+ * @remarks
1093
+ * All methods use the v4 API as documented in the spec.
1094
+ * Room operations use the token (string) as the primary identifier.
1095
+ */
1096
+ declare class RoomResource {
1097
+ private readonly http;
1098
+ constructor(http: HttpClient);
1099
+ /**
1100
+ * List all conversations the current user is part of
1101
+ *
1102
+ * @param options - List options (includeStatus, modifiedSince, etc.)
1103
+ * @returns Array of normalized room objects
1104
+ *
1105
+ * @remarks
1106
+ * OCS Status Codes:
1107
+ * - 200: Success
1108
+ */
1109
+ list(options?: ListRoomsOptions): Promise<NormalizedRoom[]>;
1110
+ /**
1111
+ * Get a single room by token
1112
+ *
1113
+ * @param token - Room token
1114
+ * @returns Normalized room object
1115
+ *
1116
+ * @remarks
1117
+ * OCS Status Codes:
1118
+ * - 200: Success
1119
+ * - 401: Unauthorized
1120
+ * - 404: Room not found
1121
+ */
1122
+ get(token: string): Promise<NormalizedRoom>;
1123
+ /**
1124
+ * Create a new room
1125
+ *
1126
+ * @param options - Room creation options
1127
+ * @returns Created room object
1128
+ *
1129
+ * @remarks
1130
+ * OCS Status Codes:
1131
+ * - 200: Existing room returned (for 1-1 conversations)
1132
+ * - 201: Room created
1133
+ * - 202: Room created with invalid invitations
1134
+ */
1135
+ create(options: CreateRoomOptions): Promise<NormalizedRoom>;
1136
+ /**
1137
+ * Update room name
1138
+ *
1139
+ * @param token - Room token
1140
+ * @param roomName - New room name
1141
+ *
1142
+ * @remarks
1143
+ * Requires moderator permissions.
1144
+ */
1145
+ rename(token: string, roomName: string): Promise<void>;
1146
+ /**
1147
+ * Update room description
1148
+ *
1149
+ * @param token - Room token
1150
+ * @param description - New description (max 2000 chars)
1151
+ *
1152
+ * @remarks
1153
+ * Requires moderator permissions.
1154
+ */
1155
+ setDescription(token: string, description: string): Promise<void>;
1156
+ /**
1157
+ * Delete a room
1158
+ *
1159
+ * @param token - Room token
1160
+ *
1161
+ * @remarks
1162
+ * Requires moderator permissions.
1163
+ */
1164
+ delete(token: string): Promise<void>;
1165
+ /**
1166
+ * Set room password
1167
+ *
1168
+ * @param token - Room token
1169
+ * @param password - Room password (empty string to remove)
1170
+ *
1171
+ * @remarks
1172
+ * Requires moderator permissions. Only for public rooms.
1173
+ */
1174
+ setPassword(token: string, password: string): Promise<void>;
1175
+ /**
1176
+ * Make room public (allow guests)
1177
+ *
1178
+ * @param token - Room token
1179
+ *
1180
+ * @remarks
1181
+ * Requires logged-in moderator.
1182
+ */
1183
+ makePublic(token: string): Promise<void>;
1184
+ /**
1185
+ * Make room private
1186
+ *
1187
+ * @param token - Room token
1188
+ *
1189
+ * @remarks
1190
+ * Requires logged-in moderator.
1191
+ */
1192
+ makePrivate(token: string): Promise<void>;
1193
+ /**
1194
+ * Set read-only state
1195
+ *
1196
+ * @param token - Room token
1197
+ * @param state - Read-only state (0 = read-write, 1 = read-only)
1198
+ */
1199
+ setReadOnly(token: string, state: 0 | 1): Promise<void>;
1200
+ /**
1201
+ * Set listable scope
1202
+ *
1203
+ * @param token - Room token
1204
+ * @param scope - Listable scope (0 = none, 1 = users, 2 = everyone)
1205
+ */
1206
+ setListable(token: string, scope: 0 | 1 | 2): Promise<void>;
1207
+ /**
1208
+ * Add room to favorites
1209
+ *
1210
+ * @param token - Room token
1211
+ */
1212
+ addToFavorites(token: string): Promise<void>;
1213
+ /**
1214
+ * Remove room from favorites
1215
+ *
1216
+ * @param token - Room token
1217
+ */
1218
+ removeFromFavorites(token: string): Promise<void>;
1219
+ /**
1220
+ * Archive room
1221
+ *
1222
+ * @param token - Room token
1223
+ */
1224
+ archive(token: string): Promise<void>;
1225
+ /**
1226
+ * Unarchive room
1227
+ *
1228
+ * @param token - Room token
1229
+ */
1230
+ unarchive(token: string): Promise<void>;
1231
+ /**
1232
+ * Mark room as important (notifications on DND)
1233
+ *
1234
+ * @param token - Room token
1235
+ */
1236
+ markImportant(token: string): Promise<void>;
1237
+ /**
1238
+ * Unmark room as important
1239
+ *
1240
+ * @param token - Room token
1241
+ */
1242
+ unmarkImportant(token: string): Promise<void>;
1243
+ /**
1244
+ * Mark room as sensitive (hide preview)
1245
+ *
1246
+ * @param token - Room token
1247
+ */
1248
+ markSensitive(token: string): Promise<void>;
1249
+ /**
1250
+ * Unmark room as sensitive
1251
+ *
1252
+ * @param token - Room token
1253
+ */
1254
+ unmarkSensitive(token: string): Promise<void>;
1255
+ /**
1256
+ * Set notification level
1257
+ *
1258
+ * @param token - Room token
1259
+ * @param level - Notification level (0-3)
1260
+ */
1261
+ setNotificationLevel(token: string, level: 0 | 1 | 2 | 3): Promise<void>;
1262
+ /**
1263
+ * Set call notification setting
1264
+ *
1265
+ * @param token - Room token
1266
+ * @param level - Call notification level (0 = off, 1 = on)
1267
+ */
1268
+ setCallNotifications(token: string, level: 0 | 1): Promise<void>;
1269
+ /**
1270
+ * Configure lobby
1271
+ *
1272
+ * @param token - Room token
1273
+ * @param state - Lobby state (0 = disabled, 1 = enabled)
1274
+ * @param timer - Optional Unix timestamp when lobby opens
1275
+ */
1276
+ setLobby(token: string, state: 0 | 1, timer?: number): Promise<void>;
1277
+ /**
1278
+ * Set default or call permissions for the room
1279
+ *
1280
+ * @param token - Room token
1281
+ * @param mode - Permission mode ('default' or 'call')
1282
+ * @param permissions - Permission bitmask
1283
+ */
1284
+ setPermissions(token: string, mode: PermissionMode, permissions: number): Promise<void>;
1285
+ /**
1286
+ * Set message expiration time
1287
+ *
1288
+ * @param token - Room token
1289
+ * @param seconds - Expiration time in seconds (0 = never)
1290
+ */
1291
+ setMessageExpiration(token: string, seconds: number): Promise<void>;
1292
+ /**
1293
+ * Get raw response with metadata headers (for advanced use)
1294
+ *
1295
+ * @param token - Room token
1296
+ * @returns Full HTTP response with data and metadata
1297
+ */
1298
+ getRaw(token: string): Promise<HttpResponse<TalkRoom>>;
1299
+ }
1300
+
1301
+ /**
1302
+ * Chat Resource (API v1)
1303
+ *
1304
+ * Handles all chat/messaging-related API operations.
1305
+ * Uses /ocs/v2.php/apps/spreed/api/v1/chat endpoints.
1306
+ */
1307
+
1308
+ /**
1309
+ * Chat resource for messaging in Nextcloud Talk conversations
1310
+ *
1311
+ * @remarks
1312
+ * All methods use the v1 API as documented in the spec.
1313
+ * The pollMessages method implements the spec's efficient update pattern.
1314
+ */
1315
+ declare class ChatResource {
1316
+ private readonly http;
1317
+ constructor(http: HttpClient);
1318
+ /**
1319
+ * Receive messages from a room
1320
+ *
1321
+ * @param token - Room token
1322
+ * @param options - Receive options (lookIntoFuture, limit, lastKnownMessageId, etc.)
1323
+ * @returns Array of normalized messages
1324
+ *
1325
+ * @remarks
1326
+ * OCS Status Codes:
1327
+ * - 200: Messages returned
1328
+ * - 304: No new messages (long-poll timeout)
1329
+ */
1330
+ receiveMessages(token: string, options: ReceiveMessagesOptions): Promise<NormalizedMessage[]>;
1331
+ /**
1332
+ * Get message history (past messages)
1333
+ *
1334
+ * @param token - Room token
1335
+ * @param options - Optional limit and lastKnownMessageId for pagination
1336
+ * @returns Array of normalized messages
1337
+ */
1338
+ getHistory(token: string, options?: {
1339
+ limit?: number;
1340
+ lastKnownMessageId?: number;
1341
+ }): Promise<NormalizedMessage[]>;
1342
+ /**
1343
+ * Poll for new messages (long-polling)
1344
+ *
1345
+ * This implements the spec's efficient update pattern for receiving
1346
+ * new messages. The server holds the connection for up to `timeout` seconds.
1347
+ *
1348
+ * @param token - Room token
1349
+ * @param options - Poll options with required lastKnownMessageId
1350
+ * @returns Poll result with messages and metadata for next poll
1351
+ *
1352
+ * @example
1353
+ * ```ts
1354
+ * let lastKnownMessageId = 0;
1355
+ *
1356
+ * while (polling) {
1357
+ * const result = await chat.pollMessages(token, { lastKnownMessageId });
1358
+ * for (const message of result.messages) {
1359
+ * console.log(message.message);
1360
+ * }
1361
+ * if (result.lastKnownMessageId) {
1362
+ * lastKnownMessageId = result.lastKnownMessageId;
1363
+ * }
1364
+ * }
1365
+ * ```
1366
+ */
1367
+ pollMessages(token: string, options: PollMessagesOptions): Promise<ChatPollResult>;
1368
+ /**
1369
+ * Send a message to a room
1370
+ *
1371
+ * @param token - Room token
1372
+ * @param options - Message options
1373
+ * @returns Sent message
1374
+ *
1375
+ * @remarks
1376
+ * OCS Status Codes:
1377
+ * - 201: Message sent
1378
+ * - 400: Sending not possible
1379
+ * - 404: Actor not found
1380
+ * - 413: Message too long (max 32000 chars)
1381
+ * - 429: Mention rate limit exceeded
1382
+ */
1383
+ sendMessage(token: string, options: SendMessageOptions): Promise<NormalizedMessage>;
1384
+ /**
1385
+ * Edit a message
1386
+ *
1387
+ * @param token - Room token
1388
+ * @param messageId - Message ID to edit
1389
+ * @param message - New message content
1390
+ * @returns Updated message
1391
+ */
1392
+ editMessage(token: string, messageId: number, message: string): Promise<NormalizedMessage>;
1393
+ /**
1394
+ * Delete a message
1395
+ *
1396
+ * @param token - Room token
1397
+ * @param messageId - Message ID to delete
1398
+ * @returns Deleted message placeholder
1399
+ */
1400
+ deleteMessage(token: string, messageId: number): Promise<NormalizedMessage>;
1401
+ /**
1402
+ * Get message context (surrounding messages)
1403
+ *
1404
+ * @param token - Room token
1405
+ * @param messageId - Message ID to get context for
1406
+ * @param options - Optional limit and threadId
1407
+ * @returns Array of messages around the target message
1408
+ */
1409
+ getContext(token: string, messageId: number, options?: {
1410
+ limit?: number;
1411
+ threadId?: number;
1412
+ }): Promise<NormalizedMessage[]>;
1413
+ /**
1414
+ * Share a rich object (file, deck card, etc.)
1415
+ *
1416
+ * @param token - Room token
1417
+ * @param options - Share options
1418
+ * @returns Shared message
1419
+ */
1420
+ shareObject(token: string, options: ShareObjectOptions): Promise<NormalizedMessage>;
1421
+ /**
1422
+ * Clear chat history
1423
+ *
1424
+ * @param token - Room token
1425
+ *
1426
+ * @remarks
1427
+ * Requires moderator permissions.
1428
+ */
1429
+ clearHistory(token: string): Promise<void>;
1430
+ /**
1431
+ * Set read marker to a specific message
1432
+ *
1433
+ * @param token - Room token
1434
+ * @param lastReadMessage - Message ID to mark as last read
1435
+ */
1436
+ setReadMarker(token: string, lastReadMessage: number): Promise<void>;
1437
+ /**
1438
+ * Mark chat as unread
1439
+ *
1440
+ * @param token - Room token
1441
+ */
1442
+ markUnread(token: string): Promise<void>;
1443
+ /**
1444
+ * Search for mention suggestions
1445
+ *
1446
+ * @param token - Room token
1447
+ * @param search - Search query
1448
+ * @param options - Optional limit and includeStatus
1449
+ * @returns Array of mention suggestions
1450
+ */
1451
+ searchMentions(token: string, search: string, options?: {
1452
+ limit?: number;
1453
+ includeStatus?: boolean;
1454
+ }): Promise<TalkChatMentionSuggestion[]>;
1455
+ /**
1456
+ * Pin a message
1457
+ *
1458
+ * @param token - Room token
1459
+ * @param messageId - Message ID to pin
1460
+ * @param pinUntil - Optional Unix timestamp when pin expires
1461
+ *
1462
+ * @remarks
1463
+ * Requires moderator permissions.
1464
+ */
1465
+ pinMessage(token: string, messageId: number, pinUntil?: number): Promise<void>;
1466
+ /**
1467
+ * Unpin a message
1468
+ *
1469
+ * @param token - Room token
1470
+ * @param messageId - Message ID to unpin
1471
+ *
1472
+ * @remarks
1473
+ * Requires moderator permissions.
1474
+ */
1475
+ unpinMessage(token: string, messageId: number): Promise<void>;
1476
+ /**
1477
+ * Hide a pinned message for the current user only
1478
+ *
1479
+ * @param token - Room token
1480
+ * @param messageId - Message ID to hide
1481
+ */
1482
+ hidePinnedMessage(token: string, messageId: number): Promise<void>;
1483
+ /**
1484
+ * Set a reminder for a message
1485
+ *
1486
+ * @param token - Room token
1487
+ * @param messageId - Message ID
1488
+ * @param timestamp - Unix timestamp for reminder
1489
+ */
1490
+ setReminder(token: string, messageId: number, timestamp: number): Promise<void>;
1491
+ /**
1492
+ * Delete a message reminder
1493
+ *
1494
+ * @param token - Room token
1495
+ * @param messageId - Message ID
1496
+ */
1497
+ deleteReminder(token: string, messageId: number): Promise<void>;
1498
+ }
1499
+
1500
+ /**
1501
+ * Participant Resource (API v4)
1502
+ *
1503
+ * Handles all participant-related API operations.
1504
+ * Uses /ocs/v2.php/apps/spreed/api/v4/room/{token}/participants endpoints.
1505
+ */
1506
+
1507
+ /**
1508
+ * Participant resource for managing room participants
1509
+ *
1510
+ * @remarks
1511
+ * All methods use the v4 API as documented in the spec.
1512
+ */
1513
+ declare class ParticipantResource {
1514
+ private readonly http;
1515
+ constructor(http: HttpClient);
1516
+ /**
1517
+ * Get list of participants in a room
1518
+ *
1519
+ * @param token - Room token
1520
+ * @param includeStatus - Include user status information
1521
+ * @returns Array of normalized participants
1522
+ */
1523
+ list(token: string, includeStatus?: boolean): Promise<NormalizedParticipant[]>;
1524
+ /**
1525
+ * Add a participant to a room
1526
+ *
1527
+ * @param token - Room token
1528
+ * @param options - Participant options
1529
+ *
1530
+ * @remarks
1531
+ * Requires logged-in moderator.
1532
+ */
1533
+ add(token: string, options: AddParticipantOptions): Promise<void>;
1534
+ /**
1535
+ * Remove a participant from a room
1536
+ *
1537
+ * @param token - Room token
1538
+ * @param attendeeId - Attendee ID to remove
1539
+ *
1540
+ * @remarks
1541
+ * Requires moderator permissions.
1542
+ */
1543
+ remove(token: string, attendeeId: number): Promise<void>;
1544
+ /**
1545
+ * Remove self from a room
1546
+ *
1547
+ * @param token - Room token
1548
+ */
1549
+ removeSelf(token: string): Promise<void>;
1550
+ /**
1551
+ * Join a room (create session)
1552
+ *
1553
+ * @param token - Room token
1554
+ * @param options - Join options
1555
+ * @returns Room data after joining
1556
+ *
1557
+ * @remarks
1558
+ * OCS Status Codes:
1559
+ * - 200: Joined successfully
1560
+ * - 409: Conflict - already joined on another device
1561
+ *
1562
+ * On 409, the response contains session conflict info.
1563
+ */
1564
+ join(token: string, options?: JoinRoomOptions): Promise<NormalizedRoom>;
1565
+ /**
1566
+ * Leave a room (end session)
1567
+ *
1568
+ * @param token - Room token
1569
+ */
1570
+ leave(token: string): Promise<void>;
1571
+ /**
1572
+ * Set session state (active/inactive)
1573
+ *
1574
+ * @param token - Room token
1575
+ * @param state - 0 = inactive, 1 = active
1576
+ */
1577
+ setSessionState(token: string, state: 0 | 1): Promise<void>;
1578
+ /**
1579
+ * Promote a participant to moderator
1580
+ *
1581
+ * @param token - Room token
1582
+ * @param attendeeId - Attendee ID to promote
1583
+ */
1584
+ promoteModerator(token: string, attendeeId: number): Promise<void>;
1585
+ /**
1586
+ * Demote a moderator to regular participant
1587
+ *
1588
+ * @param token - Room token
1589
+ * @param attendeeId - Attendee ID to demote
1590
+ */
1591
+ demoteModerator(token: string, attendeeId: number): Promise<void>;
1592
+ /**
1593
+ * Set permissions for an attendee
1594
+ *
1595
+ * @param token - Room token
1596
+ * @param options - Permission options
1597
+ */
1598
+ setPermissions(token: string, options: SetPermissionsOptions): Promise<void>;
1599
+ /**
1600
+ * Resend invitations to pending participants
1601
+ *
1602
+ * @param token - Room token
1603
+ * @param attendeeId - Optional specific attendee, or all if omitted
1604
+ */
1605
+ resendInvitations(token: string, attendeeId?: number): Promise<void>;
1606
+ }
1607
+
1608
+ /**
1609
+ * Call Resource (API v4)
1610
+ *
1611
+ * Handles all call/WebRTC-related API operations.
1612
+ * Uses /ocs/v2.php/apps/spreed/api/v4/call endpoints.
1613
+ */
1614
+
1615
+ /**
1616
+ * Call resource for managing WebRTC calls
1617
+ *
1618
+ * @remarks
1619
+ * Call operations use the v4 API.
1620
+ * Signaling settings use the v3 API.
1621
+ */
1622
+ declare class CallResource {
1623
+ private readonly http;
1624
+ constructor(http: HttpClient);
1625
+ /**
1626
+ * Get peers currently in a call
1627
+ *
1628
+ * @param token - Room token
1629
+ * @returns Array of call peers
1630
+ */
1631
+ getPeers(token: string): Promise<TalkCallPeer[]>;
1632
+ /**
1633
+ * Join a call
1634
+ *
1635
+ * @param token - Room token
1636
+ * @param options - Join options (flags, silent, etc.)
1637
+ *
1638
+ * @remarks
1639
+ * Default flags are IN_CALL | WITH_AUDIO | WITH_VIDEO (7).
1640
+ */
1641
+ join(token: string, options?: JoinCallOptions): Promise<void>;
1642
+ /**
1643
+ * Update call flags (audio/video status)
1644
+ *
1645
+ * @param token - Room token
1646
+ * @param flags - New in-call flags
1647
+ */
1648
+ updateFlags(token: string, flags: number): Promise<void>;
1649
+ /**
1650
+ * Leave a call
1651
+ *
1652
+ * @param token - Room token
1653
+ * @param options - Leave options
1654
+ */
1655
+ leave(token: string, options?: LeaveCallOptions): Promise<void>;
1656
+ /**
1657
+ * Ring a specific attendee
1658
+ *
1659
+ * @param token - Room token
1660
+ * @param attendeeId - Attendee ID to ring
1661
+ *
1662
+ * @remarks
1663
+ * Requires START_CALL permission.
1664
+ */
1665
+ ringAttendee(token: string, attendeeId: number): Promise<void>;
1666
+ /**
1667
+ * Initiate SIP dial-out to a phone participant
1668
+ *
1669
+ * @param token - Room token
1670
+ * @param attendeeId - Attendee ID to dial
1671
+ */
1672
+ dialOut(token: string, attendeeId: number): Promise<void>;
1673
+ /**
1674
+ * Get signaling settings for WebRTC
1675
+ *
1676
+ * @param token - Room token
1677
+ * @returns Signaling configuration including STUN/TURN servers
1678
+ */
1679
+ getSignalingSettings(token: string): Promise<SignalingSettings>;
1680
+ /**
1681
+ * Enable audio in call
1682
+ *
1683
+ * @param token - Room token
1684
+ * @param currentFlags - Current in-call flags
1685
+ */
1686
+ enableAudio(token: string, currentFlags: number): Promise<void>;
1687
+ /**
1688
+ * Disable audio in call
1689
+ *
1690
+ * @param token - Room token
1691
+ * @param currentFlags - Current in-call flags
1692
+ */
1693
+ disableAudio(token: string, currentFlags: number): Promise<void>;
1694
+ /**
1695
+ * Enable video in call
1696
+ *
1697
+ * @param token - Room token
1698
+ * @param currentFlags - Current in-call flags
1699
+ */
1700
+ enableVideo(token: string, currentFlags: number): Promise<void>;
1701
+ /**
1702
+ * Disable video in call
1703
+ *
1704
+ * @param token - Room token
1705
+ * @param currentFlags - Current in-call flags
1706
+ */
1707
+ disableVideo(token: string, currentFlags: number): Promise<void>;
1708
+ }
1709
+
1710
+ /**
1711
+ * Poll Resource (API v1)
1712
+ *
1713
+ * Handles all poll-related API operations.
1714
+ * Uses /ocs/v2.php/apps/spreed/api/v1/poll endpoints.
1715
+ */
1716
+
1717
+ /**
1718
+ * Poll resource for managing polls in Nextcloud Talk
1719
+ */
1720
+ declare class PollResource {
1721
+ private readonly http;
1722
+ constructor(http: HttpClient);
1723
+ /**
1724
+ * Create a new poll
1725
+ *
1726
+ * @param token - Room token
1727
+ * @param options - Poll creation options
1728
+ * @returns Created poll
1729
+ */
1730
+ create(token: string, options: CreatePollOptions): Promise<TalkPoll>;
1731
+ /**
1732
+ * Get a poll by ID
1733
+ *
1734
+ * @param token - Room token
1735
+ * @param pollId - Poll ID
1736
+ * @returns Poll data
1737
+ */
1738
+ get(token: string, pollId: number): Promise<TalkPoll>;
1739
+ /**
1740
+ * Vote on a poll
1741
+ *
1742
+ * @param token - Room token
1743
+ * @param pollId - Poll ID
1744
+ * @param options - Vote options (option indices)
1745
+ * @returns Updated poll
1746
+ */
1747
+ vote(token: string, pollId: number, options: VotePollOptions): Promise<TalkPoll>;
1748
+ /**
1749
+ * Close or delete a poll
1750
+ *
1751
+ * @param token - Room token
1752
+ * @param pollId - Poll ID
1753
+ * @returns Closed poll
1754
+ */
1755
+ close(token: string, pollId: number): Promise<TalkPoll>;
1756
+ /**
1757
+ * Get poll drafts
1758
+ *
1759
+ * @param token - Room token
1760
+ * @returns Array of draft polls
1761
+ */
1762
+ getDrafts(token: string): Promise<TalkPoll[]>;
1763
+ /**
1764
+ * Update a poll draft
1765
+ *
1766
+ * @param token - Room token
1767
+ * @param pollId - Poll draft ID
1768
+ * @param options - Updated poll options
1769
+ * @returns Updated draft
1770
+ */
1771
+ updateDraft(token: string, pollId: number, options: CreatePollOptions): Promise<TalkPoll>;
1772
+ }
1773
+
1774
+ /**
1775
+ * Reaction Resource (API v1)
1776
+ *
1777
+ * Handles all reaction-related API operations.
1778
+ * Uses /ocs/v2.php/apps/spreed/api/v1/reaction endpoints.
1779
+ */
1780
+
1781
+ /**
1782
+ * Reaction resource for managing message reactions
1783
+ */
1784
+ declare class ReactionResource {
1785
+ private readonly http;
1786
+ constructor(http: HttpClient);
1787
+ /**
1788
+ * Add a reaction to a message
1789
+ *
1790
+ * @param token - Room token
1791
+ * @param messageId - Message ID
1792
+ * @param reaction - Emoji reaction (e.g., "👍")
1793
+ * @returns Updated reactions map
1794
+ */
1795
+ add(token: string, messageId: number, reaction: string): Promise<ReactionsByEmoji>;
1796
+ /**
1797
+ * Remove a reaction from a message
1798
+ *
1799
+ * @param token - Room token
1800
+ * @param messageId - Message ID
1801
+ * @param reaction - Emoji reaction to remove
1802
+ * @returns Updated reactions map
1803
+ */
1804
+ remove(token: string, messageId: number, reaction: string): Promise<ReactionsByEmoji>;
1805
+ /**
1806
+ * Get reactions for a message
1807
+ *
1808
+ * @param token - Room token
1809
+ * @param messageId - Message ID
1810
+ * @param reaction - Optional specific emoji to filter
1811
+ * @returns Reactions grouped by emoji
1812
+ */
1813
+ get(token: string, messageId: number, reaction?: string): Promise<ReactionsByEmoji>;
1814
+ }
1815
+
1816
+ /**
1817
+ * Room Domain Entity
1818
+ *
1819
+ * High-level entity that encapsulates room data and provides
1820
+ * convenient methods for common operations.
1821
+ */
1822
+
1823
+ /** Resources needed for Room operations */
1824
+ interface RoomResources {
1825
+ chat: ChatResource;
1826
+ participants: ParticipantResource;
1827
+ call: CallResource;
1828
+ poll: PollResource;
1829
+ reaction: ReactionResource;
1830
+ }
1831
+ /**
1832
+ * Room domain entity with high-level operations
1833
+ *
1834
+ * Encapsulates both token (string) and id (integer) to handle
1835
+ * the API's identifier inconsistencies. All methods use token
1836
+ * internally but id is available for legacy v1 operations.
1837
+ *
1838
+ * @example
1839
+ * ```ts
1840
+ * const room = rooms.find(r => r.token === 'abcdefgh');
1841
+ *
1842
+ * // Send a message
1843
+ * await room.sendMessage("Hello world!");
1844
+ *
1845
+ * // Get participants
1846
+ * const participants = await room.getParticipants();
1847
+ *
1848
+ * // Poll for new messages
1849
+ * const result = await room.pollMessages({ lastKnownMessageId: 0 });
1850
+ * ```
1851
+ */
1852
+ declare class Room {
1853
+ /** Room token - primary API identifier */
1854
+ readonly token: string;
1855
+ /** Room internal database ID */
1856
+ readonly id: number;
1857
+ /** Conversation type */
1858
+ readonly type: ConversationType;
1859
+ /** Room name */
1860
+ readonly name: string;
1861
+ /** Computed display name */
1862
+ readonly displayName: string;
1863
+ /** Room description */
1864
+ readonly description: string;
1865
+ /** Current user's participant type/role */
1866
+ readonly participantType: ParticipantType;
1867
+ /** Current user's effective permissions */
1868
+ readonly permissions: number;
1869
+ /** Whether room has a password */
1870
+ readonly hasPassword: boolean;
1871
+ /** Whether there's an active call */
1872
+ readonly hasCall: boolean;
1873
+ /** Read-only state */
1874
+ readonly readOnly: ReadOnlyState;
1875
+ /** Lobby state */
1876
+ readonly lobbyState: LobbyState;
1877
+ /** Number of unread messages */
1878
+ readonly unreadMessages: number;
1879
+ /** Whether there are unread mentions */
1880
+ readonly unreadMention: boolean;
1881
+ /** Whether this is a favorite room */
1882
+ readonly isFavorite: boolean;
1883
+ /** Whether this room is archived */
1884
+ readonly isArchived: boolean;
1885
+ /** Last activity timestamp */
1886
+ readonly lastActivity: number;
1887
+ /** Raw normalized data for advanced access */
1888
+ readonly _data: NormalizedRoom;
1889
+ private readonly resources;
1890
+ constructor(data: NormalizedRoom, resources: RoomResources);
1891
+ /**
1892
+ * Send a message to this room
1893
+ *
1894
+ * @param message - Message content or full options
1895
+ * @returns Sent message
1896
+ */
1897
+ sendMessage(message: string | SendMessageOptions): Promise<NormalizedMessage>;
1898
+ /**
1899
+ * Get message history
1900
+ *
1901
+ * @param options - Optional limit and pagination
1902
+ * @returns Array of messages
1903
+ */
1904
+ getHistory(options?: {
1905
+ limit?: number;
1906
+ lastKnownMessageId?: number;
1907
+ }): Promise<NormalizedMessage[]>;
1908
+ /**
1909
+ * Poll for new messages (long-polling)
1910
+ *
1911
+ * @param options - Poll options with lastKnownMessageId
1912
+ * @returns Poll result with messages and metadata
1913
+ */
1914
+ pollMessages(options: PollMessagesOptions): Promise<ChatPollResult>;
1915
+ /**
1916
+ * Edit a message
1917
+ *
1918
+ * @param messageId - Message ID to edit
1919
+ * @param newContent - New message content
1920
+ * @returns Updated message
1921
+ */
1922
+ editMessage(messageId: number, newContent: string): Promise<NormalizedMessage>;
1923
+ /**
1924
+ * Delete a message
1925
+ *
1926
+ * @param messageId - Message ID to delete
1927
+ * @returns Deleted message placeholder
1928
+ */
1929
+ deleteMessage(messageId: number): Promise<NormalizedMessage>;
1930
+ /**
1931
+ * Set the read marker
1932
+ *
1933
+ * @param lastReadMessage - Message ID to mark as last read
1934
+ */
1935
+ setReadMarker(lastReadMessage: number): Promise<void>;
1936
+ /**
1937
+ * Get participants in this room
1938
+ *
1939
+ * @param includeStatus - Include user status information
1940
+ * @returns Array of participants
1941
+ */
1942
+ getParticipants(includeStatus?: boolean): Promise<NormalizedParticipant[]>;
1943
+ /**
1944
+ * Add a user to this room
1945
+ *
1946
+ * @param userId - User ID to add
1947
+ * @param source - Source type (default: 'users')
1948
+ */
1949
+ addParticipant(userId: string, source?: 'users' | 'groups' | 'emails'): Promise<void>;
1950
+ /**
1951
+ * Remove a participant from this room
1952
+ *
1953
+ * @param attendeeId - Attendee ID to remove
1954
+ */
1955
+ removeParticipant(attendeeId: number): Promise<void>;
1956
+ /**
1957
+ * Leave this room
1958
+ */
1959
+ leave(): Promise<void>;
1960
+ /**
1961
+ * Get peers currently in the call
1962
+ *
1963
+ * @returns Array of call peers
1964
+ */
1965
+ getCallPeers(): Promise<TalkCallPeer[]>;
1966
+ /**
1967
+ * Join the call
1968
+ *
1969
+ * @param options - Join options (flags, silent, etc.)
1970
+ */
1971
+ joinCall(options?: JoinCallOptions): Promise<void>;
1972
+ /**
1973
+ * Leave the call
1974
+ *
1975
+ * @param endForAll - End call for everyone (moderator only)
1976
+ */
1977
+ leaveCall(endForAll?: boolean): Promise<void>;
1978
+ /**
1979
+ * Create a poll in this room
1980
+ *
1981
+ * @param options - Poll creation options
1982
+ * @returns Created poll
1983
+ */
1984
+ createPoll(options: CreatePollOptions): Promise<TalkPoll>;
1985
+ /**
1986
+ * Add a reaction to a message
1987
+ *
1988
+ * @param messageId - Message ID
1989
+ * @param reaction - Emoji reaction
1990
+ */
1991
+ addReaction(messageId: number, reaction: string): Promise<void>;
1992
+ /**
1993
+ * Remove a reaction from a message
1994
+ *
1995
+ * @param messageId - Message ID
1996
+ * @param reaction - Emoji reaction to remove
1997
+ */
1998
+ removeReaction(messageId: number, reaction: string): Promise<void>;
1999
+ /** Whether the current user is a moderator or owner */
2000
+ get isModerator(): boolean;
2001
+ /** Whether this is a one-to-one conversation */
2002
+ get isOneToOne(): boolean;
2003
+ /** Whether this is a group conversation */
2004
+ get isGroup(): boolean;
2005
+ /** Whether this is a public (open) conversation */
2006
+ get isPublic(): boolean;
2007
+ /** Whether the room is currently read-only */
2008
+ get isReadOnly(): boolean;
2009
+ /** Whether the lobby is enabled */
2010
+ get hasLobby(): boolean;
2011
+ }
2012
+
2013
+ /**
2014
+ * TalkClient - Main entry point for the Nextcloud Talk SDK
2015
+ *
2016
+ * Provides a high-level interface for interacting with the Nextcloud Talk API.
2017
+ * Uses a 4-layer architecture:
2018
+ * - Transport: HTTP client with OCS headers
2019
+ * - Resource: API endpoint modules (v1/v4)
2020
+ * - Normalization: DTO mappers
2021
+ * - Domain: High-level entities (Room)
2022
+ */
2023
+
2024
+ /** Configuration options for TalkClient */
2025
+ interface TalkClientConfig {
2026
+ /** Nextcloud server host URL (e.g., 'https://nextcloud.local') */
2027
+ host: string;
2028
+ /** Nextcloud username */
2029
+ username: string;
2030
+ /** App password or regular password */
2031
+ password: string;
2032
+ /** Optional custom fetch implementation */
2033
+ fetch?: typeof fetch;
2034
+ }
2035
+ /**
2036
+ * Rooms accessor for listing and creating rooms
2037
+ *
2038
+ * Provides methods to interact with rooms and returns Room domain entities.
2039
+ */
2040
+ declare class RoomsAccessor {
2041
+ private readonly roomResource;
2042
+ private readonly roomResources;
2043
+ constructor(roomResource: RoomResource, roomResources: RoomResources);
2044
+ /**
2045
+ * List all conversations the current user is part of
2046
+ *
2047
+ * @param options - List options
2048
+ * @returns Array of Room entities
2049
+ *
2050
+ * @example
2051
+ * ```ts
2052
+ * const rooms = await client.rooms.list();
2053
+ * const targetRoom = rooms.find(r => r.token === 'abcdefgh');
2054
+ * ```
2055
+ */
2056
+ list(options?: ListRoomsOptions): Promise<Room[]>;
2057
+ /**
2058
+ * Get a single room by token
2059
+ *
2060
+ * @param token - Room token
2061
+ * @returns Room entity
2062
+ */
2063
+ get(token: string): Promise<Room>;
2064
+ /**
2065
+ * Create a new room
2066
+ *
2067
+ * @param options - Room creation options
2068
+ * @returns Created Room entity
2069
+ *
2070
+ * @example
2071
+ * ```ts
2072
+ * // Create a group room
2073
+ * const room = await client.rooms.create({
2074
+ * roomType: 2,
2075
+ * roomName: 'Team Chat',
2076
+ * });
2077
+ *
2078
+ * // Create a 1-1 chat
2079
+ * const dm = await client.rooms.create({
2080
+ * roomType: 1,
2081
+ * invite: 'other-user',
2082
+ * source: 'users',
2083
+ * });
2084
+ * ```
2085
+ */
2086
+ create(options: CreateRoomOptions): Promise<Room>;
2087
+ /**
2088
+ * Delete a room
2089
+ *
2090
+ * @param token - Room token
2091
+ */
2092
+ delete(token: string): Promise<void>;
2093
+ /**
2094
+ * Rename a room
2095
+ *
2096
+ * @param token - Room token
2097
+ * @param name - New room name
2098
+ */
2099
+ rename(token: string, name: string): Promise<void>;
2100
+ }
2101
+ /**
2102
+ * TalkClient - Main SDK client for Nextcloud Talk
2103
+ *
2104
+ * @example
2105
+ * ```ts
2106
+ * const client = new TalkClient({
2107
+ * host: 'https://nextcloud.local',
2108
+ * username: 'admin',
2109
+ * password: 'app-password'
2110
+ * });
2111
+ *
2112
+ * // List rooms
2113
+ * const rooms = await client.rooms.list();
2114
+ *
2115
+ * // Find and interact with a room
2116
+ * const targetRoom = rooms.find(r => r.token === 'abcdefgh');
2117
+ * await targetRoom.sendMessage("Automated system check initialized.");
2118
+ *
2119
+ * // Poll for new messages
2120
+ * const result = await targetRoom.pollMessages({ lastKnownMessageId: 0 });
2121
+ * ```
2122
+ */
2123
+ declare class TalkClient {
2124
+ /** HTTP client for direct API access */
2125
+ readonly http: HttpClient;
2126
+ /** Rooms accessor for room operations */
2127
+ readonly rooms: RoomsAccessor;
2128
+ /** Direct access to chat resource */
2129
+ readonly chat: ChatResource;
2130
+ /** Direct access to participant resource */
2131
+ readonly participants: ParticipantResource;
2132
+ /** Direct access to call resource */
2133
+ readonly call: CallResource;
2134
+ /** Direct access to poll resource */
2135
+ readonly poll: PollResource;
2136
+ /** Direct access to reaction resource */
2137
+ readonly reaction: ReactionResource;
2138
+ /** Direct access to room resource */
2139
+ private readonly roomResource;
2140
+ constructor(config: TalkClientConfig);
2141
+ /**
2142
+ * Get the base URL for this client
2143
+ */
2144
+ get host(): string;
2145
+ }
2146
+
2147
+ export { ActorType, type AddParticipantOptions, type AddReactionOptions, BreakoutRoomMode, type CallNotificationSettings, CallResource, type ChatPollResult, ChatResource, ConversationType, type CreatePollOptions, type CreateRoomOptions, type DeletedMessageRef, HttpClient, type HttpClientConfig, HttpClientError, type HttpResponse, InCallFlag, type JoinCallOptions, type JoinRoomOptions, type LeaveCallOptions, type ListRoomsOptions, ListableScope, type LobbySettings, LobbyState, type MessageMetadata, type MessageReminder, MessageType, type NormalizedMessage, type NormalizedParticipant, type NormalizedRoom, NotificationLevel, type NotificationSettings, type OCSResponse, ParticipantResource, ParticipantType, Permission, type PermissionMethod, type PermissionMode, type PollMessagesOptions, PollResource, PollResultMode, type PollVote, type ReactionActor, ReactionResource, type ReactionsByEmoji, ReadOnlyState, type ReceiveMessagesOptions, RecordingStatus, type RequestOptions, type ResponseMeta, Room, RoomResource, type RoomResources, RoomsAccessor, SIPState, type ScheduleMessageOptions, type SendMessageOptions, type SessionConflict, type SessionState, type SetPermissionsOptions, type ShareObjectOptions, SharedObjectType, type SignalingSettings, type TalkCallPeer, type TalkChatMentionSuggestion, type TalkChatMessage, type TalkChatMessageWithParent, TalkClient, type TalkClientConfig, type TalkParticipant, type TalkPoll, type TalkRichObjectParameter, type TalkRoom, type UpdateCallFlagsOptions, type VotePollOptions, normalizeMessage, normalizeMessageWithParent, normalizeMessages, normalizeParticipant, normalizeParticipants, normalizeRoom, normalizeRooms };