Webcom Android SDK Public API Reference / com.orange.webcom.sdkv2.datasync / DatasyncNode

DatasyncNode

class DatasyncNode : Subscriber

Represents a data node within the tree-like data of a Webcom application.

This class provides basic methods to browse, read, write data nodes, as well as subscribe to some events at a data node. Instances of DatasyncNode are built using the DatasyncManager.node method.

Properties

name

val name: String

Gives the name of the data node represented by this DatasyncNode instance, that is, the key of the last segment of its path.

path

val path: String

Gives the path of the data node represented by this DatasyncNode instance.

webcomRef

val webcomRef: Webcom

Functions

cancelNextDisconnectionAction

fun cancelNextDisconnectionAction(): Unit

Cancels any previous write operation on this data node with the DatasyncTime.AtNextDisconnection policy.

catchingCancel

fun catchingCancel(function: (WebcomError) -> Unit): Subscriber

Registers a cancellation callback for the next subscription to a callback function.

child

fun child(path: String): DatasyncNode

Returns a child of this data node specified by a path relative to the data node represented by this DatasyncNode instance.

clear

fun clear(at: DatasyncTime = DatasyncTime.Now, callback: WebcomDoneCallback? = null): Unit

Clears data at this data node asynchronously.

fun clear(callback: WebcomDoneCallback): Unit

createChild

fun createChild(): DatasyncNode

Returns a child of this data node with a unique key.

div

operator fun div(path: String): DatasyncNode

Shortcut for child.

get

fun get(callback: WebcomResultCallback<DatasyncValuable>): Unit

Reads the data at this data node asynchronously.

merge

fun merge(at: DatasyncTime = DatasyncTime.Now, value: Any?, callback: WebcomDoneCallback? = null): Unit

Merges some data with the data at this data node asynchronously.

fun merge(value: Any?, callback: WebcomDoneCallback? = null): Unit

parent

fun parent(): DatasyncNode?

Gets the parent data node of this DatasyncNode instance.

plusAssign

operator fun plusAssign(value: Any?): Unit

Shortcut for push.

push

fun push(value: Any?, callback: WebcomDoneCallback? = null): DatasyncNode

Creates a child of this data node with a unique key and writes a given value at it.

runTransaction

fun runTransaction(transaction: (DatasyncValuable) -> TransactionOperation, callback: WebcomResultCallback<TransactionResult>? = null): Unit

Performs an atomic write operation (or transaction) on this data node.

set

fun set(at: DatasyncTime = DatasyncTime.Now, value: Any?, callback: WebcomDoneCallback? = null): Unit

Writes some data at this data node asynchronously.

fun set(value: Any?, callback: WebcomDoneCallback? = null): Unit

Inherited Functions

subscribe

fun subscribe(type: Child, constraint: Constraint = Constraint.None, callback: (ChildEvent) -> Unit): Subscription

Subscribes to a Child event with a given constraint on this data node and send notifications to a callback function.

fun subscribe(type: ValueChanged.WithData, constraint: Constraint = Constraint.None, callback: (ValueChangedWithDataEvent) -> Unit): Subscription

Subscribes to a ValueChanged.WithData event with a given constraint on this data node and send notifications to a callback function.

fun subscribe(type: ValueChanged.WithoutData, constraint: Constraint = Constraint.None, callback: (ValueChangedWithoutDataEvent) -> Unit): Subscription

Subscribes to a ValueChanged.WithoutData event with a given constraint on this data node and send notifications to a callback function.

subscribeToNotifications

fun subscribeToNotifications(type: Type, expirationDate: Date? = null, cipher: CryptoMethod = CryptoMethod.None, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit

Subscribes to a type of event on this data node until a given expirationDate and push notifications to the mobile device.

fun subscribeToNotifications(type: Type, duration: Duration, cipher: CryptoMethod = CryptoMethod.None, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit

Subscribes to a type of event on this data node for a given duration and push notifications to the mobile device.

subscribeToWebhook

fun subscribeToWebhook(type: Type, identifier: String, context: String, expirationDate: Date? = null, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit

Subscribes to a type of event on this data node until a given expirationDate and send notifications to a webhook.

fun subscribeToWebhook(type: Type, identifier: String, context: String, duration: Duration, includesRevocation: Boolean = true, callback: WebcomResultCallback<Subscription>): Unit

Subscribes to a type of event on this data node for a given duration and send notifications to a webhook.