5 #ifndef INCLUDE_CBE_OBJECT_H_
6 #define INCLUDE_CBE_OBJECT_H_
9 #include "cbe/Stream.h"
10 #include "cbe/Types.h"
12 #include "cbe/delegate/AclDelegate.h"
13 #include "cbe/delegate/DownloadBinaryDelegate.h"
14 #include "cbe/delegate/DownloadDelegate.h"
15 #include "cbe/delegate/GetStreamsDelegate.h"
16 #include "cbe/delegate/object/MoveDelegate.h"
17 #include "cbe/delegate/object/RemoveDelegate.h"
18 #include "cbe/delegate/object/RenameDelegate.h"
19 #include "cbe/delegate/PublishDelegate.h"
20 #include "cbe/delegate/ShareDelegate.h"
21 #include "cbe/delegate/UnPublishDelegate.h"
22 #include "cbe/delegate/UnShareDelegate.h"
23 #include "cbe/delegate/UnSubscribeDelegate.h"
24 #include "cbe/delegate/UpdateKeyValuesDelegate.h"
25 #include "cbe/delegate/UploadDelegate.h"
28 #include "cbe/delegate/ProgressEventFn.h"
31 #include "cbe/delegate/Error.h"
32 #include "cbe/util/ErrorInfo.h"
33 #include "cbe/util/Exception.h"
34 #include "cbe/util/Optional.h"
41 using ObjectPtr = std::shared_ptr<CBI::Object>;
42 class ItemEventProtocol;
43 using ItemDelegatePtr = std::shared_ptr<ItemEventProtocol>;
44 class TransferDownloadEventProtocol;
45 using TransferDownloadDelegatePtr =
46 std::shared_ptr<TransferDownloadEventProtocol>;
47 class TransferUploadEventProtocol;
48 using TransferUploadDelegatePtr = std::shared_ptr<TransferUploadEventProtocol>;
168 const std::string&
name);
197 const std::string&
name,
290 const std::string&
path,
329 const std::string&
path,
337 const std::string&
path);
372 const std::string&
path,
381 const std::string&
path,
474 std::size_t&& sizeLimit,
483 std::size_t&& sizeLimit,
508 const std::string&
path,
538 const std::string&
path,
547 const std::string&
path,
579 const std::string&
path,
589 const std::string&
path,
627 const std::string& filePath,
663 const std::string& filePath,
672 const std::string& filePath,
717 const std::string& filePath,
727 const std::string& filePath,
1286 std::string password,
1313 std::string password);
1347 std::string password,
1496 Impl& getImpl()
const;
1500 Object(CBI::ObjectPtr cbiPeerPtr);
1501 CBI::Object& getCbiPeer()
const;
The session that holds the connection with the cloud.
Definition: CloudBackend.h:47
A collection of Item, can also represent a table or folder.
Definition: Container.h:63
A set made up of Container and Object.
Definition: Item.h:36
std::string description() const
Holder of a set of data, can represent a table row.
Definition: Object.h:64
cbe::Object rename(const std::string &name)
cbe::util::Optional< cbe::Object > uploadStream(const std::string &filePath, cbe::StreamId streamId, delegate::ProgressEventFn &&progressEventFn, UploadError &error)
void getAcl(GetAclDelegatePtr delegate)
Returns the Access Control List for current Object.
delegate::DownloadSuccess downloadStream(const std::string &path, cbe::Stream stream)
cbe::util::Optional< delegate::UnShareSuccess > unShare(cbe::ShareId shareId, UnShareError &error)
void downloadStream(const std::string &path, cbe::Stream stream, DownloadDelegatePtr delegate)
void unSubscribe(UnSubscribeDelegatePtr delegate)
UnSubscribes from this object.
uint64_t length() const
Returns the binary length/size in bytes of current object.
delegate::PublishSuccess publish(cbe::PublishAccess security, cbe::PublishVisibility privacy, std::string description, std::string password)
cbe::util::Optional< delegate::DownloadBinarySuccess > download(std::size_t &&sizeLimit, DownloadBinaryError &error)
cbe::util::Optional< delegate::DownloadSuccess > downloadStream(const std::string &path, cbe::Stream stream, DownloadError &error)
void updateKeyValues(UpdateKeyValuesDelegatePtr delegate)
Deletes all key/value pairs of data to the object.
delegate::object::RenameDelegatePtr RenameDelegatePtr
Definition: Object.h:139
void download(const std::string &path, DownloadDelegatePtr delegate)
Download the data of current object to the the local file system.
delegate::AclDelegatePtr GetAclDelegatePtr
Definition: Object.h:977
delegate::UnShareDelegatePtr UnShareDelegatePtr
Definition: Object.h:1191
void unShare(cbe::ShareId shareId, UnShareDelegatePtr delegate)
Unshare the object to a specific shareId created when sharing.
void remove(RemoveDelegatePtr delegate)
Remove the object from cloud and locally.
cbe::util::Optional< cbe::AclMap > getAcl(GetAclError &error)
std::string getMimeType() const
Returns the mime type of the object.
delegate::object::RemoveDelegatePtr RemoveDelegatePtr
Definition: Object.h:206
cbe::util::Optional< delegate::UnSubscribeSuccess > unSubscribe(UnSubscribeError &error)
cbe::util::Optional< delegate::ShareSuccess > share(cbe::UserId toUserGroup, std::string description, ShareError &error)
cbe::object_t getObjectType() const
Returns the Object type.
void getStreams(GetStreamsDelegatePtr delegate)
Downloads the streams meta data associated with current object to the SDK's cache.
delegate::UnPublishDelegatePtr UnPublishDelegatePtr
Definition: Object.h:1356
void rename(const std::string &name, RenameDelegatePtr delegate)
Rename object.
cbe::Object updateKeyValues()
Synchronous [exception] Deletes all key/value pairs of data to the object.
delegate::DownloadBinarySuccess download(std::size_t &&sizeLimit)
delegate::GetStreamsDelegatePtr GetStreamsDelegatePtr
Definition: Object.h:845
cbe::util::Optional< delegate::DownloadSuccess > download(const std::string &path, delegate::ProgressEventFn &&progressEventFn, DownloadError &error)
void updateKeyValues(KeyValues keyValues, UpdateKeyValuesDelegatePtr delegate)
Adds key/value pair data to the object.
cbe::util::Optional< cbe::AclMap > setAcl(cbe::AclMap aclMap, SetAclError &error)
std::string url()
URL to current object.
void publish(cbe::PublishAccess security, cbe::PublishVisibility privacy, std::string description, std::string password, PublishDelegatePtr delegate)
Publishes current object to any user.
void move(cbe::ContainerId dstId, MoveDelegatePtr delegate)
Relocates an object to a different container.
cbe::util::Optional< delegate::UnPublishSuccess > unPublish(UnPublishError &error)
cbe::AclMap setAcl(cbe::AclMap aclMap)
cbe::util::Optional< cbe::Object > rename(const std::string &name, RenameError &error)
delegate::UploadDelegatePtr UploadDelegatePtr
Definition: Object.h:599
cbe::util::Optional< delegate::PublishSuccess > publish(cbe::PublishAccess security, cbe::PublishVisibility privacy, std::string description, std::string password, PublishError &error)
cbe::KeyValues keyValues()
Returns all the key/values for current object as a map.
cbe::util::Optional< cbe::Object > move(cbe::ContainerId dstId, MoveError &error)
cbe::util::Optional< delegate::DownloadSuccess > downloadStream(const std::string &path, cbe::Stream stream, delegate::ProgressEventFn &&progressEventFn, DownloadError &error)
void uploadStream(const std::string &filePath, cbe::StreamId streamId, UploadDelegatePtr delegate)
Upload a file for adding a new or replacing existing stream attached to this object.
delegate::UnShareSuccess unShare(cbe::ShareId shareId)
delegate::object::RemoveSuccess remove()
cbe::util::Optional< cbe::Object > updateKeyValues(UpdateKeyValuesError &error)
Synchronous [non-throwing] Deletes all key/value pairs of data to the object.
void unPublish(UnPublishDelegatePtr delegate)
UnPublishes current object.
delegate::UnSubscribeDelegatePtr UnSubscribeDelegatePtr
Definition: Object.h:1424
cbe::Object uploadStream(const std::string &filePath, cbe::StreamId streamId, delegate::ProgressEventFn &&progressEventFn)
delegate::UpdateKeyValuesDelegatePtr UpdateKeyValuesDelegatePtr
Definition: Object.h:737
delegate::ShareDelegatePtr ShareDelegatePtr
Definition: Object.h:1114
delegate::DownloadBinarySuccess download(std::size_t &&sizeLimit, delegate::ProgressEventFn &&progressEventFn)
cbe::Streams Streams
Collection of Stream objects.
Definition: Object.h:878
delegate::DownloadBinaryDelegatePtr DownloadBinaryDelegatePtr
Definition: Object.h:390
cbe::Object move(cbe::ContainerId dstId)
cbe::util::Optional< delegate::DownloadBinarySuccess > download(std::size_t &&sizeLimit, delegate::ProgressEventFn &&progressEventFn, DownloadBinaryError &error)
void setAcl(cbe::AclMap aclMap, SetAclDelegatePtr delegate)
Sets the Access Control List for current object.
delegate::UnSubscribeSuccess unSubscribe()
delegate::ShareSuccess share(cbe::UserId toUserGroup, std::string description)
delegate::DownloadSuccess download(const std::string &path, delegate::ProgressEventFn &&progressEventFn)
delegate::DownloadSuccess download(const std::string &path)
void share(cbe::UserId toUserGroup, std::string description, ShareDelegatePtr delegate)
Share current object to a user.
delegate::DownloadDelegatePtr DownloadDelegatePtr
Definition: Object.h:275
delegate::object::MoveDelegatePtr MoveDelegatePtr
Definition: Object.h:71
delegate::AclDelegatePtr SetAclDelegatePtr
Definition: Object.h:1043
cbe::util::Optional< delegate::DownloadSuccess > download(const std::string &path, DownloadError &error)
delegate::PublishDelegatePtr PublishDelegatePtr
Definition: Object.h:1267
delegate::UnPublishSuccess unPublish()
cbe::Object uploadStream(const std::string &filePath, cbe::StreamId streamId)
cbe::util::Optional< delegate::object::RemoveSuccess > remove(RemoveError &error)
cbe::util::Optional< cbe::Object > updateKeyValues(KeyValues keyValues, UpdateKeyValuesError &error)
Synchronous [non-throwing] Adds key/value pair data to the object.
void download(std::size_t &&sizeLimit, DownloadBinaryDelegatePtr delegate)
Download the binary data associated with current object.
cbe::util::Optional< Streams > getStreams(GetStreamsError &error)
cbe::util::Optional< cbe::Object > uploadStream(const std::string &filePath, cbe::StreamId streamId, UploadError &error)
cbe::Object updateKeyValues(KeyValues keyValues)
Synchronous [exception] Adds key/value pair data to the object.
delegate::DownloadSuccess downloadStream(const std::string &path, cbe::Stream stream, delegate::ProgressEventFn &&progressEventFn)
A data file attached to Object.
Definition: Stream.h:24
Convenience type that bundles all parameters passed to method cbe::delegate::DownloadBinaryDelegate::...
Definition: DownloadBinarySuccess.h:17
Convenience type that bundles all parameters passed to method cbe::delegate::DownloadDelegate::onDown...
Definition: DownloadSuccess.h:16
Convenience type that bundles the parameter passed to method cbe::delegate::ShareDelegate::onShareSuc...
Definition: PublishSuccess.h:14
Convenience type that bundles the parameter passed to method cbe::delegate::ShareDelegate::onShareSuc...
Definition: ShareDelegate.h:77
Convenience type that bundles all parameters passed to method cbe::delegate::UnPublishDelegate::onUnP...
Definition: UnPublishDelegate.h:77
Convenience type that bundles the parameter passed to method cbe::delegate::ShareDelegate::onShareSuc...
Definition: UnShareDelegate.h:73
Convenience type that bundles all parameters passed to method cbe::delegate::UnSubscribeDelegate::onU...
Definition: UnSubscribeDelegate.h:76
Convenience type that bundles all parameters passed to method cbe::delegate::object::onRemoveSuccess.
Definition: RemoveDelegate.h:75
Class template Optional manages an optional contained value - i.e., a value that is either present or...
Definition: Optional.h:20
std::shared_ptr< MoveDelegate > MoveDelegatePtr
Definition: MoveDelegate.h:64
std::shared_ptr< RenameDelegate > RenameDelegatePtr
Definition: RenameDelegate.h:64
std::shared_ptr< RemoveDelegate > RemoveDelegatePtr
Definition: RemoveDelegate.h:68
std::function< void(const ChunkTransferred &)> ProgressEventFn
Callback interface function that the CloudBackend SDK uses to indicate the progress of an upload/down...
Definition: ProgressEventFn.h:19
std::shared_ptr< GetStreamsDelegate > GetStreamsDelegatePtr
Definition: GetStreamsDelegate.h:68
std::shared_ptr< UnPublishDelegate > UnPublishDelegatePtr
Definition: UnPublishDelegate.h:70
std::shared_ptr< ShareDelegate > ShareDelegatePtr
Definition: ShareDelegate.h:70
std::shared_ptr< PublishDelegate > PublishDelegatePtr
Definition: PublishDelegate.h:66
std::shared_ptr< UpdateKeyValuesDelegate > UpdateKeyValuesDelegatePtr
Definition: UpdateKeyValuesDelegate.h:66
std::shared_ptr< AclDelegate > AclDelegatePtr
Definition: AclDelegate.h:68
std::shared_ptr< UnShareDelegate > UnShareDelegatePtr
Definition: UnShareDelegate.h:66
std::shared_ptr< UploadDelegate > UploadDelegatePtr
Definition: UploadDelegate.h:83
std::shared_ptr< DownloadBinaryDelegate > DownloadBinaryDelegatePtr
Definition: DownloadBinaryDelegate.h:87
std::shared_ptr< UnSubscribeDelegate > UnSubscribeDelegatePtr
Definition: UnSubscribeDelegate.h:69
std::shared_ptr< DownloadDelegate > DownloadDelegatePtr
Definition: DownloadDelegate.h:84
Root namespace for the CloudBackend SDK API.
Definition: Account.h:22
std::vector< cbe::Stream > Streams
Collection of Stream objects.
Definition: Stream.h:49
std::map< cbe::AclGroupId, std::pair< cbe::Permissions, AclScope > > AclMap
ACL map (Access Control List) relating to users and groups.
Definition: Types.h:390
std::uint64_t StreamId
Uniquely identifies a cbe::Stream.
Definition: Types.h:118
std::uint64_t ShareId
Uniquely identifies a sharing of a cbe::Container or cbe::Object.
Definition: Types.h:113
std::uint64_t UserId
Uniquely identifies the CBE user number.
Definition: Types.h:126
std::uint64_t ContainerId
Unique Id of a cbe::Container.
Definition: Types.h:60
DefaultCtor
Default constructor marker.
Definition: Types.h:204
PublishVisibility
Definition: Types.h:357
PublishAccess
Definition: Types.h:342
std::map< std::string, std::pair< std::string, bool > > KeyValues
Map with key/value pairs, a.k.a. metadata.
Definition: Types.h:417
Definition: AclDelegate.h:41
exception thrown by cbe::Object::getAcl() if the request fails.
Definition: AclDelegate.h:51
Definition: DownloadBinaryDelegate.h:63
exception thrown by cbe::Object::download() if the request fails.
Definition: DownloadBinaryDelegate.h:73
Definition: DownloadDelegate.h:56
exception thrown by:
Definition: DownloadDelegate.h:69
Definition: GetStreamsDelegate.h:46
exception thrown by cbe::Object::getStreams() if the request fails.
Definition: GetStreamsDelegate.h:56
Definition: PublishDelegate.h:38
exception thrown by:
Definition: PublishDelegate.h:51
Definition: ShareDelegate.h:42
exception thrown by
Definition: ShareDelegate.h:55
Definition: UnPublishDelegate.h:42
exception thrown by
Definition: UnPublishDelegate.h:55
Definition: UnShareDelegate.h:38
exception thrown by
Definition: UnShareDelegate.h:51
Definition: UnSubscribeDelegate.h:41
exception thrown by
Definition: UnSubscribeDelegate.h:54
Definition: UpdateKeyValuesDelegate.h:42
exception thrown by cbe::Object::updateKeyValues() if the request fails.
Definition: UpdateKeyValuesDelegate.h:52
Definition: UploadDelegate.h:57
exception thrown by cbe::Container::upload(const std::string&,const std::string&) and its overloads i...
Definition: UploadDelegate.h:68
Definition: MoveDelegate.h:43
exception thrown by cbe::Object::move() if the request fails.
Definition: MoveDelegate.h:53
Definition: RemoveDelegate.h:45
exception thrown by cbe::Object::remove() if the request fails.
Definition: RemoveDelegate.h:55
Definition: RenameDelegate.h:43
exception thrown by cbe::Object::rename() if the request fails.
Definition: RenameDelegate.h:53