{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/31492068","id":31492068,"diff_hunk":"@@ -0,0 +1,91 @@\n+# The layers in the Messages application\n+\n+## Terms explanation\n+\n+There are 3 layers whose interfaces managed by the Bridge (aka [threads.js](https://github.com/gaia-components/threads/)):\n+\n+* Services define high-level semantics to access the model. They are the only\n+  interfaces that can be directly called by the views. Ideally one user action\n+  has one matching service method.\n+\n+  Ideally a service doesn't call another service and calls only managers.\n+  (but we can relax this rule in our case).\n+\n+  All together they form the Service Layer.\n+\n+* Managers define lower-level semantics. They'll be called by the Service layer.\n+  Ideally their responsabilities are well-defined and they don't call each other.\n+\n+* Wrappers define interfaces to access mozAPI that are not available in workers.\n+  Ideally they expose very similar APIs than their mozAPI counterparts because\n+  their goal is to eventually disappear.\n+\n+## The Service Layer\n+### ConversationService\n+\n+This service manages everything related to directly interacting with\n+conversations and messages.\n+\n+Here are the operations needed:\n+\n+* Get All Conversations\n+  - used in InboxView\n+  - contains everything needed to display the Inbox (so including the \"body\", the \"type\", the \"draft\" and the \"contact information\".\n+* Delete Conversations\n+  -  used in InboxView\n+* Delete Messages\n+  -  used in ConversationView (and can in turn delete Conversations)\n+* Mark Conversations As Read/Unread\n+  -  Used in InboxView and ConversationView\n+* Load 1 Conversation + its messages + contact(s) information(s)\n+  -  Used in ConversationView\n+* send an event when a message change and the local IDB (if existing) has been updated.\n+* send an event when receiving a message and the local IDB (if existing) has been updated.\n+* Load 1 Message\n+  -  Used in ReportView and GroupView\n+  - (If these views are really part of the ConversationPanel, maybe we don't need this operation)\n+* find a conversation from number\n+  - (if the redirection (new message -> conversation) is done from the service worker, this will be used from the service worker)\n+\n+### MessagingService\n+\n+This service will be used when a view does actions related to messaging functionality,\n+especially sending messages.\n+\n+Here are the operations for this service:\n+\n+* send a message\n+  - used from ConversationView and NewMessageView\n+  - this service may use other services (eg: ConversationService to change model --","path":"apps/sms/services/README.md","position":59,"original_position":59,"commit_id":"b24bc3fbe404b165e351cd2d6a8e8aaf90d66f61","original_commit_id":"b24bc3fbe404b165e351cd2d6a8e8aaf90d66f61","user":{"login":"steveck-chung","id":1704452,"avatar_url":"https://avatars.githubusercontent.com/u/1704452?v=3","gravatar_id":"","url":"https://api.github.com/users/steveck-chung","html_url":"https://github.com/steveck-chung","followers_url":"https://api.github.com/users/steveck-chung/followers","following_url":"https://api.github.com/users/steveck-chung/following{/other_user}","gists_url":"https://api.github.com/users/steveck-chung/gists{/gist_id}","starred_url":"https://api.github.com/users/steveck-chung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveck-chung/subscriptions","organizations_url":"https://api.github.com/users/steveck-chung/orgs","repos_url":"https://api.github.com/users/steveck-chung/repos","events_url":"https://api.github.com/users/steveck-chung/events{/privacy}","received_events_url":"https://api.github.com/users/steveck-chung/received_events","type":"User","site_admin":false},"body":"Sorry I'm still not sure why we might use this in service","created_at":"2015-06-02T04:19:35Z","updated_at":"2015-06-02T04:19:35Z","html_url":"https://github.com/mozilla-b2g/gaia/pull/30347#discussion_r31492068","pull_request_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347","_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments/31492068"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/30347#discussion_r31492068"},"pull_request":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347","id":36624937,"html_url":"https://github.com/mozilla-b2g/gaia/pull/30347","diff_url":"https://github.com/mozilla-b2g/gaia/pull/30347.diff","patch_url":"https://github.com/mozilla-b2g/gaia/pull/30347.patch","issue_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30347","number":30347,"state":"open","locked":false,"title":"Bug 1169543 - [Messages][NG] Create draft spec for the main services …","user":{"login":"julienw","id":454175,"avatar_url":"https://avatars.githubusercontent.com/u/454175?v=3","gravatar_id":"","url":"https://api.github.com/users/julienw","html_url":"https://github.com/julienw","followers_url":"https://api.github.com/users/julienw/followers","following_url":"https://api.github.com/users/julienw/following{/other_user}","gists_url":"https://api.github.com/users/julienw/gists{/gist_id}","starred_url":"https://api.github.com/users/julienw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienw/subscriptions","organizations_url":"https://api.github.com/users/julienw/orgs","repos_url":"https://api.github.com/users/julienw/repos","events_url":"https://api.github.com/users/julienw/events{/privacy}","received_events_url":"https://api.github.com/users/julienw/received_events","type":"User","site_admin":false},"body":"…we need r=azasypkin,schung","created_at":"2015-06-01T12:44:20Z","updated_at":"2015-06-02T04:19:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29c7d8794b428923016d6525ea95b2ce42c2690e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347/commits","review_comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347/comments","review_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30347/comments","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/b24bc3fbe404b165e351cd2d6a8e8aaf90d66f61","head":{"label":"julienw:1169543-services-description","ref":"1169543-services-description","sha":"b24bc3fbe404b165e351cd2d6a8e8aaf90d66f61","user":{"login":"julienw","id":454175,"avatar_url":"https://avatars.githubusercontent.com/u/454175?v=3","gravatar_id":"","url":"https://api.github.com/users/julienw","html_url":"https://github.com/julienw","followers_url":"https://api.github.com/users/julienw/followers","following_url":"https://api.github.com/users/julienw/following{/other_user}","gists_url":"https://api.github.com/users/julienw/gists{/gist_id}","starred_url":"https://api.github.com/users/julienw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienw/subscriptions","organizations_url":"https://api.github.com/users/julienw/orgs","repos_url":"https://api.github.com/users/julienw/repos","events_url":"https://api.github.com/users/julienw/events{/privacy}","received_events_url":"https://api.github.com/users/julienw/received_events","type":"User","site_admin":false},"repo":{"id":6565987,"name":"gaia","full_name":"julienw/gaia","owner":{"login":"julienw","id":454175,"avatar_url":"https://avatars.githubusercontent.com/u/454175?v=3","gravatar_id":"","url":"https://api.github.com/users/julienw","html_url":"https://github.com/julienw","followers_url":"https://api.github.com/users/julienw/followers","following_url":"https://api.github.com/users/julienw/following{/other_user}","gists_url":"https://api.github.com/users/julienw/gists{/gist_id}","starred_url":"https://api.github.com/users/julienw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/julienw/subscriptions","organizations_url":"https://api.github.com/users/julienw/orgs","repos_url":"https://api.github.com/users/julienw/repos","events_url":"https://api.github.com/users/julienw/events{/privacy}","received_events_url":"https://api.github.com/users/julienw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/julienw/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project","fork":true,"url":"https://api.github.com/repos/julienw/gaia","forks_url":"https://api.github.com/repos/julienw/gaia/forks","keys_url":"https://api.github.com/repos/julienw/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/julienw/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/julienw/gaia/teams","hooks_url":"https://api.github.com/repos/julienw/gaia/hooks","issue_events_url":"https://api.github.com/repos/julienw/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/julienw/gaia/events","assignees_url":"https://api.github.com/repos/julienw/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/julienw/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/julienw/gaia/tags","blobs_url":"https://api.github.com/repos/julienw/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/julienw/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/julienw/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/julienw/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/julienw/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/julienw/gaia/languages","stargazers_url":"https://api.github.com/repos/julienw/gaia/stargazers","contributors_url":"https://api.github.com/repos/julienw/gaia/contributors","subscribers_url":"https://api.github.com/repos/julienw/gaia/subscribers","subscription_url":"https://api.github.com/repos/julienw/gaia/subscription","commits_url":"https://api.github.com/repos/julienw/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/julienw/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/julienw/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/julienw/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/julienw/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/julienw/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/julienw/gaia/merges","archive_url":"https://api.github.com/repos/julienw/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/julienw/gaia/downloads","issues_url":"https://api.github.com/repos/julienw/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/julienw/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/julienw/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/julienw/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/julienw/gaia/labels{/name}","releases_url":"https://api.github.com/repos/julienw/gaia/releases{/id}","created_at":"2012-11-06T17:18:15Z","updated_at":"2014-06-25T07:25:16Z","pushed_at":"2015-06-01T12:33:57Z","git_url":"git://github.com/julienw/gaia.git","ssh_url":"git@github.com:julienw/gaia.git","clone_url":"https://github.com/julienw/gaia.git","svn_url":"https://github.com/julienw/gaia","homepage":"https://wiki.mozilla.org/B2G","size":929461,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla-b2g:master","ref":"master","sha":"63233508824132bff0f2b14222a83a54ca94b8f3","user":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"repo":{"id":2317369,"name":"gaia","full_name":"mozilla-b2g/gaia","owner":{"login":"mozilla-b2g","id":1261292,"avatar_url":"https://avatars.githubusercontent.com/u/1261292?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-b2g","html_url":"https://github.com/mozilla-b2g","followers_url":"https://api.github.com/users/mozilla-b2g/followers","following_url":"https://api.github.com/users/mozilla-b2g/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-b2g/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-b2g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-b2g/subscriptions","organizations_url":"https://api.github.com/users/mozilla-b2g/orgs","repos_url":"https://api.github.com/users/mozilla-b2g/repos","events_url":"https://api.github.com/users/mozilla-b2g/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-b2g/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-b2g/gaia","description":"Gaia is a HTML5-based Phone UI for the Boot 2 Gecko Project. NOTE: For details of what branches are used for what releases, see","fork":false,"url":"https://api.github.com/repos/mozilla-b2g/gaia","forks_url":"https://api.github.com/repos/mozilla-b2g/gaia/forks","keys_url":"https://api.github.com/repos/mozilla-b2g/gaia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-b2g/gaia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-b2g/gaia/teams","hooks_url":"https://api.github.com/repos/mozilla-b2g/gaia/hooks","issue_events_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-b2g/gaia/events","assignees_url":"https://api.github.com/repos/mozilla-b2g/gaia/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-b2g/gaia/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/tags","blobs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-b2g/gaia/languages","stargazers_url":"https://api.github.com/repos/mozilla-b2g/gaia/stargazers","contributors_url":"https://api.github.com/repos/mozilla-b2g/gaia/contributors","subscribers_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscribers","subscription_url":"https://api.github.com/repos/mozilla-b2g/gaia/subscription","commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-b2g/gaia/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-b2g/gaia/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-b2g/gaia/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-b2g/gaia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-b2g/gaia/merges","archive_url":"https://api.github.com/repos/mozilla-b2g/gaia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-b2g/gaia/downloads","issues_url":"https://api.github.com/repos/mozilla-b2g/gaia/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-b2g/gaia/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-b2g/gaia/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-b2g/gaia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-b2g/gaia/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-b2g/gaia/releases{/id}","created_at":"2011-09-03T01:38:46Z","updated_at":"2015-06-02T02:17:40Z","pushed_at":"2015-06-02T02:16:04Z","git_url":"git://github.com/mozilla-b2g/gaia.git","ssh_url":"git@github.com:mozilla-b2g/gaia.git","clone_url":"https://github.com/mozilla-b2g/gaia.git","svn_url":"https://github.com/mozilla-b2g/gaia","homepage":"https://wiki.mozilla.org/B2G","size":1678832,"stargazers_count":1935,"watchers_count":1935,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2322,"mirror_url":null,"open_issues_count":1017,"forks":2322,"open_issues":1017,"watchers":1935,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347"},"html":{"href":"https://github.com/mozilla-b2g/gaia/pull/30347"},"issue":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30347"},"comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/issues/30347/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/pulls/30347/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-b2g/gaia/statuses/b24bc3fbe404b165e351cd2d6a8e8aaf90d66f61"}}}}