@noverachat/sdk-web 0.0.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +8 -8
- package/README.md +8 -8
- package/dist/index.cjs +485 -258
- package/dist/index.d.cts +212 -169
- package/dist/index.d.ts +212 -169
- package/dist/index.js +485 -258
- package/package.json +1 -1
- package/src/client.ts +50 -157
- package/src/features/room.ts +274 -344
- package/src/generated/rest.ts +529 -0
- package/src/index.ts +4 -0
- package/src/types.ts +62 -177
package/dist/index.d.cts
CHANGED
|
@@ -204,34 +204,49 @@ interface WsPing {
|
|
|
204
204
|
client_ts: number;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
207
|
+
/** Client-facing feature flags for the caller's app. */
|
|
208
|
+
interface AppPolicy {
|
|
209
|
+
appId: string;
|
|
210
|
+
allowMemberBulkDelete: boolean;
|
|
211
|
+
readReceiptsEnabled: boolean;
|
|
212
|
+
typingIndicatorsEnabled: boolean;
|
|
213
|
+
allowMemberDeleteAnyMessage: boolean;
|
|
214
|
+
}
|
|
215
|
+
/** Aggregate unread state across every room the calling user is in. */
|
|
216
|
+
interface UnreadSummary {
|
|
217
|
+
total: number;
|
|
218
|
+
rooms: UnreadRoomItem[];
|
|
219
|
+
}
|
|
220
|
+
interface UnreadRoomItem {
|
|
221
|
+
roomId: string;
|
|
222
|
+
name: string | null;
|
|
223
|
+
roomType?: string | null;
|
|
224
|
+
unreadCount: number;
|
|
225
|
+
lastMessageId?: string | null;
|
|
226
|
+
lastReadMessageId?: string | null;
|
|
227
|
+
lastMessagePreview?: string | null;
|
|
228
|
+
memberCount?: number;
|
|
229
|
+
membersPreview?: MemberPreview[];
|
|
230
|
+
}
|
|
231
|
+
/** A single member shown in a channel-list avatar mosaic. */
|
|
232
|
+
interface MemberPreview {
|
|
222
233
|
userId: string;
|
|
223
234
|
nickname?: string | null;
|
|
224
235
|
profileImageUrl?: string | null;
|
|
236
|
+
isOnline?: boolean | null;
|
|
225
237
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
238
|
+
/** Per-room unread state for the calling user. */
|
|
239
|
+
interface RoomUnread {
|
|
240
|
+
roomId: string;
|
|
241
|
+
unreadCount: number;
|
|
242
|
+
lastReadMessageId?: string | null;
|
|
243
|
+
lastMessageId?: string | null;
|
|
230
244
|
}
|
|
231
|
-
|
|
245
|
+
/** Canonical NoveraChat message response. Bemily clients hit the compat adapter which translates this into Sendbird wire-format (channelUrl, data as JSON string, etc.). */
|
|
246
|
+
interface MessageOut$1 {
|
|
232
247
|
appId: string;
|
|
233
248
|
roomId: string;
|
|
234
|
-
messageId:
|
|
249
|
+
messageId: string;
|
|
235
250
|
sender?: SenderMini | null;
|
|
236
251
|
senderId?: string | null;
|
|
237
252
|
messageType: MessageType;
|
|
@@ -239,44 +254,22 @@ interface MessageOut {
|
|
|
239
254
|
content?: string | null;
|
|
240
255
|
data?: Record<string, unknown> | null;
|
|
241
256
|
meta?: Record<string, unknown> | null;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
* signed download URL, or ``chat.getFileMeta(fileId)`` for metadata
|
|
248
|
-
* without the download. Null for text-only messages. */
|
|
249
|
-
fileId?: MessageIdStr | null;
|
|
250
|
-
/** Inline file metadata embedded by the server on chat_receive — lets
|
|
251
|
-
* the UI render a placeholder (filename, size, dimensions, thumbnail
|
|
252
|
-
* status) without an extra round-trip. May be null even when `fileId`
|
|
253
|
-
* is set (e.g. for messages loaded via REST history before the inline
|
|
254
|
-
* metadata feature shipped); call ``getFileMeta()`` in that case. */
|
|
255
|
-
file?: FileInline | null;
|
|
256
|
-
/** Multi-file bundle — set when the message references multiple files
|
|
257
|
-
* via ``data.file_ids`` (kind = "file_group"). Each entry has the
|
|
258
|
-
* same shape as ``file``. Null for single-file / text-only messages.
|
|
259
|
-
* UIs should check ``files?.length > 0`` first and only fall through
|
|
260
|
-
* to the ``file`` singleton when the bundle field is absent. */
|
|
261
|
-
files?: FileInline[] | null;
|
|
262
|
-
replyToId?: MessageIdStr | null;
|
|
263
|
-
reactions: ReactionEntry[];
|
|
257
|
+
fileId?: string | null;
|
|
258
|
+
file?: Record<string, unknown> | null;
|
|
259
|
+
files?: Record<string, unknown>[] | null;
|
|
260
|
+
replyToId?: string | null;
|
|
261
|
+
reactions?: ReactionEntry[];
|
|
264
262
|
createdAt: string;
|
|
265
|
-
createdAtMs: number;
|
|
266
263
|
updatedAt?: string | null;
|
|
267
|
-
updatedAtMs?: number | null;
|
|
268
264
|
deletedAt?: string | null;
|
|
269
265
|
deletedByUserId?: string | null;
|
|
270
|
-
deleteScope?:
|
|
271
|
-
editedCount
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
roomId: string;
|
|
275
|
-
unreadCount: number;
|
|
276
|
-
lastReadMessageId: MessageIdStr | null;
|
|
277
|
-
lastMessageId: MessageIdStr | null;
|
|
266
|
+
deleteScope?: string | null;
|
|
267
|
+
editedCount?: number;
|
|
268
|
+
createdAtMs: number;
|
|
269
|
+
updatedAtMs: number | null;
|
|
278
270
|
}
|
|
279
|
-
|
|
271
|
+
/** 공지사항 (KakaoTalk 스타일) — 방마다 다수. `deleted_at` 이 세팅되면 소프트 삭제된 것으로 리스트/current 조회에서 제외된다. */
|
|
272
|
+
interface AnnouncementOut {
|
|
280
273
|
id: number;
|
|
281
274
|
roomId: string;
|
|
282
275
|
content: string;
|
|
@@ -284,98 +277,120 @@ interface Announcement {
|
|
|
284
277
|
createdAt: string;
|
|
285
278
|
updatedAt: string;
|
|
286
279
|
}
|
|
287
|
-
/**
|
|
288
|
-
|
|
289
|
-
* A row in the caller's block list. The blocked user is NOT told they're
|
|
290
|
-
* blocked; they keep sending messages that just don't reach the blocker.
|
|
291
|
-
* See ``chat.blockUser`` / ``chat.unblockUser`` / ``chat.listBlocks``.
|
|
292
|
-
*/
|
|
293
|
-
interface Block {
|
|
294
|
-
blockedUserId: string;
|
|
295
|
-
reason: string | null;
|
|
296
|
-
/** ISO-8601 UTC. */
|
|
297
|
-
createdAt: string;
|
|
298
|
-
}
|
|
299
|
-
/** 방 초대 링크 (카톡 오픈채팅 URL 스타일). Minted by an OPERATOR via
|
|
300
|
-
* ``room.createInvite()``; consumed by any user via ``chat.acceptInvite()``. */
|
|
301
|
-
interface InviteToken {
|
|
302
|
-
/** URL-safe short id (~22 chars). Embed in the shareable URL as-is. */
|
|
280
|
+
/** 방 초대 링크 (카톡 오픈채팅 URL 스타일). */
|
|
281
|
+
interface InviteTokenOut {
|
|
303
282
|
token: string;
|
|
304
283
|
roomId: string;
|
|
305
284
|
createdBy: string;
|
|
306
|
-
/** ISO-8601 UTC. */
|
|
307
285
|
createdAt: string;
|
|
308
|
-
/** ISO-8601 UTC. `null` = never expires. */
|
|
309
286
|
expiresAt: string | null;
|
|
310
|
-
/** `null` = unlimited uses. */
|
|
311
287
|
maxUses: number | null;
|
|
312
|
-
/** Successful `accept` calls so far. */
|
|
313
288
|
usedCount: number;
|
|
314
|
-
/** ISO-8601 UTC. `null` = still active (assuming not expired / exhausted). */
|
|
315
289
|
revokedAt: string | null;
|
|
316
290
|
}
|
|
317
|
-
/**
|
|
318
|
-
interface
|
|
291
|
+
/** `POST /invites/{token}/accept` 성공 응답. 가입한 방 정보. */
|
|
292
|
+
interface InviteAcceptResponse {
|
|
319
293
|
roomId: string;
|
|
320
294
|
roomName: string | null;
|
|
321
|
-
/** True when the caller was already an active member — the call is a
|
|
322
|
-
* no-op and does NOT bump the invite's `used_count`. Useful for
|
|
323
|
-
* deep-link flows that may be triggered on re-open. */
|
|
324
295
|
wasAlreadyMember: boolean;
|
|
325
296
|
}
|
|
326
|
-
|
|
327
|
-
|
|
297
|
+
interface DeviceOut {
|
|
298
|
+
deviceId: string;
|
|
299
|
+
tokenType: string;
|
|
300
|
+
tokenPreview: string;
|
|
301
|
+
os: string | null;
|
|
302
|
+
appVersion: string | null;
|
|
303
|
+
pushEnabled: boolean;
|
|
304
|
+
lastActiveAt: string | null;
|
|
305
|
+
createdAt: string;
|
|
306
|
+
}
|
|
307
|
+
/** One row from ``user_blocks`` for the caller. We DON'T echo ``blocker_user_id`` — it's always the caller, and including it in every list entry would just add noise. ``model_config`` lets the router return ORM instances directly via ``response_model``. */
|
|
308
|
+
interface BlockOut {
|
|
309
|
+
blockedUserId: string;
|
|
310
|
+
reason: string | null;
|
|
311
|
+
createdAt: string;
|
|
312
|
+
}
|
|
313
|
+
interface RoomMemberOut {
|
|
328
314
|
userId: string;
|
|
329
|
-
nickname
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
315
|
+
nickname?: string | null;
|
|
316
|
+
role: MemberRole;
|
|
317
|
+
pushTrigger: PushTrigger;
|
|
318
|
+
lastReadMessageId?: string | null;
|
|
319
|
+
joinedAt: string;
|
|
320
|
+
isOnline?: boolean | null;
|
|
321
|
+
mutedUntil?: string | null;
|
|
336
322
|
}
|
|
337
|
-
interface
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
/** One-line preview shown under the room name in the channel list.
|
|
345
|
-
* TEXT/SYSTEM → first 200 chars, EMOTICON → "[이모티콘]", images/videos/
|
|
346
|
-
* files → "[사진]" / "[동영상]" / "[파일] name". Null when the room has
|
|
347
|
-
* no messages yet (or was just cleared). */
|
|
348
|
-
lastMessagePreview: string | null;
|
|
349
|
-
lastReadMessageId: MessageIdStr | null;
|
|
350
|
-
/** Total active (non-KICKED) members incl. the caller — the count badge. */
|
|
351
|
-
memberCount: number;
|
|
352
|
-
/** Up to 4 OTHER members (caller excluded) for the avatar mosaic. */
|
|
353
|
-
members: MemberPreview[];
|
|
323
|
+
interface JoinRequestOut {
|
|
324
|
+
userId: string;
|
|
325
|
+
status: "PENDING" | "APPROVED" | "REJECTED" | "CANCELLED";
|
|
326
|
+
reason: string | null;
|
|
327
|
+
requestedAt: string;
|
|
328
|
+
processedAt: string | null;
|
|
329
|
+
processedByUserId: string | null;
|
|
354
330
|
}
|
|
355
|
-
interface
|
|
331
|
+
interface JoinRequestListResponse {
|
|
332
|
+
items: JoinRequestOut[];
|
|
356
333
|
total: number;
|
|
357
|
-
|
|
334
|
+
limit: number;
|
|
335
|
+
offset: number;
|
|
358
336
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
337
|
+
/** Synchronous response after `POST /join-request`. `status="joined"` — OPEN room, user was immediately added. `status="pending"` — APPROVAL_REQUIRED, request is pending. `status="already_member"` — caller is already an active member; no-op. */
|
|
338
|
+
interface JoinRequestCreateResponse {
|
|
339
|
+
status: "joined" | "pending" | "already_member";
|
|
340
|
+
roomId: string;
|
|
341
|
+
}
|
|
342
|
+
/** Minimal sender identity — no friend/block/profile-url fluff. */
|
|
343
|
+
interface SenderMini {
|
|
344
|
+
userId: string;
|
|
345
|
+
nickname?: string | null;
|
|
346
|
+
profileImageUrl?: string | null;
|
|
347
|
+
}
|
|
348
|
+
interface ReactionEntry {
|
|
349
|
+
key: string;
|
|
350
|
+
userIds: string[];
|
|
351
|
+
updatedAt: number;
|
|
352
|
+
}
|
|
353
|
+
type MemberRole = "OPERATOR" | "MEMBER" | "KICKED";
|
|
354
|
+
type PushTrigger = "ALL" | "MENTION_ONLY" | "OFF";
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Shared wire types. Must stay in lock-step with:
|
|
358
|
+
* noverachat-backend/src/noverachat/ws/protocol.py
|
|
359
|
+
* noverachat-backend/src/noverachat/modules/message/schemas.py
|
|
360
|
+
*
|
|
361
|
+
* NOTE on `message_id` / `reply_to_id` / `last_*_message_id`: server-side
|
|
362
|
+
* these are 63-bit Snowflake integers. On the wire they are JSON STRINGS
|
|
363
|
+
* because JS `Number` can only represent integers up to 2^53 exactly.
|
|
364
|
+
* Stringifying preserves precision; the SDK never converts them back to
|
|
365
|
+
* Number. Compare with `BigInt(a) > BigInt(b)`.
|
|
366
|
+
*/
|
|
367
|
+
/** 63-bit Snowflake serialized as a JSON string. Treat as opaque. */
|
|
368
|
+
type MessageIdStr = string;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Canonical message shape surfaced to SDK callers. Structurally the
|
|
372
|
+
* GENERATED REST `MessageOut` PLUS two client-side enhancements the server
|
|
373
|
+
* doesn't send verbatim:
|
|
374
|
+
* - `file` / `files` parsed into the camelCase `FileInline` shape (the
|
|
375
|
+
* generated model leaves them free-form since the OpenAPI schema does),
|
|
376
|
+
* - `customMeta` lifted out of `data._customMeta`.
|
|
377
|
+
* Built by `toMessageOut` in features/room.ts.
|
|
378
|
+
*/
|
|
379
|
+
interface MessageOut extends Omit<MessageOut$1, "file" | "files" | "reactions"> {
|
|
380
|
+
/** Inline file metadata embedded by the server on chat_receive / REST
|
|
381
|
+
* history — lets the UI render a placeholder (filename, size, dims,
|
|
382
|
+
* thumbnail status) without an extra round-trip. May be null even when
|
|
383
|
+
* `fileId` is set (older history predating inline meta); call
|
|
384
|
+
* ``getFileMeta()`` in that case. */
|
|
385
|
+
file?: FileInline | null;
|
|
386
|
+
/** Multi-file bundle (kind = "file_group"). Null for single-file /
|
|
387
|
+
* text-only messages. Check ``files?.length`` first, then fall back to
|
|
388
|
+
* the ``file`` singleton. */
|
|
389
|
+
files?: FileInline[] | null;
|
|
390
|
+
reactions: ReactionEntry[];
|
|
391
|
+
/** Custom metadata attached by the sender (extracted from
|
|
392
|
+
* `data._customMeta`). Null when the sender didn't attach anything. */
|
|
393
|
+
customMeta?: Record<string, unknown> | null;
|
|
379
394
|
}
|
|
380
395
|
/** Push providers we can deliver to. Matches the backend `TokenType`. */
|
|
381
396
|
type DeviceTokenType = "FCM" | "APNS" | "HUAWEI";
|
|
@@ -393,18 +408,6 @@ interface RegisterDeviceParams {
|
|
|
393
408
|
os?: DeviceOS;
|
|
394
409
|
appVersion?: string;
|
|
395
410
|
}
|
|
396
|
-
interface DeviceInfo {
|
|
397
|
-
deviceId: string;
|
|
398
|
-
tokenType: DeviceTokenType;
|
|
399
|
-
/** Server returns only a short prefix of the token — it's a credential
|
|
400
|
-
* and the caller already holds the full value. */
|
|
401
|
-
tokenPreview: string;
|
|
402
|
-
os: DeviceOS | null;
|
|
403
|
-
appVersion: string | null;
|
|
404
|
-
pushEnabled: boolean;
|
|
405
|
-
lastActiveAt: string | null;
|
|
406
|
-
createdAt: string;
|
|
407
|
-
}
|
|
408
411
|
interface SendParams {
|
|
409
412
|
content?: string;
|
|
410
413
|
messageType?: "TEXT" | "FILE" | "EMOTICON";
|
|
@@ -735,8 +738,31 @@ declare class Room {
|
|
|
735
738
|
* Other members get a `MEMBER_LEFT` [`roomEvent`](../reference/noverachat.md#events).
|
|
736
739
|
* Idempotent if already a non-member; throws 409 if the caller was KICKED
|
|
737
740
|
* (ask an operator to restore first). For GROUP/SUPER_GROUP, re-entry needs
|
|
738
|
-
* an operator add; for ONE, re-creating the 1:1 rejoins with history kept.
|
|
739
|
-
|
|
741
|
+
* an operator add; for ONE, re-creating the 1:1 rejoins with history kept.
|
|
742
|
+
*
|
|
743
|
+
* Optional `deleteMessages` — atomically clean up chat history as part
|
|
744
|
+
* of leaving. Default is `"none"` (messages survive so the room's
|
|
745
|
+
* history keeps making sense to remaining members).
|
|
746
|
+
* - `"none"` — leave only.
|
|
747
|
+
* - `"mine"` — soft-delete every message YOU sent, then leave. Other
|
|
748
|
+
* members' messages are untouched. Broadcasts
|
|
749
|
+
* `messages_cleared_by_sender` so connected clients hide
|
|
750
|
+
* them locally.
|
|
751
|
+
* - `"all"` — wipe every message in the room, then leave. Subject to
|
|
752
|
+
* the app's `allow_member_bulk_delete` gate and per-room
|
|
753
|
+
* OPERATOR check — a plain member gets 403 back. */
|
|
754
|
+
leave(options?: {
|
|
755
|
+
deleteMessages?: "none" | "mine" | "all";
|
|
756
|
+
}): Promise<void>;
|
|
757
|
+
/** Delete every message YOU sent in this room. Standalone version of
|
|
758
|
+
* `leave({ deleteMessages: "mine" })` — useful when a user wants to
|
|
759
|
+
* scrub their history without actually leaving. Other members'
|
|
760
|
+
* messages are untouched; broadcasts `messages_cleared_by_sender`
|
|
761
|
+
* so connected clients hide the vanished ones locally.
|
|
762
|
+
* No OPERATOR gate — you own your messages. */
|
|
763
|
+
deleteMyMessages(): Promise<{
|
|
764
|
+
cleared: number;
|
|
765
|
+
}>;
|
|
740
766
|
/**
|
|
741
767
|
* Set the caller's per-room push preference — like long-pressing a
|
|
742
768
|
* chat and tapping "notifications off".
|
|
@@ -811,20 +837,7 @@ declare class Room {
|
|
|
811
837
|
* `room.deleteAllMessages()`. Server gates by membership for non-public
|
|
812
838
|
* rooms, so the caller must already be a member to read this.
|
|
813
839
|
*/
|
|
814
|
-
listMembers(): Promise<
|
|
815
|
-
userId: string;
|
|
816
|
-
nickname: string | null;
|
|
817
|
-
role: "OPERATOR" | "MEMBER" | "KICKED";
|
|
818
|
-
pushTrigger: "ALL" | "MENTION" | "OFF";
|
|
819
|
-
lastReadMessageId: MessageIdStr | null;
|
|
820
|
-
joinedAt: string;
|
|
821
|
-
/** Cluster-wide presence dot. `null` when the server didn't resolve it. */
|
|
822
|
-
isOnline: boolean | null;
|
|
823
|
-
/** Per-room mute expiry. `null` = not muted. A far-future sentinel
|
|
824
|
-
* (year 9999) means the operator picked "indefinite" — clients
|
|
825
|
-
* should render that as "무기한" instead of a real timestamp. */
|
|
826
|
-
mutedUntil: string | null;
|
|
827
|
-
}>>;
|
|
840
|
+
listMembers(): Promise<RoomMemberOut[]>;
|
|
828
841
|
/** OPERATOR-only: mute a member so they can't send messages in this
|
|
829
842
|
* room. `durationMinutes=null` → indefinite (until an explicit unmute).
|
|
830
843
|
* Emits a `MEMBER_MUTED` [`roomEvent`](../reference/noverachat.md#events)
|
|
@@ -853,10 +866,10 @@ declare class Room {
|
|
|
853
866
|
* approval). Auto-inserts a SYSTEM chat message and broadcasts a
|
|
854
867
|
* `ROOM_VISIBILITY_CHANGED` roomEvent so peers update in real time. */
|
|
855
868
|
setPublic(isPublic: boolean): Promise<void>;
|
|
856
|
-
listAnnouncements(): Promise<
|
|
857
|
-
getCurrentAnnouncement(): Promise<
|
|
858
|
-
postAnnouncement(content: string): Promise<
|
|
859
|
-
updateAnnouncement(id: number, content: string): Promise<
|
|
869
|
+
listAnnouncements(): Promise<AnnouncementOut[]>;
|
|
870
|
+
getCurrentAnnouncement(): Promise<AnnouncementOut | null>;
|
|
871
|
+
postAnnouncement(content: string): Promise<AnnouncementOut>;
|
|
872
|
+
updateAnnouncement(id: number, content: string): Promise<AnnouncementOut>;
|
|
860
873
|
deleteAnnouncement(id: number): Promise<void>;
|
|
861
874
|
/**
|
|
862
875
|
* OPERATOR-only: mint a new invite link for this room. Default:
|
|
@@ -874,13 +887,44 @@ declare class Room {
|
|
|
874
887
|
/** Max successful `acceptInvite` calls before the link
|
|
875
888
|
* auto-exhausts. Default null (unlimited). */
|
|
876
889
|
maxUses?: number | null;
|
|
877
|
-
}): Promise<
|
|
890
|
+
}): Promise<InviteTokenOut>;
|
|
878
891
|
/** OPERATOR-only: list all invite tokens for this room (including
|
|
879
892
|
* revoked / expired / exhausted), newest first. */
|
|
880
|
-
listInvites(): Promise<
|
|
893
|
+
listInvites(): Promise<InviteTokenOut[]>;
|
|
881
894
|
/** OPERATOR-only: revoke a token immediately. Idempotent — revoking
|
|
882
895
|
* an already-revoked token returns 204 as well. */
|
|
883
896
|
revokeInvite(token: string): Promise<void>;
|
|
897
|
+
/**
|
|
898
|
+
* Ask to join this room (self). Behavior depends on the room's
|
|
899
|
+
* `joinPolicy`:
|
|
900
|
+
* - `OPEN` → the caller is added immediately (`status: "joined"`);
|
|
901
|
+
* - `APPROVAL_REQUIRED` → the request lands in the operators' inbox
|
|
902
|
+
* (`status: "pending"`) until [`approveJoinRequest`] / reject.
|
|
903
|
+
* Idempotent for members (`status: "already_member"`).
|
|
904
|
+
*
|
|
905
|
+
* @param reason Optional note shown to operators ("하은이 반 친구 엄마예요").
|
|
906
|
+
*/
|
|
907
|
+
requestJoin(reason?: string): Promise<JoinRequestCreateResponse>;
|
|
908
|
+
/** Cancel the caller's own pending join request. */
|
|
909
|
+
cancelJoinRequest(): Promise<void>;
|
|
910
|
+
/** OPERATOR-only: list join requests for this room (the approval inbox).
|
|
911
|
+
* Defaults to pending only — pass a status to see processed history. */
|
|
912
|
+
listJoinRequests(opts?: {
|
|
913
|
+
status?: "PENDING" | "APPROVED" | "REJECTED" | "CANCELLED";
|
|
914
|
+
limit?: number;
|
|
915
|
+
offset?: number;
|
|
916
|
+
}): Promise<JoinRequestListResponse>;
|
|
917
|
+
/** OPERATOR-only: approve a pending join request — the requester becomes
|
|
918
|
+
* a MEMBER. [reason] is echoed back to them in later list calls. */
|
|
919
|
+
approveJoinRequest(userId: string, reason?: string): Promise<void>;
|
|
920
|
+
/** OPERATOR-only: reject a pending join request. */
|
|
921
|
+
rejectJoinRequest(userId: string, reason?: string): Promise<void>;
|
|
922
|
+
/** Hide this room from the caller's own room list (self, reversible —
|
|
923
|
+
* the KakaoTalk "숨기기"). The room typically reappears via [unhide]
|
|
924
|
+
* or on new activity, per server policy. Messages are untouched. */
|
|
925
|
+
hide(): Promise<void>;
|
|
926
|
+
/** Undo [hide] — the room shows up in the caller's list again. */
|
|
927
|
+
unhide(): Promise<void>;
|
|
884
928
|
on<K extends keyof RoomEvents>(event: K, fn: (p: RoomEvents[K]) => void): () => void;
|
|
885
929
|
off<K extends keyof RoomEvents>(event: K, fn: (p: RoomEvents[K]) => void): void;
|
|
886
930
|
_dispatchAnnouncement(msg: WsAnnouncementEvent): void;
|
|
@@ -1005,9 +1049,9 @@ declare class NoveraChat {
|
|
|
1005
1049
|
* on `deviceId` — the server upserts, so re-registering is cheap and
|
|
1006
1050
|
* safe. Returns the stored device record (token shown only as a prefix).
|
|
1007
1051
|
*/
|
|
1008
|
-
registerDevice(params: RegisterDeviceParams): Promise<
|
|
1052
|
+
registerDevice(params: RegisterDeviceParams): Promise<DeviceOut>;
|
|
1009
1053
|
/** List the devices registered for the authenticated user. */
|
|
1010
|
-
listDevices(): Promise<
|
|
1054
|
+
listDevices(): Promise<DeviceOut[]>;
|
|
1011
1055
|
/**
|
|
1012
1056
|
* Turn push delivery on/off for one device without unregistering it —
|
|
1013
1057
|
* the token stays stored, the push pipeline just skips it. Use for an
|
|
@@ -1046,12 +1090,11 @@ declare class NoveraChat {
|
|
|
1046
1090
|
* a validation error server-side.
|
|
1047
1091
|
* @param reason Optional local note ≤500 chars.
|
|
1048
1092
|
*/
|
|
1049
|
-
blockUser(userId: string, reason?: string): Promise<
|
|
1093
|
+
blockUser(userId: string, reason?: string): Promise<BlockOut>;
|
|
1050
1094
|
/** Unblock a user. Idempotent — resolves either way. */
|
|
1051
1095
|
unblockUser(userId: string): Promise<void>;
|
|
1052
1096
|
/** List every user the caller has blocked, newest first. */
|
|
1053
|
-
listBlocks(): Promise<
|
|
1054
|
-
private _toDeviceInfo;
|
|
1097
|
+
listBlocks(): Promise<BlockOut[]>;
|
|
1055
1098
|
/**
|
|
1056
1099
|
* Authorization-gated URL for downloading a file attachment.
|
|
1057
1100
|
*
|
|
@@ -1108,7 +1151,7 @@ declare class NoveraChat {
|
|
|
1108
1151
|
* invalid, expired, revoked, exhausted, or when the caller has been
|
|
1109
1152
|
* kicked from the target room.
|
|
1110
1153
|
*/
|
|
1111
|
-
acceptInvite(token: string): Promise<
|
|
1154
|
+
acceptInvite(token: string): Promise<InviteAcceptResponse>;
|
|
1112
1155
|
private dispatch;
|
|
1113
1156
|
private highestKnownMessageId;
|
|
1114
1157
|
private backfillAllRooms;
|
|
@@ -1148,4 +1191,4 @@ declare class NoveraChatError extends Error {
|
|
|
1148
1191
|
static fromResponse(status: number, body: unknown): NoveraChatError;
|
|
1149
1192
|
}
|
|
1150
1193
|
|
|
1151
|
-
export { type AcceptInviteResult, type Announcement, type AppPolicy, type Block, type ClientOptions, type DeleteScope, ErrorCode, type ErrorCodeValue, type InviteToken, type MessageOut, type MessageType, NoveraChat, NoveraChatError, type ReactionEntry, Room, type RoomEvents, type RoomUnread, type SendParams, type SenderMini, type UnreadRoomItem, type UnreadSummary, type WsAnnouncementEvent, type WsInbound, type WsOutbound };
|
|
1194
|
+
export { type InviteAcceptResponse as AcceptInviteResult, type AnnouncementOut as Announcement, type AppPolicy, type BlockOut as Block, type ClientOptions, type DeleteScope, ErrorCode, type ErrorCodeValue, type InviteTokenOut as InviteToken, type JoinRequestCreateResponse, type JoinRequestListResponse, type JoinRequestOut, type MessageOut, type MessageType, NoveraChat, NoveraChatError, type ReactionEntry, Room, type RoomEvents, type RoomMemberOut, type RoomUnread, type SendParams, type SenderMini, type UnreadRoomItem, type UnreadSummary, type WsAnnouncementEvent, type WsInbound, type WsOutbound };
|