public interface SyncList
You can add, remove and modify values associated with the indices.
To obtain an instance of a SyncList use SyncClient.openList(com.twilio.sync.SyncOptions, com.twilio.sync.SyncListObserver, com.twilio.sync.SuccessListener<com.twilio.sync.SyncList>).
| Modifier and Type | Interface and Description |
|---|---|
static interface |
SyncList.Item
Single item in a SyncList.
|
static interface |
SyncList.QueryOptions
Options passed while querying SyncList objects within Sync specifying
query parameters and result set position and sorting.
|
static class |
SyncList.QueryOrder
Defines collection query direction (forward or backwards item listing).
|
| Modifier and Type | Field and Description |
|---|---|
static int |
INFINITE_DURATION
Time to live for a list, specifying no expiry.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(org.json.JSONObject itemData,
SuccessListener<SyncList.Item> listener)
Add Item to the SyncList.
|
void |
addItem(org.json.JSONObject itemData,
SyncList.Item.Metadata metadata,
SuccessListener<SyncList.Item> listener)
Add Item to the SyncList.
|
java.util.Date |
getDateUpdated()
Retrieves a Date when the List was last updated.
|
void |
getItem(long itemIndex,
SuccessListener<SyncList.Item> listener)
Retrieve contents of a given Item in the SyncList.
|
void |
getItems(SuccessListener<SyncListIterator> listener)
Get iterator access to all items in the list.
|
java.lang.String |
getSid()
Retrieves a machine-generated unique identifier for this SyncList.
|
java.lang.String |
getUniqueName()
Retrieves a user-set unique name for this SyncList.
|
void |
mutateItem(long itemIndex,
SyncMutator mutator,
SuccessListener<SyncList.Item> listener)
Mutate contents of a given Item in the SyncList.
|
void |
mutateItem(long itemIndex,
SyncMutator mutator,
SyncList.Item.Metadata metadata,
SuccessListener<SyncList.Item> listener)
Mutate contents of a given Item in the SyncList.
|
void |
queryItems(SyncList.QueryOptions options,
SuccessListener<SyncListPaginator> listener)
Query paginated sequence of items from the list, based on query options.
|
SyncList.QueryOptions |
queryOptions()
Provide options for querying items from the SyncList.
|
void |
removeItem(long itemIndex,
SuccessListener<java.lang.Void> listener)
Remove Item from the SyncList.
|
void |
removeList(SuccessListener<java.lang.Void> listener)
Remove entire SyncList object.
|
void |
setItem(long itemIndex,
org.json.JSONObject itemData,
SuccessListener<SyncList.Item> listener)
Set contents of a given Item in the SyncList.
|
void |
setItem(long itemIndex,
org.json.JSONObject itemData,
SyncList.Item.Metadata metadata,
SuccessListener<SyncList.Item> listener)
Set contents of a given Item in the SyncList.
|
void |
setItemTtl(long itemIndex,
int ttl,
SuccessListener<java.lang.Void> listener)
Set time to live for an item in list.
|
void |
setTtl(int ttl,
SuccessListener<java.lang.Void> listener)
Set time to live for list object in seconds.
|
static final int INFINITE_DURATION
java.lang.String getSid()
java.lang.String getUniqueName()
java.util.Date getDateUpdated()
void addItem(org.json.JSONObject itemData,
SuccessListener<SyncList.Item> listener)
metadata.itemData - Item data to add as a JSON object.listener - Async result listener. See SuccessListener.void addItem(org.json.JSONObject itemData,
SyncList.Item.Metadata metadata,
SuccessListener<SyncList.Item> listener)
itemData - Item data to add as a JSON object.metadata - Optional metadata for the added item, currently only ttl.listener - Async result listener. See SuccessListener.void getItem(long itemIndex,
SuccessListener<SyncList.Item> listener)
itemIndex - Index of the item to retrieve.listener - Async result listener. See SuccessListener.void setItem(long itemIndex,
org.json.JSONObject itemData,
SuccessListener<SyncList.Item> listener)
metadata.itemIndex - Index of the item to set.itemData - Item data to set as a JSON object.listener - Async result listener. See SuccessListener.void setItem(long itemIndex,
org.json.JSONObject itemData,
SyncList.Item.Metadata metadata,
SuccessListener<SyncList.Item> listener)
itemIndex - Index of the item to set.itemData - Item data to set as a JSON object.metadata - Optional metadata for the updated item, currently only ttl.listener - Async result listener. See SuccessListener.void mutateItem(long itemIndex,
SyncMutator mutator,
SuccessListener<SyncList.Item> listener)
metadata.itemIndex - Index of the item to mutate.mutator - Mutator function object.listener - Async result listener. See SuccessListener.SyncMutatorvoid mutateItem(long itemIndex,
SyncMutator mutator,
SyncList.Item.Metadata metadata,
SuccessListener<SyncList.Item> listener)
itemIndex - Index of the item to mutate.mutator - Mutator function object.metadata - Optional metadata for the mutated item, currently only ttl.listener - Async result listener. See SuccessListener.SyncMutatorvoid removeItem(long itemIndex,
SuccessListener<java.lang.Void> listener)
itemIndex - Index of the item to remove.listener - Async result listener. See SuccessListener.void getItems(SuccessListener<SyncListIterator> listener)
listener - Async result listener. See SuccessListener.SyncList.QueryOptions queryOptions()
SyncOptionsvoid queryItems(SyncList.QueryOptions options, SuccessListener<SyncListPaginator> listener)
options - Specific query options.listener - Async result listener. See SuccessListener.void setTtl(int ttl,
SuccessListener<java.lang.Void> listener)
This TTL specifies the minimum time the SyncList 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.void setItemTtl(long itemIndex,
int ttl,
SuccessListener<java.lang.Void> listener)
TTL specifies the minimum time the Item 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.
itemIndex - Index of item to set ttl for.ttl - Time to live in seconds from now or SyncList.Item.INFINITE_DURATION to indicate no expiry.listener - Async result listener. See SuccessListener.void removeList(SuccessListener<java.lang.Void> listener)
listener - Async result listener. See SuccessListener.