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

A mock content fetcher. More...

Inheritance diagram for alexaClientSDK::mediaPlayer::test::MockContentFetcher:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::mediaPlayer::test::MockContentFetcher:
Collaboration graph
[legend]

Public Member Functions

 MockContentFetcher (const std::string &url)
 
std::string getUrl () const override
 
std::string getEffectiveUrl () const override
 
HTTPContentFetcherInterface::Header getHeader (std::atomic< bool > *shouldShutdown) override
 
HTTPContentFetcherInterface::State getState () override
 
bool getBody (std::shared_ptr< avsCommon::avs::attachment::AttachmentWriter > writer) override
 
void shutdown () override
 
std::unique_ptr< avsCommon::utils::HTTPContentgetContent (FetchOptions fetchOption, std::unique_ptr< avsCommon::avs::attachment::AttachmentWriter > writer, const std::vector< std::string > &customHeaders=std::vector< std::string >()) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface
virtual ~HTTPContentFetcherInterface ()=default
 
virtual bool getBody (std::shared_ptr< avsCommon::avs::attachment::AttachmentWriter > writer)=0
 
virtual std::unique_ptr< avsCommon::utils::HTTPContentgetContent (FetchOptions option, std::unique_ptr< avsCommon::avs::attachment::AttachmentWriter > writer=nullptr, const std::vector< std::string > &customHeaders=std::vector< std::string >())=0
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface
enum  FetchOptions { FetchOptions::CONTENT_TYPE, FetchOptions::ENTIRE_BODY }
 Represents what HTTP content to fetch. More...
 
enum  State {
  State::INITIALIZED, State::FETCHING_HEADER, State::HEADER_DONE, State::FETCHING_BODY,
  State::BODY_DONE, State::ERROR
}
 The state of payload fetching. More...
 
- Static Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface
static std::string getUserAgent ()
 
static std::string stateToString (State state)
 

Detailed Description

A mock content fetcher.

Constructor & Destructor Documentation

◆ MockContentFetcher()

alexaClientSDK::mediaPlayer::test::MockContentFetcher::MockContentFetcher ( const std::string &  url)
inline

Member Function Documentation

◆ getBody()

bool alexaClientSDK::mediaPlayer::test::MockContentFetcher::getBody ( std::shared_ptr< avsCommon::avs::attachment::AttachmentWriter writer)
inlineoverride

◆ getContent()

std::unique_ptr<avsCommon::utils::HTTPContent> alexaClientSDK::mediaPlayer::test::MockContentFetcher::getContent ( FetchOptions  fetchOption,
std::unique_ptr< avsCommon::avs::attachment::AttachmentWriter writer,
const std::vector< std::string > &  customHeaders = std::vector<std::string>() 
)
inlineoverride

◆ getEffectiveUrl()

std::string alexaClientSDK::mediaPlayer::test::MockContentFetcher::getEffectiveUrl ( ) const
inlineoverridevirtual

Gets the effective URL associated with this content fetcher.

Note
This is useful in the case of redirects where the first URL used redirects to a different URL to fetch the content.
Returns
The content fetcher's effective URL.

Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.

◆ getHeader()

HTTPContentFetcherInterface::Header alexaClientSDK::mediaPlayer::test::MockContentFetcher::getHeader ( std::atomic< bool > *  shouldShutdown)
inlineoverridevirtual

Waits until the header was fetched successfully. If any problem happened during header, returns false. After the header was already fetched, this method can be called multiple times and will return immediately.

Parameters
shouldShutdownA pointer to allow for the caller to asynchronously cancel the wait, if needed. this argument is optional. If it is a null pointer, the function will ignore it.
Returns
The header struct. It is the caller's responsibility to check the struct to see if the header was retrieved successfully.

Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.

◆ getState()

HTTPContentFetcherInterface::State alexaClientSDK::mediaPlayer::test::MockContentFetcher::getState ( )
inlineoverridevirtual

The current content fetching state. In particular, a caller of getBody, an asynchronous function, can use this method to monitor the download progress.

Returns
The current content fetching state.

Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.

◆ getUrl()

std::string alexaClientSDK::mediaPlayer::test::MockContentFetcher::getUrl ( ) const
inlineoverridevirtual

Gets the URL associated with this content fetcher

Returns
The content fetcher URL

Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.

◆ shutdown()

void alexaClientSDK::mediaPlayer::test::MockContentFetcher::shutdown ( )
inlineoverridevirtual

Shuts down the content fetcher.

Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.


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