2
* Copyright (C) 2016 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: James Henstridge <james.henstridge@canonical.com>
3
21
#include <unity/storage/provider/ProviderBase.h>
18
37
virtual ~DavProvider();
20
39
boost::future<unity::storage::provider::ItemList> roots(
40
std::vector<std::string> const& metadata_keys,
21
41
unity::storage::provider::Context const& ctx) override;
22
42
boost::future<std::tuple<unity::storage::provider::ItemList,std::string>> list(
23
43
std::string const& item_id, std::string const& page_token,
44
std::vector<std::string> const& metadata_keys,
24
45
unity::storage::provider::Context const& ctx) override;
25
46
boost::future<unity::storage::provider::ItemList> lookup(
26
47
std::string const& parent_id, std::string const& name,
48
std::vector<std::string> const& metadata_keys,
27
49
unity::storage::provider::Context const& ctx) override;
28
50
boost::future<unity::storage::provider::Item> metadata(
29
51
std::string const& item_id,
52
std::vector<std::string> const& metadata_keys,
30
53
unity::storage::provider::Context const& ctx) override;
32
55
boost::future<unity::storage::provider::Item> create_folder(
33
56
std::string const& parent_id, std::string const& name,
57
std::vector<std::string> const& metadata_keys,
34
58
unity::storage::provider::Context const& ctx) override;
35
59
boost::future<std::unique_ptr<unity::storage::provider::UploadJob>> create_file(
36
60
std::string const& parent_id, std::string const& name,
37
61
int64_t size, std::string const& content_type, bool allow_overwrite,
62
std::vector<std::string> const& metadata_keys,
38
63
unity::storage::provider::Context const& ctx) override;
39
64
boost::future<std::unique_ptr<unity::storage::provider::UploadJob>> update(
40
65
std::string const& item_id, int64_t size,
41
66
std::string const& old_etag,
67
std::vector<std::string> const& metadata_keys,
42
68
unity::storage::provider::Context const& ctx) override;
44
70
boost::future<std::unique_ptr<unity::storage::provider::DownloadJob>> download(
45
71
std::string const& item_id,
72
std::string const& match_etag,
46
73
unity::storage::provider::Context const& ctx) override;
48
75
boost::future<void> delete_item(std::string const& item_id,
50
77
boost::future<unity::storage::provider::Item> move(
51
78
std::string const& item_id, std::string const& new_parent_id,
52
79
std::string const& new_name,
80
std::vector<std::string> const& metadata_keys,
53
81
unity::storage::provider::Context const& ctx) override;
54
82
boost::future<unity::storage::provider::Item> copy(
55
83
std::string const& item_id, std::string const& new_parent_id,
56
84
std::string const& new_name,
85
std::vector<std::string> const& metadata_keys,
57
86
unity::storage::provider::Context const& ctx) override;
59
88
virtual QUrl base_url(
61
90
virtual QNetworkReply *send_request(
62
91
QNetworkRequest& request, QByteArray const& verb, QIODevice* data,
63
92
unity::storage::provider::Context const& ctx) const = 0;
93
virtual unity::storage::provider::Item make_item(
94
QUrl const& href, QUrl const& base_url,
95
std::vector<MultiStatusProperty> const& properties) const;
66
98
std::unique_ptr<QNetworkAccessManager> const network_;
101
inline std::shared_ptr<DavProvider> shared_from_this();