![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <CurlWrapper.h>
Public Types | |
using | HeaderResults = avsCommon::utils::error::Result< commonInterfaces::ResultCode, std::string > |
Return status for header APIs. More... | |
Public Member Functions | |
virtual | ~CurlWrapper () |
commonInterfaces::ResultCode | get (const std::string &url, std::ostream &response, const std::weak_ptr< CurlProgressCallbackInterface > &callbackObj) |
commonInterfaces::ResultCode | download (const std::string &url, const std::string &path, const std::weak_ptr< CurlProgressCallbackInterface > &callbackObj, bool unpack=false, size_t size=0) |
HeaderResults | getHeaders (const std::string &url) |
HeaderResults | getHeadersAuthorized (const std::string &url) |
commonInterfaces::ResultCode | getAndDownloadMultipart (const std::string &url, std::shared_ptr< ResponseSink > sink, const std::weak_ptr< CurlProgressCallbackInterface > &callbackObj) |
Static Public Member Functions | |
static std::unique_ptr< CurlWrapper > | create (bool isThrottled, std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface > authDelegate, const std::string &certPath="") |
static std::string | getValueFromHeaders (const std::string &headers, const std::string &key) |
Wraps the libcurl library in a more C++ friendly manner. Still undecided if this will be generic or specific to DAVS. Likely will be DAVS specific.
using alexaClientSDK::acsdkAssets::common::CurlWrapper::HeaderResults = avsCommon::utils::error::Result<commonInterfaces::ResultCode, std::string> |
Return status for header APIs.
|
virtual |
|
static |
Creates and initializes the object.
isThrottled | whether the download should be slowed down for throttling |
authDelegate | the Authentication Delegate to generate the authentication token |
certPath | - optional - a path to a local SSL cert to use instead of maplite |
commonInterfaces::ResultCode alexaClientSDK::acsdkAssets::common::CurlWrapper::download | ( | const std::string & | url, |
const std::string & | path, | ||
const std::weak_ptr< CurlProgressCallbackInterface > & | callbackObj, | ||
bool | unpack = false , |
||
size_t | size = 0 |
||
) |
Synchronously download a remote URL to local file or directory (if unpack is needed)
url | the URL to download from |
path | the absolute path to a file (or directory) to write to (if unpack is needed) |
callbackObj | object that implements CurlProgressCallbackInterface |
unpack | whether unpack is needed during download, size must be specified or download would fail. |
size | size of the file to be downloaded, if not specified or set to 0, size check will be skipped. (except when unpack=1) |
commonInterfaces::ResultCode alexaClientSDK::acsdkAssets::common::CurlWrapper::get | ( | const std::string & | url, |
std::ostream & | response, | ||
const std::weak_ptr< CurlProgressCallbackInterface > & | callbackObj | ||
) |
Executes HTTP GET request and populates the response.
url | IN, the URL to execute, must be a https. It should include any query parameters as well. |
response | OUT, the ostream to populate with the HTTP entity-body; it may end up empty if entity-body is empty or not present. |
callbackObj | object that implements CurlProgressCallbackInterface |
commonInterfaces::ResultCode alexaClientSDK::acsdkAssets::common::CurlWrapper::getAndDownloadMultipart | ( | const std::string & | url, |
std::shared_ptr< ResponseSink > | sink, | ||
const std::weak_ptr< CurlProgressCallbackInterface > & | callbackObj | ||
) |
Executes HTTP GET request which returns a multipart response streams the data in chunks and downloads them to file.
url | IN, the URL to execute, must be a https. It should include any query parameters as well. |
sink | OUT, object that is used by the multipart parser to read in the data. |
callbackObj | object that implements CurlProgressCallbackInterface |
HeaderResults alexaClientSDK::acsdkAssets::common::CurlWrapper::getHeaders | ( | const std::string & | url | ) |
Executes HTTP HEAD request and populates the response.
url | IN, the URL to execute, must use https. It should include any query parameters as well. |
HeaderResults alexaClientSDK::acsdkAssets::common::CurlWrapper::getHeadersAuthorized | ( | const std::string & | url | ) |
Executes HTTP HEAD request and populates the response. Authorizes to access davs headers
url | IN, the URL to execute, must use https. It should include any query parameters as well. |
|
static |
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0