SDK  2.1.4 [async]
CloudBackend Software Development Kit - SDK API for C++
SubscribeManager.h
1 /*
2  Copyright © CloudBackend AB 2022-2023.
3 */
4 
5 #ifndef INCLUDE_CBE_SUBSCRIBE_MANAGER_H_
6 #define INCLUDE_CBE_SUBSCRIBE_MANAGER_H_
7 
8 #include <vector>
9 
10 #include "cbe/Subscribe.h"
11 #include "cbe/Types.h"
12 
13 #include "cbe/delegate/SubscribeDelegate.h"
14 #include "cbe/delegate/GetSubscriptionsDelegate.h"
15 
16 #include "cbe/delegate/Error.h"
17 #include "cbe/util/ErrorInfo.h"
18 #include "cbe/util/Exception.h"
19 #include "cbe/util/Optional.h"
20 
21 namespace CBI {
22 class SubscribeManager;
23 } // namespace CBI
24 
25 namespace cbe {
31 public:
56 #ifndef CBE_NO_SYNC
60  using GetSubscriptionsException = delegate::GetSubscriptionsDelegate::Exception;
75 
82  using GetSubscriptionsError = delegate::GetSubscriptionsDelegate::ErrorInfo;
104  getSubscriptions(GetSubscriptionsError& error);
105 #endif // #ifndef CBE_NO_SYNC
106  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
107 
116 
139  void subscribe(cbe::UserId sharingUserId,
140  std::string sharingUserName,
141  cbe::PublishId publishId,
142  std::string publishName,
143  std::string password,
144  std::string subscribeName,
145  SubscribeDelegatePtr subscribeDelegate);
152 #ifndef CBE_NO_SYNC
156  using SubscribeException = delegate::SubscribeDelegate::Exception;
176  delegate::SubscribeDelegate::Success subscribe(cbe::UserId sharingUserId,
177  std::string sharingUserName,
178  cbe::PublishId publishId,
179  std::string publishName,
180  std::string password,
181  std::string subscribeName);
182 
195  using SubscribeError = delegate::SubscribeDelegate::ErrorInfo;
228  cbe::UserId sharingUserId,
229  std::string sharingUserName,
230  cbe::PublishId publishId,
231  std::string publishName,
232  std::string password,
233  std::string subscribeName,
234  SubscribeError& error);
235 #endif // #ifndef CBE_NO_SYNC
236  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
237 
238 
249  void subscribe(std::string sharingUserName,
250  std::string publishName,
251  SubscribeDelegatePtr subscribeDelegate) {
252  subscribe(0, sharingUserName, 0, publishName, "", publishName,
253  subscribeDelegate);
254  }
255 
267  void subscribe(cbe::UserId sharingUserId,
268  cbe::PublishId publishId,
269  std::string subscribeName,
270  SubscribeDelegatePtr subscribeDelegate) {
271  subscribe(sharingUserId, "", publishId, "", "", subscribeName,
272  subscribeDelegate);
273  }
274 
276  ~SubscribeManager();
277 
278  explicit operator bool() const;
279 private:
280  struct Impl;
281  std::shared_ptr<Impl> pImpl{};
282 
283  friend class CloudBackend;
284  SubscribeManager(CBI::SubscribeManager& cbiPeer);
285  CBI::SubscribeManager& getCbiPeer() const;
286 }; // class SubscribeManager
287 
288 } // namespace cbe
289 
290 #endif // INCLUDE_CBE_SUBSCRIBE_MANAGER_H_
resultset of data retrieved.
Definition: QueryResult.h:51
For managing subscriptions.
Definition: SubscribeManager.h:30
void subscribe(cbe::UserId sharingUserId, std::string sharingUserName, cbe::PublishId publishId, std::string publishName, std::string password, std::string subscribeName, SubscribeDelegatePtr subscribeDelegate)
Subscribes to a Publish using all parameters.
void getSubscriptions(GetSubscriptionsDelegatePtr subscribeDelegate)
List your current subscriptions.
delegate::GetSubscriptionsDelegatePtr GetSubscriptionsDelegatePtr
Definition: SubscribeManager.h:39
void subscribe(std::string sharingUserName, std::string publishName, SubscribeDelegatePtr subscribeDelegate)
Subscribes to a Publish using names.
Definition: SubscribeManager.h:249
delegate::SubscribeDelegatePtr SubscribeDelegatePtr
Definition: SubscribeManager.h:115
void subscribe(cbe::UserId sharingUserId, cbe::PublishId publishId, std::string subscribeName, SubscribeDelegatePtr subscribeDelegate)
Subscribes to a Publish using ids.
Definition: SubscribeManager.h:267
Class template Optional manages an optional contained value - i.e., a value that is either present or...
Definition: Optional.h:20
std::shared_ptr< SubscribeDelegate > SubscribeDelegatePtr
Definition: SubscribeDelegate.h:60
std::shared_ptr< GetSubscriptionsDelegate > GetSubscriptionsDelegatePtr
Definition: GetSubscriptionsDelegate.h:64
Root namespace for the CloudBackend SDK API.
Definition: Account.h:22
std::uint64_t UserId
Uniquely identifies the CBE user number.
Definition: Types.h:126
DefaultCtor
Default constructor marker.
Definition: Types.h:204
std::uint64_t PublishId
Id of a subscribed cbe::Container or cbe::Object.
Definition: Types.h:104
Definition: GetSubscriptionsDelegate.h:42
Definition: SubscribeDelegate.h:36