NMContent Class Reference
| Inherits from | NMCore : NSObject |
| Declared in | NMContent.h NMContent.m |
Overview
The NMContent class is used to run CRUD (Create, Update and Delete) operations over the data. Fields on NMContent objects can be instances of certain classes. While creating or updating your contents, you should beware of class limitations. The objects created by this class are stored over cloud. Whenever you need your content data, you can access them easily over cloud.
Tasks
-
identifierIdentifier of the NMContent object.
property -
pathPath of the NMContent object.
property -
createDateCreate date of the NMContent object.
property -
updateDateUpdate date of the NMContent object.
property -
privacyPrivacy of the NMContent object.
property -
– initWithIdentifier:Initializes the newly allocated NMContent object with the specified identifier value.
-
– createWithError:Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.
-
– createInBackgroundWithCompletionHandler:Creates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.
-
– updateWithError:Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.
-
– updateInBackgroundWithCompletionHandler:Updates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. After adding needful key-value pairs, call this method over receiver.
-
– deleteWithError:Removes the receiver content from cloud.
-
– deleteInBackgroundWithCompletionHandler:Removes the receiver content from cloud on the background thread and executes the given handler block at the completion of running method.
-
– setObject:forKey:Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.
-
– setBool:forKey:Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.
-
– incrementByValue:forKey:Increases/decreases a field of a content by the given value on create or update operation. If the value is a positive number, the field is increased, otherwise it is decreased.
-
– objectForKey:Returns the object associated with the given key.
-
– boolForKey:Returns the boolean value associated with the given key.
-
– dateForKey:Returns the NSDate object associated with the given key.
-
– locationForKey:Returns the NMGeolocation object associated with the given key.
-
– userForKey:Returns the NMUser object associated with the given key.
-
– setOwner:Sets the owner of this content. This provides that the receiver NMContent object is private for just the owner.
Properties
createDate
Create date of the NMContent object.
@property (nonatomic, readonly, strong) NSString *createDateDiscussion
Create date of the NMContent object.
This value is generated by Netmera automatically in the creation process of any NMContent object. You do NOT have to set this value by creating your content. After creation, String representation of creation date of your content is set automatically.
Declared In
NMContent.hidentifier
Identifier of the NMContent object.
@property (nonatomic, strong) NSString *identifierDiscussion
Identifier of the NMContent object.
This value represents the contents which have the same fields. You can think this string value as the name of the table in the relational databases.
Declared In
NMContent.hpath
Path of the NMContent object.
@property (nonatomic, strong) NSString *pathDiscussion
Path of the NMContent object.
This value is generated by Netmera automatically in the creation process of any NMContent object. Every content has unique path throuhout the application. You do NOT have to set this value by creationg your content. After creation, path string is set over your content automatically.
Declared In
NMContent.hprivacy
Privacy of the NMContent object.
@property (nonatomic, assign) NMPrivacy privacyDiscussion
Privacy of the NMContent object.
This value is used to determine the accessibility of the NMContent object.
Declared In
NMContent.hupdateDate
Update date of the NMContent object.
@property (nonatomic, readonly, strong) NSString *updateDateDiscussion
Update date of the NMContent object.
This value is generated by Netmera automatically in every update process of any NMContent object. You do NOT have to set this value by updating your content. After update operation, String representation of update date of your content is set automatically.
Declared In
NMContent.hInstance Methods
boolForKey:
Returns the boolean value associated with the given key.
- (BOOL)boolForKey:(NSString *)keyParameters
- key
Alphanumeric string that corresponds the requested object.
Return Value
The boolean value for the specified key. Returns NSNotFound if key-value pairs does not exist in the content object.
Discussion
Returns the boolean value associated with the given key.
Declared In
NMContent.hcreateInBackgroundWithCompletionHandler:
Creates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.
- (void)createInBackgroundWithCompletionHandler:(NMContentResponseHandler)handlerParameters
- handler
The block to execute when the creation of the content is completed.
Discussion
Creates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.
As background methods does not block your main thread, it is recommended to use createInBackgroundWithCompletionHandler: over createWithError: or create:.
Declared In
NMContent.hcreateWithError:
Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.
- (BOOL)createWithError:(NSError **)errorParameters
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the content is created successfully. Returns NO if an error occurs.
Discussion
Creates a content that contains JSON-compatible key-value pairs over cloud. Since these contents have shameless structure, you can set whatever key-value pairs you want by the condition that keys should be alphanumeric strings and values should be JSON-encoded objects.
Declared In
NMContent.hdateForKey:
Returns the NSDate object associated with the given key.
- (NSDate *)dateForKey:(NSString *)keyParameters
- key
Alphanumeric string that corresponds the requested object.
Return Value
The NSDate object for the specified key. Returns nil if key-value pairs does not exist in the content object.
Discussion
Returns the NSDate object associated with the given key.
Declared In
NMContent.hdeleteInBackgroundWithCompletionHandler:
Removes the receiver content from cloud on the background thread and executes the given handler block at the completion of running method.
- (void)deleteInBackgroundWithCompletionHandler:(void ( ^ ) ( NSError *error ))handlerParameters
- handler
The block to execute when delete of the content is completed.
Discussion
Removes the receiver content from cloud on the background thread and executes the given handler block at the completion of running method.
Warning: In order to delete a content, you should be sure that you set its path correctly or directly call this method on fetched content.
As background methods does not block your main thread, it is recommended to use deleteInBackgroundWithCompletionHandler: over deleteWithError: or delete:.
Declared In
NMContent.hdeleteWithError:
Removes the receiver content from cloud.
- (BOOL)deleteWithError:(NSError **)errorParameters
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the content is deleted successfully. Returns NO if an error occurs.
Discussion
Removes the receiver content from cloud.
Declared In
NMContent.hincrementByValue:forKey:
Increases/decreases a field of a content by the given value on create or update operation. If the value is a positive number, the field is increased, otherwise it is decreased.
- (void)incrementByValue:(NSNumber *)value forKey:(NSString *)keyParameters
- value
The increment or decrement value for the field.
- key
Alphanumeric string that represents the field to perform operation.
Discussion
Increases/decreases a field of a content by the given value on create or update operation. If the value is a positive number, the field is increased, otherwise it is decreased.
If the field does not exist for a content object while creating or updating, new field is created for it with the given key and value.
Declared In
NMContent.hinitWithIdentifier:
Initializes the newly allocated NMContent object with the specified identifier value.
- (id)initWithIdentifier:(NSString *)identifierParameters
- identifier
Identifier of the NMContent object.
Return Value
An initialized NMContent object.
Discussion
Initializes the newly allocated NMContent object with the specified identifier value.
Declared In
NMContent.hlocationForKey:
Returns the NMGeolocation object associated with the given key.
- (NMGeolocation *)locationForKey:(NSString *)keyParameters
- key
Alphanumeric string that corresponds the requested object.
Return Value
The NMGeolocation object for the specified key. Returns nil if key-value pairs does not exist in the content object.
Discussion
Returns the NMGeolocation object associated with the given key.
Declared In
NMContent.hobjectForKey:
Returns the object associated with the given key.
- (id)objectForKey:(NSString *)keyParameters
- key
Alphanumeric string that corresponds the requested object.
Return Value
The object for the specified key. Returns nil if key-value pairs does not exist in the content object.
Discussion
Returns the object associated with the given key.
Declared In
NMContent.hsetBool:forKey:
Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.
- (void)setBool:(BOOL)value forKey:(NSString *)keyParameters
- value
BOOL value associated with the specified key.
- key
Alphanumeric string that represents the key value.
Discussion
Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones. Value is a BOOL type.
Warning: Raises an exception if value is not an object that NSDictionary accepts or the value is not a JSON-compatible object.s
Declared In
NMContent.hsetObject:forKey:
Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.
- (void)setObject:(id)object forKey:(NSString *)keyParameters
- key
Alphanumeric string that represents the key value.
- value
Object value associated with the specified key. This value can be an instance of the below classes:
NSString, NSNumber, NSDate, NSData, NSDictionary (members must be one of the mentioned class instances), NSArray (members must be one of the above instance), NMGeolocation, NMUser.
Discussion
Adds JSON-compatible key-value pairs into the object. If the object contains the given key, the old value is replaced with the new ones.
Warning: Raises an exception if value is not an object that NSDictionary accepts or the value is not a JSON-compatible object.
Declared In
NMContent.hsetOwner:
Sets the owner of this content. This provides that the receiver NMContent object is private for just the owner.
- (void)setOwner:(NMUser *)userParameters
- user
Owner of the content.
Discussion
Sets the owner of this content. This provides that the receiver NMContent object is private for just the owner.
You cannot give any user object as the owner of the content. The user should be login to the application for the current state.
Declared In
NMContent.hupdateInBackgroundWithCompletionHandler:
Updates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. After adding needful key-value pairs, call this method over receiver.
- (void)updateInBackgroundWithCompletionHandler:(NMContentResponseHandler)handlerParameters
- handler
The block to execute when update of the content is completed.
Discussion
Updates a content that contains JSON-compatible key-value pairs over cloud on background thread and executes the given handler block at the completion of running method. After adding needful key-value pairs, call this method over receiver.
Warning: In order to update a content, firstly the relevant content should be fetched using get or search methods.
As background methods does not block your main thread, it is recommended to use updateInBackgroundWithCompletionHandler: over updateWithError: or update:.
Declared In
NMContent.hupdateWithError:
Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.
- (BOOL)updateWithError:(NSError **)errorParameters
- error
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
Return Value
YES if the content is updated successfully. Returns NO if an error occurs.
Discussion
Updates a content that contains JSON-compatible key-value pairs over cloud. After adding needful key-value pairs, call this method over receiver.
Declared In
NMContent.huserForKey:
Returns the NMUser object associated with the given key.
- (NMUser *)userForKey:(NSString *)keyParameters
- key
Alphanumeric string that corresponds the requested object.
Return Value
The NMUser object for the specified key. Returns nil if key-value pairs does not exist in the content object.
Discussion
Returns the NMUser object associated with the given key.
Declared In
NMContent.h