~unity-api-team/storage-provider-webdav/trunk

« back to all changes in this revision

Viewing changes to src/DavProvider.h

  • Committer: Bileto Bot
  • Author(s): James Henstridge, Tarmac
  • Date: 2016-11-28 07:45:30 UTC
  • mfrom: (10.2.12 devel)
  • Revision ID: ci-train-bot@canonical.com-20161128074530-mvjmc01hwb2s8q45
Merge lp:storage-provider-webdav/devel r22 to trunk.

Approved by: Michi Henning

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2016 Canonical Ltd.
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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/>.
 
15
 *
 
16
 * Authored by: James Henstridge <james.henstridge@canonical.com>
 
17
 */
 
18
 
1
19
#pragma once
2
20
 
3
21
#include <unity/storage/provider/ProviderBase.h>
10
28
class QNetworkReply;
11
29
class QNetworkRequest;
12
30
class QUrl;
 
31
struct MultiStatusProperty;
13
32
 
14
33
class DavProvider : public unity::storage::provider::ProviderBase
15
34
{
18
37
    virtual ~DavProvider();
19
38
 
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;
31
54
 
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;
43
69
 
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;
47
74
 
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;
58
87
 
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;
64
96
 
65
97
protected:
66
98
    std::unique_ptr<QNetworkAccessManager> const network_;
 
99
 
 
100
private:
 
101
    inline std::shared_ptr<DavProvider> shared_from_this();
67
102
};