{"action":"created","comment":{"url":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/comments/51172490","id":51172490,"diff_hunk":"@@ -25,49 +25,144 @@\n #include <WiFiClientSecure.h>\n #include <ESP8266HTTPClient.h>\n \n-// FirebaseError represents a Firebase API error with a code and a\n-// message.\n-class FirebaseError {\n+class FirebaseGetResult;\n+class FirebasePushResult;\n+class FirebaseRemoveResult;\n+class FirebaseEventStream;\n+\n+// Primary client to the Firebase backend.\n+class Firebase {\n+ public:\n+  Firebase(const String& host);\n+  Firebase& auth(const String& auth);\n+\n+  // Fetch result at \"path\".\n+  FirebaseGetResult get(const String& path);\n+\n+  // Add new value to list at \"path\", will return child name of new item.\n+  FirebasePushResult push(const String& path, const String& value);\n+\n+  // Deletes value at \"path\" from server.\n+  FirebaseRemoveResult remove(const String& path);\n+\n+  // Starts a stream of events that effect object at \"path\".\n+  FirebaseEventStream stream(const String& path);\n+\n+ private:\n+\n+  int sendRequest(const char* method, const String& path, const String& value);\n+\n+  HTTPClient http_;\n+  String host_;\n+  String auth_;\n+};\n+\n+// Base class for Results from a Firebase call.\n+class FirebaseResult {\n  public:\n-  operator bool() const { return _code < 0; }\n-  int code() const { return _code; }\n-  const String& message() const { return _message; }\n-  void reset() { set(0, \"\"); }\n-  void set(int code, const String& message) {\n-    _code = code;\n-    _message = message;\n+  // Constructor for error result.\n+  FirebaseResult(const String& error_message);\n+  // Constructor if no error.\n+  FirebaseResult();\n+\n+  // True if no error.\n+  operator bool() const;\n+\n+  bool isError() const;","path":"Firebase.h","position":57,"original_position":57,"commit_id":"2ac7ab345183d8604ad9f78f598a0e1eb663a09c","original_commit_id":"2ac7ab345183d8604ad9f78f598a0e1eb663a09c","user":{"login":"ed7coyne","id":16657086,"avatar_url":"https://avatars.githubusercontent.com/u/16657086?v=3","gravatar_id":"","url":"https://api.github.com/users/ed7coyne","html_url":"https://github.com/ed7coyne","followers_url":"https://api.github.com/users/ed7coyne/followers","following_url":"https://api.github.com/users/ed7coyne/following{/other_user}","gists_url":"https://api.github.com/users/ed7coyne/gists{/gist_id}","starred_url":"https://api.github.com/users/ed7coyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ed7coyne/subscriptions","organizations_url":"https://api.github.com/users/ed7coyne/orgs","repos_url":"https://api.github.com/users/ed7coyne/repos","events_url":"https://api.github.com/users/ed7coyne/events{/privacy}","received_events_url":"https://api.github.com/users/ed7coyne/received_events","type":"User","site_admin":false},"body":"Sounds good.","created_at":"2016-01-28T19:20:51Z","updated_at":"2016-01-28T19:20:51Z","html_url":"https://github.com/googlesamples/firebase-arduino/pull/42#discussion_r51172490","pull_request_url":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/comments/51172490"},"html":{"href":"https://github.com/googlesamples/firebase-arduino/pull/42#discussion_r51172490"},"pull_request":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42","id":55830152,"html_url":"https://github.com/googlesamples/firebase-arduino/pull/42","diff_url":"https://github.com/googlesamples/firebase-arduino/pull/42.diff","patch_url":"https://github.com/googlesamples/firebase-arduino/pull/42.patch","issue_url":"https://api.github.com/repos/googlesamples/firebase-arduino/issues/42","number":42,"state":"open","locked":false,"title":"Refactored Firebase library","user":{"login":"ed7coyne","id":16657086,"avatar_url":"https://avatars.githubusercontent.com/u/16657086?v=3","gravatar_id":"","url":"https://api.github.com/users/ed7coyne","html_url":"https://github.com/ed7coyne","followers_url":"https://api.github.com/users/ed7coyne/followers","following_url":"https://api.github.com/users/ed7coyne/following{/other_user}","gists_url":"https://api.github.com/users/ed7coyne/gists{/gist_id}","starred_url":"https://api.github.com/users/ed7coyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ed7coyne/subscriptions","organizations_url":"https://api.github.com/users/ed7coyne/orgs","repos_url":"https://api.github.com/users/ed7coyne/repos","events_url":"https://api.github.com/users/ed7coyne/events{/privacy}","received_events_url":"https://api.github.com/users/ed7coyne/received_events","type":"User","site_admin":false},"body":"As discussed in issue #41 \r\n\r\nRefactored to provide result and not depend on class state for error reporting, conform to Google C++ style.\r\n\r\nAlso broke FirebaseEventStream out from Firebase. When this is connected I believe any other calls (push,fetch,etc..) to the class would break it. For that reason it really seems like this should be its own focused class. Or you need large comments explaining this gotcha.","created_at":"2016-01-12T22:55:16Z","updated_at":"2016-01-28T19:20:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ff3d1412f2e9cf2fea439deab5f6014d62ba679","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42/commits","review_comments_url":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42/comments","review_comment_url":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/comments{/number}","comments_url":"https://api.github.com/repos/googlesamples/firebase-arduino/issues/42/comments","statuses_url":"https://api.github.com/repos/googlesamples/firebase-arduino/statuses/2ac7ab345183d8604ad9f78f598a0e1eb663a09c","head":{"label":"ed7coyne:refactor","ref":"refactor","sha":"2ac7ab345183d8604ad9f78f598a0e1eb663a09c","user":{"login":"ed7coyne","id":16657086,"avatar_url":"https://avatars.githubusercontent.com/u/16657086?v=3","gravatar_id":"","url":"https://api.github.com/users/ed7coyne","html_url":"https://github.com/ed7coyne","followers_url":"https://api.github.com/users/ed7coyne/followers","following_url":"https://api.github.com/users/ed7coyne/following{/other_user}","gists_url":"https://api.github.com/users/ed7coyne/gists{/gist_id}","starred_url":"https://api.github.com/users/ed7coyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ed7coyne/subscriptions","organizations_url":"https://api.github.com/users/ed7coyne/orgs","repos_url":"https://api.github.com/users/ed7coyne/repos","events_url":"https://api.github.com/users/ed7coyne/events{/privacy}","received_events_url":"https://api.github.com/users/ed7coyne/received_events","type":"User","site_admin":false},"repo":{"id":49516087,"name":"firebase-arduino","full_name":"ed7coyne/firebase-arduino","owner":{"login":"ed7coyne","id":16657086,"avatar_url":"https://avatars.githubusercontent.com/u/16657086?v=3","gravatar_id":"","url":"https://api.github.com/users/ed7coyne","html_url":"https://github.com/ed7coyne","followers_url":"https://api.github.com/users/ed7coyne/followers","following_url":"https://api.github.com/users/ed7coyne/following{/other_user}","gists_url":"https://api.github.com/users/ed7coyne/gists{/gist_id}","starred_url":"https://api.github.com/users/ed7coyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ed7coyne/subscriptions","organizations_url":"https://api.github.com/users/ed7coyne/orgs","repos_url":"https://api.github.com/users/ed7coyne/repos","events_url":"https://api.github.com/users/ed7coyne/events{/privacy}","received_events_url":"https://api.github.com/users/ed7coyne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ed7coyne/firebase-arduino","description":"Arduino samples for Firebase.","fork":true,"url":"https://api.github.com/repos/ed7coyne/firebase-arduino","forks_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/forks","keys_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/teams","hooks_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/hooks","issue_events_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/issues/events{/number}","events_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/events","assignees_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/assignees{/user}","branches_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/branches{/branch}","tags_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/tags","blobs_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/git/refs{/sha}","trees_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/statuses/{sha}","languages_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/languages","stargazers_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/stargazers","contributors_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/contributors","subscribers_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/subscribers","subscription_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/subscription","commits_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/commits{/sha}","git_commits_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/git/commits{/sha}","comments_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/comments{/number}","issue_comment_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/issues/comments{/number}","contents_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/contents/{+path}","compare_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/merges","archive_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/downloads","issues_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/issues{/number}","pulls_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/pulls{/number}","milestones_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/milestones{/number}","notifications_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/labels{/name}","releases_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/releases{/id}","deployments_url":"https://api.github.com/repos/ed7coyne/firebase-arduino/deployments","created_at":"2016-01-12T17:14:18Z","updated_at":"2016-01-12T17:14:18Z","pushed_at":"2016-01-28T04:08:05Z","git_url":"git://github.com/ed7coyne/firebase-arduino.git","ssh_url":"git@github.com:ed7coyne/firebase-arduino.git","clone_url":"https://github.com/ed7coyne/firebase-arduino.git","svn_url":"https://github.com/ed7coyne/firebase-arduino","homepage":"","size":260,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"googlesamples:master","ref":"master","sha":"615dfe4fe618b9780ae6b11ea1016e30fed230f1","user":{"login":"googlesamples","id":7378196,"avatar_url":"https://avatars.githubusercontent.com/u/7378196?v=3","gravatar_id":"","url":"https://api.github.com/users/googlesamples","html_url":"https://github.com/googlesamples","followers_url":"https://api.github.com/users/googlesamples/followers","following_url":"https://api.github.com/users/googlesamples/following{/other_user}","gists_url":"https://api.github.com/users/googlesamples/gists{/gist_id}","starred_url":"https://api.github.com/users/googlesamples/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlesamples/subscriptions","organizations_url":"https://api.github.com/users/googlesamples/orgs","repos_url":"https://api.github.com/users/googlesamples/repos","events_url":"https://api.github.com/users/googlesamples/events{/privacy}","received_events_url":"https://api.github.com/users/googlesamples/received_events","type":"Organization","site_admin":false},"repo":{"id":45581692,"name":"firebase-arduino","full_name":"googlesamples/firebase-arduino","owner":{"login":"googlesamples","id":7378196,"avatar_url":"https://avatars.githubusercontent.com/u/7378196?v=3","gravatar_id":"","url":"https://api.github.com/users/googlesamples","html_url":"https://github.com/googlesamples","followers_url":"https://api.github.com/users/googlesamples/followers","following_url":"https://api.github.com/users/googlesamples/following{/other_user}","gists_url":"https://api.github.com/users/googlesamples/gists{/gist_id}","starred_url":"https://api.github.com/users/googlesamples/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/googlesamples/subscriptions","organizations_url":"https://api.github.com/users/googlesamples/orgs","repos_url":"https://api.github.com/users/googlesamples/repos","events_url":"https://api.github.com/users/googlesamples/events{/privacy}","received_events_url":"https://api.github.com/users/googlesamples/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/googlesamples/firebase-arduino","description":"Arduino samples for Firebase.","fork":false,"url":"https://api.github.com/repos/googlesamples/firebase-arduino","forks_url":"https://api.github.com/repos/googlesamples/firebase-arduino/forks","keys_url":"https://api.github.com/repos/googlesamples/firebase-arduino/keys{/key_id}","collaborators_url":"https://api.github.com/repos/googlesamples/firebase-arduino/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/googlesamples/firebase-arduino/teams","hooks_url":"https://api.github.com/repos/googlesamples/firebase-arduino/hooks","issue_events_url":"https://api.github.com/repos/googlesamples/firebase-arduino/issues/events{/number}","events_url":"https://api.github.com/repos/googlesamples/firebase-arduino/events","assignees_url":"https://api.github.com/repos/googlesamples/firebase-arduino/assignees{/user}","branches_url":"https://api.github.com/repos/googlesamples/firebase-arduino/branches{/branch}","tags_url":"https://api.github.com/repos/googlesamples/firebase-arduino/tags","blobs_url":"https://api.github.com/repos/googlesamples/firebase-arduino/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/googlesamples/firebase-arduino/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/googlesamples/firebase-arduino/git/refs{/sha}","trees_url":"https://api.github.com/repos/googlesamples/firebase-arduino/git/trees{/sha}","statuses_url":"https://api.github.com/repos/googlesamples/firebase-arduino/statuses/{sha}","languages_url":"https://api.github.com/repos/googlesamples/firebase-arduino/languages","stargazers_url":"https://api.github.com/repos/googlesamples/firebase-arduino/stargazers","contributors_url":"https://api.github.com/repos/googlesamples/firebase-arduino/contributors","subscribers_url":"https://api.github.com/repos/googlesamples/firebase-arduino/subscribers","subscription_url":"https://api.github.com/repos/googlesamples/firebase-arduino/subscription","commits_url":"https://api.github.com/repos/googlesamples/firebase-arduino/commits{/sha}","git_commits_url":"https://api.github.com/repos/googlesamples/firebase-arduino/git/commits{/sha}","comments_url":"https://api.github.com/repos/googlesamples/firebase-arduino/comments{/number}","issue_comment_url":"https://api.github.com/repos/googlesamples/firebase-arduino/issues/comments{/number}","contents_url":"https://api.github.com/repos/googlesamples/firebase-arduino/contents/{+path}","compare_url":"https://api.github.com/repos/googlesamples/firebase-arduino/compare/{base}...{head}","merges_url":"https://api.github.com/repos/googlesamples/firebase-arduino/merges","archive_url":"https://api.github.com/repos/googlesamples/firebase-arduino/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/googlesamples/firebase-arduino/downloads","issues_url":"https://api.github.com/repos/googlesamples/firebase-arduino/issues{/number}","pulls_url":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls{/number}","milestones_url":"https://api.github.com/repos/googlesamples/firebase-arduino/milestones{/number}","notifications_url":"https://api.github.com/repos/googlesamples/firebase-arduino/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/googlesamples/firebase-arduino/labels{/name}","releases_url":"https://api.github.com/repos/googlesamples/firebase-arduino/releases{/id}","deployments_url":"https://api.github.com/repos/googlesamples/firebase-arduino/deployments","created_at":"2015-11-05T02:24:39Z","updated_at":"2016-01-28T08:40:32Z","pushed_at":"2016-01-28T04:08:05Z","git_url":"git://github.com/googlesamples/firebase-arduino.git","ssh_url":"git@github.com:googlesamples/firebase-arduino.git","clone_url":"https://github.com/googlesamples/firebase-arduino.git","svn_url":"https://github.com/googlesamples/firebase-arduino","homepage":"","size":300,"stargazers_count":13,"watchers_count":13,"language":"Eagle","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":13,"forks":9,"open_issues":13,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42"},"html":{"href":"https://github.com/googlesamples/firebase-arduino/pull/42"},"issue":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/issues/42"},"comments":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/googlesamples/firebase-arduino/statuses/2ac7ab345183d8604ad9f78f598a0e1eb663a09c"}}}}