AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
StartConversationHandler.h
1
6#pragma once
7#include <aws/core/utils/HashingUtils.h>
8#include <aws/core/utils/event/EventStreamHandler.h>
9#include <aws/core/client/AWSError.h>
10#include <aws/lexv2-runtime/LexRuntimeV2_EXPORTS.h>
11#include <aws/lexv2-runtime/LexRuntimeV2Errors.h>
12
13#include <aws/lexv2-runtime/model/StartConversationInitialResponse.h>
14#include <aws/lexv2-runtime/model/PlaybackInterruptionEvent.h>
15#include <aws/lexv2-runtime/model/TranscriptEvent.h>
16#include <aws/lexv2-runtime/model/IntentResultEvent.h>
17#include <aws/lexv2-runtime/model/TextResponseEvent.h>
18#include <aws/lexv2-runtime/model/AudioResponseEvent.h>
19#include <aws/lexv2-runtime/model/HeartbeatEvent.h>
20
21namespace Aws
22{
23namespace LexRuntimeV2
24{
25namespace Model
26{
28 {
37 };
38
40 {
41 typedef std::function<void(const StartConversationInitialResponse&)> StartConversationInitialResponseCallback;
42 typedef std::function<void(const StartConversationInitialResponse&, const Utils::Event::InitialResponseType)> StartConversationInitialResponseCallbackEx;
43 typedef std::function<void(const PlaybackInterruptionEvent&)> PlaybackInterruptionEventCallback;
44 typedef std::function<void(const TranscriptEvent&)> TranscriptEventCallback;
45 typedef std::function<void(const IntentResultEvent&)> IntentResultEventCallback;
46 typedef std::function<void(const TextResponseEvent&)> TextResponseEventCallback;
47 typedef std::function<void(const AudioResponseEvent&)> AudioResponseEventCallback;
48 typedef std::function<void(const HeartbeatEvent&)> HeartbeatEventCallback;
49 typedef std::function<void(const Aws::Client::AWSError<LexRuntimeV2Errors>& error)> ErrorCallback;
50
51 public:
52 AWS_LEXRUNTIMEV2_API StartConversationHandler();
53 AWS_LEXRUNTIMEV2_API StartConversationHandler& operator=(const StartConversationHandler&) = default;
54
55 AWS_LEXRUNTIMEV2_API virtual void OnEvent() override;
56
58
64 inline void SetInitialResponseCallbackEx(const StartConversationInitialResponseCallbackEx& callback) { m_onInitialResponse = callback; }
68 inline void SetInitialResponseCallback(const StartConversationInitialResponseCallback& noArgCallback)
69 {
70 m_onInitialResponse = [noArgCallback](const StartConversationInitialResponse& rs, const Utils::Event::InitialResponseType) { return noArgCallback(rs); };
71 }
73 inline void SetPlaybackInterruptionEventCallback(const PlaybackInterruptionEventCallback& callback) { m_onPlaybackInterruptionEvent = callback; }
74 inline void SetTranscriptEventCallback(const TranscriptEventCallback& callback) { m_onTranscriptEvent = callback; }
75 inline void SetIntentResultEventCallback(const IntentResultEventCallback& callback) { m_onIntentResultEvent = callback; }
76 inline void SetTextResponseEventCallback(const TextResponseEventCallback& callback) { m_onTextResponseEvent = callback; }
77 inline void SetAudioResponseEventCallback(const AudioResponseEventCallback& callback) { m_onAudioResponseEvent = callback; }
78 inline void SetHeartbeatEventCallback(const HeartbeatEventCallback& callback) { m_onHeartbeatEvent = callback; }
79 inline void SetOnErrorCallback(const ErrorCallback& callback) { m_onError = callback; }
80
81 inline StartConversationInitialResponseCallbackEx& GetInitialResponseCallbackEx() { return m_onInitialResponse; }
82
83 private:
84 AWS_LEXRUNTIMEV2_API void HandleEventInMessage();
85 AWS_LEXRUNTIMEV2_API void HandleErrorInMessage();
86 AWS_LEXRUNTIMEV2_API void MarshallError(const Aws::String& errorCode, const Aws::String& errorMessage);
87
88 StartConversationInitialResponseCallbackEx m_onInitialResponse;
89 PlaybackInterruptionEventCallback m_onPlaybackInterruptionEvent;
90 TranscriptEventCallback m_onTranscriptEvent;
91 IntentResultEventCallback m_onIntentResultEvent;
92 TextResponseEventCallback m_onTextResponseEvent;
93 AudioResponseEventCallback m_onAudioResponseEvent;
94 HeartbeatEventCallback m_onHeartbeatEvent;
95 ErrorCallback m_onError;
96 };
97
98namespace StartConversationEventMapper
99{
101
103} // namespace StartConversationEventMapper
104} // namespace Model
105} // namespace LexRuntimeV2
106} // namespace Aws
AWS_LEXRUNTIMEV2_API StartConversationHandler & operator=(const StartConversationHandler &)=default
StartConversationInitialResponseCallbackEx & GetInitialResponseCallbackEx()
void SetPlaybackInterruptionEventCallback(const PlaybackInterruptionEventCallback &callback)
void SetAudioResponseEventCallback(const AudioResponseEventCallback &callback)
void SetHeartbeatEventCallback(const HeartbeatEventCallback &callback)
void SetTranscriptEventCallback(const TranscriptEventCallback &callback)
void SetInitialResponseCallback(const StartConversationInitialResponseCallback &noArgCallback)
void SetIntentResultEventCallback(const IntentResultEventCallback &callback)
void SetInitialResponseCallbackEx(const StartConversationInitialResponseCallbackEx &callback)
void SetTextResponseEventCallback(const TextResponseEventCallback &callback)
virtual AWS_LEXRUNTIMEV2_API void OnEvent() override
AWS_LEXRUNTIMEV2_API StartConversationEventType GetStartConversationEventTypeForName(const Aws::String &name)
AWS_LEXRUNTIMEV2_API Aws::String GetNameForStartConversationEventType(StartConversationEventType value)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String