Ditto 2.0.2
Public Member Functions | List of all members
DittoSDK.DittoPendingCollectionsOperation Class Reference

These objects are returned when calling Collections() on DittoStore. More...

Public Member Functions

DittoPendingCollectionsOperation Limit (int limit)
 Limit the number of collections that get returned. More...
 
DittoPendingCollectionsOperation Offset (uint offset)
 Offset the resulting set of collections. More...
 
DittoPendingCollectionsOperation Sort (string query, DittoSortDirection direction)
 Sort the collections based on a property of the collection. More...
 
unsafe List< DittoCollectionExec ()
 Return the list of collections requested based on the preceding function chaining. More...
 
DittoSubscription Subscribe ()
 Subscribes the device to updates about collections that other devices know about. More...
 
DittoLiveQuery Observe (Action< DittoCollectionsEvent > handler)
 Enables you to listen for changes that occur in relation to the collections that are known about. The handler Action gets called when an update is received either locally or remotely. More...
 
DittoLiveQuery ObserveLocal (Action< DittoCollectionsEvent > handler)
 Enables you to listen for changes that occur in relation to the collections that are known about locally. More...
 
DittoLiveQuery ObserveWithNextSignal (Action< DittoCollectionsEvent, Action > handler)
 Enables you to listen for changes that occur in relation to the collections that are known about. The handler Action gets called when an update is received either locally or remotely. You can signal when you are ready for the next event to be delivered. More...
 
DittoLiveQuery ObserveLocalWithNextSignal (Action< DittoCollectionsEvent, Action > handler)
 Enables you to listen for changes that occur in relation to the collections that are known about locally. You can signal when you are ready for the next event to be delivered. More...
 

Detailed Description

These objects are returned when calling Collections() on DittoStore.

They allow chaining of further collections-related functions. You can either call exec on the object to get an array of s as an immediate return value, or you can establish either a live query or a subscription, which both work over time. A live query, established by calling , will notify you every time there's a change in the collections that the device knows about.

A subscription, established by calling Subscribe, will act as a signal to other peers that the device connects to that you would like to receive updates from them about the collections that they know about.

Calling Observe will generate both a subscription and a live query at the same time.

If you'd like to only observe local changes then you can call ObserveLocal(Action<DittoCollectionsEvent>).

Member Function Documentation

◆ Exec()

unsafe List< DittoCollection > DittoSDK.DittoPendingCollectionsOperation.Exec ( )
inline

Return the list of collections requested based on the preceding function chaining.

Returns
A list of DittoCollections based on the preceding function chaining.

◆ Limit()

DittoPendingCollectionsOperation DittoSDK.DittoPendingCollectionsOperation.Limit ( int  limit)
inline

Limit the number of collections that get returned.

Parameters
limitThe maximum number of collections that will be returned.
Returns
A DittoPendingCollectionsOperation that you can chain further function calls to.

◆ Observe()

DittoLiveQuery DittoSDK.DittoPendingCollectionsOperation.Observe ( Action< DittoCollectionsEvent handler)
inline

Enables you to listen for changes that occur in relation to the collections that are known about. The handler Action gets called when an update is received either locally or remotely.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerAn Action that will be called every time there is an update about the list of known about collections.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ ObserveLocal()

DittoLiveQuery DittoSDK.DittoPendingCollectionsOperation.ObserveLocal ( Action< DittoCollectionsEvent handler)
inline

Enables you to listen for changes that occur in relation to the collections that are known about locally.

This won't subscribe to receive updates from other devices and so it will only fires when a local change to the known about collections occurs. If you want to receive remote updates as well then use Observe or call Subscribe.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerAn Action that will be called every time there is an update about the list of known about collections.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ ObserveLocalWithNextSignal()

DittoLiveQuery DittoSDK.DittoPendingCollectionsOperation.ObserveLocalWithNextSignal ( Action< DittoCollectionsEvent, Action >  handler)
inline

Enables you to listen for changes that occur in relation to the collections that are known about locally. You can signal when you are ready for the next event to be delivered.

This won't subscribe to receive updates from other devices and so it will only fires when a local change to the known about collections occurs. If you want to receive remote updates as well then use Observe or call Subscribe.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerAn Action that will be called every time there is an update about the list of known about collections.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ ObserveWithNextSignal()

DittoLiveQuery DittoSDK.DittoPendingCollectionsOperation.ObserveWithNextSignal ( Action< DittoCollectionsEvent, Action >  handler)
inline

Enables you to listen for changes that occur in relation to the collections that are known about. The handler Action gets called when an update is received either locally or remotely. You can signal when you are ready for the next event to be delivered.

The returned DittoLiveQuery object must be kept in scope for as long as you want the provided handler to be called when an update occurs.

Parameters
handlerAn Action that will be called every time there is an update about the list of known about collections.
Returns
A DittoLiveQuery object that must be kept in scope for as long as you want to keep receiving updates.

◆ Offset()

DittoPendingCollectionsOperation DittoSDK.DittoPendingCollectionsOperation.Offset ( uint  offset)
inline

Offset the resulting set of collections.

This is useful if you aren't interested in the first N collections for one reason or another. For example, you might already have obtained the first 20 collections and so you might want to get the next 20 collections, and that is when you would use Offset(uint).

Parameters
offsetThe number of collections that you want the eventual resulting set of collections to be offset by (and thus not include).
Returns
A DittoPendingCollectionsOperation that you can chain further function calls to.

◆ Sort()

DittoPendingCollectionsOperation DittoSDK.DittoPendingCollectionsOperation.Sort ( string  query,
DittoSortDirection  direction 
)
inline

Sort the collections based on a property of the collection.

Parameters
queryThe query specifies the logic to be used when sorting the collections.
directionSpecify whether you want the sorting order to be ascending or descending.
Returns
A DittoPendingCollectionsOperation that you can chain further function calls to.

◆ Subscribe()

DittoSubscription DittoSDK.DittoPendingCollectionsOperation.Subscribe ( )
inline

Subscribes the device to updates about collections that other devices know about.

The returned DittoSubscription object must be kept in scope for as long as you want to keep receiving updates.

Returns
A DittoSubscription object that must be kept in scope for as long as you want to keep receiving updates from other devices about the collections that they know about.