From f68d1a50a42b3b1c19d4b3a7a5cdd6be62feec74 Mon Sep 17 00:00:00 2001 From: jayce1116 Date: Wed, 3 Jan 2024 13:51:01 +0900 Subject: [PATCH] =?UTF-8?q?NuguClient=20=EB=82=B4=20requestTextInput=20ove?= =?UTF-8?q?rloading=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NuguClientKit/Sources/Client/NuguClient.swift | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/NuguClientKit/Sources/Client/NuguClient.swift b/NuguClientKit/Sources/Client/NuguClient.swift index b746e471..e2ad6385 100644 --- a/NuguClientKit/Sources/Client/NuguClient.swift +++ b/NuguClientKit/Sources/Client/NuguClient.swift @@ -510,6 +510,35 @@ public extension NuguClient { service: [String: AnyHashable]? = nil, completion: ((StreamDataState) -> Void)? = nil ) -> String { + requestTextInput( + text: text, + token: token, + playServiceId: playServiceId, + source: source, + service: service, + completion: completion + ).dialogRequestId + } + + /// Send event that needs a text-based recognition + /// + /// This function cancel speech recognition.(e.g. `ASRAgentProtocol.startRecognition(:initiator)`) + /// Use `NuguClient.textAgent.requestTextInput` directly to request independent of speech recognition. + /// + /// - Parameters: + /// - text: The `text` to be recognized + /// - token: token + /// - requestType: `TextAgentRequestType` + /// - completion: The completion handler to call when the request is complete + /// - Returns: The eventIdentifier for request. + @discardableResult func requestTextInput( + text: String, + token: String? = nil, + playServiceId: String? = nil, + source: TextInputSource? = nil, + service: [String: AnyHashable]? = nil, + completion: ((StreamDataState) -> Void)? = nil + ) -> EventIdentifier { dialogStateAggregator.isChipsRequestInProgress = true return textAgent.requestTextInput(