{"action":"created","comment":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/comments/35654907","id":35654907,"diff_hunk":"@@ -0,0 +1,59 @@\n+Api = new Restivus\n+\tuseDefaultAuth: true\n+\tprettyJson: true\n+\n+\n+Api.addCollection ChatMessage\n+Api.addCollection ChatRoom\n+\n+\n+Api.addRoute 'version', authRequired: false,\n+\tget: ->\n+\t\tversion = {api: '0.1', rocketchat: '0.5'}\n+\t\tstatus: 'success', versions: version\n+\n+Api.addRoute 'publicRooms', authRequired: true,\n+\tget: ->\n+\t\trooms = ChatRoom.find({ t: 'c' }, { sort: { msgs:-1 } }).fetch()\n+\t\tif rooms\n+\t\t\tstatus: 'success', rooms: rooms\n+\t\telse\n+\t\t\tstatusCode: 404\n+\t\t\tbody: status: 'fail', message: 'Rooms not found'\n+\n+# join a room\n+Api.addRoute 'rooms/:id/join', authRequired: true,\n+\tpost: ->\n+\t\tMeteor.runAsUser this.userId, () =>\n+\t\t\tMeteor.call('joinRoom', @urlParams.id)\n+\t\tstatus: 'success'   # need to handle error\n+\n+\n+# leave a room\n+Api.addRoute 'rooms/:id/leave', authRequired: true,\n+\tpost: ->\n+\t\tMeteor.runAsUser this.userId, () =>\n+\t\t\tMeteor.call('leaveRoom', @urlParams.id)\n+\t\tstatus: 'success'   # need to handle error\n+\n+\n+# get messages in a room\n+Api.addRoute 'rooms/:id/messages', authRequired: true,\n+\tget: ->","path":"server/restapi/restapi.coffee","position":38,"original_position":42,"commit_id":"0a4025db5d07911dda6cebc6fdd7a67a07ec88bd","original_commit_id":"e27bd18abe4656300c54701d6ebe5ce67ea0b617","user":{"login":"sampaiodiego","id":8591547,"avatar_url":"https://avatars.githubusercontent.com/u/8591547?v=3","gravatar_id":"","url":"https://api.github.com/users/sampaiodiego","html_url":"https://github.com/sampaiodiego","followers_url":"https://api.github.com/users/sampaiodiego/followers","following_url":"https://api.github.com/users/sampaiodiego/following{/other_user}","gists_url":"https://api.github.com/users/sampaiodiego/gists{/gist_id}","starred_url":"https://api.github.com/users/sampaiodiego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sampaiodiego/subscriptions","organizations_url":"https://api.github.com/users/sampaiodiego/orgs","repos_url":"https://api.github.com/users/sampaiodiego/repos","events_url":"https://api.github.com/users/sampaiodiego/events{/privacy}","received_events_url":"https://api.github.com/users/sampaiodiego/received_events","type":"User","site_admin":false},"body":"agreed. we need to start making tests.. maybe the APIs are a good start =)","created_at":"2015-07-28T14:41:39Z","updated_at":"2015-07-28T14:41:39Z","html_url":"https://github.com/RocketChat/Rocket.Chat/pull/350#discussion_r35654907","pull_request_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350","_links":{"self":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/comments/35654907"},"html":{"href":"https://github.com/RocketChat/Rocket.Chat/pull/350#discussion_r35654907"},"pull_request":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350"}}},"pull_request":{"url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350","id":40948576,"html_url":"https://github.com/RocketChat/Rocket.Chat/pull/350","diff_url":"https://github.com/RocketChat/Rocket.Chat/pull/350.diff","patch_url":"https://github.com/RocketChat/Rocket.Chat/pull/350.patch","issue_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/350","number":350,"state":"open","locked":false,"title":"Add REST-full API Implementation","user":{"login":"Sing-Li","id":122633,"avatar_url":"https://avatars.githubusercontent.com/u/122633?v=3","gravatar_id":"","url":"https://api.github.com/users/Sing-Li","html_url":"https://github.com/Sing-Li","followers_url":"https://api.github.com/users/Sing-Li/followers","following_url":"https://api.github.com/users/Sing-Li/following{/other_user}","gists_url":"https://api.github.com/users/Sing-Li/gists{/gist_id}","starred_url":"https://api.github.com/users/Sing-Li/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sing-Li/subscriptions","organizations_url":"https://api.github.com/users/Sing-Li/orgs","repos_url":"https://api.github.com/users/Sing-Li/repos","events_url":"https://api.github.com/users/Sing-Li/events{/privacy}","received_events_url":"https://api.github.com/users/Sing-Li/received_events","type":"User","site_admin":false},"body":"Working initial implementation.  Ready for extension and contributions.   \r\n\r\nTo be moved to optional package a little later.","created_at":"2015-07-27T20:58:29Z","updated_at":"2015-07-28T14:41:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d2d9890344d25377c7f9047cec72ae85f636f82","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350/commits","review_comments_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350/comments","review_comment_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/350/comments","statuses_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/statuses/0a4025db5d07911dda6cebc6fdd7a67a07ec88bd","head":{"label":"Sing-Li:restfull-api","ref":"restfull-api","sha":"0a4025db5d07911dda6cebc6fdd7a67a07ec88bd","user":{"login":"Sing-Li","id":122633,"avatar_url":"https://avatars.githubusercontent.com/u/122633?v=3","gravatar_id":"","url":"https://api.github.com/users/Sing-Li","html_url":"https://github.com/Sing-Li","followers_url":"https://api.github.com/users/Sing-Li/followers","following_url":"https://api.github.com/users/Sing-Li/following{/other_user}","gists_url":"https://api.github.com/users/Sing-Li/gists{/gist_id}","starred_url":"https://api.github.com/users/Sing-Li/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sing-Li/subscriptions","organizations_url":"https://api.github.com/users/Sing-Li/orgs","repos_url":"https://api.github.com/users/Sing-Li/repos","events_url":"https://api.github.com/users/Sing-Li/events{/privacy}","received_events_url":"https://api.github.com/users/Sing-Li/received_events","type":"User","site_admin":false},"repo":{"id":39238787,"name":"Rocket.Chat","full_name":"Sing-Li/Rocket.Chat","owner":{"login":"Sing-Li","id":122633,"avatar_url":"https://avatars.githubusercontent.com/u/122633?v=3","gravatar_id":"","url":"https://api.github.com/users/Sing-Li","html_url":"https://github.com/Sing-Li","followers_url":"https://api.github.com/users/Sing-Li/followers","following_url":"https://api.github.com/users/Sing-Li/following{/other_user}","gists_url":"https://api.github.com/users/Sing-Li/gists{/gist_id}","starred_url":"https://api.github.com/users/Sing-Li/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sing-Li/subscriptions","organizations_url":"https://api.github.com/users/Sing-Li/orgs","repos_url":"https://api.github.com/users/Sing-Li/repos","events_url":"https://api.github.com/users/Sing-Li/events{/privacy}","received_events_url":"https://api.github.com/users/Sing-Li/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Sing-Li/Rocket.Chat","description":"Have your own Slack like online chat, built with Meteor.","fork":true,"url":"https://api.github.com/repos/Sing-Li/Rocket.Chat","forks_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/forks","keys_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/teams","hooks_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/hooks","issue_events_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/issues/events{/number}","events_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/events","assignees_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/assignees{/user}","branches_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/branches{/branch}","tags_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/tags","blobs_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/statuses/{sha}","languages_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/languages","stargazers_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/stargazers","contributors_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/contributors","subscribers_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/subscribers","subscription_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/subscription","commits_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/contents/{+path}","compare_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/merges","archive_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/downloads","issues_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/issues{/number}","pulls_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/pulls{/number}","milestones_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/milestones{/number}","notifications_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/labels{/name}","releases_url":"https://api.github.com/repos/Sing-Li/Rocket.Chat/releases{/id}","created_at":"2015-07-17T06:33:37Z","updated_at":"2015-07-17T06:33:38Z","pushed_at":"2015-07-28T14:27:34Z","git_url":"git://github.com/Sing-Li/Rocket.Chat.git","ssh_url":"git@github.com:Sing-Li/Rocket.Chat.git","clone_url":"https://github.com/Sing-Li/Rocket.Chat.git","svn_url":"https://github.com/Sing-Li/Rocket.Chat","homepage":"https://rocket.chat/","size":16901,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"RocketChat:master","ref":"master","sha":"ba7eb3ac0df67eb755d8bf607f947e952df42e88","user":{"login":"RocketChat","id":12508788,"avatar_url":"https://avatars.githubusercontent.com/u/12508788?v=3","gravatar_id":"","url":"https://api.github.com/users/RocketChat","html_url":"https://github.com/RocketChat","followers_url":"https://api.github.com/users/RocketChat/followers","following_url":"https://api.github.com/users/RocketChat/following{/other_user}","gists_url":"https://api.github.com/users/RocketChat/gists{/gist_id}","starred_url":"https://api.github.com/users/RocketChat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RocketChat/subscriptions","organizations_url":"https://api.github.com/users/RocketChat/orgs","repos_url":"https://api.github.com/users/RocketChat/repos","events_url":"https://api.github.com/users/RocketChat/events{/privacy}","received_events_url":"https://api.github.com/users/RocketChat/received_events","type":"Organization","site_admin":false},"repo":{"id":35866694,"name":"Rocket.Chat","full_name":"RocketChat/Rocket.Chat","owner":{"login":"RocketChat","id":12508788,"avatar_url":"https://avatars.githubusercontent.com/u/12508788?v=3","gravatar_id":"","url":"https://api.github.com/users/RocketChat","html_url":"https://github.com/RocketChat","followers_url":"https://api.github.com/users/RocketChat/followers","following_url":"https://api.github.com/users/RocketChat/following{/other_user}","gists_url":"https://api.github.com/users/RocketChat/gists{/gist_id}","starred_url":"https://api.github.com/users/RocketChat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RocketChat/subscriptions","organizations_url":"https://api.github.com/users/RocketChat/orgs","repos_url":"https://api.github.com/users/RocketChat/repos","events_url":"https://api.github.com/users/RocketChat/events{/privacy}","received_events_url":"https://api.github.com/users/RocketChat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/RocketChat/Rocket.Chat","description":"Have your own Slack like online chat, built with Meteor.","fork":false,"url":"https://api.github.com/repos/RocketChat/Rocket.Chat","forks_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/forks","keys_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/teams","hooks_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/hooks","issue_events_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/events{/number}","events_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/events","assignees_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/assignees{/user}","branches_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/branches{/branch}","tags_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/tags","blobs_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/git/refs{/sha}","trees_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/statuses/{sha}","languages_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/languages","stargazers_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/stargazers","contributors_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/contributors","subscribers_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/subscribers","subscription_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/subscription","commits_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/commits{/sha}","git_commits_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/git/commits{/sha}","comments_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/comments{/number}","issue_comment_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/comments{/number}","contents_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/contents/{+path}","compare_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/merges","archive_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/downloads","issues_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues{/number}","pulls_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls{/number}","milestones_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/milestones{/number}","notifications_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/labels{/name}","releases_url":"https://api.github.com/repos/RocketChat/Rocket.Chat/releases{/id}","created_at":"2015-05-19T07:36:09Z","updated_at":"2015-07-28T13:27:38Z","pushed_at":"2015-07-28T14:28:33Z","git_url":"git://github.com/RocketChat/Rocket.Chat.git","ssh_url":"git@github.com:RocketChat/Rocket.Chat.git","clone_url":"https://github.com/RocketChat/Rocket.Chat.git","svn_url":"https://github.com/RocketChat/Rocket.Chat","homepage":"https://rocket.chat/","size":18806,"stargazers_count":2713,"watchers_count":2713,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":323,"mirror_url":null,"open_issues_count":99,"forks":323,"open_issues":99,"watchers":2713,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350"},"html":{"href":"https://github.com/RocketChat/Rocket.Chat/pull/350"},"issue":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/350"},"comments":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/issues/350/comments"},"review_comments":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350/comments"},"review_comment":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/pulls/350/commits"},"statuses":{"href":"https://api.github.com/repos/RocketChat/Rocket.Chat/statuses/0a4025db5d07911dda6cebc6fdd7a67a07ec88bd"}}}}