Inherits from NSObject
Declared in NetmeraService.h
NetmeraService.m

Overview

NetmeraService is used to get NetmeraContent object by its search and get methods. Many query options defined to help finding exact object.

Tasks

Properties

conditionalMap

List to add queries for the search

@property (nonatomic, strong) NSMutableDictionary *conditionalMap

Discussion

List to add queries for the search

Declared In

NetmeraService.h

locationSearchField

the field that holds location info

@property (nonatomic, strong) NSString *locationSearchField

Discussion

the field that holds location info

Declared In

NetmeraService.h

max

Maximum number of the content to return

@property (nonatomic, setter=setMax:) int max

Discussion

Maximum number of the content to return

Declared In

NetmeraService.h

objectName

Name of the content

@property (nonatomic, strong) NSString *objectName

Discussion

Name of the content

Declared In

NetmeraService.h

page

Number of the pages

@property (nonatomic, setter=setPage:) int page

Discussion

Number of the pages

Declared In

NetmeraService.h

path

Path of the content

@property (nonatomic, strong) NSString *path

Discussion

Path of the content

Declared In

NetmeraService.h

queries

List to add queries for the search

@property (nonatomic, strong) NSMutableArray *queries

Discussion

List to add queries for the search

Declared In

NetmeraService.h

searchText

Text to search

@property (nonatomic, strong) NSString *searchText

Discussion

Text to search

Declared In

NetmeraService.h

searchType

the search type

@property (nonatomic, strong) NSString *searchType

Discussion

the search type

Declared In

NetmeraService.h

sortBy

Name of the field that is used for sorting

@property (nonatomic, strong) NSString *sortBy

Discussion

Name of the field that is used for sorting

Declared In

NetmeraService.h

sortOrder

Enum type of order to use while sorting

@property (nonatomic) enum SortOrder sortOrder

Discussion

Enum type of order to use while sorting

Warning: Available enum options for sort order

ascending, sorts contents by increasing order

descending, sorts contents by decreasing order

Declared In

NetmeraService.h

Instance Methods

addSearchText:

Adds the searchText into the query.

- (void)addSearchText:(NSString *)searchText

Parameters

searchText

Text to search

Discussion

Adds the searchText into the query.

Declared In

NetmeraService.h

boxSearchInBackgroundWithTarget:selector:firstLocation:secondLocation:locationSearchField:

Creates box using the given two location (latitude,longitude) data and searches inside that box in the background thread.Since it runs on the background thread it does not block program.It is recommended over boxSearch method.

- (void)boxSearchInBackgroundWithTarget:(id)target selector:(SEL)selector firstLocation:(NetmeraGeoLocation *)firstPoint secondLocation:(NetmeraGeoLocation *)secondPoint locationSearchField:(NSString *)locationSearchField

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void) callBackBoxSearchWithContentArray:(NSArray)netmeraContentArray error:(NSError )error. error will be nil on success and set if there was an error. netmeraContentArray(NSArray with NetmeraContent) is the result of search query.

firstPoint

NetmeraGeoLocation object

secondPoint

NetmeraGeoLocation object

locationSearchField

name of the field that holds location data.

Discussion

Creates box using the given two location (latitude,longitude) data and searches inside that box in the background thread.Since it runs on the background thread it does not block program.It is recommended over boxSearch method.

Declared In

NetmeraService.h

boxSearchWithFirstLocation:andSecondLocation:andlocationSearchField:withError:

Creates box using the given two location (latitude,longitude) data and searches inside that box.

- (NSArray *)boxSearchWithFirstLocation:(NetmeraGeoLocation *)firstPoint andSecondLocation:(NetmeraGeoLocation *)secondPoint andlocationSearchField:(NSString *)locationSearchField withError:(NSError **)error

Parameters

firstPoint

NetmeraGeoLocation object

secondPoint

NetmeraGeoLocation object

locationSearchField

name of the field that holds location data.

error

if it cannot access server

Return Value

the list of NetmeraContent object.

Discussion

Creates box using the given two location (latitude,longitude) data and searches inside that box.

Declared In

NetmeraService.h

circleSearchInBackgroundWithTarget:selector:startLocation:distance:locationSearchField:

Searches the content by taking given location as a base and retrieves the contents that located given distance far away in the background thread.Since it runs on the background thread it does not block program.It is recommended over circleSearch method.

- (void)circleSearchInBackgroundWithTarget:(id)target selector:(SEL)selector startLocation:(NetmeraGeoLocation *)startLocation distance:(double)distance locationSearchField:(NSString *)locationSearchField

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: callBackCircleSearchWithContentArray:(NSArray)netmeraContentArray error:(NSError )error. error will be nil on success and set if there was an error. netmeraContentArray(NSArray with NetmeraContent) is the result of search query.

startLocation

base location to search near it.

distance

is used to create circle by taking the startLocation as a center.

locationSearchField

name of the field that holds location data.

Discussion

Searches the content by taking given location as a base and retrieves the contents that located given distance far away in the background thread.Since it runs on the background thread it does not block program.It is recommended over circleSearch method.

Declared In

NetmeraService.h

circleSearchWithStartLocation:andDistance:andlocationSearchField:withError:

Searches the content by taking given location as a base and retrieves the contents that located given distance far away.

- (NSArray *)circleSearchWithStartLocation:(NetmeraGeoLocation *)startLocation andDistance:(double)distance andlocationSearchField:(NSString *)locationSearchField withError:(NSError **)error

Parameters

startLocation

base location to search near it.

distance

is used to create circle by taking the startLocation as a center.

locationSearchField

name of the field that holds location data.

error

if it cannot access server

Return Value

the list of NetmeraContent object.

Discussion

Searches the content by taking given location as a base and retrieves the contents that located given distance far away.

Declared In

NetmeraService.h

count:

Gets the total number of results that matches the query.

- (long)count:(NSError **)error

Parameters

error

if it cannot access server.

Return Value

Returns the total number of results

Discussion

Gets the total number of results that matches the query.

Declared In

NetmeraService.h

countInBackgroundWithBlock:

Gets the total number of results that match the query in the background thread and executes.Since it runs on the background thread it does not block program.It is recommended over count method.

- (void)countInBackgroundWithBlock:(void ( ^ ) ( NSNumber *count , NSError *error ))block

Parameters

block

The block to execute. The block should have the following argument signature: (NSNumber count, NSError error)

Discussion

Gets the total number of results that match the query in the background thread and executes.Since it runs on the background thread it does not block program.It is recommended over count method.

Declared In

NetmeraService.h

countInBackgroundWithTarget:selector:

Gets the total number of results that match the query in the background thread.Since it runs on the background thread it does not block program.It is recommended over count method.

- (void)countInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void)callBackCountWithCount:(NSNumber)count error:(NSError )error. error will be nil on success and set if there was an error. count will tell count of contents

Discussion

Gets the total number of results that match the query in the background thread.Since it runs on the background thread it does not block program.It is recommended over count method.

Declared In

NetmeraService.h

get:

Gets the single NetmeraContent object that matches the query.

- (NetmeraContent *)get:(NSError **)error

Parameters

error

if it cannot access server

Discussion

Gets the single NetmeraContent object that matches the query.

Declared In

NetmeraService.h

getCustomCondition

Gets the queries list of queries and merges them as single query.

- (NSString *)getCustomCondition

Discussion

Gets the queries list of queries and merges them as single query.

Declared In

NetmeraService.h

getInBackgroundWithBlock:

Gets the single NetmeraContent object that matches the query in the background thread and executes.Since it runs on the background thread it does not block program.It is recommended over get method.

- (void)getInBackgroundWithBlock:(void ( ^ ) ( NetmeraContent *content , NSError *error ))block

Parameters

block

The block to execute. The block should have the following argument signature: (NetmeraContent content, NSError error)

Discussion

Gets the single NetmeraContent object that matches the query in the background thread and executes.Since it runs on the background thread it does not block program.It is recommended over get method.

Declared In

NetmeraService.h

getInBackgroundWithTarget:selector:

Gets the single NetmeraContent object that matches the query in the background thread.Since it runs on the background thread it does not block program.It is recommended over get method.

- (void)getInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void)callBackGetWithContent:(NetmeraContent )content error:(NSError )error. error will be nil on success and set if there was an error. content will ne the NetmeraContent object.

Discussion

Gets the single NetmeraContent object that matches the query in the background thread.Since it runs on the background thread it does not block program.It is recommended over get method.

Declared In

NetmeraService.h

initWithName:

Default constructor for the NetmeraService that sets objectName and other default parameters.

- (id)initWithName:(NSString *)objectName

Parameters

objectName

Name of the content

Discussion

Default constructor for the NetmeraService that sets objectName and other default parameters.

Warning: Default value for the max = 10 and page = 0. It returns 10 result in each page. It skips page * max in each iteration.

Declared In

NetmeraService.h

search:

Gets the list of NetmeraContent from the network.

- (NSArray *)search:(NSError **)error

Parameters

error

if it cannot access server

Discussion

Gets the list of NetmeraContent from the network.

Declared In

NetmeraService.h

searchInBackgroundWithBlock:

Retrieves the list of NetmeraContent objects that matches with the query in the background thread and executes.Since it runs on the background thread it does not block program.It is recommended over search method.

- (void)searchInBackgroundWithBlock:(void ( ^ ) ( NSArray *netmeraContentArray , NSError *error ))block

Parameters

block

The block to execute. The block should have the following argument signature: (NSArray netmeraContentArray, NSError error)

Discussion

Retrieves the list of NetmeraContent objects that matches with the query in the background thread and executes.Since it runs on the background thread it does not block program.It is recommended over search method.

Declared In

NetmeraService.h

searchInBackgroundWithTarget:selector:

Retrieves the list of NetmeraContent objects that matches with the query in the background thread.Since it runs on the background thread it does not block program.It is recommended over search method.

- (void)searchInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void) callBackSearchWithContentArray:(NSArray)netmeraContentArray error:(NSError )error. error will be nil on success and set if there was an error. netmeraContentArray(NSArray with NetmeraContent) is the result of search query.

Discussion

Retrieves the list of NetmeraContent objects that matches with the query in the background thread.Since it runs on the background thread it does not block program.It is recommended over search method.

Declared In

NetmeraService.h

searchUser:

Retrieves the list of NetmeraUser objects that matches with the query.

- (NSArray *)searchUser:(NSError **)error

Parameters

error

if it cannot access server

Return Value

List of the NetmeraUser array

Discussion

Retrieves the list of NetmeraUser objects that matches with the query.

Declared In

NetmeraService.h

whereAllContaintedInWithKey:andValues:

Adds an options to the query where value that matches with the query contains all of the values in the given collection.

- (void)whereAllContaintedInWithKey:(NSString *)key andValues:(NSArray *)values

Parameters

key

key to identify specified value

values

values associates with the specified key

Discussion

Adds an options to the query where value that matches with the query contains all of the values in the given collection.

Declared In

NetmeraService.h

whereContainedInWithKey:andValues:

Adds an options to the query where value that matches with the query contains any of the values in the given collection.

- (void)whereContainedInWithKey:(NSString *)key andValues:(NSArray *)values

Parameters

key

key to identify specified value

values

values associates with the specified key

Discussion

Adds an options to the query where value that matches with the query contains any of the values in the given collection.

Declared In

NetmeraService.h

whereEndsWithWithKey:andSuffix:

Adds an options to the query where value that matches with the query ends with the given suffix.

- (void)whereEndsWithWithKey:(NSString *)key andSuffix:(id)suffix

Parameters

key

key to identify specified value

suffix

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query ends with the given suffix.

Declared In

NetmeraService.h

whereEqualWithKey:andValue:

Adds an options to the query where value that matches with the query is equal to the given value.

- (void)whereEqualWithKey:(NSString *)key andValue:(id)value

Parameters

key

key to identify specified value

value

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query is equal to the given value.

Declared In

NetmeraService.h

whereExistsWithKey:andValue:

Adds an options to the query where the given key is exists or not. If value is true then it checks whether key exists, if value is false then it checks whether key not exists.

- (void)whereExistsWithKey:(NSString *)key andValue:(BOOL)value

Parameters

key

key to identify specified value

value

BOOL value to check whether key exists or not

Discussion

Adds an options to the query where the given key is exists or not. If value is true then it checks whether key exists, if value is false then it checks whether key not exists.

Declared In

NetmeraService.h

whereGreatherThanOrEqualWithKey:andValue:

Adds an options to the query where value that matches with the query is greater than or equal to the given value.

- (void)whereGreatherThanOrEqualWithKey:(NSString *)key andValue:(id)value

Parameters

key

key to identify specified value

value

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query is greater than or equal to the given value.

Declared In

NetmeraService.h

whereGreatherThanWithKey:andValue:

Adds an options to the query where value that matches with the query is greater than the given value.

- (void)whereGreatherThanWithKey:(NSString *)key andValue:(id)value

Parameters

key

key to identify specified value

value

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query is greater than the given value.

Declared In

NetmeraService.h

whereLessThanOrEqualWithKey:andValue:

Adds an options to the query where value that matches with the query is less than or equal to the given value.

- (void)whereLessThanOrEqualWithKey:(NSString *)key andValue:(id)value

Parameters

key

key to identify specified value

value

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query is less than or equal to the given value.

Declared In

NetmeraService.h

whereLessThanWithKey:andValue:

Adds an options to the query where value that matches with the query is less than the given value.

- (void)whereLessThanWithKey:(NSString *)key andValue:(id)value

Parameters

key

key to identify specified value

value

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query is less than the given value.

Declared In

NetmeraService.h

whereMatchesWithKey:andRegex:

Adds an options to the query where value that returns from the query matches with the given regex.

- (void)whereMatchesWithKey:(NSString *)key andRegex:(NSString *)regex

Parameters

key

key to identify specified value

regex

value associates with the specified key

Discussion

Adds an options to the query where value that returns from the query matches with the given regex.

Declared In

NetmeraService.h

whereNotEqualWithKey:andValue:

Adds an options to the query where value that matches with the query is not equal to the given value.

- (void)whereNotEqualWithKey:(NSString *)key andValue:(id)value

Parameters

key

key to identify specified value

value

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query is not equal to the given value.

Declared In

NetmeraService.h

whereOwnerEqual:

This is used to get the contents of the logged user.

- (void)whereOwnerEqual:(NetmeraUser *)user

Parameters

user

current user

Discussion

This is used to get the contents of the logged user.

Declared In

NetmeraService.h

whereStartsWithWithKey:andPrefix:

Adds an options to the query where value that matches with the query starts with the given prefix.

- (void)whereStartsWithWithKey:(NSString *)key andPrefix:(id)prefix

Parameters

key

key to identify specified value

prefix

value associates with the specified key

Discussion

Adds an options to the query where value that matches with the query starts with the given prefix.

Declared In

NetmeraService.h