AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::acl::MimeResponseSink Class Reference

#include <MimeResponseSink.h>

Inheritance diagram for alexaClientSDK::acl::MimeResponseSink:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acl::MimeResponseSink:
Collaboration graph
[legend]

Public Member Functions

 MimeResponseSink (std::shared_ptr< MimeResponseStatusHandlerInterface > handler, std::shared_ptr< MessageConsumerInterface > messageConsumer, std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface > attachmentManager, std::string attachmentContextId)
 
virtual ~MimeResponseSink ()=default
 
HTTP2MimeResponseSinkInterface methods
bool onReceiveResponseCode (long responseCode) override
 
bool onReceiveHeaderLine (const std::string &line) override
 
bool onBeginMimePart (const std::multimap< std::string, std::string > &headers) override
 
avsCommon::utils::http2::HTTP2ReceiveDataStatus onReceiveMimeData (const char *bytes, size_t size) override
 
bool onEndMimePart () override
 
avsCommon::utils::http2::HTTP2ReceiveDataStatus onReceiveNonMimeData (const char *bytes, size_t size) override
 
void onResponseFinished (avsCommon::utils::http2::HTTP2ResponseFinishedStatus status) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface
virtual ~HTTP2MimeResponseSinkInterface ()=default
 

Detailed Description

Handle Mime encoded responses from AVS.

This includes forwarding json payloads to an MessageConsumer, attachments to attachment writers, and capturing exceptions for non 2xx results.

Constructor & Destructor Documentation

◆ MimeResponseSink()

alexaClientSDK::acl::MimeResponseSink::MimeResponseSink ( std::shared_ptr< MimeResponseStatusHandlerInterface handler,
std::shared_ptr< MessageConsumerInterface messageConsumer,
std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface attachmentManager,
std::string  attachmentContextId 
)

Constructor.

Parameters
handlerThe object to forward status and result notifications to.
messageConsumerObject to send decoded messages to.
attachmentManagerObject with which to get attachments to write to.
attachmentContextIdId added to content IDs to assure global uniqueness.

◆ ~MimeResponseSink()

virtual alexaClientSDK::acl::MimeResponseSink::~MimeResponseSink ( )
virtualdefault

Destructor.

Member Function Documentation

◆ onBeginMimePart()

bool alexaClientSDK::acl::MimeResponseSink::onBeginMimePart ( const std::multimap< std::string, std::string > &  headers)
overridevirtual

Notification of the start of a new mime part.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
headersA multimap from header names to header values.
Returns
Whether receipt of the response should continue.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface.

◆ onEndMimePart()

bool alexaClientSDK::acl::MimeResponseSink::onEndMimePart ( )
overridevirtual

Notification of the end of the current mime part.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Returns
Whether receipt of the response should continue.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface.

◆ onReceiveHeaderLine()

bool alexaClientSDK::acl::MimeResponseSink::onReceiveHeaderLine ( const std::string &  line)
overridevirtual

Notification that an HTTP header line was received.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
lineThe HTTP response header line that was received.
Returns
Whether receipt of the response should continue.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface.

◆ onReceiveMimeData()

avsCommon::utils::http2::HTTP2ReceiveDataStatus alexaClientSDK::acl::MimeResponseSink::onReceiveMimeData ( const char *  bytes,
size_t  size 
)
overridevirtual

Notification of new body data received from an HTTP2 response.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
bytesThe buffer containing the bytes to consume.
sizeThe number of bytes to consume.
Returns
Status of the operation.
See also
HTTP2ReceiveDataStatus

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface.

◆ onReceiveNonMimeData()

avsCommon::utils::http2::HTTP2ReceiveDataStatus alexaClientSDK::acl::MimeResponseSink::onReceiveNonMimeData ( const char *  bytes,
size_t  size 
)
overridevirtual

Notification of receipt of non-mime body data in an HTTP2 response.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
bytesThe buffer containing the bytes to consume.
sizeThe number of bytes to consume.
Returns
Status of the operation.
See also
HTTP2ReceiveDataStatus.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface.

◆ onReceiveResponseCode()

bool alexaClientSDK::acl::MimeResponseSink::onReceiveResponseCode ( long  responseCode)
overridevirtual

Notification that an HTTP response code was returned for the request.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
responseCodeThe response code received for the request.
Returns
Whether receipt of the response should continue.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface.

◆ onResponseFinished()

void alexaClientSDK::acl::MimeResponseSink::onResponseFinished ( avsCommon::utils::http2::HTTP2ResponseFinishedStatus  status)
overridevirtual

Notification that the request/response cycle has finished and no further notifications will be provided.

Note
Calls to this method may block network operations for the associated instance of HTTP2ConnectionInterface, so they should return quickly.
Parameters
statusThe status with which the response finished.
See also
HTTP2ResponseFinishedStatus.

Implements alexaClientSDK::avsCommon::utils::http2::HTTP2MimeResponseSinkInterface.


The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0