{"action":"created","comment":{"url":"https://api.github.com/repos/coursera/naptime/pulls/comments/62098791","id":62098791,"diff_hunk":"@@ -2,7 +2,462 @@\n layout: page\n ---\n \n-Getting Started\n----------------\n+# Getting Started #\n \n-Coming soon...\n+This getting started / quickstart guide will help get your first Naptime resource up and running.\n+\n+## An Example Resource: Users\n+\n+Let's walk through an example of exposing a simple User resource. The full example resource can\n+be found at: <https://github.com/coursera/naptime/examples/TODO>.\n+\n+A user has an id, a name, an email, and an optional description of self (long\n+blob of text).\n+\n+<small>Note: For clarity, imports / sections of code may be snipped.</small>\n+\n+### Setting Up\n+\n+#### Installing Naptime\n+\n+Simply add:\n+\n+```\n+libraryDependencies += \"org.coursera.naptime\" %% \"naptime\" % \"0.0.1\"\n+```\n+\n+to your `build.sbt` file.\n+\n+#### Defining the model\n+\n+Models for Naptime are declared in Courier.  See the\n+[Courier documentation](http://coursera.github.io/courier/) for details.\n+\n+Example:\n+\n+```\n+namespace org.coursera.user\n+\n+record User {\n+  name: string,\n+  email: string,\n+  selfDescription: string?\n+}\n+```\n+\n+All models live in the `models/src/main/pegasus` directory.\n+\n+#### Legacy: Defining models with OFormats\n+\n+Before Courier, we defined all models using Play! JSON and \"OFormats\".\n+\n+Example:\n+\n+```scala\n+package org.coursera.user\n+\n+import play.api.libs.json.Json\n+\n+case class User(\n+    name: String,\n+    email: String,\n+    selfDescription: Option[String])\n+\n+object User {\n+  implicit val format: OFormat[User] = Json.format[User]\n+}\n+```\n+\n+> <small>Note: IntelliJ will flag the type annotation `OFormat[User]` as unable to compile.\n+> This is normal, and `sbt` should be able to compile correctly.[^1]</small>\n+\n+#### Resource Collection Class\n+\n+Next we define the CollectionResource for User. A CollectionResource exposes\n+a collection of resources each identified by a key (`Int` in our case) and of a\n+particular type (the case class `User`).\n+\n+Naptime supports all kinds of key types natively, including `UUID`, `Int`, `Long`, `String` and\n+arbitrary user-defined types. (Note: must use the macro router.)\n+\n+Note that resource names for collections (like users) should be plural.\n+\n+```scala\n+import javax.inject.Inject\n+import org.coursera.model.Keyed\n+import org.coursera.playcour.naptime.router2.Router\n+import org.coursera.playcour.naptime.resources.ResourceCaches\n+import org.coursera.playcour.naptime.resources.DefaultCollectionResource\n+\n+class UserCollectionResource @Inject() (","path":"gettingstarted/index.md","position":94,"original_position":94,"commit_id":"5604157774538755bfd2873924b3aaeca374fe5f","original_commit_id":"5604157774538755bfd2873924b3aaeca374fe5f","user":{"login":"josh-newman","id":3987603,"avatar_url":"https://avatars.githubusercontent.com/u/3987603?v=3","gravatar_id":"","url":"https://api.github.com/users/josh-newman","html_url":"https://github.com/josh-newman","followers_url":"https://api.github.com/users/josh-newman/followers","following_url":"https://api.github.com/users/josh-newman/following{/other_user}","gists_url":"https://api.github.com/users/josh-newman/gists{/gist_id}","starred_url":"https://api.github.com/users/josh-newman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josh-newman/subscriptions","organizations_url":"https://api.github.com/users/josh-newman/orgs","repos_url":"https://api.github.com/users/josh-newman/repos","events_url":"https://api.github.com/users/josh-newman/events{/privacy}","received_events_url":"https://api.github.com/users/josh-newman/received_events","type":"User","site_admin":false},"body":"I thought we settled on plural names for collections without \"collection\", like `UsersResource`.","created_at":"2016-05-04T19:24:11Z","updated_at":"2016-05-04T19:24:11Z","html_url":"https://github.com/coursera/naptime/pull/7#discussion_r62098791","pull_request_url":"https://api.github.com/repos/coursera/naptime/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/coursera/naptime/pulls/comments/62098791"},"html":{"href":"https://github.com/coursera/naptime/pull/7#discussion_r62098791"},"pull_request":{"href":"https://api.github.com/repos/coursera/naptime/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/coursera/naptime/pulls/7","id":68912981,"html_url":"https://github.com/coursera/naptime/pull/7","diff_url":"https://github.com/coursera/naptime/pull/7.diff","patch_url":"https://github.com/coursera/naptime/pull/7.patch","issue_url":"https://api.github.com/repos/coursera/naptime/issues/7","number":7,"state":"open","locked":false,"title":"Migrate the quickstart guide to gh-pages.","user":{"login":"saeta","id":1284535,"avatar_url":"https://avatars.githubusercontent.com/u/1284535?v=3","gravatar_id":"","url":"https://api.github.com/users/saeta","html_url":"https://github.com/saeta","followers_url":"https://api.github.com/users/saeta/followers","following_url":"https://api.github.com/users/saeta/following{/other_user}","gists_url":"https://api.github.com/users/saeta/gists{/gist_id}","starred_url":"https://api.github.com/users/saeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saeta/subscriptions","organizations_url":"https://api.github.com/users/saeta/orgs","repos_url":"https://api.github.com/users/saeta/repos","events_url":"https://api.github.com/users/saeta/events{/privacy}","received_events_url":"https://api.github.com/users/saeta/received_events","type":"User","site_admin":false},"body":"Coursera internally has a quickstart guide. This has been cleaned up,\r\ninaccuracies fixed, and included in this commit.\r\n\r\nIn order to get the code to format properly, I've added some additional\r\nlines to the configuration file.\r\n\r\nI've additionally added some extra lines to the `.gitignore` file to make\r\nswitching between code branches and the `gh-pages` branch a little less\r\ncumbersome.","created_at":"2016-05-04T18:54:04Z","updated_at":"2016-05-04T19:24:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6bd56cc71f9cc59a565cd9ce7d8fe1e9f99e7976","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/coursera/naptime/pulls/7/commits","review_comments_url":"https://api.github.com/repos/coursera/naptime/pulls/7/comments","review_comment_url":"https://api.github.com/repos/coursera/naptime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coursera/naptime/issues/7/comments","statuses_url":"https://api.github.com/repos/coursera/naptime/statuses/5604157774538755bfd2873924b3aaeca374fe5f","head":{"label":"saeta:add-quickstart","ref":"add-quickstart","sha":"5604157774538755bfd2873924b3aaeca374fe5f","user":{"login":"saeta","id":1284535,"avatar_url":"https://avatars.githubusercontent.com/u/1284535?v=3","gravatar_id":"","url":"https://api.github.com/users/saeta","html_url":"https://github.com/saeta","followers_url":"https://api.github.com/users/saeta/followers","following_url":"https://api.github.com/users/saeta/following{/other_user}","gists_url":"https://api.github.com/users/saeta/gists{/gist_id}","starred_url":"https://api.github.com/users/saeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saeta/subscriptions","organizations_url":"https://api.github.com/users/saeta/orgs","repos_url":"https://api.github.com/users/saeta/repos","events_url":"https://api.github.com/users/saeta/events{/privacy}","received_events_url":"https://api.github.com/users/saeta/received_events","type":"User","site_admin":false},"repo":{"id":57408936,"name":"naptime","full_name":"saeta/naptime","owner":{"login":"saeta","id":1284535,"avatar_url":"https://avatars.githubusercontent.com/u/1284535?v=3","gravatar_id":"","url":"https://api.github.com/users/saeta","html_url":"https://github.com/saeta","followers_url":"https://api.github.com/users/saeta/followers","following_url":"https://api.github.com/users/saeta/following{/other_user}","gists_url":"https://api.github.com/users/saeta/gists{/gist_id}","starred_url":"https://api.github.com/users/saeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saeta/subscriptions","organizations_url":"https://api.github.com/users/saeta/orgs","repos_url":"https://api.github.com/users/saeta/repos","events_url":"https://api.github.com/users/saeta/events{/privacy}","received_events_url":"https://api.github.com/users/saeta/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/saeta/naptime","description":"Making REST APIs so easy, you can build them in your sleep!","fork":true,"url":"https://api.github.com/repos/saeta/naptime","forks_url":"https://api.github.com/repos/saeta/naptime/forks","keys_url":"https://api.github.com/repos/saeta/naptime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/saeta/naptime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/saeta/naptime/teams","hooks_url":"https://api.github.com/repos/saeta/naptime/hooks","issue_events_url":"https://api.github.com/repos/saeta/naptime/issues/events{/number}","events_url":"https://api.github.com/repos/saeta/naptime/events","assignees_url":"https://api.github.com/repos/saeta/naptime/assignees{/user}","branches_url":"https://api.github.com/repos/saeta/naptime/branches{/branch}","tags_url":"https://api.github.com/repos/saeta/naptime/tags","blobs_url":"https://api.github.com/repos/saeta/naptime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/saeta/naptime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/saeta/naptime/git/refs{/sha}","trees_url":"https://api.github.com/repos/saeta/naptime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/saeta/naptime/statuses/{sha}","languages_url":"https://api.github.com/repos/saeta/naptime/languages","stargazers_url":"https://api.github.com/repos/saeta/naptime/stargazers","contributors_url":"https://api.github.com/repos/saeta/naptime/contributors","subscribers_url":"https://api.github.com/repos/saeta/naptime/subscribers","subscription_url":"https://api.github.com/repos/saeta/naptime/subscription","commits_url":"https://api.github.com/repos/saeta/naptime/commits{/sha}","git_commits_url":"https://api.github.com/repos/saeta/naptime/git/commits{/sha}","comments_url":"https://api.github.com/repos/saeta/naptime/comments{/number}","issue_comment_url":"https://api.github.com/repos/saeta/naptime/issues/comments{/number}","contents_url":"https://api.github.com/repos/saeta/naptime/contents/{+path}","compare_url":"https://api.github.com/repos/saeta/naptime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/saeta/naptime/merges","archive_url":"https://api.github.com/repos/saeta/naptime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/saeta/naptime/downloads","issues_url":"https://api.github.com/repos/saeta/naptime/issues{/number}","pulls_url":"https://api.github.com/repos/saeta/naptime/pulls{/number}","milestones_url":"https://api.github.com/repos/saeta/naptime/milestones{/number}","notifications_url":"https://api.github.com/repos/saeta/naptime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/saeta/naptime/labels{/name}","releases_url":"https://api.github.com/repos/saeta/naptime/releases{/id}","deployments_url":"https://api.github.com/repos/saeta/naptime/deployments","created_at":"2016-04-29T19:45:40Z","updated_at":"2016-04-29T19:45:41Z","pushed_at":"2016-05-04T18:53:44Z","git_url":"git://github.com/saeta/naptime.git","ssh_url":"git@github.com:saeta/naptime.git","clone_url":"https://github.com/saeta/naptime.git","svn_url":"https://github.com/saeta/naptime","homepage":"","size":455,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"coursera:gh-pages","ref":"gh-pages","sha":"feb0bef647a7774ab715f4df80328fbd9edb2500","user":{"login":"coursera","id":1744549,"avatar_url":"https://avatars.githubusercontent.com/u/1744549?v=3","gravatar_id":"","url":"https://api.github.com/users/coursera","html_url":"https://github.com/coursera","followers_url":"https://api.github.com/users/coursera/followers","following_url":"https://api.github.com/users/coursera/following{/other_user}","gists_url":"https://api.github.com/users/coursera/gists{/gist_id}","starred_url":"https://api.github.com/users/coursera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coursera/subscriptions","organizations_url":"https://api.github.com/users/coursera/orgs","repos_url":"https://api.github.com/users/coursera/repos","events_url":"https://api.github.com/users/coursera/events{/privacy}","received_events_url":"https://api.github.com/users/coursera/received_events","type":"Organization","site_admin":false},"repo":{"id":57407978,"name":"naptime","full_name":"coursera/naptime","owner":{"login":"coursera","id":1744549,"avatar_url":"https://avatars.githubusercontent.com/u/1744549?v=3","gravatar_id":"","url":"https://api.github.com/users/coursera","html_url":"https://github.com/coursera","followers_url":"https://api.github.com/users/coursera/followers","following_url":"https://api.github.com/users/coursera/following{/other_user}","gists_url":"https://api.github.com/users/coursera/gists{/gist_id}","starred_url":"https://api.github.com/users/coursera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coursera/subscriptions","organizations_url":"https://api.github.com/users/coursera/orgs","repos_url":"https://api.github.com/users/coursera/repos","events_url":"https://api.github.com/users/coursera/events{/privacy}","received_events_url":"https://api.github.com/users/coursera/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coursera/naptime","description":"Making REST APIs so easy, you can build them in your sleep!","fork":false,"url":"https://api.github.com/repos/coursera/naptime","forks_url":"https://api.github.com/repos/coursera/naptime/forks","keys_url":"https://api.github.com/repos/coursera/naptime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coursera/naptime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coursera/naptime/teams","hooks_url":"https://api.github.com/repos/coursera/naptime/hooks","issue_events_url":"https://api.github.com/repos/coursera/naptime/issues/events{/number}","events_url":"https://api.github.com/repos/coursera/naptime/events","assignees_url":"https://api.github.com/repos/coursera/naptime/assignees{/user}","branches_url":"https://api.github.com/repos/coursera/naptime/branches{/branch}","tags_url":"https://api.github.com/repos/coursera/naptime/tags","blobs_url":"https://api.github.com/repos/coursera/naptime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coursera/naptime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coursera/naptime/git/refs{/sha}","trees_url":"https://api.github.com/repos/coursera/naptime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coursera/naptime/statuses/{sha}","languages_url":"https://api.github.com/repos/coursera/naptime/languages","stargazers_url":"https://api.github.com/repos/coursera/naptime/stargazers","contributors_url":"https://api.github.com/repos/coursera/naptime/contributors","subscribers_url":"https://api.github.com/repos/coursera/naptime/subscribers","subscription_url":"https://api.github.com/repos/coursera/naptime/subscription","commits_url":"https://api.github.com/repos/coursera/naptime/commits{/sha}","git_commits_url":"https://api.github.com/repos/coursera/naptime/git/commits{/sha}","comments_url":"https://api.github.com/repos/coursera/naptime/comments{/number}","issue_comment_url":"https://api.github.com/repos/coursera/naptime/issues/comments{/number}","contents_url":"https://api.github.com/repos/coursera/naptime/contents/{+path}","compare_url":"https://api.github.com/repos/coursera/naptime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coursera/naptime/merges","archive_url":"https://api.github.com/repos/coursera/naptime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coursera/naptime/downloads","issues_url":"https://api.github.com/repos/coursera/naptime/issues{/number}","pulls_url":"https://api.github.com/repos/coursera/naptime/pulls{/number}","milestones_url":"https://api.github.com/repos/coursera/naptime/milestones{/number}","notifications_url":"https://api.github.com/repos/coursera/naptime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coursera/naptime/labels{/name}","releases_url":"https://api.github.com/repos/coursera/naptime/releases{/id}","deployments_url":"https://api.github.com/repos/coursera/naptime/deployments","created_at":"2016-04-29T19:27:17Z","updated_at":"2016-05-03T07:51:12Z","pushed_at":"2016-05-04T18:54:04Z","git_url":"git://github.com/coursera/naptime.git","ssh_url":"git@github.com:coursera/naptime.git","clone_url":"https://github.com/coursera/naptime.git","svn_url":"https://github.com/coursera/naptime","homepage":"","size":454,"stargazers_count":10,"watchers_count":10,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coursera/naptime/pulls/7"},"html":{"href":"https://github.com/coursera/naptime/pull/7"},"issue":{"href":"https://api.github.com/repos/coursera/naptime/issues/7"},"comments":{"href":"https://api.github.com/repos/coursera/naptime/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/coursera/naptime/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/coursera/naptime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coursera/naptime/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/coursera/naptime/statuses/5604157774538755bfd2873924b3aaeca374fe5f"}}}}