![]() |
SDK
2.1.4
CloudBackend Software Development Kit - SDK API for C++
|
The session that holds the connection with the cloud. More...
#include <CloudBackend.h>
Public Types | |
using | LogInDelegatePtr = delegate::LogInDelegatePtr |
using | LogInException = delegate::LogInDelegate::Exception |
using | LogInError = delegate::LogInDelegate::ErrorInfo |
using | CreateAccountDelegatePtr = delegate::CreateAccountDelegatePtr |
using | CreateAccountException = delegate::CreateAccountDelegate::Exception |
using | CreateAccountError = delegate::CreateAccountDelegate::ErrorInfo |
using | CloudBackendListenerDelegatePtr = std::shared_ptr< delegate::CloudBackendListenerDelegate > |
using | ListenerHandle = std::uint64_t |
Handle identifying a registered Listener. | |
using | QueryDelegatePtr = delegate::QueryDelegatePtr |
using | QueryJoinDelegatePtr = delegate::QueryJoinDelegatePtr |
using | QueryException = delegate::QueryDelegate::Exception |
using | QueryJoinError = delegate::QueryJoinDelegate::ErrorInfo |
using | QueryError = delegate::QueryDelegate::ErrorInfo |
using | SearchException = delegate::QueryDelegate::Exception |
using | SearchError = delegate::QueryDelegate::ErrorInfo |
Public Member Functions | |
ListenerHandle | addListener (CloudBackendListenerDelegatePtr listener) |
Listen for changes to specific items. More... | |
void | removeListener (ListenerHandle handle) |
Delete a specific listener. More... | |
cbe::QueryChain | query (ContainerId containerId, QueryDelegatePtr queryDelegate) |
Select Item's of a container (table). More... | |
cbe::QueryChain | query (ContainerId containerId, Filter filter, QueryDelegatePtr queryDelegate) |
Select Item's of a container (table) with a filter (where). More... | |
cbe::QueryChainExt | query (ContainerId containerId, QueryJoinDelegatePtr queryJoinDelegate) |
Join multiple tables. More... | |
cbe::QueryChainExt | query (ContainerId containerId, Filter filter, QueryJoinDelegatePtr queryJoinDelegate) |
Join multiple tables using filter (where). More... | |
cbe::QueryChainSync | query (ContainerId containerId) |
Synchronous [exception]. More... | |
cbe::QueryChainSync | query (ContainerId containerId, Filter filter) |
Synchronous [exception] filtered. More... | |
cbe::QueryChainSync | query (ContainerId containerId, QueryJoinError &error) |
Synchronous [non-throwing] query. More... | |
cbe::QueryChainSync | query (ContainerId containerId, Filter filter, QueryJoinError &error) |
Synchronous [non-throwing] filtered query. More... | |
cbe::QueryChain | queryWithPath (std::string relativePath, cbe::ContainerId queryRoot, QueryDelegatePtr delegate) |
Queries items of a container with a given path. More... | |
cbe::QueryChain | queryWithPath (std::string relativePath, QueryDelegatePtr delegate) |
Queries items of a container with a given path relative the home root container. More... | |
cbe::QueryResult | search (std::string tags, cbe::ContainerId containerId, QueryDelegatePtr delegate) |
Select Object's with specified key/values. More... | |
cbe::QueryResult | search (std::string tags, cbe::ContainerId containerId) |
Synchronous [exception] Synchronous version of search(std::string, cbe::ContainerId, QueryDelegatePtr) , and throws an exception, SearchException, in case of a failed call. See search(QueryDelegatePtr) More... | |
cbe::util::Optional< cbe::QueryResult > | search (std::string tags, cbe::ContainerId containerId, SearchError &error) |
Synchronous [non-throwing] search Synchronous version of search(tags, containerId, QueryDelegatePtr) , and throws no exception on error, instead the out/return parameter error is used to provide the error information in connection with a failed call. See search(tags, containerId, QueryDelegatePtr) More... | |
cbe::QueryResult | search (cbe::Filter filter, cbe::ContainerId containerId, QueryDelegatePtr delegate) |
Select Object's with specified key/values using filter. More... | |
cbe::QueryResult | search (cbe::Filter filter, cbe::ContainerId containerId) |
Synchronous [exception] Synchronous version of search(cbe::Filter, cbe::ContainerId, QueryDelegatePtr) , and throws an exception, SearchException, in case of a failed call. See search(QueryDelegatePtr) More... | |
cbe::util::Optional< cbe::QueryResult > | search (cbe::Filter filter, cbe::ContainerId containerId, SearchError &error) |
Synchronous [non-throwing] search Synchronous version of search(filter,containerId,QueryDelegatePtr) , and throws no exception on error, instead the out/return parameter error is used to provide the error information in connection with a failed call. See search(filter,containerId, QueryDelegatePtr) More... | |
bool | clearCache () |
Clear the local cache. More... | |
cbe::Account | account () |
Returns an account object with information on the user. More... | |
std::string | version () const |
Returns the version number of the SDK. More... | |
cbe::GroupManager | groupManager () |
Gets the group manager. More... | |
cbe::ShareManager | shareManager () |
Gets the share manager. More... | |
cbe::PublishManager | publishManager () |
Gets the publish manager. More... | |
void | terminate () |
Terminates the CloudBackend service. More... | |
cbe::SubscribeManager | subscribeManager () |
Gets the subscribe manager. More... | |
CloudBackend (cbe::DefaultCtor) | |
Default constructor. More... | |
operator bool () const | |
Checks if the current instance is real. More... | |
Static Public Member Functions | |
static cbe::CloudBackend | logIn (const std::string &username, const std::string &password, const std::string &tenant, const std::string &client, LogInDelegatePtr delegate) |
Logs in to the CloudBackend service. More... | |
static cbe::CloudBackend | logIn (const std::string &username, const std::string &password, const std::string &tenant, const std::string &client) |
Synchronous [exception] logIn. More... | |
static cbe::CloudBackend | logIn (const std::string &username, const std::string &password, const std::string &tenant, const std::string &client, LogInError &error) |
Synchronous [non-throwing] logIn. More... | |
static cbe::UserId | createAccount (const std::string &username, const std::string &password, const std::string &email, const std::string &firstName, const std::string &lastName, const std::string &tenant, const std::string &client, CreateAccountDelegatePtr delegate) |
Creates a user account. More... | |
static cbe::UserId | createAccount (const std::string &username, const std::string &password, const std::string &email, const std::string &firstName, const std::string &lastName, const std::string &tenant, const std::string &client) |
Synchronous [exception] Creates a user account. More... | |
static cbe::util::Optional< cbe::UserId > | createAccount (const std::string &username, const std::string &password, const std::string &email, const std::string &firstName, const std::string &lastName, const std::string &tenant, const std::string &client, CreateAccountError &error) |
Synchronous [no exception] Synchronous version of createAccount(username,password,email,firstname,lastname,tenant,client,CreateAccountDelegatePtr) , and throws no exception on error, instead the out/return parameter error is used to provide the error information in connection with a failed call. See createAccount(username,password,email,firstname,lastname,tenant,client,CreateAccountDelegatePtr) More... | |
static cbe::Container | castContainer (cbe::Item item) |
Casts an item to a container. More... | |
static cbe::Object | castObject (cbe::Item item) |
Casts an item to an object. More... | |
The session that holds the connection with the cloud.
It ensures the connection is authenticated.
Pointer to cbe::delegate::LogInDelegate() that is passed into asynchronous version of method logIn()
Forms the type of the error
return parameter for the synchronous version of method logIn()
Pointer to delegate::CreateAccountDelegate that is passed into asynchronous version of method createAccount()
Forms the type of the error
return parameter for the synchronous version of method createAccount()
See delegate::CreateAccountDelegate::ErrorInfo
using cbe::CloudBackend::CloudBackendListenerDelegatePtr = std::shared_ptr<delegate::CloudBackendListenerDelegate> |
Pointer to delegate::CloudBackendListenerDelegate that is passed into asynchronous version of method addListener(CloudBackendListenerDelegatePtr)
Pointer to delegate::QueryDelegate that is passed into asynchronous version of methods:
Pointer to delegate::QueryJoinDelegate that is passed into asynchronous version of methods
Pointer to cbe::delegate::QueryDelegate that is passed into asynchronous version of method search() See delegate::object::QueryDelegate::Exception
Forms the type of the error
return parameter for the synchronous version of method search()
See delegate::QueryDelegate::ErrorInfo
cbe::CloudBackend::CloudBackend | ( | cbe::DefaultCtor | ) |
Default constructor.
Construct a new object with the DefaultCtor
to enable the operator bool() test
|
static |
Logs in to the CloudBackend service.
When finished with the usage of the CloudBackend service, call method CloudBackend::terminate() in all cases.
The authentication to the account is determined by username
, password
and tenant
.
Asynchronous version of this service function.
username | Name of the user to be signed in. |
password | Password for the user to be signed in. |
tenant | The identifier for the tenant, formerly known as source . |
client | Identifier of what type of client the program is running on. This is used by the tenant for statistics and selective communication with the users. The tenant administrator defines what client names to use. |
delegate | Pointer to a be::CloudBackend::LogInDelegate() instance that is implemented by the user to receive the response of this login request. This is accomplished in terms of the LogInDelegate callback functions onLogInSuccess() and onLogInError(). |
|
static |
Synchronous [exception] logIn.
Synchronous version of logIn(), and throws an exception, LogInException, in case of a failed login.
LogInException |
|
static |
Synchronous [non-throwing] logIn.
Synchronous version of logIn(), and throws no exception on error, instead the out/return parameter error
is used to provide the error information.
[out] | error | Return parameter containing the error information in case of a failed login. The return value, of type CloudBackend, will indicate false on a failed login, and the LogInError object passed in will we be populated with the error information. |
false
, an error has occurred. I.e., the login has failed, and the error information has been passed out via the error
out/return parameter.
|
static |
Creates a user account.
This method is only granted to the tenant administrator.
Asynchronous version of this service function.
username | Username for the new account |
password | Password for the new account |
Email address to owner of the new account | |
firstName | First name of the owner of the new account |
lastName | Last name of the owner of the new account |
tenant | The identifier for the tenant, formerly known as source . |
client | Describing platform running the software. Names defined by the tenant administrator. |
delegate | Pointer to a delegate::CreateAccountDelegate instance that is implemented by the user. |
|
static |
Synchronous [exception] Creates a user account.
Synchronous version of createAccount(), and throws an exception, CreateAccountException, in case of a failed account creation.
See createAccount()
CreateAccountException |
|
static |
Synchronous [no exception] Synchronous version of createAccount(username,password,email,firstname,lastname,tenant,client,CreateAccountDelegatePtr) , and throws no exception on error, instead the out/return parameter error
is used to provide the error information in connection with a failed call.
See createAccount(username,password,email,firstname,lastname,tenant,client,CreateAccountDelegatePtr)
[out] | error | Return parameter containing the error information in case of a failed call. An empty return value will indicate failure, and the CreateAccountError object passed in will we be populated with the error information. |
false
— indicates a failed call, and the error information is passed out via the error
out/return parameter. ListenerHandle cbe::CloudBackend::addListener | ( | CloudBackendListenerDelegatePtr | listener | ) |
Listen for changes to specific items.
Adds a listener that will receive updates as changes occur on the account.
listener | Delegate is a shared pointer to the class delegate::CloudBackendListenerDelegate that the user has implemented |
void cbe::CloudBackend::removeListener | ( | ListenerHandle | handle | ) |
Delete a specific listener.
Removes a listener that will receive updates as changes occur on the account
handle | Handle previously retrieved from method addListener(CloudBackendListenerDelegatePtr). |
cbe::QueryChain cbe::CloudBackend::query | ( | ContainerId | containerId, |
QueryDelegatePtr | queryDelegate | ||
) |
Select Item's of a container (table).
Inquires for a set of Items from the provided Container, identified by containerId
. Response is delivered asynchronously via the delegate::QueryDelegate callback interface passed in as argument via parameter queryDelegate
.
This overload of join() accepting a QueryDelegate-pointer as parameter has two use cases:
delegate
argument, must be used. Asynchronous version of this service function.
containerId | Id of the container which contents will inquired. |
queryDelegate | Pointer to a QueryDelegate instance, implemented by the user, that receives the response of this query request. I.e., either the QueryDelegate callback function onQuerySuccess() or onQueryError() will be called in the event of success, or failure respectively. |
cloudBackend
object. cbe::QueryChain cbe::CloudBackend::query | ( | ContainerId | containerId, |
Filter | filter, | ||
QueryDelegatePtr | queryDelegate | ||
) |
Select Item's of a container (table) with a filter (where).
Same as query(ContainerId,QueryDelegatePtr), but with an additional parameter filter
.
filter | Filter specifying the constraints of the requested items. |
cbe::QueryChainExt cbe::CloudBackend::query | ( | ContainerId | containerId, |
QueryJoinDelegatePtr | queryJoinDelegate | ||
) |
Join multiple tables.
Same as query(ContainerId,delegate::QueryDelegatePtr), but with a QueryJoinDelegate as delegate, queryJoinDelegate
.
queryJoinDelegate | Pointer to a QueryJoinDelegate instance, implemented by the user, that receives the response of this query request. I.e., either its callback function onQueryJoinSuccess() or onQueryJoinError() will be called in the event of success or failure respectively. |
cbe::QueryChainExt cbe::CloudBackend::query | ( | ContainerId | containerId, |
Filter | filter, | ||
QueryJoinDelegatePtr | queryJoinDelegate | ||
) |
Join multiple tables using filter (where).
Same as query(ContainerId,delegate::QueryJoinDelegatePtr), but with an additional Filter parameter filter
.
filter | Filter specifying the constraints of the requested items. |
cbe::QueryChainSync cbe::CloudBackend::query | ( | ContainerId | containerId | ) |
Synchronous [exception].
Synchronous version of query(ContainerId,delegate::QueryDelegatePtr), and throws an exception, QueryException, in case of a failed query.
QueryException |
cloudBackend
class object. cbe::QueryChainSync cbe::CloudBackend::query | ( | ContainerId | containerId, |
Filter | filter | ||
) |
Synchronous [exception] filtered.
Extended version of query(ContainerId) with an additional filter parameter filter
.
filter | Filter specifying the constraints of the requested items. |
cbe::QueryChainSync cbe::CloudBackend::query | ( | ContainerId | containerId, |
QueryJoinError & | error | ||
) |
Synchronous [non-throwing] query.
In line with synchronous query(ContainerId), but throws no exception on error, instead the out/return parameter error
is used to provide the error information.
[out] | error | Return parameter containing the error information in case of a failed query. The return value, of type QueryChainSync, will indicate false on a failed query, and the passed in QueryJoinError object will we be populated with the error information.Since there might be multiple chained calls after the return from this method, the error information will also contain the index of the failed chained join() call. |
false
an error has occurred, i.e., a failed query, and the error information has been passed out via the error
out/return parameter. cbe::QueryChainSync cbe::CloudBackend::query | ( | ContainerId | containerId, |
Filter | filter, | ||
QueryJoinError & | error | ||
) |
Synchronous [non-throwing] filtered query.
Extended version of query(ContainerId,QueryJoinError&) with an additional filter parameter filter
.
cloudBackend
class object. cbe::QueryChain cbe::CloudBackend::queryWithPath | ( | std::string | relativePath, |
cbe::ContainerId | queryRoot, | ||
QueryDelegatePtr | delegate | ||
) |
Queries items of a container with a given path.
..
or .
relative path options are not permitted. queryRoot
id to downwards path in container tree. relativePath | The relative path from the queryRoot .E.g.: /Documents/Pictures from a queryRoot that has the nested containers Documents and Pictures . |
queryRoot | The container id forming the root of this query. |
delegate | Pointer to a delegate::QueryDelegate instance that is implemented by the user. |
cbe::QueryChain cbe::CloudBackend::queryWithPath | ( | std::string | relativePath, |
QueryDelegatePtr | delegate | ||
) |
Queries items of a container with a given path relative the home root container.
Same as queryWithPath(std::string, cbe::ContainerId, QueryDelegatePtr), but with the queryRoot
parameter omitted. Instead, here the home root container is used as top container in the search tree.
cbe::QueryResult cbe::CloudBackend::search | ( | std::string | tags, |
cbe::ContainerId | containerId, | ||
QueryDelegatePtr | delegate | ||
) |
Select Object's with specified key/values.
Search the whole container for tags related to Objects in the container structure.
E.g., Key = Name, Value Contract/Object/Song => Name:Contract1
.
Search handles tags in combination / conjunction of keys and/or key values separated by |.
E.g., Name:*|Country:Sweden|Country:Norway.
This would search for objects with key Name of any value and where key Country is either Sweden or Norway.
tags | Is a string of key tags or key:value pairs that are separated by |. |
containerId | Is the cbe::ContainerId id of the rootContainer to start the search of objects in. E.g., if starting in the rootContainer, the whole account will be searched for matching tags, key/value's. |
delegate | Is the callback pointer to where the API returns from either cache or Server. |
cbe::QueryResult cbe::CloudBackend::search | ( | std::string | tags, |
cbe::ContainerId | containerId | ||
) |
Synchronous [exception] Synchronous version of search(std::string, cbe::ContainerId, QueryDelegatePtr) , and throws an exception, SearchException, in case of a failed call.
See search(QueryDelegatePtr)
SearchException |
cbe::util::Optional<cbe::QueryResult> cbe::CloudBackend::search | ( | std::string | tags, |
cbe::ContainerId | containerId, | ||
SearchError & | error | ||
) |
Synchronous [non-throwing] search Synchronous version of search(tags, containerId, QueryDelegatePtr) , and throws no exception on error, instead the out/return parameter error
is used to provide the error information in connection with a failed call.
See search(tags, containerId, QueryDelegatePtr)
[out] | error | Return parameter containing the error information in case of a failed call. An empty return value will indicate failure, and the SearchError object passed in will we be populated with the error information. |
false
— indicates a failed call, and the error information is passed out via the error
out/return parameter. cbe::QueryResult cbe::CloudBackend::search | ( | cbe::Filter | filter, |
cbe::ContainerId | containerId, | ||
QueryDelegatePtr | delegate | ||
) |
Select Object's with specified key/values using filter.
Search the whole container with sub-containers related to Objects in the container hierarchy structure.
E.g., Key = Name, Value Contract/Object/Song => Name:Contract1
.
Search handles tags in combination / conjunction of keys and/or key values separated by |.
E.g., Name:*|Country:Sweden|Country:Norway, this would search for objects with key Name of any value and where key Country is either Sweden or Norway.
See Filter.
filter | is a cbe::Filter on which you can set how you want data to be ordered when searching. Remember to set the queryString to be keys/tags or key:value pairs that are separated by |. |
containerId | is the ContainerId of the Container to start the search of Objects in. E.g., if starting in the rootContainer, the whole account will be searched for matching tags, key/value's. |
delegate | is the callback pointer to where the API returns from either cache or Server. |
cbe::QueryResult cbe::CloudBackend::search | ( | cbe::Filter | filter, |
cbe::ContainerId | containerId | ||
) |
Synchronous [exception] Synchronous version of search(cbe::Filter, cbe::ContainerId, QueryDelegatePtr) , and throws an exception, SearchException, in case of a failed call.
See search(QueryDelegatePtr)
Pointer to cbe::delegate::QueryDelegate that is passed into asynchronous version of method search() See delegate::object::QueryDelegate::Exception
SearchException |
cbe::util::Optional<cbe::QueryResult> cbe::CloudBackend::search | ( | cbe::Filter | filter, |
cbe::ContainerId | containerId, | ||
SearchError & | error | ||
) |
Synchronous [non-throwing] search Synchronous version of search(filter,containerId,QueryDelegatePtr) , and throws no exception on error, instead the out/return parameter error
is used to provide the error information in connection with a failed call.
See search(filter,containerId, QueryDelegatePtr)
Forms the type of the error
return parameter for the synchronous version of method search()
See delegate::QueryDelegate::ErrorInfo
[out] | error | Return parameter containing the error information in case of a failed call. An empty return value will indicate failure, and the SearchError object passed in will we be populated with the error information. |
false
— indicates a failed call, and the error information is passed out via the error
out/return parameter.
|
static |
Casts an item to a container.
If the provided cbe::Item "item" is not a cbe::Container "container", an empty container instance is returned
|
static |
Casts an item to an object.
If the provided cbe::Item "item" is not a cbe::Object "object", an empty object instance is returned
bool cbe::CloudBackend::clearCache | ( | ) |
Clear the local cache.
Use if there is a local SDK memory issue.
cbe::Account cbe::CloudBackend::account | ( | ) |
Returns an account object with information on the user.
std::string cbe::CloudBackend::version | ( | ) | const |
Returns the version number of the SDK.
cbe::GroupManager cbe::CloudBackend::groupManager | ( | ) |
Gets the group manager.
cbe::ShareManager cbe::CloudBackend::shareManager | ( | ) |
Gets the share manager.
cbe::PublishManager cbe::CloudBackend::publishManager | ( | ) |
Gets the publish manager.
void cbe::CloudBackend::terminate | ( | ) |
Terminates the CloudBackend service.
Shall also be called in connection with a failed log in.
cbe::SubscribeManager cbe::CloudBackend::subscribeManager | ( | ) |
Gets the subscribe manager.
|
explicit |
Checks if the current instance is real.
An "unreal" instance implies typically a failed login event.
Relies on the Default
constructor
CloudBackend(cbe::DefaultCtor)
true
: is real false
: unreal; got nullptr; if current instance is unbound/undefined. I.e., if it is only default constructed.