61 const auto code = response.getError();
63 if (code == NetworkError::NoError)
66 if (code == NetworkError::OperationCancelled)
70 code == NetworkError::ConnectionFailed ||
71 code == NetworkError::ConnectionRefused ||
72 code == NetworkError::HostNotFound ||
73 code == NetworkError::ProxyConnectionFailed ||
74 code == NetworkError::ProxyNotFound ||
75 code == NetworkError::RemoteHostClosed ||
79 if (code == NetworkError::HTTPError)
92 readBody ? response.
readAll<std::string>() : std::string {} };
94 if (response.
getError() != NetworkError::HTTPError)
98 std::string(
"HTTP ") + std::to_string(response.
getHTTPCode()) +
99 std::string(
"\n") + response.
readAll<std::string>() };
106 if (!language.empty())
112 if (oauthService.HasAccessToken())
Declare an interface for HTTP response.
Declare a class for constructing HTTP requests.
std::string GetAcceptLanguageValue() const
Returns the preferred language.
Interface, that provides access to the data from the HTTP response.
virtual std::string getErrorString() const =0
virtual unsigned getHTTPCode() const noexcept=0
virtual NetworkError getError() const noexcept=0
Request & setHeader(const std::string &name, std::string value)
SyncResultCode GuessResultCode(IResponse &response) noexcept
SyncResultCode GetResultCodeFromHttpCode(int code) noexcept
bool IsUploadRecoverable(SyncResultCode code)
void SetCommonHeaders(Request &request)
OAuthService & GetOAuthService()
Returns the instance of the OAuthService.
ResponseResult GetResponseResult(IResponse &response, bool readBody)
const ServiceConfig & GetServiceConfig()
Returns the instance of the ServiceConfig.
int64_t ProjectFilesTransferred
TransferStats & SetBytesTransferred(int64_t bytesTransferred)
TransferStats & SetProjectFilesTransferred(int64_t projectFilesTransferred)
TransferStats & SetBlocksTransferred(int64_t blocksTransferred)
TransferStats & SetTransferDuration(Duration transferDuration)
int64_t BlocksTransferred
std::chrono::milliseconds Duration
Duration TransferDuration