AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
InvokeFlowHandler.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/bedrock-agent-runtime/BedrockAgentRuntime_EXPORTS.h>
11#include <aws/bedrock-agent-runtime/BedrockAgentRuntimeErrors.h>
12
13#include <aws/bedrock-agent-runtime/model/InvokeFlowInitialResponse.h>
14#include <aws/bedrock-agent-runtime/model/FlowCompletionEvent.h>
15#include <aws/bedrock-agent-runtime/model/FlowOutputEvent.h>
16
17namespace Aws
18{
19namespace BedrockAgentRuntime
20{
21namespace Model
22{
24 {
29 };
30
32 {
33 typedef std::function<void(const InvokeFlowInitialResponse&)> InvokeFlowInitialResponseCallback;
34 typedef std::function<void(const InvokeFlowInitialResponse&, const Utils::Event::InitialResponseType)> InvokeFlowInitialResponseCallbackEx;
35 typedef std::function<void(const FlowCompletionEvent&)> FlowCompletionEventCallback;
36 typedef std::function<void(const FlowOutputEvent&)> FlowOutputEventCallback;
37 typedef std::function<void(const Aws::Client::AWSError<BedrockAgentRuntimeErrors>& error)> ErrorCallback;
38
39 public:
40 AWS_BEDROCKAGENTRUNTIME_API InvokeFlowHandler();
41 AWS_BEDROCKAGENTRUNTIME_API InvokeFlowHandler& operator=(const InvokeFlowHandler&) = default;
42
43 AWS_BEDROCKAGENTRUNTIME_API virtual void OnEvent() override;
44
46
52 inline void SetInitialResponseCallbackEx(const InvokeFlowInitialResponseCallbackEx& callback) { m_onInitialResponse = callback; }
56 inline void SetInitialResponseCallback(const InvokeFlowInitialResponseCallback& noArgCallback)
57 {
58 m_onInitialResponse = [noArgCallback](const InvokeFlowInitialResponse& rs, const Utils::Event::InitialResponseType) { return noArgCallback(rs); };
59 }
61 inline void SetFlowCompletionEventCallback(const FlowCompletionEventCallback& callback) { m_onFlowCompletionEvent = callback; }
62 inline void SetFlowOutputEventCallback(const FlowOutputEventCallback& callback) { m_onFlowOutputEvent = callback; }
63 inline void SetOnErrorCallback(const ErrorCallback& callback) { m_onError = callback; }
64
65 inline InvokeFlowInitialResponseCallbackEx& GetInitialResponseCallbackEx() { return m_onInitialResponse; }
66
67 private:
68 AWS_BEDROCKAGENTRUNTIME_API void HandleEventInMessage();
69 AWS_BEDROCKAGENTRUNTIME_API void HandleErrorInMessage();
70 AWS_BEDROCKAGENTRUNTIME_API void MarshallError(const Aws::String& errorCode, const Aws::String& errorMessage);
71
72 InvokeFlowInitialResponseCallbackEx m_onInitialResponse;
73 FlowCompletionEventCallback m_onFlowCompletionEvent;
74 FlowOutputEventCallback m_onFlowOutputEvent;
75 ErrorCallback m_onError;
76 };
77
78namespace InvokeFlowEventMapper
79{
80 AWS_BEDROCKAGENTRUNTIME_API InvokeFlowEventType GetInvokeFlowEventTypeForName(const Aws::String& name);
81
83} // namespace InvokeFlowEventMapper
84} // namespace Model
85} // namespace BedrockAgentRuntime
86} // namespace Aws
virtual AWS_BEDROCKAGENTRUNTIME_API void OnEvent() override
AWS_BEDROCKAGENTRUNTIME_API InvokeFlowHandler & operator=(const InvokeFlowHandler &)=default
AWS_BEDROCKAGENTRUNTIME_API InvokeFlowHandler()
void SetFlowOutputEventCallback(const FlowOutputEventCallback &callback)
InvokeFlowInitialResponseCallbackEx & GetInitialResponseCallbackEx()
void SetOnErrorCallback(const ErrorCallback &callback)
void SetFlowCompletionEventCallback(const FlowCompletionEventCallback &callback)
void SetInitialResponseCallbackEx(const InvokeFlowInitialResponseCallbackEx &callback)
void SetInitialResponseCallback(const InvokeFlowInitialResponseCallback &noArgCallback)
AWS_BEDROCKAGENTRUNTIME_API InvokeFlowEventType GetInvokeFlowEventTypeForName(const Aws::String &name)
AWS_BEDROCKAGENTRUNTIME_API Aws::String GetNameForInvokeFlowEventType(InvokeFlowEventType value)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String