OMCFetchObjectCollectionBuilder Class Reference

Inherits from NSObject
Declared in OMCFetchObjectCollectionBuilder.h

Overview

Fetch objectCollection builder to get OMCMobileObjectCollection

– getSyncPolicy

  • Gets currently set SyncPolicy
- (OMCSyncPolicy *)getSyncPolicy

Return Value

OMCSyncPolicy object, if not set will return default SyncPolicy.

Declared In

OMCFetchObjectCollectionBuilder.h

– setSyncPolicy:

  • Sets SyncPolicy
- (void)setSyncPolicy:(OMCSyncPolicy *)syncPolicy

Parameters

syncPolicy

will set the passed policy as current SyncPolicy

Declared In

OMCFetchObjectCollectionBuilder.h

– setSyncPolicyFetchFromServer

Sets Fetch policy in SyncPolicy as FETCH_POLICY_FETCH_FROM_SERVICE_IF_ONLINE. Other policies in SyncPolicy will remain same.

- (void)setSyncPolicyFetchFromServer

Declared In

OMCFetchObjectCollectionBuilder.h

– withParamName:paramValue:

Specifies query parameters. (Will override existing parameters with the same name)

- (void)withParamName:(NSString *)name paramValue:(NSString *)value

Parameters

name

name of the query param

value

value of the query param

Declared In

OMCFetchObjectCollectionBuilder.h

– queryForProperty:comparision:compareWith:

  • Sets the query to use when fetching data from the local cache.
  • Must initialize synchronization with the custom class with properties for which to query on.
  • And use that custom class in openEndpoint.
- (void)queryForProperty:(NSString *)propertyName comparision:(SyncCompareOperator)compareOperation compareWith:(id)propertyValue

Parameters

propertyName

name of the property to query on

compareOperation

compare operator

propertyValue

value to compare

Declared In

OMCFetchObjectCollectionBuilder.h

– sortByAscending:

  • Specifies an ascending sort for the results. Multiple sorts can be specified.
- (void)sortByAscending:(NSString *)propertyName

Parameters

propertyName

Name of the property to sort on. The sort will be ascending.

Declared In

OMCFetchObjectCollectionBuilder.h

– sortByDescending:

  • Specifies a descending sort for the results. Multiple sorts can be specified.
- (void)sortByDescending:(NSString *)propertyName

Parameters

propertyName

Name of the property to sort on. The sort will be descending.

Declared In

OMCFetchObjectCollectionBuilder.h

– setRequestHeaders:

Sets extra request headers. No need to specify headers for authorization and content-type, as they will be added by default.

- (void)setRequestHeaders:(NSDictionary *)headers

Parameters

headers

Extra request headers

Declared In

OMCFetchObjectCollectionBuilder.h

– executeFetchOnSuccess:OnError:

  • Execute the Get request. Based on the set policy, it will go to the server, to the local cache, or to both.
- (void)executeFetchOnSuccess:(OMCFetchCollectionSuccess)successBlk OnError:(OMCSyncErrorBlock)errorBlk

Parameters

successBlk

block that will be called after the request has successfully finished with the mobile resource.

errorBlk

block that will be called after the request has finished with an error.

Declared In

OMCFetchObjectCollectionBuilder.h