AWS SDK for C++

AWS SDK for C++ Version 1.11.763

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