public class WcsClient extends Object
Constructor | Description |
---|---|
WcsClient(String userName,
String password,
String workspaceId) |
|
WcsClient(String userName,
String password,
String workspaceId,
WcsContextCache contextCacheImpl) |
Modifier and Type | Method | Description |
---|---|---|
com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse |
callWelcomeNodeIfNeeded(String wcsClientId) |
Do first call for welcome node.
|
void |
clearConversation(String wcsClientId) |
Clear user's conversation with Watson.
|
Boolean |
getAsBoolean(String wcsClientId,
String key) |
Get Boolean data from context
|
Double |
getAsDouble(String wcsClientId,
String key) |
Get Double data from context
|
Integer |
getAsInteger(String wcsClientId,
String key) |
Get Integer data from context
|
Map<String,Object> |
getAsMap(String wcsClientId,
String key) |
Get complex data(nested JSON) from context
|
String |
getAsString(String wcsClientId,
String key) |
Get String data from context
|
WcsClientWrapper |
getDialogManager() |
|
String |
getTextFrom(com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse messageResponse) |
Returns concat text from messageResponse
|
boolean |
isConversationStarted(String wcsClientId) |
|
void |
put(String wcsClientId,
String key,
Object value) |
Put data into context
|
com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse |
sendMessage(String wcsClientId,
String text) |
Send text to watson
|
String |
sendMessageForText(String wcsClientId,
String userInputText) |
Send text to Watson and receive it as text
|
void |
setLibLoggingEnabled(boolean enabled) |
Enable base library logging
|
void |
setResponseTextSeparator(String responseTextNewLine) |
Separator with multiple node outputs
|
void |
setWelcomeNodeResponseEnabled(boolean enabled) |
Set whether to include the response text returned by the welcome node in
the result
|
com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse |
startConversation(String wcsClientId) |
Start conversation
|
public WcsClient(String userName, String password, String workspaceId)
userName
- userName of Watson conversation workspacepassword
- password of Watson conversation workspaceworkspaceId
- public WcsClient(String userName, String password, String workspaceId, WcsContextCache contextCacheImpl)
public boolean isConversationStarted(String wcsClientId)
public com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse startConversation(String wcsClientId)
wcsClientId
- public com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse callWelcomeNodeIfNeeded(String wcsClientId)
wcsClientId
- public void clearConversation(String wcsClientId)
user
- public com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse sendMessage(String wcsClientId, String text)
wcsClientId
- text
- public void setWelcomeNodeResponseEnabled(boolean enabled)
enabled
- sendMessageForText(java.lang.String, java.lang.String)
public void setResponseTextSeparator(String responseTextNewLine)
responseTextNewLine
- sendMessageForText(java.lang.String, java.lang.String)
public String sendMessageForText(String wcsClientId, String userInputText)
High level method to get Watson's result as text. Whether or not to
include the response of the Welcome node (the first node) at the initial
access is specified by setWelcomeNodeResponseEnabled(boolean)
.
The separator of OutputText when passing through multiple nodes is
specified by setResponseTextSeparator(java.lang.String)
If you want to do more raw-level operations, use sendMessage(java.lang.String, java.lang.String)
instead of this method
wcsClientId
- userInputText
- setWelcomeNodeResponseEnabled(boolean)
,
setResponseTextSeparator(String)
,
sendMessage(String, String)
public void put(String wcsClientId, String key, Object value)
user
- key
- value
- public String getAsString(String wcsClientId, String key)
user
- key
- public Boolean getAsBoolean(String wcsClientId, String key)
user
- key
- public Integer getAsInteger(String wcsClientId, String key)
user
- key
- public Double getAsDouble(String wcsClientId, String key)
user
- key
- public Map<String,Object> getAsMap(String wcsClientId, String key)
user
- key
- public void setLibLoggingEnabled(boolean enabled)
enabled
- public WcsClientWrapper getDialogManager()
public String getTextFrom(com.ibm.watson.developer_cloud.conversation.v1.model.MessageResponse messageResponse)
messageResponse
- Copyright © 2018. All rights reserved.