I am going to update my customised sample based on Build a home assistant mobile application with Watson and IoT Platform services
In this code I get the message:
Can not convert value of type 'String' to expected argument type 'InputData?'
How to solve this problem? Inside the documentation of developer cloud/conversation/api I can find the definition of InputData, but NO sample how to realize this in Swift iOS?
// Based on API Changes
// ====================
// Incorrect argument label in call (have 'text:context:', expected 'input:context:')
// Cannot convert value of type 'String' to expected argument type 'InputData?'
let request = MessageRequest(input: text, context: self.context)
self.conversation?.message(workspaceID: Credentials.ConversationWorkspaceID,
request: request,
failure: failure) {
response in
print(response.output.text)
self.didReceiveConversationResponse(response.output.text)
self.context = response.context
// issue command based on intents and entities
// Additional Properties:
// response.context.json -> response.context.additionalProperties
print("appl_action: \(response.context.additionalProperties["appl_action"])")
self.issueCommand(intents: response.intents, entities: response.entities)
}
The
input
parameter of theMessageRequest
constructor takes anInputData
object, which is easy to construct from a text string. Try