public interface FirebaseClient
The implementations are meant to work in "one client per database" format.
Modifier and Type | Method and Description |
---|---|
void |
create(io.spine.web.firebase.NodePath nodePath,
NodeValue value)
Writes the specified value to the Firebase database node.
|
void |
delete(io.spine.web.firebase.NodePath nodePath)
Deletes the node under the given path.
|
java.util.Optional<NodeValue> |
fetchNode(io.spine.web.firebase.NodePath nodePath)
Retrieves the value of the specified Firebase database node.
|
void |
subscribeTo(io.spine.web.firebase.NodePath nodePath,
com.google.firebase.database.ChildEventListener listener)
Subscribes to the child events of the given node.
|
void |
update(io.spine.web.firebase.NodePath nodePath,
NodeValue value)
Merges the specified value to the Firebase database node.
|
java.util.Optional<NodeValue> fetchNode(io.spine.web.firebase.NodePath nodePath)
The null
value (i.e. the node is not present in the database) is returned as
Optional.empty()
.
nodePath
- the path to the requested node in the databaseOptional
if the node is not present in the databasevoid subscribeTo(io.spine.web.firebase.NodePath nodePath, com.google.firebase.database.ChildEventListener listener)
nodePath
- the path to the node to subscribe tolistener
- the callbacks invoked on child eventsvoid create(io.spine.web.firebase.NodePath nodePath, NodeValue value)
If the node exists, the value is overridden.
nodePath
- the path to the node in the Firebase databasevalue
- the value to writevoid update(io.spine.web.firebase.NodePath nodePath, NodeValue value)
If the node doesn't exist, it is created with the given value.
If the node exists, the value entries are added to the node children overwriting common ones if present.
nodePath
- the path to the node in the Firebase databasevalue
- the value to mergevoid delete(io.spine.web.firebase.NodePath nodePath)
Does nothing if the node does not exist.
nodePath
- the path to the node to delete