Streamlyne / Cocoa-SDK

Streamlyne API for Cocoa Developers
https://github.com/Streamlyne/Cocoa-SDK
2 stars 1 forks source link

Record/Node Serializer and Adapter #7

Open Glavin001 opened 10 years ago

Glavin001 commented 10 years ago

Base off of http://emberjs.com/api/data/classes/DS.RESTSerializer.html

Glavin001 commented 10 years ago
Glavin001 commented 10 years ago

The SLAPIManager can act as this.

Glavin001 commented 10 years ago
Glavin001 commented 10 years ago
Glavin001 commented 10 years ago
Glavin001 commented 10 years ago

These are for SLSerializer not SLAPIManager.

Glavin001 commented 10 years ago

Changed SLAPIManager to SLAdapter.

Glavin001 commented 10 years ago

For keyForAttribute, have the base method convert the string into underscore-case: http://stackoverflow.com/a/11463782

Glavin001 commented 10 years ago

findQuery is going to be very difficult because for our GET requests our query param structure is VERY non-standard with ?{/*query*/}.

See http://stackoverflow.com/a/21626123 and http://stackoverflow.com/a/21659058

Working on a possible solution by bypassing AFNetworking and using lower level HTTP request APIs... Ugh.

Glavin001 commented 10 years ago

Currently reading through http://cocoadocs.org/docsets/AFNetworking/2.0.0/Classes/AFHTTPRequestOperationManager.html#//api/name/HTTPRequestOperationWithRequest:success:failure: and https://github.com/AFNetworking/AFNetworking/blob/2ce309331664746c39d82ea89ad7719bf1a6007f/AFNetworking/AFHTTPRequestOperationManager.m#L95-L125 and http://stackoverflow.com/a/6212611

Glavin001 commented 10 years ago
2014-07-26 01:21:15.107 xctest[77821:303] urlWithParams http://localhost:5000/api/v1/attributes/?{"criteria":{"_id":{"$in":[{"$oid":"538770b42fb05c514e6cb341"},{"$oid":"53986c682fb05c52e0f5e686"}]}}}
2014-07-26 01:21:15.107 xctest[77821:303] getURL: (null)
2014-07-26 01:21:15.108 xctest[77821:303] Error: Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0x105806c50 {NSLocalizedDescription=bad URL, NSUnderlyingError=0x100235300 "bad URL"}
2014-07-26 01:21:15.108 xctest[77821:303] Response: (null)
2014-07-26 01:21:15.109 xctest[77821:303] Error: Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0x105806c50 {NSLocalizedDescription=bad URL, NSUnderlyingError=0x100235300 "bad URL"}
/Users/glavin/Documents/Streamlyne/cocoa-sdk/Streamlyne-iOS-SDKTests/Streamlyne_iOS_SDKTests.m:380: error: -[Streamlyne_iOS_SDKTests testFindMany] : failed - Error Domain=NSURLErrorDomain Code=-1000 "bad URL" UserInfo=0x105806c50 {NSLocalizedDescription=bad URL, NSUnderlyingError=0x100235300 "bad URL"}

Yeah this isn't going to work at all.

This simple code is failing there..

NSURL *getUrl = [NSURL URLWithString:urlWithParams];
NSLog(@"getURL: %@", getUrl);

I officially am blocked by https://github.com/Streamlyne/api-server/issues/8#issuecomment-50222861

Glavin001 commented 9 years ago

Update the endpoints to conform to: https://github.com/Streamlyne/api-server/blob/4657365a2bed193b39a09e722d676297db449853/slapi/rest/api.py#L47-L58