mcloud  1.0.0
MCloud API library for cmcc cloud service
client.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Gary Wang <gary.wang@canonical.com>
17  */
18 
19 #ifndef MCLOUD_API_CLIENT_H_
20 #define MCLOUD_API_CLIENT_H_
21 
22 #include <mcloud/api/visibility.h>
23 #include <mcloud/api/taskqueue.h>
24 #include <mcloud/api/diskinfo.h>
25 #include <mcloud/api/outlink.h>
28 #include <mcloud/api/cloudfolder.h>
30 #include <mcloud/api/uploadtask.h>
31 #include <mcloud/api/syncmanager.h>
32 
33 #include <deque>
34 /*#include <future>*/
35 /*#include <thread>*/
36 
37 namespace mcloud {
38 namespace api {
39 
40 class ClientPriv;
41 
67 
68  public:
69  typedef std::shared_ptr<Client> Ptr;
70 
71  typedef std::deque<CloudResource::Ptr> ResourceList;
72 
73  typedef std::deque<Outlink::Ptr> OutlinkList;
74 
75  typedef std::vector<std::string> Stringlist;
76 
81  Client(int request_timeout = 10);
82 
83  Client(const Client&) = delete;
84 
85  Client& operator=(const Client&) = delete;
86 
87  virtual ~Client();
88 
93  void set_access_token(const std::string &access_token);
94 
101  bool refresh_token(const std::string &refresh_token);
102 
108  DiskInfo disk_info();
109 
117  std::string cloud_root_folder_id();
118 
128  ResourceList cloud_content_list(int start_index,
129  int count,
131  const std::string &folder_id = std::string());
132 
139  CloudContent::Ptr content_info(const std::string & content_id);
140 
147  CloudFolder::Ptr create_folder(const std::string &folder_name,
148  const std::string &folder_id);
149 
157  [[gnu::deprecated("cmcc closes this api for security reason")]]
158  Client::ResourceList look_up(const std::string &name,
159  const std::string &folder_id,
161 
168  OutlinkList create_folder_extranet_link(const Stringlist &folder_ids);
169 
176  OutlinkList create_content_extranet_link(const Stringlist &content_ids);
177 
184  Client::Stringlist copy_folders(const Stringlist &folder_ids,
185  const std::string &_folder_id);
186 
193  Client::Stringlist copy_contents(const Stringlist &contents_ids,
194  const std::string &folder_id);
195 
202  bool move_items(const Stringlist &folder_ids,
203  const Stringlist &content_ids,
204  const std::string &folder_id);
205 
211  bool update_folder(const std::string &folder_id,
212  const std::string &new_folder_name);
213 
219  bool delete_contents(const Stringlist &content_ids);
220 
226  bool exist_on_cloud(const std::string &file_path,
227  const std::string &folder_id = std::string());
228 
233  SyncManager::Ptr syncmanager() const;
234 
235  private:
236  std::shared_ptr<ClientPriv> p_;
237 
238 };
239 
240 }
241 }
242 
243 #endif // MCLOUD_API_CLIENT_H_
DiskInfo is a class that provides basic user&#39;s mcloud storage usage information.
Definition: diskinfo.h:38
std::deque< CloudResource::Ptr > ResourceList
Definition: client.h:71
Mcloud API provides developer to easily access login user&#39;s cloud contents stored on mcloud...
Definition: client.h:66
std::shared_ptr< SyncManager > Ptr
Definition: syncmanager.h:47
std::shared_ptr< CloudContent > Ptr
Definition: cloudcontent.h:40
std::shared_ptr< CloudFolder > Ptr
Definition: cloudfolder.h:50
std::vector< std::string > Stringlist
Definition: client.h:75
std::deque< Outlink::Ptr > OutlinkList
Definition: client.h:73
Definition: client.h:37
Type
All Content type .
Definition: cloudcontent.h:45
all kinds of content type
#define MCLOUD_API_DLL_PUBLIC
Definition: visibility.h:26
std::shared_ptr< Client > Ptr
Definition: client.h:69