Main methods used in the Sailfish framework.

Authenticate the user by login and password
To authenticate the user by login and password, use the "auth" method:
std::string hhive::HHive::auth (
std::string login,
std::string password
)
Arguments:
login. User login.
password. User password.
The method returns JSON as a string with server response.
To get a certificates list, use the getDSSCertificates method:
std::string hhive::HHive::getDSSCertificates (
std::string password
)
Arguments:
password. DSS user password.
The method returns JSON as a string with server response.
To sign a cell, use the signDSSCertificate method:
std::string hhive::HHive::signDSSCertificate (
std::string resource,
std::string tableName,
std::string requestParams,
std::string column,
std::string row,
std::string password,
std::string certificateID,
std::string certificatePin
)
Arguments:
resource. Resource name.
tableName. Table name with server cache.
requestParams. Parameters, with which a request to get data of cached resource was called.
column. Table column name.
hhiveID. Row name.
password. DSS user password.
certificateID. Certificate ID.
certificatePin. Certificate PIN.
The method returns JSON as a string with server response.
To set server URL, use the setUrl method:
void hhive::HHive::setUrl (
std::string url
)
Arguments:
url. Server URL.
To get server URL, use the "url" method:
std::string hhive::HHive::url (
)
const
To set API version, use the setApi method:
void hhive::HHive::setApi (
std::string api
)
Arguments:
api. API version.
To set application name, use the setApp method:
void hhive::HHive::setApp (
std::string app
)
Arguments:
app. Application name.
To connect to database, use the openDatabase method:
bool hhive::HHive::openDatabase (
std::string path,
std::string key
)
Arguments:
path. Path to the database containing database name.
key. Database password.
NOTE. Password can be an empty string.
The method returns True if the connection is successful, otherwise the method returns False.

Execute request in opened database
To execute a request in an opened database, use the "query" method:
std::string hhive::HHive::query (
std::string database,
std::string query
)
Arguments:
database. Path to the database containing database name.
query. SQL query.
To get resource tables list, use the getTablesName method:
std::string hhive::HHive::getTablesName ( std::string database,
std::string resource,
std::string params,
std::string tableName
)
Arguments:
database. Path to the database containing database name.
resource. Resource name.
params. Parameters that were used to get resource data.
tableName. Table name at server. It is used to get a specific table in a multi-table resource.
The method returns JSON as a string with table names list.
To delete the saved version of cache by parameters from database, use the dropCache method:
std::string hhive::HHive::dropCache ( std::string database,
std::string resource,
std::string params
)
Arguments:
database. Path to the database containing database name.
resource. Resource name.
params. Parameters that were used to get resource data.
The method returns request execution result as JSON.
To disconnect database, use the closeDatabase method:
bool hhive::HHive::closeDatabase (
std::string path
)
Arguments:
path. Path to the database containing database name.
The method returns True if disconnection was successful, otherwise the method returns False.

Get resource data with scalar parameters
To get resource data with scalar parameters, use the deltaStreamRequest method:
std::string hhive::HHive::deltaStreamRequest (
const std::string & resource,
const DeltaParams & params
)
Arguments:
resource. Resource name.
params. Additional request parameters.
The method returns JSON as a string with server response.

Get resource data with table parameters
To get resource data with table parameters, use the tableRequest method:
std::string hhive::HHive::tableRequest (
std::string resource,
std::string transactionID,
TableParams params
)
Arguments:
resource. Resource name.
transactionID. Transaction ID.
params. Additional request parameters.
The method returns JSON as a string with server response.

Get resource data with table or scalar parameters
To get resource data with table or scalar parameters, use the tableStreamRequest method:
std::string hhive::HHive::tableStreamRequest (
std::string resource,
std::string transactionID,
TableStreamParams params
)
Arguments:
resource. Resource name.
transactionID. Transaction ID.
NOTE. It is set only for resource with table parameters.
params. Additional request parameters.
The method returns JSON as a string with server response.
To get all resources list, use the "resources" method:
std::string hhive::HHive::resources (
std::string databasePath
)
Arguments:
databasePath. Database file name.
NOTE. If the file does not exist at the specified path, it is created automatically.
The method saves the obtained resources list to database.
To set an environment name, use the setEnvironment method:
void hhive::HHive::setEnvironment (
std::string environment
)
Arguments:
environment. Environment name.
To set a project name, use the setProject method:
void hhive::HHive::setProject (
std::string project
)
Arguments:
project. Project name.
To set a device identifier, use the setDevice method:
void hhive::HHive::setDevice (
std::string device
)
Arguments:
device. Device identifier.
To get an environment name, use the "environment" method:
std::string hhive::HHive::environment (
)
const
To get a project name, use the "project" name:
std::string hhive::HHive::project (
)
const
To get a device identifier, use the "device" method:
std::string hhive::HHive::device (
)
const
To load a file to server, use the putFile method:
std::string hhive::HHive::putFile (
std::string mountName,
std::string filename,
std::string localFilename
)
Arguments:
mountName. Mount point name at server
filename. Path to the file at server containing file name.
localFilename. Path to the local file containing local file name.
The method returns JSON as a string with server response.
To get a file, use the getFile method:
std::string hhive::HHive::getFile (
std::string mountName,
std::string filename,
std::string localFilename
)
Arguments:
mountName. Mount point name at server
filename. Path to the file at server containing file name.
localFilename. Path to the local file containing file name.
The method returns JSON as a string with server response.

Get information about file at server
To get information about file at server, use the getFileMeta method:
std::string hhive::HHive::getFileMeta (
std::string mountName,
std::string filename
)
Arguments:
mountName. Mount point name at server
filename. Path to the file containing file name.
The method returns JSON as a string with server response.
To get directory contents, use the getDirectoryContent method:
std::string hhive::HHive::getDirectoryContent (
std::string mountName,
std::string dirPath
)
Arguments:
mountName. Mount point name at server
filename. Path to directory.
The method returns JSON as a string with server response, directory contents as a files list, and folders of the specified directory.
To delete file at server, use the deleteFile method:
std::string hhive::HHive::deleteFile (
std::string mountName,
std::string filename
)
NOTE. Local files are not deleted.
Arguments:
mountName. Name of mount point at server.
filename. Path to the file at server containing file name.

Get data about completed transaction
To get data about completed transaction, use the getTransaction method:
std::string hhive::HHive::getTransaction (
std::string resource,
std::string transactionID
)
Arguments:
resource. Resource name.
transactionID. Transaction ID.
The method returns JSON as a string with server response.

Get completed transactions list with table resource
To get completed transactions list with table resource, use the getAllTransaction method:
std::string hhive::HHive::getAllTransaction (
std::string resource
)
Arguments:
resource. Resource name.
To delete transaction at server, use the deleteTransaction method:
std::string hhive::HHive::deleteTransaction (
std::string resource,
std::string transactionID
)
Arguments:
resource. Resource name.
transactionID. Transaction ID.
To initialize and set up the Sailfish framework, see the Initializing and Setting Up Sailfish Framework section.
See also:
Sailfish Framework | Initializing and Setting Up Sailfish Framework | Auxiliary Classes