{"action":"created","comment":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/comments/35386058","id":35386058,"diff_hunk":"@@ -85,34 +98,151 @@ - (SLRESTContract *)contract {\n                                                      verb:@\"GET\"]\n             forMethod:[NSString stringWithFormat:@\"%@.prototype.download\", self.className]];\n     [contract addItem:[SLRESTContractItem itemWithPattern:[NSString stringWithFormat:@\"/%@/:container/files/:name\", self.className]\n+                                                     verb:@\"DELETE\"]\n+            forMethod:[NSString stringWithFormat:@\"%@.prototype.delete\", self.className]];\n+    [contract addItem:[SLRESTContractItem itemWithPattern:[NSString stringWithFormat:@\"/%@/:container/upload\", self.className]\n+                                                     verb:@\"POST\"\n+                                                multipart:YES]\n+            forMethod:[NSString stringWithFormat:@\"%@.upload\", self.className]];\n+    [contract addItem:[SLRESTContractItem itemWithPattern:[NSString stringWithFormat:@\"/%@/:container/download/:name\", self.className]\n+                                                     verb:@\"GET\"]\n+            forMethod:[NSString stringWithFormat:@\"%@.download\", self.className]];\n+    [contract addItem:[SLRESTContractItem itemWithPattern:[NSString stringWithFormat:@\"/%@/:container/files/:name\", self.className]\n                                                      verb:@\"GET\"]\n             forMethod:[NSString stringWithFormat:@\"%@.get\", self.className]];\n-    \n+    [contract addItem:[SLRESTContractItem itemWithPattern:[NSString stringWithFormat:@\"/%@/:container/files\", self.className]\n+                                                     verb:@\"GET\"]\n+            forMethod:[NSString stringWithFormat:@\"%@.getAll\", self.className]];\n+\n     return contract;\n }\n \n-- (LBFile *)createFileWithName:(NSString*)name\n-                     localPath:(NSString*)localPath\n-                     container:(NSString*)container {\n-    LBFile *file = (LBFile*)[self modelWithDictionary:@{@\"name\" : name, @\"localPath\" : localPath, @\"container\" : container}];\n+- (LBFile *)createFileWithName:(NSString *)name\n+                     localPath:(NSString *)localPath\n+                     container:(NSString *)container {\n+    \n+    LBFile *file = (LBFile *)[self modelWithDictionary:@{ @\"name\": name,\n+                                                          @\"localPath\": localPath,\n+                                                          @\"container\": container }];\n     return file;\n }\n \n-- (void)getFileWithName:(NSString*)name\n-              localPath:(NSString*)localPath\n-              container:(NSString*)container\n+- (void)getFileWithName:(NSString *)name\n+              localPath:(NSString *)localPath\n+              container:(NSString *)container\n                 success:(LBFileGetSuccessBlock)success\n                 failure:(SLFailureBlock)failure {\n+\n     NSParameterAssert(name);\n     NSParameterAssert(container);\n     [self invokeStaticMethod:@\"get\"\n-            parameters:@{@\"name\": name, @\"localPath\" : localPath, @\"container\" : container}\n+            parameters:@{ @\"name\": name,\n+                          @\"container\" : container }","path":"LoopBack/LBFile.m","position":101,"original_position":101,"commit_id":"7dbc1a720d1eb6ca50ebb96e0aa7fc91d4b83f76","original_commit_id":"7dbc1a720d1eb6ca50ebb96e0aa7fc91d4b83f76","user":{"login":"hideya","id":321713,"avatar_url":"https://avatars.githubusercontent.com/u/321713?v=3","gravatar_id":"","url":"https://api.github.com/users/hideya","html_url":"https://github.com/hideya","followers_url":"https://api.github.com/users/hideya/followers","following_url":"https://api.github.com/users/hideya/following{/other_user}","gists_url":"https://api.github.com/users/hideya/gists{/gist_id}","starred_url":"https://api.github.com/users/hideya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hideya/subscriptions","organizations_url":"https://api.github.com/users/hideya/orgs","repos_url":"https://api.github.com/users/hideya/repos","events_url":"https://api.github.com/users/hideya/events{/privacy}","received_events_url":"https://api.github.com/users/hideya/received_events","type":"User","site_admin":false},"body":"I don't usually make format adjustments but decided to do some for readability as I'm touching many lines in this file.","created_at":"2015-07-24T00:17:28Z","updated_at":"2015-07-24T00:17:28Z","html_url":"https://github.com/strongloop/loopback-sdk-ios/pull/47#discussion_r35386058","pull_request_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/comments/35386058"},"html":{"href":"https://github.com/strongloop/loopback-sdk-ios/pull/47#discussion_r35386058"},"pull_request":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47","id":40726136,"html_url":"https://github.com/strongloop/loopback-sdk-ios/pull/47","diff_url":"https://github.com/strongloop/loopback-sdk-ios/pull/47.diff","patch_url":"https://github.com/strongloop/loopback-sdk-ios/pull/47.patch","issue_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/issues/47","number":47,"state":"open","locked":false,"title":"LBFile and LBFileRepository enhancements","user":{"login":"hideya","id":321713,"avatar_url":"https://avatars.githubusercontent.com/u/321713?v=3","gravatar_id":"","url":"https://api.github.com/users/hideya","html_url":"https://github.com/hideya","followers_url":"https://api.github.com/users/hideya/followers","following_url":"https://api.github.com/users/hideya/following{/other_user}","gists_url":"https://api.github.com/users/hideya/gists{/gist_id}","starred_url":"https://api.github.com/users/hideya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hideya/subscriptions","organizations_url":"https://api.github.com/users/hideya/orgs","repos_url":"https://api.github.com/users/hideya/repos","events_url":"https://api.github.com/users/hideya/events{/privacy}","received_events_url":"https://api.github.com/users/hideya/received_events","type":"User","site_admin":false},"body":"1) Added `[LBFile deleteWithSuccess:failure:]` and `[LBFileRepository getAllFilesWithSuccess:failure:]`\r\n2) Also added file upload/download via binary data/streaming features.  \r\n\r\n1) is must to be done.\r\n2) is better be done but the API is debatable...\r\n\r\nAs discussed in Issue https://github.com/strongloop/loopback-sdk-ios/issues/34, I was initially interested in following Android SDK's newer and cleaner API.  However, I realized that it takes kind of fundamentally different approach than the current iOS SDK's LBFile API, and the usage can become a bit too involved.\r\n\r\nIn this PR, I kept the current approach and added file upload/download via binary data/streaming features as convenience methods to `LBFileRepository`.  Those are:\r\n```\r\n- (void)uploadWithName:(NSString *)name container:(NSString*)container data:(NSData *)data contentType:(NSString*)contentType success:... failure:...\r\n- (void)uploadWithName:(NSString *)name container:(NSString*)container inputStream:(NSInputStream *)inputStream contentType:(NSString *)contentType length:(NSInteger)length success:... failure:...\r\n- (void)downloadWithName:(NSString *)name container:(NSString*)container outputStream:(NSOutputStream *)outputStream success:... failure:...\r\n- (void)downloadAsDataWithName:(NSString *)name container:(NSString*)container success:... failure:...\r\n```\r\nHope this is OK approach...  Any input/suggestions are appreciated!","created_at":"2015-07-23T22:35:28Z","updated_at":"2015-07-24T00:17:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6dda17dd605bb8ba41aa12af407b764436fd6a8b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47/commits","review_comments_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47/comments","review_comment_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/issues/47/comments","statuses_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/statuses/7dbc1a720d1eb6ca50ebb96e0aa7fc91d4b83f76","head":{"label":"hideya:fix/lbfile","ref":"fix/lbfile","sha":"7dbc1a720d1eb6ca50ebb96e0aa7fc91d4b83f76","user":{"login":"hideya","id":321713,"avatar_url":"https://avatars.githubusercontent.com/u/321713?v=3","gravatar_id":"","url":"https://api.github.com/users/hideya","html_url":"https://github.com/hideya","followers_url":"https://api.github.com/users/hideya/followers","following_url":"https://api.github.com/users/hideya/following{/other_user}","gists_url":"https://api.github.com/users/hideya/gists{/gist_id}","starred_url":"https://api.github.com/users/hideya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hideya/subscriptions","organizations_url":"https://api.github.com/users/hideya/orgs","repos_url":"https://api.github.com/users/hideya/repos","events_url":"https://api.github.com/users/hideya/events{/privacy}","received_events_url":"https://api.github.com/users/hideya/received_events","type":"User","site_admin":false},"repo":{"id":30176812,"name":"loopback-sdk-ios","full_name":"hideya/loopback-sdk-ios","owner":{"login":"hideya","id":321713,"avatar_url":"https://avatars.githubusercontent.com/u/321713?v=3","gravatar_id":"","url":"https://api.github.com/users/hideya","html_url":"https://github.com/hideya","followers_url":"https://api.github.com/users/hideya/followers","following_url":"https://api.github.com/users/hideya/following{/other_user}","gists_url":"https://api.github.com/users/hideya/gists{/gist_id}","starred_url":"https://api.github.com/users/hideya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hideya/subscriptions","organizations_url":"https://api.github.com/users/hideya/orgs","repos_url":"https://api.github.com/users/hideya/repos","events_url":"https://api.github.com/users/hideya/events{/privacy}","received_events_url":"https://api.github.com/users/hideya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hideya/loopback-sdk-ios","description":"iOS Client SDK for the LoopBack framework.","fork":true,"url":"https://api.github.com/repos/hideya/loopback-sdk-ios","forks_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/forks","keys_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/teams","hooks_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/hooks","issue_events_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/issues/events{/number}","events_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/events","assignees_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/assignees{/user}","branches_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/branches{/branch}","tags_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/tags","blobs_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/languages","stargazers_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/stargazers","contributors_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/contributors","subscribers_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/subscribers","subscription_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/subscription","commits_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/contents/{+path}","compare_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/merges","archive_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/downloads","issues_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/issues{/number}","pulls_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/labels{/name}","releases_url":"https://api.github.com/repos/hideya/loopback-sdk-ios/releases{/id}","created_at":"2015-02-02T07:53:53Z","updated_at":"2015-04-10T06:19:25Z","pushed_at":"2015-07-23T02:47:52Z","git_url":"git://github.com/hideya/loopback-sdk-ios.git","ssh_url":"git@github.com:hideya/loopback-sdk-ios.git","clone_url":"https://github.com/hideya/loopback-sdk-ios.git","svn_url":"https://github.com/hideya/loopback-sdk-ios","homepage":"","size":3417,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"strongloop:master","ref":"master","sha":"4eb5abc9652bff44ea1f61cfea77b3df2579fbd4","user":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":15151788,"name":"loopback-sdk-ios","full_name":"strongloop/loopback-sdk-ios","owner":{"login":"strongloop","id":3020012,"avatar_url":"https://avatars.githubusercontent.com/u/3020012?v=3","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongloop/loopback-sdk-ios","description":"iOS Client SDK for the LoopBack framework.","fork":false,"url":"https://api.github.com/repos/strongloop/loopback-sdk-ios","forks_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/forks","keys_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/teams","hooks_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/hooks","issue_events_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/events","assignees_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/tags","blobs_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/languages","stargazers_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/stargazers","contributors_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/contributors","subscribers_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/subscribers","subscription_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/subscription","commits_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/merges","archive_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/downloads","issues_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/loopback-sdk-ios/releases{/id}","created_at":"2013-12-13T01:08:15Z","updated_at":"2015-07-21T15:48:10Z","pushed_at":"2015-07-23T22:35:29Z","git_url":"git://github.com/strongloop/loopback-sdk-ios.git","ssh_url":"git@github.com:strongloop/loopback-sdk-ios.git","clone_url":"https://github.com/strongloop/loopback-sdk-ios.git","svn_url":"https://github.com/strongloop/loopback-sdk-ios","homepage":"","size":3625,"stargazers_count":36,"watchers_count":36,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":24,"forks":23,"open_issues":24,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47"},"html":{"href":"https://github.com/strongloop/loopback-sdk-ios/pull/47"},"issue":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/issues/47"},"comments":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/strongloop/loopback-sdk-ios/statuses/7dbc1a720d1eb6ca50ebb96e0aa7fc91d4b83f76"}}}}