54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#include "stdafx.h"
|
|
#include "SiaApi.h"
|
|
|
|
using namespace Sia::Api;
|
|
|
|
CSiaApi::_CSiaRenter::_CSiaRenter(CSiaCurl& siaCurl) :
|
|
_siaCurl(siaCurl)
|
|
{
|
|
}
|
|
|
|
CSiaApi::_CSiaRenter::~_CSiaRenter()
|
|
{
|
|
|
|
}
|
|
|
|
SiaApiError CSiaApi::_CSiaRenter::FileExists(const String& siaPath, bool& exists) const
|
|
{
|
|
CSiaFileTreePtr siaFileTree;
|
|
SiaApiError ret = GetFileTree(siaFileTree);
|
|
if (API_SUCCESS(SiaApiError, ret))
|
|
{
|
|
exists = siaFileTree->FileExists(siaPath);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
SiaApiError CSiaApi::_CSiaRenter::DeleteFile(const String& siaPath)
|
|
{
|
|
return SiaApiError::NotImplemented;
|
|
}
|
|
|
|
SiaApiError CSiaApi::_CSiaRenter::DownloadFile(const String& siaPath, const String& location) const
|
|
{
|
|
return SiaApiError::NotImplemented;
|
|
}
|
|
|
|
SiaApiError CSiaApi::_CSiaRenter::QueueUploadFile(const String& siaPath, const String& filePath)
|
|
{
|
|
return SiaApiError::NotImplemented;
|
|
}
|
|
|
|
SiaApiError CSiaApi::_CSiaRenter::GetFileTree(CSiaFileTreePtr& siaFileTree) const
|
|
{
|
|
SiaApiError ret = SiaApiError::RequestError;
|
|
siaFileTree.reset(new CSiaFileTree(_siaCurl));
|
|
json result;
|
|
if (API_SUCCESS(SiaCurlError, _siaCurl.Get(L"/renter/files", result)))
|
|
{
|
|
siaFileTree->BuildTree(result);
|
|
ret = SiaApiError::Success;
|
|
}
|
|
|
|
return ret;
|
|
} |