people-arrowsConversations

The Conversations class manages conversations for a Cryptalk client.

Class: Conversations

Constructor

  • constructor(client: Client): Initializes a new conversations instance.

Instance Methods

  • async sync(): Promise<void>: Synchronizes conversations for the current client from the network.

  • async syncAll(consentStates?: ConsentState[]): Promise<void>: Synchronizes all conversations and messages from the network with optional consent state filtering, then uploads conversation and message history to the history sync server.

  • async getConversationById(id: string): Promise<Group | Dm | undefined>: Retrieves a conversation by its ID.

  • async getMessageById<T = unknown>(id: string): Promise<DecodedMessage<T> | undefined>: Retrieves a message by its ID.

  • async getDmByInboxId(inboxId: string): Promise<Dm | undefined>: Retrieves a DM by Inbox ID.

  • async list(options?: SafeListConversationsOptions): Promise<Array<Group | Dm>>: Retrieves all conversations.

  • async listGroups(options?: Omit<SafeListConversationsOptions, 'conversation_type'>): Promise<Group[]>: Retrieves all group conversations.

  • async listDms(options?: Omit<SafeListConversationsOptions, 'conversation_type'>): Promise<Dm[]>: Retrieves all DM conversations.

  • async newGroupOptimistic(options?: SafeCreateGroupOptions): Promise<Group>: Creates a new group without syncing to the network.

  • async newGroupWithIdentifiers(identifiers: Identifier[], options?: SafeCreateGroupOptions): Promise<Group>: Creates a new group conversation with the specified identifiers.

  • async newGroup(inboxIds: string[], options?: SafeCreateGroupOptions): Promise<Group>: Creates a new group conversation with the specified inbox IDs.

  • async newDmWithIdentifier(identifier: Identifier, options?: SafeCreateDmOptions): Promise<Dm>: Creates a new DM conversation with the specified identifier.

  • async newDm(inboxId: string, options?: SafeCreateDmOptions): Promise<Dm>: Creates a new DM conversation with the specified inbox ID.

  • async getHmacKeys(): Promise<SafeHmacKeys>: Retrieves HMAC keys for all conversations.

  • async stream<T extends Group | Dm = Group | Dm>(callback?: StreamCallback<T>, conversationType?: ConversationType): Promise<AsyncStream<T>>: Creates a stream for new conversations.

  • async streamGroups(callback?: StreamCallback<Group>): Promise<AsyncStream<Group>>: Creates a stream for new group conversations.

  • async streamDms(callback?: StreamCallback<Dm>): Promise<AsyncStream<Dm>>: Creates a stream for new DM conversations.

  • async streamAllMessages(callback?: StreamCallback<DecodedMessage>, conversationType?: ConversationType, consentStates?: ConsentState[]): Promise<AsyncStream<DecodedMessage>>: Creates a stream for all new messages.

  • async streamAllGroupMessages(callback?: StreamCallback<DecodedMessage>, consentStates?: ConsentState[]): Promise<AsyncStream<DecodedMessage>>: Creates a stream for all new group messages.

  • async streamAllDmMessages(callback?: StreamCallback<DecodedMessage>, consentStates?: ConsentState[]): Promise<AsyncStream<DecodedMessage>>: Creates a stream for all new DM messages.

Last updated