My Project
Loading...
Searching...
No Matches
dxproject.h
Go to the documentation of this file.
1// Copyright (C) 2013-2016 DNAnexus, Inc.
2//
3// This file is part of dx-toolkit (DNAnexus platform client libraries).
4//
5// Licensed under the Apache License, Version 2.0 (the "License"); you may
6// not use this file except in compliance with the License. You may obtain a
7// copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14// License for the specific language governing permissions and limitations
15// under the License.
16
24#ifndef DXCPP_BINDINGS_DXPROJECT_H
25#define DXCPP_BINDINGS_DXPROJECT_H
26
27#include "../bindings.h"
28
29namespace dx {
31
43
45 private:
46 std::string dxid_;
47
48 public:
49
55 DXContainer(const std::string &dxid=config::CURRENT_PROJECT()) : dxid_(dxid) { }
56
62 void setID(const std::string &dxid) { dxid_ = dxid; }
63
67 std::string getID() const { return dxid_; }
68
75 operator std::string() { return dxid_;}
76
86 // TODO: add wiki link for /class-xxx/describe
87 dx::JSON describe(bool folders=false) const;
88
99 void move(const dx::JSON &objects,
100 const dx::JSON &folders,
101 const std::string &dest_folder) const;
102
114 void clone(const dx::JSON &objects,
115 const dx::JSON &folders,
116 const std::string &dest_container,
117 const std::string &dest_folder="/") const;
118
119 // Folder specific
120
127 void newFolder(const std::string &folder, bool parents=false) const;
128
136 dx::JSON listFolder(const std::string &folder="/") const;
137
147 void moveFolder(const std::string &folder,
148 const std::string &dest_folder) const;
149
158 void removeFolder(const std::string &folder, const bool recurse=false) const;
159
160 // Objects-specific
161
170 void moveObjects(const dx::JSON &objects,
171 const std::string &dest_folder) const {
172 move(objects, dx::JSON(dx::JSON_ARRAY), dest_folder);
173 }
174
180 void removeObjects(const dx::JSON &objects) const;
181
195 void cloneFolder(const std::string &folder,
196 const std::string &dest_container,
197 const std::string &dest_folder) const {
198 clone(dx::JSON(dx::JSON_ARRAY), dx::JSON::parse("[\"" + folder + "\"]"), dest_container, dest_folder);
199 }
200
210 void cloneObjects(const dx::JSON &objects,
211 const std::string &dest_container,
212 const std::string &dest_folder) const {
213 clone(objects, dx::JSON(dx::JSON_ARRAY), dest_container, dest_folder);
214 }
215 };
216
218
223
224 class DXProject : public DXContainer {
225 public:
226
232 DXProject(const std::string &dxid=config::CURRENT_PROJECT()) : DXContainer(dxid) { }
233
241 void update(const dx::JSON &to_update) const;
242
247 void destroy() const;
248
260 void invite(const std::string &invitee, const std::string &level) const;
261
271 // TODO: link to wiki docs
272 void decreasePerms(const std::string &member, const std::string &level) const;
273 };
274}
275#endif
A generic container for data objects.
Definition dxproject.h:44
void moveObjects(const dx::JSON &objects, const std::string &dest_folder) const
Definition dxproject.h:170
void removeObjects(const dx::JSON &objects) const
Definition dxproject.cc:85
void cloneFolder(const std::string &folder, const std::string &dest_container, const std::string &dest_folder) const
Definition dxproject.h:195
dx::JSON describe(bool folders=false) const
Definition dxproject.cc:22
void cloneObjects(const dx::JSON &objects, const std::string &dest_container, const std::string &dest_folder) const
Definition dxproject.h:210
void moveFolder(const std::string &folder, const std::string &dest_folder) const
Definition dxproject.cc:65
DXContainer(const std::string &dxid=config::CURRENT_PROJECT())
Definition dxproject.h:55
void newFolder(const std::string &folder, bool parents=false) const
Definition dxproject.cc:54
void clone(const dx::JSON &objects, const dx::JSON &folders, const std::string &dest_container, const std::string &dest_folder="/") const
Definition dxproject.cc:41
void move(const dx::JSON &objects, const dx::JSON &folders, const std::string &dest_folder) const
Definition dxproject.cc:31
void removeFolder(const std::string &folder, const bool recurse=false) const
Definition dxproject.cc:70
void setID(const std::string &dxid)
Definition dxproject.h:62
dx::JSON listFolder(const std::string &folder="/") const
Definition dxproject.cc:61
std::string getID() const
Definition dxproject.h:67
A DXContainer with additional functionality for collaboration.
Definition dxproject.h:224
void invite(const std::string &invitee, const std::string &level) const
Definition dxproject.cc:99
void decreasePerms(const std::string &member, const std::string &level) const
Definition dxproject.cc:103
void destroy() const
Definition dxproject.cc:95
DXProject(const std::string &dxid=config::CURRENT_PROJECT())
Definition dxproject.h:232
void update(const dx::JSON &to_update) const
Definition dxproject.cc:91
An executable object that can be published for others to discover.
Definition api.cc:7