AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <LibCurlHttpContentFetcher.h>
Public Member Functions | |
LibCurlHttpContentFetcher (const std::string &url, const std::shared_ptr< LibcurlSetCurlOptionsCallbackInterface > &setCurlOptionsCallback=nullptr) | |
std::unique_ptr< avsCommon::utils::HTTPContent > | getContent (FetchOptions option, std::unique_ptr< avsCommon::avs::attachment::AttachmentWriter > writer=nullptr, const std::vector< std::string > &customHeaders=std::vector< std::string >()) override |
~LibCurlHttpContentFetcher () override | |
HTTPContentFetcherInterface methods | |
State | getState () override |
std::string | getUrl () const override |
std::string | getEffectiveUrl () const override |
Header | getHeader (std::atomic< bool > *shouldShutdown) override |
bool | getBody (std::shared_ptr< avsCommon::avs::attachment::AttachmentWriter > writer) override |
void | shutdown () 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::HTTPContent > | getContent (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) |
A class used to retrieve content from remote URLs. Note that this object will only write to the Attachment while it remains alive. If the object goes out of scope, writing to the Attachment will abort.
|
explicit |
Constructor.
url | The url to fetch the content from. |
setCurlOptionsCallback | The optional LibcurlSetCurlOptionsCallbackInterface allows setting user defined curl options. |
|
override |
|
override |
|
override |
In this implementation, the function may only be called once. Subsequent calls will return nullptr.
|
overridevirtual |
Gets the effective URL associated with this content fetcher.
Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.
|
overridevirtual |
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.
shouldShutdown | A 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. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.
|
overridevirtual |
The current content fetching state. In particular, a caller of getBody
, an asynchronous function, can use this method to monitor the download progress.
Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.
|
overridevirtual |
Gets the URL associated with this content fetcher
Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.
|
overridevirtual |
Shuts down the content fetcher.
Implements alexaClientSDK::avsCommon::sdkInterfaces::HTTPContentFetcherInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0