TWSMap Class Reference

Inherits from NSObject
Declared in TWSMap.h

Overview

A map stores unordered JSON objects accessible via a developer defined key.

  sid

The unique identifier for this map.

@property (readonly, nonnull) NSString *sid

Discussion

The unique identifier for this map.

Declared In

TWSMap.h

  uniqueName

The unique name for this map.

@property (readonly, nullable) NSString *uniqueName

Discussion

The unique name for this map.

Declared In

TWSMap.h

  dateUpdated

The date when this map was last updated.

@property (readonly, nullable) NSDate *dateUpdated

Discussion

The date when this map was last updated.

Declared In

TWSMap.h

– getItemWithKey:completion:

Request the map item with the specified key.

- (void)getItemWithKey:(nonnull NSString *)key completion:(nonnull TWSMapItemCompletion)completion

Parameters

key

The key of the item to retrieve.

completion

Completion block that will specify the result of the operation and the requested item if it exists.

Discussion

Request the map item with the specified key.

Declared In

TWSMap.h

– setItemWithKey:data:metadata:completion:

Sets the item for the specified key.

- (void)setItemWithKey:(nonnull NSString *)key data:(nonnull TWSData *)data metadata:(nullable TWSMapItemMetadata *)objectMetadata completion:(nullable TWSMapItemCompletion)completion

Parameters

key

The key of the item to set.

data

The new data.

objectMetadata

Optional metadata for the set item, currently only ttl.

completion

Completion block that will specify the result of the operation and the new item.

Discussion

Sets the item for the specified key.

Declared In

TWSMap.h

– mutateItemWithKey:mutator:metadata:completion:

Modify the MapItem’s data in a conflict-friendly way.

- (void)mutateItemWithKey:(nonnull NSString *)key mutator:(nonnull TWSDataMutator)mutator metadata:(nullable TWSMapItemMetadata *)objectMetadata completion:(nullable TWSMapItemCompletion)completion

Parameters

key

The key of the item to mutate.

mutator

The mutator that you provide to modify the data passed in.

objectMetadata

Optional metadata for the mutated item, currently only ttl.

completion

Completion block that will specify the result of the operation and the updated item.

Discussion

Modify the MapItem’s data in a conflict-friendly way.

Declared In

TWSMap.h

– removeItemWithKey:completion:

Removes the MapItem with the specified key.

- (void)removeItemWithKey:(nonnull NSString *)key completion:(nullable TWSCompletion)completion

Parameters

key

The key of the item to remove.

completion

Completion block that will specify the result of the operation.

Discussion

Removes the MapItem with the specified key.

Declared In

TWSMap.h

– queryItemsWithOptions:completion:

Query the map’s items with the requested parameters. The order of items within the page is not guaranteed.

- (void)queryItemsWithOptions:(nonnull TWSMapQueryOptions *)mapQueryOptions completion:(nonnull TWSMapPaginatorCompletion)completion

Parameters

mapQueryOptions

The options for the map query.

completion

Completion block that will specify the result of the operation and a paginator for this page of results.

Discussion

Query the map’s items with the requested parameters. The order of items within the page is not guaranteed.

Declared In

TWSMap.h

– setTtl:completion:

Set time to live for map object in seconds.

- (void)setTtl:(TWSDuration)ttl completion:(nullable TWSCompletion)completion

Parameters

ttl

Time to live in seconds from now or TWSDurationInfinity to indicate no expiry.

completion

Completion block that will specify the result of the operation.

Discussion

Set time to live for map object in seconds.

This TTL specifies the minimum time the Map 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.

Declared In

TWSMap.h

– setTtl:forItemWithKey:completion:

Set time to live for an item in map.

- (void)setTtl:(TWSDuration)ttl forItemWithKey:(nonnull NSString *)key completion:(nullable TWSCompletion)completion

Parameters

ttl

Time to live in seconds from now or TWSDurationInfinity to indicate no expiry.

key

The key of item to set ttl for.

completion

Completion block that will specify the result of the operation.

Discussion

Set time to live for an item in map.

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.

Declared In

TWSMap.h

– removeMapWithCompletion:

Remove the map from the system, deleting it.

- (void)removeMapWithCompletion:(nullable TWSCompletion)completion

Parameters

completion

Completion block that will specify the result of the operation.

Discussion

Remove the map from the system, deleting it.

Declared In

TWSMap.h