hubiC DBus API Documenation


Table of Contents

com.hubic.general — General API, always available
com.hubic.account — Account dependant API.
com.hubic.settings
com.hubic.backup — Controls backup state and settings.

Introduction

As the hubiC client is just a headless service, it exposes an API to communicate with third party software. This API can be consumed with the widely used D-Bus IPC machanism.

The API is exposed on a session bus with com.hubiC unique bus name. It is splitted over multiple objects.

The background synchronization process is registered as a D-Bus service so it should be started transparently when calling the API if it's not already running.


Name

com.hubic.general — General API, always available

Methods

Login     (IN  s email,
           IN  s password,
           IN  s synchronizedDir);
Reconnect ();
Stop      ();

Signals

Messages     (i level,
              s message,
              s targetPath);
StateChanged (s oldState,
              s newState);

Properties

CurrentState          readable   s
CurrentUploadSpeed    readable   x
CurrentDownloadSpeed  readable   x
LastMessages          readable   a(xiss)

Description

Holds methods and properties that are not directly tied to a specific account. All methods and properties of this interface will be available at anytime.

This interface is exposed through the /com/hubic/General object.

Method Details

The Login() method

Login (IN  s email,
       IN  s password,
       IN  s synchronizedDir);

Connects to an existing account and starts synchronising given folder.

To connect without syncing, pass an empty string to synchronizedDir.

This method will not return until connection sequence has either finished successfully or failed (which can last up to 10 seconds).

IN s email:

Account email address.

IN s password:

Account password string.

IN s synchronizedDir:

Directory to synchronize (absolute path).

The Reconnect() method

Reconnect ();

If a connection has been already established, it can be resumed without passing credentials again with this method.

A possible use of this method is to retry connection if the automatic one failed for some reason (network not yet up, synchronized dir not yet mounted, ...) or if you called Logout() before.

The Stop() method

Stop ();

Stops synchronization process.

Signal Details

The "Messages" signal

Messages (i level,
          s message,
          s targetPath);

Messages emitted during synchronization to under exceptional circumstances.

Message levels are:

0: Information
1: Warning
2: Error
3: Critical

i level:

Importance level. The higher it is, the more critical is the message.

s message:

Message body. It is ready to be displayed to user and localized whenever possible.

s targetPath:

Message target path. If message is about a particular file (for instance when a conflict occur), the path to the file will be provided. Otherwise this is an empty string.

The "StateChanged" signal

StateChanged (s oldState,
              s newState);

Fired when swtiching from one state to anther. See "CurrentState" for a list of possible states.

s oldState:

The state before change.

s newState:

The new state after the event.

Property Details

The "CurrentState" property

CurrentState  readable   s

The current state of the client. Possible states are:

NotConnected: Client is not connected to an account
Connecting: Connection is in progress
Paused: Client is in pause, no synchronization will occur
Idle: Connected, watching for changes and wait for next sync
Busy: Connected and currently index/synchronize content

The "CurrentUploadSpeed" property

CurrentUploadSpeed  readable   x

The current upload speed. It includes any utility requests that can be done by client such as listings, ...

The "CurrentDownloadSpeed" property

CurrentDownloadSpeed  readable   x

The current download speed. It includes any utility requests that can be done by client such as listings, ...

The "LastMessages" property

LastMessages  readable   a(xiss)

History of 10 last "Messages" signals preceeded by a Unix timestamp.


Name

com.hubic.account — Account dependant API.

Methods

Logout              ();
SynchronizeNow      ();
SetPauseState       (IN  b     paused);
Publish             (IN  s     absolutePath);
PublishWithDuration (IN  s     absolutePath,
                     IN  i     duration);
Unpublish           (IN  s     absolutePath);
GetPublishUrl       (IN  s     absolutePath,
                     OUT s     ret);
GetItemStatus       (IN  s     absolutePath,
                     OUT (sbb) ret);
CreateBackup        (IN  s     path,
                     IN  s     name,
                     IN  s     frequency,
                     IN  i     versionsKept,
                     IN  b     keepDeletedFiles);

Signals

ItemChanged (s absolutePath);

Properties

QueueStatus        readable   (iiixx)
RunningOperations  readable   a(xsssxx)
PublishedFiles     readable   a(ssx)
Account            readable   s
SynchronizedDir    readwrite  s
ExcludedFolders    readwrite  as
TotalBytes         readable   x
UsedBytes          readable   x

Description

Holds methds and properties that are are linked to the current connected account (if any).

In NotConnected or Connecting states, methods usually raises an error if they are called, properties returns a default value for Get opreation, Set also results in error.

This interface is exposed through the /com/hubic/Account object.

Method Details

The Logout() method

Logout ();

Disconnect current account so you can call Login() or Reconnect() again.

The SynchronizeNow() method

SynchronizeNow ();

Triggers an immediate and complete synchronization cycle.

The SetPauseState() method

SetPauseState (IN  b paused);

Change pause status. When enabling pause state, aborts any running operation. When resuming synchronization, makes a complete synchronization cycle.

See "CurrentState" and "StateChanged"

IN b paused:

true to set account in Paused state, false to resume synchronization.

The Publish() method

Publish (IN  s absolutePath);

Publish a new file or folder. On failure, an error is raised and a message is sent over "Messages" explaining what went wrong.

IN s absolutePath:

File to publish.

The PublishWithDuration() method

PublishWithDuration (IN  s absolutePath,
                     IN  i duration);

Publish a new file or folder. On failure, an error is raised and a message is sent over "Messages" explaining what went wrong.

In case of illegal TTL, just the error will be raised.

IN s absolutePath:

File to publish.

IN i duration:

Publication time to live (in days). Currently legal values are 1, 5, 10, 15, 20, 25, 30.

The Unpublish() method

Unpublish (IN  s absolutePath);

Deleted publication of a file. If the file were not published, this is a no-op.

IN s absolutePath:

File to unpublish.

The GetPublishUrl() method

GetPublishUrl (IN  s absolutePath,
               OUT s ret);

Retrieves the URL of an already published file. If path was not published this result in an error.

IN s absolutePath:

File to get the public URL.

OUT s ret:

Public URL.

The GetItemStatus() method

GetItemStatus (IN  s     absolutePath,
               OUT (sbb) ret);

This method is intended to quickly gives the status of a particular file or folder. It notably used to draw the overlay icons on Windows and MacOSX.

This method does not raise error if it is called in NotConnected or Connecting state.

The returned tuple is (in order):

Status (string)

The synchronization status. It can be Synchronized (file is ok), Unsynchronized (the file is either downloading or uploading), NoStatus (the file is filtered out or outside of synchronized directory) or else Error when an unexpected exception happen.

IsPublished (bool)

Whether the item is published or not.

CanBePublished (bool)

Whether the item could be published. It this is false, trying to Publish() the item will certainly fail.

IN s absolutePath:

File to get the status from.

OUT (sbb) ret:

A tuple containing the file status.

The CreateBackup() method

CreateBackup (IN  s path,
              IN  s name,
              IN  s frequency,
              IN  i versionsKept,
              IN  b keepDeletedFiles);

This method creates a new backup, the created backup will be acessible through /com/hubib/Backup/<name> path.

This method may raise an error if the name or frequency are invalid, if the path cannot be accessed, ...

IN s path:

Local folder to backup

IN s name:

Backup name (must be a unique non empty string)

IN s frequency:

Automatic backup frequency. Must be one of: "never", "hourly", "daily", "weekly" (case insensitive).

IN i versionsKept:

Number of versions to keep (0: no versioning, negative: infinite versioning)

IN b keepDeletedFiles:

whether or not the locally deleted files are also deleted on hubiC.

Signal Details

The "ItemChanged" signal

ItemChanged (s absolutePath);

Signal raised when a file or folder status changed somehow so GetItemStatus() should be called again to update file (e.g. change overlay icon, ...).

This signal can be raised in following cases:

The item has been modified so it need to be synced,
The item synchronization operation(s) has been finished,
The item has been (un)published.

s absolutePath:

File or folder to update.

Property Details

The "QueueStatus" property

QueueStatus  readable   (iiixx)

Current status of synchronization queue. Gives how many items are wating to be synchronized. This will be non-zero only in Busy state.

The tuple is (in order):

QueuedUploads (int)

Number of queued upload operations.

QueuedDownloads (int)

Number of queued download operations.

QueuedMisc (int)

Number of other queued operation. This include deletes, copies, renames, ...

QueuedBytesToUpload (long)

Amount of bytes to upload. Sum of sizes of QueuedUploads

QueuedBytesToDownload (long)

Amount of bytes to download. Sum of sizes of QueuedDownloads

The "RunningOperations" property

RunningOperations  readable   a(xsssxx)

List of currently running operations. It will be an empty list except during Busy state.

The value is an array of tuples, themselves composed of (in order):

Id (int)

Some unique operation id. Can be used to bind some progress indicator to the operation.

SourcePath (string)

File on which operation work.

DestinationPath (string)

Only used for copies and renames.

OperationType (string)

Name of operation.

BytesDone (long)

Current progress of operation (for Upload and Download), or else -1 if operation does not have progress.

TotalBytes (long)

Size of file to process (for Upload and Download), or else -1 if operation does not have progress.

The "PublishedFiles" property

PublishedFiles  readable   a(ssx)

List of all published files. This list is cached locally and is updated time to time so it is fast to retrieve (but may not be up to date in some cases).

The value is an array of tuples, themselves composed of (in order):

Path (string)

File on which operation work.

Url (string)

The public HTTP link to see publication.

PublishedUntil (long)

Date of the end of publication (Unix timestamp).

The "Account" property

Account  readable   s

Account email address. Returns an empty string when no account is connected.

The "SynchronizedDir" property

SynchronizedDir  readwrite  s

Currently synchronized directory. Can be changed at anytime (as long as account is connected). If operations were in progress, they are interrupted.

To disable synchronization, set the property to an empty string.

Returns an empty string when no account is connected or when synchronization is disabled.

The "ExcludedFolders" property

ExcludedFolders  readwrite  as

Folders that will not be synchronized nor indexed. This is a collection of absolute paths, all of them must be inside "SynchronizedDir".

It can be changed at anytime (as long as account is connected). If operations were in progress, they are interrupted.

Returns an empty array when no account is connected.

The "TotalBytes" property

TotalBytes  readable   x

Available bytes on this account or -1 for unlimited accounts or when no account is connected.

The "UsedBytes" property

UsedBytes  readable   x

Currently used bytes. May take some minutes to update after operations have been done. Returns -1 when no account is connected.


Name

com.hubic.settings

Methods

GetSetting            (IN  s setting,
                       OUT s ret);
SetSetting            (IN  s setting,
                       IN  s value);
SetProxy              (IN  s hostname,
                       IN  i port);
SetAuthenticatedProxy (IN  s hostname,
                       IN  i port,
                       IN  s username,
                       IN  s password);
UnsetProxy            ();

Properties

TimeBetweenSynchronization  readwrite  u
UseRecycleBin               readwrite  b
AllowBugReporting           readwrite  b
UploadSpeedLimit            readwrite  x
DownloadSpeedLimit          readwrite  x
ProxyEnabled                readable   b
ProxyHost                   readable   s
ProxyPort                   readable   i
ProxyUsername               readable   s

Description

Method Details

The GetSetting() method

GetSetting (IN  s setting,
            OUT s ret);

Retriees a setting value as string.

IN s setting:

name of a property.

OUT s ret:

setting value serialized as string.

The SetSetting() method

SetSetting (IN  s setting,
            IN  s value);

Set a setting value with a serialized string. As string serialization method is implementation defined, this method should be avoided.

IN s setting:

name of a property.

IN s value:

new setting value serialized as string.

The SetProxy() method

SetProxy (IN  s hostname,
          IN  i port);

Install a new unauthenticated proxy. Overwrites any previous proxy configuration.

IN s hostname:

host name or IP address of the new proxy.

IN i port:

port of the new proxy.

The SetAuthenticatedProxy() method

SetAuthenticatedProxy (IN  s hostname,
                       IN  i port,
                       IN  s username,
                       IN  s password);

Installs a new authenticated proxy. Overwrites any previous proxy configuration.

IN s hostname:

host name or IP address of the new proxy.

IN i port:

port of the new proxy.

IN s username:

IN s password:

The UnsetProxy() method

UnsetProxy ();

Reset proxy configuration to direct Internet access.

Property Details

The "TimeBetweenSynchronization" property

TimeBetweenSynchronization  readwrite  u

Interval between two complete synchronization cycles in minutes. Note that local changes are detected immediately and trigger partial synchronizations independentely of this setting.

The "UseRecycleBin" property

UseRecycleBin  readwrite  b

Whether locally deleted files are placed in recylce bin or deleted directly. Trash can is not yet implemented under Linux !

The "AllowBugReporting" property

AllowBugReporting  readwrite  b

Whether automated bug reports are sent over unexpected errors.

The "UploadSpeedLimit" property

UploadSpeedLimit  readwrite  x

Maximum upload speed in bytes per second (0 means unlimited).

The "DownloadSpeedLimit" property

DownloadSpeedLimit  readwrite  x

Maximum download speed in bytes per second (0 means unlimited).

The "ProxyEnabled" property

ProxyEnabled  readable   b

Whether or not a proxy is currently enabled.

The "ProxyHost" property

ProxyHost  readable   s

Current proxy host or IP address. (Empty string if proxy is disabled)

The "ProxyPort" property

ProxyPort  readable   i

Current proxy port. (0 if proxy is disabled)

The "ProxyUsername" property

ProxyUsername  readable   s

Current proxy user name. (Empty string if proxy disabled or does not need authentication.


Name

com.hubic.backup — Controls backup state and settings.

Methods

BackupNow            ();
DownloadInto         (IN  s localPath);
AttachToThisComputer (IN  s localPath);
Delete               ();

Properties

Name              readable   s
Owned             readable   b
LastBackup        readable   x
Size              readable   x
LocalPath         readwrite  s
BackupInProgress  readable   b
Frequency         readwrite  s
DeletePolicy      readwrite  s
VersionsKept      readwrite  i

Description

For each backup, an object of this interface is available under the path /com/hubic/Backup/<name>.

Objects of this type does ont exists in NotConnected or Connecting states.

Note that the backup are attached to only one client (see the man page for details). This is reflected by the com.hubic.backup::Owned attribute. Some operations are allowed only for owned backups (otherwise they would raise errors).

Method Details

The BackupNow() method

BackupNow ();

Triggers an immediate update of the backup. The backup needs to be owned.

The DownloadInto() method

DownloadInto (IN  s localPath);

Triggers the download of the backup into given local folder. This method is asynchronous and return immediately.

IN s localPath:

the local path to download into. Needs to be an empty folder.

The AttachToThisComputer() method

AttachToThisComputer (IN  s localPath);

Attach a unowned backup to local folder. See man page for details about backup ownership.

IN s localPath:

the local path to attach to.

The Delete() method

Delete ();

Triggers the deletion of the backup and all attached files. This method is asynchronous and return immediately.

Property Details

The "Name" property

Name  readable   s

Unique backup name. It can be set only at creation time.

The "Owned" property

Owned  readable   b

Whether or not the backup is attached on this client.

The "LastBackup" property

LastBackup  readable   x

UNIX timestamp of the last full backup cycle. Can be -1 if the backup is in progress (this also include new backups).

The "Size" property

Size  readable   x

Size of the backup in bytes. Note this does not reflect the size of the local folder, as versions are counted too and some data compression could occur.

The "LocalPath" property

LocalPath  readwrite  s

Local backup path. It can be changed to another folder, this will trigger an update.

The "BackupInProgress" property

BackupInProgress  readable   b

Whether or not a backup is in progress.

The "Frequency" property

Frequency  readwrite  s

The automatic backup frequency. This must br one of "never", "hourly", "daily", "weekly" (case insensitive).

The "DeletePolicy" property

DeletePolicy  readwrite  s

The behavior when a file is deleted. It must be one of "keep" (do not delete files on hubiC), "delete" (forward delete to hubiC).

The "VersionsKept" property

VersionsKept  readwrite  i

Number of older versions to keep. 0 means no versioning, a negative number means infinite versioning.