![]() |
SDK
2.1.4 [async]
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 | CreateAccountDelegatePtr = delegate::CreateAccountDelegatePtr |
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 |
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::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 (cbe::Filter filter, cbe::ContainerId containerId, QueryDelegatePtr delegate) |
Select Object's with specified key/values using filter. 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::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::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.
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::CreateAccountDelegate that is passed into asynchronous version of method createAccount()
Pointer to cbe::delegate::LogInDelegate() that is passed into asynchronous version of method logIn()
Pointer to delegate::QueryDelegate that is passed into asynchronous version of methods:
Pointer to delegate::QueryJoinDelegate that is passed into asynchronous version of methods
cbe::CloudBackend::CloudBackend | ( | cbe::DefaultCtor | ) |
Default constructor.
Construct a new object with the DefaultCtor
to enable the operator bool() test
cbe::Account cbe::CloudBackend::account | ( | ) |
Returns an account object with information on the user.
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 |
|
static |
Casts an item to a container.
Pointer to cbe::delegate::QueryDelegate that is passed into asynchronous version of method search()
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.
|
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. |
cbe::GroupManager cbe::CloudBackend::groupManager | ( | ) |
Gets the group manager.
|
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(). |
|
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. cbe::PublishManager cbe::CloudBackend::publishManager | ( | ) |
Gets the publish manager.
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, |
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::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::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::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.
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::QueryResult cbe::CloudBackend::search | ( | cbe::Filter | filter, |
cbe::ContainerId | containerId, | ||
QueryDelegatePtr | delegate | ||
) |
Select Object's with specified key/values using filter.
Pointer to cbe::delegate::QueryDelegate that is passed into asynchronous version of method search()
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 | ( | 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::ShareManager cbe::CloudBackend::shareManager | ( | ) |
Gets the share manager.
cbe::SubscribeManager cbe::CloudBackend::subscribeManager | ( | ) |
Gets the subscribe manager.
void cbe::CloudBackend::terminate | ( | ) |
Terminates the CloudBackend service.
Shall also be called in connection with a failed log in.
std::string cbe::CloudBackend::version | ( | ) | const |
Returns the version number of the SDK.