strongloop-community / loopback-sdk-ios

iOS Client SDK for the LoopBack framework.
Other
76 stars 39 forks source link

LBFile uploadWithName should return HTTP Response #88

Closed kgoedecke closed 8 years ago

kgoedecke commented 8 years ago

I feel like it would be helpful if uploadWithName would pass the actual HTTP Response into the success callback or even an LBFile object.

https://github.com/strongloop/loopback-sdk-ios/blob/master/LoopBack/LBFile.m#L188

For example I'm converting the filename on the server side to a random hash value, and I need the HTTP response to let the client side know what the new filename is.

I suggest the following: In L188 in LBFile.m convert the id value to an actual LBFile object and pass it into success (Sadly we can't use modelWithDictionary, as the dictionary looks a little different as the one from the getFileWithName for example). I'll try to workout the details and open a PR soon, for now I'd appreciate what you guys think about this especially on how to convert the value to a LBFile.

hideya commented 8 years ago

@kgoedecke thank you for posting the issue! I agree that uploadWithSuccess and uploadWithName should have returned the LBFile object based on the server response, since the server does return such info. I'll check out the PR asap.

hideya commented 8 years ago

@kgoedecke thanks for the PR! Now the PR has been merged and the issue has been fixed. I'm going to close this.