16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_MESSAGEREQUEST_H_ 17 #define ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_MESSAGEREQUEST_H_ 24 #include <unordered_set> 34 class EditableMessageRequest;
59 std::shared_ptr<avsCommon::avs::attachment::AttachmentReader>
reader;
71 eventNamespace{eventNamespace},
72 eventName{eventName} {
92 std::function<bool(const std::shared_ptr<EditableMessageRequest>& req,
const std::string& resolveKey)>;
108 const unsigned int threshold = 0,
142 std::vector<std::pair<std::string, std::string>> headers = {},
144 const unsigned int threshold = 0,
232 void addObserver(std::shared_ptr<avsCommon::sdkInterfaces::MessageRequestObserverInterface> observer);
239 void removeObserver(std::shared_ptr<avsCommon::sdkInterfaces::MessageRequestObserverInterface> observer);
253 const std::vector<std::pair<std::string, std::string>>&
getHeaders()
const;
285 std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::MessageRequestObserverInterface>>
m_observers;
300 std::vector<std::pair<std::string, std::string>>
m_headers;
316 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_MESSAGEREQUEST_H_ A struct to hold an AttachmentReader alongside its name.
Definition: MessageRequest.h:43
int attachmentReadersCount() const
MessageRequestResolveFunction m_resolver
Resolver function to resolve current message request to a valid state. Null if message is already res...
Definition: MessageRequest.h:303
bool m_isSerialized
True if sending this message must be serialized with sending other serialized messages.
Definition: MessageRequest.h:291
EventHeaders retrieveEventHeaders() const
Definition: MessageRequest.h:40
::std::string string
Definition: gtest-port.h:1097
bool getIsSerialized() const
std::vector< std::shared_ptr< NamedReader > > m_readers
The AttachmentReaders of the Attachments data to be sent to AVS.
Definition: MessageRequest.h:297
const std::vector< std::pair< std::string, std::string > > & getHeaders() const
virtual ~MessageRequest()
void addAttachmentReader(const std::string &name, std::shared_ptr< attachment::AttachmentReader > attachmentReader)
unsigned int getStreamBytesThreshold() const
MessageRequest(const std::string &jsonContent, const std::string &uriPathExtension="", const unsigned int threshold=0, const std::string &streamMetricName="")
std::vector< std::pair< std::string, std::string > > m_headers
Optional headers to send with this request to AVS.
Definition: MessageRequest.h:300
void addObserver(std::shared_ptr< avsCommon::sdkInterfaces::MessageRequestObserverInterface > observer)
unsigned int m_streamBytesThreshold
The threshold for the number of bytes for when we should record the stream metric.
Definition: MessageRequest.h:309
std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::MessageRequestObserverInterface > > m_observers
Set of observers of MessageRequestObserverInterface.
Definition: MessageRequest.h:285
std::mutex m_observerMutex
Mutex to guard access of m_observers.
Definition: MessageRequest.h:282
std::string m_uriPathExtension
The path extension to be appended to the base URL when sending.
Definition: MessageRequest.h:294
std::string name
The name of this message part.
Definition: MessageRequest.h:56
std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > reader
The AttachmentReader contains the data of this message part.
Definition: MessageRequest.h:59
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::string getUriPathExtension() const
virtual void sendCompleted(avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status)
virtual void exceptionReceived(const std::string &exceptionMessage)
std::function< bool(const std::shared_ptr< EditableMessageRequest > &req, const std::string &resolveKey)> MessageRequestResolveFunction
Definition: MessageRequest.h:92
NamedReader(const std::string &name, std::shared_ptr< avsCommon::avs::attachment::AttachmentReader > reader)
Definition: MessageRequest.h:50
std::string getJsonContent() const
Status
Definition: MessageRequestObserverInterface.h:33
virtual void responseStatusReceived(avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status)
std::string m_streamMetricName
The name for the stream byte metric.
Definition: MessageRequest.h:306
void removeObserver(std::shared_ptr< avsCommon::sdkInterfaces::MessageRequestObserverInterface > observer)
std::shared_ptr< MessageRequest > resolveRequest(const std::string &resolveKey) const
std::string getStreamMetricName() const
std::string m_jsonContent
The JSON content to be sent to AVS.
Definition: MessageRequest.h:288
std::shared_ptr< NamedReader > getAttachmentReader(size_t index) const