1
0
This repository has been archived on 2025-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
Files
siadrive/SiaDrive.Api/SiaRenter.cpp
Scott E. Graves 3c1dd68622 Dokan changes
2017-02-11 19:42:51 -06:00

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;
}