TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by mac.
Drupal8 iOS SDK is a library for native iOS applications to communicate with Drupal web servers.
Currently library is using AFNetworking for communication with server.
Main purpose of this library is to make communication with Drupal 8 - based servers as easy and intuitive as possible.
You can simply call
- [DrupalEntity pushToServer] //to post data to server.
- [DrupalEntity pullFromServer] //to pull data from server.
- [DrupalEntity deleteFromServer] //to remove data from server.
- [DrupalEntity patchServerData] //to patch patch data to server.
Besides of entity api provides few more handy structures:
NSArray
/ NSDictionary
can manage drupal and non-drupal entities, providing them with all DrupalEntity methods like post, push, pull, delete.
Library automatically serializes/deserializes objects including attached objects and arrays of objects. Because objective c does not support strongly typed arrays you have to implement method: - (Class)classOfItems:(NSString *)propertyName
and return class of objects of array.
DrupalEntity
object or array of objects (depends on response).
Object, containing server base URL and is responsible for server request generation and posting to server. You have to set DrupalAPIManager.baseURL
before making action with DrupalEntity instance.
Category extends manager of AFNetworking
and is used in DrupalAPIManager. Will be imporoved and extended to support login scheme.
If field should not be serialized or deserialized override method - (BOOL)isPropertyTransient:(NSString *)propertyName
and return YES for needed property name.
In order to implement drupal entity you just have to extend DrupalEntity
and implement following methods:
this method will return relative path to entity on the server.
- (NSString *)path {
return [NSString stringWithFormat:@"node/%@", self.nid]
;}
this method will return item get parameters if needed.
- (NSDictionary *)requestGETParams {
return @{@"page": self.page};
}
[DrupalAPIManager sharedDrupalAPIManager].baseURL = [NSURL URLWithString:@"http://myserver.com"];
BlogPage *bp = [BlogPage new];
bp.page = @(page);
[bp pullFromServer:nil];
To run the example project; clone the repo, and run pod install
from the Example directory first.
LSDrupalSDK is available under the MIT license. See the LICENSE file for more info.