From d4b9c546c0304b11f9bd952767fb742dfed73a67 Mon Sep 17 00:00:00 2001 From: Michele Riva Date: Fri, 19 Jul 2024 20:23:51 -0700 Subject: [PATCH] adds swift docs --- Sources/oramacloud-client/answer-session.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Sources/oramacloud-client/answer-session.swift b/Sources/oramacloud-client/answer-session.swift index dd0c576..208a08e 100644 --- a/Sources/oramacloud-client/answer-session.swift +++ b/Sources/oramacloud-client/answer-session.swift @@ -43,7 +43,7 @@ struct AnswerParams { let related: Related? } - struct Interaction { + struct Interaction { var interactionId: String var query: String var response: String @@ -108,6 +108,20 @@ class AnswerSession { searchEndpoint = params.oramaClient.endpoint } + public func getState() -> [AnswerParams.Interaction] { + return state + } + + public func getMessages() -> [AnswerParams.Message] { + return messages + } + + public func clearSession() -> Void { + abortController?.cancel() + state = [] + messages = [] + } + public func on(event: AnswerParams.Event, callback: @escaping AnswerParams.Events.Callback) -> AnswerSession { eventEmitter.on(event.rawValue) { data in callback(data)