Class Conversation
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.transcription.Conversation
-
- All Implemented Interfaces:
AutoCloseable
public final class Conversation extends Object implements AutoCloseable
Performs conversation management including add and remove participants. Note: close() must be called in order to release underlying resources held by the object. Added in version 1.8.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConversation(long handleValue)Protected constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Future<Participant>addParticipantAsync(Participant participant)Add a participant to a conversation using a participant object.Future<User>addParticipantAsync(User user)Add a participant to a conversation using a user object.Future<Participant>addParticipantAsync(String userId)Add a participant to a conversation using the user's id.voidclose()Dispose of associated resources.static Future<Conversation>createConversationAsync(SpeechConfig speechConfig)Initializes a new instance of Conversation.static Future<Conversation>createConversationAsync(SpeechConfig speechConfig, String conversationId)Initializes a new instance of Conversation.Future<Void>deleteConversationAsync()Delete a conversation.protected voiddispose(boolean disposing)PROTECTEDFuture<Void>endConversationAsync()End a conversation.StringgetAuthorizationToken()Gets the authorization token used to communicate with the service.StringgetConversationId()Gets the conversation Id.SafeHandlegetImpl()Returns the comversation implementation.PropertyCollectiongetProperties()The collection of properties and their values defined for this Conversation.Future<Void>lockConversationAsync()Lock a conversation.Future<Void>muteAllParticipantsAsync()Mute all other participants in the conversation.Future<Void>muteParticipantAsync(String userId)Mute a participant.Future<Void>removeParticipantAsync(Participant participant)Remove a participant from a conversation using a participant object.Future<Void>removeParticipantAsync(User user)Remove a participant from a conversation using a user object.Future<Void>removeParticipantAsync(String userId)Remove a participant from a conversation using a user id.voidsetAuthorizationToken(String token)Sets the authorization token used to communicate with the service.Future<Void>startConversationAsync()Start a conversation.Future<Void>unlockConversationAsync()Unlocks a conversation.Future<Void>unmuteAllParticipantsAsync()Unmute all other participants in the conversation.Future<Void>unmuteParticipantAsync(String userId)Unmute a participant.
-
-
-
Method Detail
-
createConversationAsync
public static Future<Conversation> createConversationAsync(SpeechConfig speechConfig)
Initializes a new instance of Conversation.- Parameters:
speechConfig- speech configuration.- Returns:
- A task representing the asynchronous operation that creates a conversation.
-
createConversationAsync
public static Future<Conversation> createConversationAsync(SpeechConfig speechConfig, String conversationId)
Initializes a new instance of Conversation.- Parameters:
speechConfig- speech configuration.conversationId- a unqiue identification of your conversation.- Returns:
- A task representing the asynchronous operation that creates a conversation.
-
close
public void close()
Dispose of associated resources. Note: close() must be called in order to release underlying resources held by the object.- Specified by:
closein interfaceAutoCloseable
-
getConversationId
public String getConversationId()
Gets the conversation Id.- Returns:
- the conversation Id.
-
setAuthorizationToken
public void setAuthorizationToken(String token)
Sets the authorization token used to communicate with the service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the recognizer will encounter errors during recognition.- Parameters:
token- Authorization token.
-
getAuthorizationToken
public String getAuthorizationToken()
Gets the authorization token used to communicate with the service.- Returns:
- Authorization token.
-
getProperties
public PropertyCollection getProperties()
The collection of properties and their values defined for this Conversation.- Returns:
- The collection of properties and their values defined for this Conversation.
-
addParticipantAsync
public Future<Participant> addParticipantAsync(Participant participant)
Add a participant to a conversation using a participant object.- Parameters:
participant- A participant object.- Returns:
- A task representing the asynchronous operation of adding a participant.
-
addParticipantAsync
public Future<Participant> addParticipantAsync(String userId)
Add a participant to a conversation using the user's id.- Parameters:
userId- The user id.- Returns:
- A task representing the asynchronous operation of adding a participant.
-
addParticipantAsync
public Future<User> addParticipantAsync(User user)
Add a participant to a conversation using a user object.- Parameters:
user- A user object.- Returns:
- A task representing the asynchronous operation of adding a participant.
-
removeParticipantAsync
public Future<Void> removeParticipantAsync(User user)
Remove a participant from a conversation using a user object.- Parameters:
user- A user object.- Returns:
- Am empty task representing the asynchronous operation of removing a participant.
-
removeParticipantAsync
public Future<Void> removeParticipantAsync(Participant participant)
Remove a participant from a conversation using a participant object.- Parameters:
participant- A participant object.- Returns:
- Am empty task representing the asynchronous operation of removing a participant.
-
removeParticipantAsync
public Future<Void> removeParticipantAsync(String userId)
Remove a participant from a conversation using a user id.- Parameters:
userId- A user id.- Returns:
- Am empty task representing the asynchronous operation of removing a participant.
-
endConversationAsync
public Future<Void> endConversationAsync()
End a conversation.- Returns:
- An empty task representing the asynchronous operation that ending a conversation.
-
startConversationAsync
public Future<Void> startConversationAsync()
Start a conversation.- Returns:
- An asynchronous operation representing starting a conversation.
-
deleteConversationAsync
public Future<Void> deleteConversationAsync()
Delete a conversation. After this no one will be able to join the conversation.- Returns:
- An asynchronous operation representing deleting a conversation.
-
lockConversationAsync
public Future<Void> lockConversationAsync()
Lock a conversation. This will prevent new participants from joining.- Returns:
- An asynchronous operation representing locking a conversation.
-
unlockConversationAsync
public Future<Void> unlockConversationAsync()
Unlocks a conversation.- Returns:
- An asynchronous operation representing unlocking a conversation.
-
muteAllParticipantsAsync
public Future<Void> muteAllParticipantsAsync()
Mute all other participants in the conversation. After this no other participants will have their speech recognitions broadcast, nor be able to send text messages.- Returns:
- An asynchronous operation representing muting all participants.
-
unmuteAllParticipantsAsync
public Future<Void> unmuteAllParticipantsAsync()
Unmute all other participants in the conversation.- Returns:
- An asynchronous operation representing un-muting all participants.
-
muteParticipantAsync
public Future<Void> muteParticipantAsync(String userId)
Mute a participant.- Parameters:
userId- A user identifier.- Returns:
- An asynchronous operation representing muting a particular participant.
-
unmuteParticipantAsync
public Future<Void> unmuteParticipantAsync(String userId)
Unmute a participant.- Parameters:
userId- A user identifier.- Returns:
- An asynchronous operation representing un-muting a particular participant.
-
getImpl
public SafeHandle getImpl()
Returns the comversation implementation.- Returns:
- The implementation of the conversation.
-
dispose
protected void dispose(boolean disposing)
PROTECTED- Parameters:
disposing- PROTECTED
-
-