Partilhar via


StatefulChatClient interface

Define os métodos que permitem que {@Link @azure/communication-chat#ChatClient} seja usado com um estado gerado centralizado.

A interface fornece acesso ao estado proxy e também permite registrar um manipulador para eventos de alteração de estado.

Extends

Métodos

dispose()

Limpa o cache de recursos do cliente de thread de chat.

downloadResourceToCache(string, string, string)

Baixa um recurso para uma mensagem específica e armazena-o em cache.

getState()

Mantém todo o estado que poderíamos fazer proxy de ChatClient {@Link @azure/communication-chat#ChatClient} como ChatClientState {@Link ChatClientState}.

offStateChange((state: ChatClientState) => void)

Permite cancelar o registro para eventos 'stateChanged'.

onStateChange((state: ChatClientState) => void)

Permite que um manipulador seja registrado para eventos 'stateChanged'.

removeResourceFromCache(string, string, string)

Remove um recurso do cache de uma mensagem específica.

Métodos Herdados

createChatThread(CreateChatThreadRequest, CreateChatThreadOptions)

Cria um thread de chat. Retorna o cliente de thread com a id do thread criado.

deleteChatThread(string, OperationOptions)

Exclui um tópico de bate-papo.

getChatThreadClient(string)

Retorna ChatThreadClient com a ID de thread específica.

listChatThreads(ChatListChatThreadsOptionalParams)

Obtém a lista de tópicos de bate-papo de um usuário.

off("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)

Cancele a inscrição no chatMessageDeleted.

off("chatMessageEdited", (e: ChatMessageEditedEvent) => void)

Cancelar inscrição no chatMessageEdited.

off("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)

Cancele a inscrição no chatMessageReceived.

off("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)

Cancele a assinatura do chatThreadCreated.

off("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)

Cancele a assinatura do chatThreadDeleted.

off("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)

Cancele a assinatura de chatThreadPropertiesUpdated.

off("participantsAdded", (e: ParticipantsAddedEvent) => void)

Cancelar inscrição de participantesAdicionado.

off("participantsRemoved", (e: ParticipantsRemovedEvent) => void)

Cancelar inscrição de participantesRemovido.

off("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)

Cancele a assinatura de readReceiptReceived.

off("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)

Cancelar inscrição de digitaçãoIndicatorReceived.

on("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)

Função de assinatura para chatMessageDeleted. O remetente inicial também receberá este evento.

on("chatMessageEdited", (e: ChatMessageEditedEvent) => void)

Função de assinatura para chatMessageEdited. O remetente inicial também receberá este evento.

on("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)

Função de assinatura para chatMessageReceived. O remetente inicial também receberá este evento. Você precisa chamar startRealtimeNotifications antes de se inscrever em qualquer evento.

on("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)

Função de assinatura para chatThreadCreated.

on("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)

Função de assinatura para chatThreadDeleted.

on("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)

Função de assinatura para chatThreadPropertiesUpdated.

on("participantsAdded", (e: ParticipantsAddedEvent) => void)

Função de inscrição para participantesAdicionado.

on("participantsRemoved", (e: ParticipantsRemovedEvent) => void)

Função de inscrição para participantesRemovido.

on("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)

Função Subscribe para readReceiptReceived.

on("realTimeNotificationConnected", () => void)

Função de assinatura para realTimeNotificationConnected.

on("realTimeNotificationDisconnected", () => void)

Função de assinatura para realTimeNotificationDisconnected.

on("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)

Função Subscribe para digitarIndicatorReceived. O remetente inicial também receberá este evento.

startRealtimeNotifications()

Comece a receber notificações em tempo real. Chame esta função antes de subscrever qualquer evento.

stopRealtimeNotifications()

Pare de receber notificações em tempo real. Esta função cancelaria a subscrição de todos os eventos.

Detalhes de Método

dispose()

Limpa o cache de recursos do cliente de thread de chat.

function dispose()

downloadResourceToCache(string, string, string)

Baixa um recurso para uma mensagem específica e armazena-o em cache.

function downloadResourceToCache(threadId: string, messageId: string, resourceUrl: string)

Parâmetros

threadId

string

O ID do thread do thread de chat.

messageId

string

O ID da mensagem de chat.

resourceUrl

string

A url do recurso para buscar e armazenar em cache.

getState()

Mantém todo o estado que poderíamos fazer proxy de ChatClient {@Link @azure/communication-chat#ChatClient} como ChatClientState {@Link ChatClientState}.

function getState(): ChatClientState

Devoluções

offStateChange((state: ChatClientState) => void)

Permite cancelar o registro para eventos 'stateChanged'.

function offStateChange(handler: (state: ChatClientState) => void)

Parâmetros

handler

(state: ChatClientState) => void

Retorno de chamada original a ser cancelado.

onStateChange((state: ChatClientState) => void)

Permite que um manipulador seja registrado para eventos 'stateChanged'.

function onStateChange(handler: (state: ChatClientState) => void)

Parâmetros

handler

(state: ChatClientState) => void

Retorno de chamada para receber o estado.

removeResourceFromCache(string, string, string)

Remove um recurso do cache de uma mensagem específica.

function removeResourceFromCache(threadId: string, messageId: string, resourceUrl: string)

Parâmetros

threadId

string

O ID do thread do thread de chat.

messageId

string

O ID da mensagem de chat.

resourceUrl

string

A url do recurso a ser removida do cache.

Detalhes do Método Herdado

createChatThread(CreateChatThreadRequest, CreateChatThreadOptions)

Cria um thread de chat. Retorna o cliente de thread com a id do thread criado.

function createChatThread(request: CreateChatThreadRequest, options?: CreateChatThreadOptions): Promise<CreateChatThreadResult>

Parâmetros

request
CreateChatThreadRequest

Solicitação para criar um tópico de bate-papo.

options
CreateChatThreadOptions

Opções de operação.

Devoluções

herdado de ChatClient.createChatThread

deleteChatThread(string, OperationOptions)

Exclui um tópico de bate-papo.

function deleteChatThread(threadId: string, options?: OperationOptions): Promise<void>

Parâmetros

threadId

string

A ID do thread a ser excluído.

options
OperationOptions

Opções de operação.

Devoluções

Promise<void>

herdado de ChatClient.deleteChatThread

getChatThreadClient(string)

Retorna ChatThreadClient com a ID de thread específica.

function getChatThreadClient(threadId: string): ChatThreadClient

Parâmetros

threadId

string

ID de thread para o ChatThreadClient

Devoluções

herdado de ChatClient.getChatThreadClient

listChatThreads(ChatListChatThreadsOptionalParams)

Obtém a lista de tópicos de bate-papo de um usuário.

function listChatThreads(options?: ChatListChatThreadsOptionalParams): PagedAsyncIterableIterator<ChatThreadItem, ChatThreadItem[], PageSettings>

Parâmetros

options
@azure/communication-chat.ChatListChatThreadsOptionalParams

Listar opções de tópicos de bate-papo.

Devoluções

herdado de ChatClient.listChatThreads

off("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)

Cancele a inscrição no chatMessageDeleted.

function off(event: "chatMessageDeleted", listener: (e: ChatMessageDeletedEvent) => void)

Parâmetros

event

"chatMessageDeleted"

O ChatMessageDeletedEvent.

listener

(e: ChatMessageDeletedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("chatMessageEdited", (e: ChatMessageEditedEvent) => void)

Cancelar inscrição no chatMessageEdited.

function off(event: "chatMessageEdited", listener: (e: ChatMessageEditedEvent) => void)

Parâmetros

event

"chatMessageEdited"

O ChatMessageEditedEvent.

listener

(e: ChatMessageEditedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)

Cancele a inscrição no chatMessageReceived.

function off(event: "chatMessageReceived", listener: (e: ChatMessageReceivedEvent) => void)

Parâmetros

event

"chatMessageReceived"

O ChatMessageReceivedEvent.

listener

(e: ChatMessageReceivedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)

Cancele a assinatura do chatThreadCreated.

function off(event: "chatThreadCreated", listener: (e: ChatThreadCreatedEvent) => void)

Parâmetros

event

"chatThreadCreated"

O ChatThreadCreatedEvent.

listener

(e: ChatThreadCreatedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)

Cancele a assinatura do chatThreadDeleted.

function off(event: "chatThreadDeleted", listener: (e: ChatThreadDeletedEvent) => void)

Parâmetros

event

"chatThreadDeleted"

O ChatThreadDeletedEvent.

listener

(e: ChatThreadDeletedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)

Cancele a assinatura de chatThreadPropertiesUpdated.

function off(event: "chatThreadPropertiesUpdated", listener: (e: ChatThreadPropertiesUpdatedEvent) => void)

Parâmetros

event

"chatThreadPropertiesUpdated"

O ChatThreadPropertiesUpdatedEvent.

listener

(e: ChatThreadPropertiesUpdatedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("participantsAdded", (e: ParticipantsAddedEvent) => void)

Cancelar inscrição de participantesAdicionado.

function off(event: "participantsAdded", listener: (e: ParticipantsAddedEvent) => void)

Parâmetros

event

"participantsAdded"

O ParticipantsAddedEvent.

listener

(e: ParticipantsAddedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("participantsRemoved", (e: ParticipantsRemovedEvent) => void)

Cancelar inscrição de participantesRemovido.

function off(event: "participantsRemoved", listener: (e: ParticipantsRemovedEvent) => void)

Parâmetros

event

"participantsRemoved"

O ParticipantsRemovedEvent.

listener

(e: ParticipantsRemovedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)

Cancele a assinatura de readReceiptReceived.

function off(event: "readReceiptReceived", listener: (e: ReadReceiptReceivedEvent) => void)

Parâmetros

event

"readReceiptReceived"

O ReadReceiptReceivedEvent.

listener

(e: ReadReceiptReceivedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

off("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)

Cancelar inscrição de digitaçãoIndicatorReceived.

function off(event: "typingIndicatorReceived", listener: (e: TypingIndicatorReceivedEvent) => void)

Parâmetros

event

"typingIndicatorReceived"

O TypingIndicatorReceivedEvent.

listener

(e: TypingIndicatorReceivedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.off

on("chatMessageDeleted", (e: ChatMessageDeletedEvent) => void)

Função de assinatura para chatMessageDeleted. O remetente inicial também receberá este evento.

function on(event: "chatMessageDeleted", listener: (e: ChatMessageDeletedEvent) => void)

Parâmetros

event

"chatMessageDeleted"

O ChatMessageDeletedEvent.

listener

(e: ChatMessageDeletedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("chatMessageEdited", (e: ChatMessageEditedEvent) => void)

Função de assinatura para chatMessageEdited. O remetente inicial também receberá este evento.

function on(event: "chatMessageEdited", listener: (e: ChatMessageEditedEvent) => void)

Parâmetros

event

"chatMessageEdited"

O ChatMessageEditedEvent.

listener

(e: ChatMessageEditedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("chatMessageReceived", (e: ChatMessageReceivedEvent) => void)

Função de assinatura para chatMessageReceived. O remetente inicial também receberá este evento. Você precisa chamar startRealtimeNotifications antes de se inscrever em qualquer evento.

function on(event: "chatMessageReceived", listener: (e: ChatMessageReceivedEvent) => void)

Parâmetros

event

"chatMessageReceived"

O ChatMessageReceivedEvent.

listener

(e: ChatMessageReceivedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("chatThreadCreated", (e: ChatThreadCreatedEvent) => void)

Função de assinatura para chatThreadCreated.

function on(event: "chatThreadCreated", listener: (e: ChatThreadCreatedEvent) => void)

Parâmetros

event

"chatThreadCreated"

O ChatThreadCreatedEvent.

listener

(e: ChatThreadCreatedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("chatThreadDeleted", (e: ChatThreadDeletedEvent) => void)

Função de assinatura para chatThreadDeleted.

function on(event: "chatThreadDeleted", listener: (e: ChatThreadDeletedEvent) => void)

Parâmetros

event

"chatThreadDeleted"

O ChatThreadDeletedEvent.

listener

(e: ChatThreadDeletedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("chatThreadPropertiesUpdated", (e: ChatThreadPropertiesUpdatedEvent) => void)

Função de assinatura para chatThreadPropertiesUpdated.

function on(event: "chatThreadPropertiesUpdated", listener: (e: ChatThreadPropertiesUpdatedEvent) => void)

Parâmetros

event

"chatThreadPropertiesUpdated"

O ChatThreadPropertiesUpdatedEvent.

listener

(e: ChatThreadPropertiesUpdatedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("participantsAdded", (e: ParticipantsAddedEvent) => void)

Função de inscrição para participantesAdicionado.

function on(event: "participantsAdded", listener: (e: ParticipantsAddedEvent) => void)

Parâmetros

event

"participantsAdded"

O ParticipantsAddedEvent.

listener

(e: ParticipantsAddedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("participantsRemoved", (e: ParticipantsRemovedEvent) => void)

Função de inscrição para participantesRemovido.

function on(event: "participantsRemoved", listener: (e: ParticipantsRemovedEvent) => void)

Parâmetros

event

"participantsRemoved"

O ParticipantsRemovedEvent.

listener

(e: ParticipantsRemovedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("readReceiptReceived", (e: ReadReceiptReceivedEvent) => void)

Função Subscribe para readReceiptReceived.

function on(event: "readReceiptReceived", listener: (e: ReadReceiptReceivedEvent) => void)

Parâmetros

event

"readReceiptReceived"

O ReadReceiptReceivedEvent.

listener

(e: ReadReceiptReceivedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("realTimeNotificationConnected", () => void)

Função de assinatura para realTimeNotificationConnected.

function on(event: "realTimeNotificationConnected", listener: () => void)

Parâmetros

event

"realTimeNotificationConnected"

O evento realTimeNotificationConnected

listener

() => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("realTimeNotificationDisconnected", () => void)

Função de assinatura para realTimeNotificationDisconnected.

function on(event: "realTimeNotificationDisconnected", listener: () => void)

Parâmetros

event

"realTimeNotificationDisconnected"

O evento realTimeNotificationDisconnected

listener

() => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

on("typingIndicatorReceived", (e: TypingIndicatorReceivedEvent) => void)

Função Subscribe para digitarIndicatorReceived. O remetente inicial também receberá este evento.

function on(event: "typingIndicatorReceived", listener: (e: TypingIndicatorReceivedEvent) => void)

Parâmetros

event

"typingIndicatorReceived"

O TypingIndicatorReceivedEvent.

listener

(e: TypingIndicatorReceivedEvent) => void

O ouvinte para lidar com o evento.

herdado de ChatClient.on

startRealtimeNotifications()

Comece a receber notificações em tempo real. Chame esta função antes de subscrever qualquer evento.

function startRealtimeNotifications(): Promise<void>

Devoluções

Promise<void>

herdado de ChatClient.startRealtimeNotifications

stopRealtimeNotifications()

Pare de receber notificações em tempo real. Esta função cancelaria a subscrição de todos os eventos.

function stopRealtimeNotifications(): Promise<void>

Devoluções

Promise<void>

herdado de ChatClient.stopRealtimeNotifications