|
Sync Android SDK
1.1.0
|
SyncDocument is an arbitrary JSON value. More...
Public Member Functions | |
| String | getSid () |
| Retrieves a machine-generated unique identifier for this SyncDocument. More... | |
| String | getUniqueName () |
| Retrieves a user-set unique name for this SyncDocument. More... | |
| Date | getDateUpdated () |
| Retrieves a Date when the Document was last updated. More... | |
| JSONObject | getData () |
| Get value of the document as a JSON object. More... | |
| void | setData (JSONObject data, SuccessListener< JSONObject > listener) |
| Set value of the document as a JSON object. More... | |
| void | setData (JSONObject data, Metadata metadata, SuccessListener< JSONObject > listener) |
| Set value of the document as a JSON object. More... | |
| void | mutateData (SyncMutator mutator, SuccessListener< JSONObject > listener) |
| Mutate value of the document using provided Mutator function. More... | |
| void | mutateData (SyncMutator mutator, Metadata metadata, SuccessListener< JSONObject > listener) |
| Mutate value of the document using provided Mutator function. More... | |
| void | setTtl (int ttl, SuccessListener< Void > listener) |
| Set time to live for document object in seconds. More... | |
| void | removeDocument (SuccessListener< Void > listener) |
| Remove document. More... | |
Public Attributes | |
| int | INFINITE_DURATION = 0 |
| Time to live for a document, specifying no expiry. | |
SyncDocument is an arbitrary JSON value.
You can set, get and modify this value.
To obtain an instance of a SyncDocument use SyncClient#openDocument.
| JSONObject com.twilio.sync.SyncDocument.getData | ( | ) |
Get value of the document as a JSON object.
| Date com.twilio.sync.SyncDocument.getDateUpdated | ( | ) |
Retrieves a Date when the Document was last updated.
| String com.twilio.sync.SyncDocument.getSid | ( | ) |
Retrieves a machine-generated unique identifier for this SyncDocument.
| String com.twilio.sync.SyncDocument.getUniqueName | ( | ) |
Retrieves a user-set unique name for this SyncDocument.
| void com.twilio.sync.SyncDocument.mutateData | ( | SyncMutator | mutator, |
| SuccessListener< JSONObject > | listener | ||
| ) |
Mutate value of the document using provided Mutator function.
Uses default metadata.
| mutator | Mutator which will be applied to document data. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncDocument.mutateData | ( | SyncMutator | mutator, |
| Metadata | metadata, | ||
| SuccessListener< JSONObject > | listener | ||
| ) |
Mutate value of the document using provided Mutator function.
| mutator | Mutator which will be applied to document data. |
| metadata | Optional metadata for the updated document, currently only ttl. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncDocument.removeDocument | ( | SuccessListener< Void > | listener | ) |
Remove document.
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncDocument.setData | ( | JSONObject | data, |
| SuccessListener< JSONObject > | listener | ||
| ) |
Set value of the document as a JSON object.
Uses default metadata.
| data | New document data. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncDocument.setData | ( | JSONObject | data, |
| Metadata | metadata, | ||
| SuccessListener< JSONObject > | listener | ||
| ) |
Set value of the document as a JSON object.
| data | New document data. |
| metadata | Optional metadata for the updated document, currently only ttl. |
| listener | Async result listener. See SuccessListener. |
| void com.twilio.sync.SyncDocument.setTtl | ( | int | ttl, |
| SuccessListener< Void > | listener | ||
| ) |
Set time to live for document object in seconds.
This TTL specifies the minimum time the SyncDocument will live, sometime soon after this time the object will be deleted.
If time to live is not specified, object lives infinitely long.
TTL could be used in order to auto-recycle old unused objects, but it is not recommended to build some app logic like timers using ttl.
| ttl | Time to live in seconds from now or INFINITE_DURATION to indicate no expiry. |
| listener | Async result listener. See SuccessListener. |