{"action":"created","comment":{"url":"https://api.github.com/repos/marmelab/quarto-android/pulls/comments/199073736","pull_request_review_id":133119501,"id":199073736,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTA3MzczNg==","diff_hunk":"@@ -1,3 +1,73 @@\n+import config from '../config.dist';\n+\n+const HEADER_JSON = {\n+    Accept: 'application/json',\n+    'Content-Type': 'application/json',\n+};\n+\n+const BASE_URL = config.apiUrl;\n+\n+function handleErrors(res) {\n+    if (!res.ok) {\n+        return Promise.reject(res.statusText);\n+    }\n+    return res;\n+}\n+\n+export const newGameTest = numberPlayers => {\n+    var grid = [['.', '.', '.'], ['.', '.', '.'], ['.', '.', '.']];\n+    return {\n+        idGame: '1',\n+        grid: grid,\n+        selectedPiece: 0,\n+        numberPlayers: numberPlayers,\n+    };\n+};\n+\n export const newGame = numberPlayers => {\n-    return { id: '1', numberPlayers: numberPlayers };\n+    const url = `${BASE_URL}`;\n+    const method = 'POST';\n+    const headers = Object.assign({}, HEADER_JSON);\n+    return fetch(url, {\n+        method,\n+        headers,\n+    })\n+        .then(handleErrors)\n+        .then(res => res.json())\n+        .then(res => {\n+            res.numberPlayers = numberPlayers;\n+            return res;\n+        });\n+};\n+\n+export const placePiece = (game, x, y) => {\n+    const url = `${BASE_URL}/${game.idGame}/place/${x}/${y}`;\n+    const method = 'PUT';\n+    const headers = Object.assign({}, HEADER_JSON);\n+    return fetch(url, {\n+        method,\n+        headers,\n+    })\n+        .then(handleErrors)\n+        .then(res => res.json())\n+        .then(res => {\n+            res.numberPlayers = game.numberOfPlayers;\n+            return res;\n+        });\n+};\n+\n+export const selectPiece = (game, piece) => {\n+    const url = `${BASE_URL}/${game.idGame}/select/${piece}`;\n+    const method = 'PUT';\n+    const headers = Object.assign({}, HEADER_JSON);\n+    return fetch(url, {\n+        method,\n+        headers,\n+    })\n+        .then(handleErrors)\n+        .then(res => res.json())\n+        .then(res => {","path":"src/services/GameService.js","position":38,"original_position":70,"commit_id":"0ae7f2d82ccd17b325c3b967402d6bbd8d5cc312","original_commit_id":"0ae7f2d82ccd17b325c3b967402d6bbd8d5cc312","user":{"login":"djhi","id":1122076,"node_id":"MDQ6VXNlcjExMjIwNzY=","avatar_url":"https://avatars2.githubusercontent.com/u/1122076?v=4","gravatar_id":"","url":"https://api.github.com/users/djhi","html_url":"https://github.com/djhi","followers_url":"https://api.github.com/users/djhi/followers","following_url":"https://api.github.com/users/djhi/following{/other_user}","gists_url":"https://api.github.com/users/djhi/gists{/gist_id}","starred_url":"https://api.github.com/users/djhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djhi/subscriptions","organizations_url":"https://api.github.com/users/djhi/orgs","repos_url":"https://api.github.com/users/djhi/repos","events_url":"https://api.github.com/users/djhi/events{/privacy}","received_events_url":"https://api.github.com/users/djhi/received_events","type":"User","site_admin":false},"body":"Same, maybe it's time to extract it to a `addNumberOfPlayer` function ?","created_at":"2018-06-29T07:19:36Z","updated_at":"2018-06-29T07:19:39Z","html_url":"https://github.com/marmelab/quarto-android/pull/3#discussion_r199073736","pull_request_url":"https://api.github.com/repos/marmelab/quarto-android/pulls/3","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/marmelab/quarto-android/pulls/comments/199073736"},"html":{"href":"https://github.com/marmelab/quarto-android/pull/3#discussion_r199073736"},"pull_request":{"href":"https://api.github.com/repos/marmelab/quarto-android/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/marmelab/quarto-android/pulls/3","id":198041853,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MDQxODUz","html_url":"https://github.com/marmelab/quarto-android/pull/3","diff_url":"https://github.com/marmelab/quarto-android/pull/3.diff","patch_url":"https://github.com/marmelab/quarto-android/pull/3.patch","issue_url":"https://api.github.com/repos/marmelab/quarto-android/issues/3","number":3,"state":"open","locked":false,"title":"[WIP] Basic game display","user":{"login":"JulienMattiussi","id":39904906,"node_id":"MDQ6VXNlcjM5OTA0OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/39904906?v=4","gravatar_id":"","url":"https://api.github.com/users/JulienMattiussi","html_url":"https://github.com/JulienMattiussi","followers_url":"https://api.github.com/users/JulienMattiussi/followers","following_url":"https://api.github.com/users/JulienMattiussi/following{/other_user}","gists_url":"https://api.github.com/users/JulienMattiussi/gists{/gist_id}","starred_url":"https://api.github.com/users/JulienMattiussi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JulienMattiussi/subscriptions","organizations_url":"https://api.github.com/users/JulienMattiussi/orgs","repos_url":"https://api.github.com/users/JulienMattiussi/repos","events_url":"https://api.github.com/users/JulienMattiussi/events{/privacy}","received_events_url":"https://api.github.com/users/JulienMattiussi/received_events","type":"User","site_admin":false},"body":"https://trello.com/c/0P5PwSnd\r\n\r\n- [x] Player can create a new game\r\n- [x] Player can see the board\r\n- [ ] Enhance visual informations\r\n- [ ] Unit tests\r\n\r\n![image](https://user-images.githubusercontent.com/39904906/42039197-1c6f383a-7aed-11e8-96b6-a3516f229ebe.png)\r\n\r\n\r\nPlayer can also select and places pieces whithout any control (added for testing various display and routing, will be improve in next cards)\r\n","created_at":"2018-06-28T14:06:10Z","updated_at":"2018-06-29T07:19:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d791b76f3bbfc86212594b200cb404b9ba1a539","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/marmelab/quarto-android/pulls/3/commits","review_comments_url":"https://api.github.com/repos/marmelab/quarto-android/pulls/3/comments","review_comment_url":"https://api.github.com/repos/marmelab/quarto-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/marmelab/quarto-android/issues/3/comments","statuses_url":"https://api.github.com/repos/marmelab/quarto-android/statuses/0ae7f2d82ccd17b325c3b967402d6bbd8d5cc312","head":{"label":"marmelab:gamedisplay","ref":"gamedisplay","sha":"0ae7f2d82ccd17b325c3b967402d6bbd8d5cc312","user":{"login":"marmelab","id":3116319,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMTYzMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/3116319?v=4","gravatar_id":"","url":"https://api.github.com/users/marmelab","html_url":"https://github.com/marmelab","followers_url":"https://api.github.com/users/marmelab/followers","following_url":"https://api.github.com/users/marmelab/following{/other_user}","gists_url":"https://api.github.com/users/marmelab/gists{/gist_id}","starred_url":"https://api.github.com/users/marmelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmelab/subscriptions","organizations_url":"https://api.github.com/users/marmelab/orgs","repos_url":"https://api.github.com/users/marmelab/repos","events_url":"https://api.github.com/users/marmelab/events{/privacy}","received_events_url":"https://api.github.com/users/marmelab/received_events","type":"Organization","site_admin":false},"repo":{"id":138718122,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg3MTgxMjI=","name":"quarto-android","full_name":"marmelab/quarto-android","owner":{"login":"marmelab","id":3116319,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMTYzMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/3116319?v=4","gravatar_id":"","url":"https://api.github.com/users/marmelab","html_url":"https://github.com/marmelab","followers_url":"https://api.github.com/users/marmelab/followers","following_url":"https://api.github.com/users/marmelab/following{/other_user}","gists_url":"https://api.github.com/users/marmelab/gists{/gist_id}","starred_url":"https://api.github.com/users/marmelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmelab/subscriptions","organizations_url":"https://api.github.com/users/marmelab/orgs","repos_url":"https://api.github.com/users/marmelab/repos","events_url":"https://api.github.com/users/marmelab/events{/privacy}","received_events_url":"https://api.github.com/users/marmelab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/marmelab/quarto-android","description":"Quarto game in react-native for Android","fork":false,"url":"https://api.github.com/repos/marmelab/quarto-android","forks_url":"https://api.github.com/repos/marmelab/quarto-android/forks","keys_url":"https://api.github.com/repos/marmelab/quarto-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marmelab/quarto-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marmelab/quarto-android/teams","hooks_url":"https://api.github.com/repos/marmelab/quarto-android/hooks","issue_events_url":"https://api.github.com/repos/marmelab/quarto-android/issues/events{/number}","events_url":"https://api.github.com/repos/marmelab/quarto-android/events","assignees_url":"https://api.github.com/repos/marmelab/quarto-android/assignees{/user}","branches_url":"https://api.github.com/repos/marmelab/quarto-android/branches{/branch}","tags_url":"https://api.github.com/repos/marmelab/quarto-android/tags","blobs_url":"https://api.github.com/repos/marmelab/quarto-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marmelab/quarto-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marmelab/quarto-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/marmelab/quarto-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marmelab/quarto-android/statuses/{sha}","languages_url":"https://api.github.com/repos/marmelab/quarto-android/languages","stargazers_url":"https://api.github.com/repos/marmelab/quarto-android/stargazers","contributors_url":"https://api.github.com/repos/marmelab/quarto-android/contributors","subscribers_url":"https://api.github.com/repos/marmelab/quarto-android/subscribers","subscription_url":"https://api.github.com/repos/marmelab/quarto-android/subscription","commits_url":"https://api.github.com/repos/marmelab/quarto-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/marmelab/quarto-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/marmelab/quarto-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/marmelab/quarto-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/marmelab/quarto-android/contents/{+path}","compare_url":"https://api.github.com/repos/marmelab/quarto-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marmelab/quarto-android/merges","archive_url":"https://api.github.com/repos/marmelab/quarto-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marmelab/quarto-android/downloads","issues_url":"https://api.github.com/repos/marmelab/quarto-android/issues{/number}","pulls_url":"https://api.github.com/repos/marmelab/quarto-android/pulls{/number}","milestones_url":"https://api.github.com/repos/marmelab/quarto-android/milestones{/number}","notifications_url":"https://api.github.com/repos/marmelab/quarto-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marmelab/quarto-android/labels{/name}","releases_url":"https://api.github.com/repos/marmelab/quarto-android/releases{/id}","deployments_url":"https://api.github.com/repos/marmelab/quarto-android/deployments","created_at":"2018-06-26T09:49:10Z","updated_at":"2018-06-29T07:09:50Z","pushed_at":"2018-06-29T07:09:50Z","git_url":"git://github.com/marmelab/quarto-android.git","ssh_url":"git@github.com:marmelab/quarto-android.git","clone_url":"https://github.com/marmelab/quarto-android.git","svn_url":"https://github.com/marmelab/quarto-android","homepage":null,"size":718,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"marmelab:master","ref":"master","sha":"eba3b2e4e7ce25e0687db07c5a84e2d472e42bfb","user":{"login":"marmelab","id":3116319,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMTYzMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/3116319?v=4","gravatar_id":"","url":"https://api.github.com/users/marmelab","html_url":"https://github.com/marmelab","followers_url":"https://api.github.com/users/marmelab/followers","following_url":"https://api.github.com/users/marmelab/following{/other_user}","gists_url":"https://api.github.com/users/marmelab/gists{/gist_id}","starred_url":"https://api.github.com/users/marmelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmelab/subscriptions","organizations_url":"https://api.github.com/users/marmelab/orgs","repos_url":"https://api.github.com/users/marmelab/repos","events_url":"https://api.github.com/users/marmelab/events{/privacy}","received_events_url":"https://api.github.com/users/marmelab/received_events","type":"Organization","site_admin":false},"repo":{"id":138718122,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg3MTgxMjI=","name":"quarto-android","full_name":"marmelab/quarto-android","owner":{"login":"marmelab","id":3116319,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMxMTYzMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/3116319?v=4","gravatar_id":"","url":"https://api.github.com/users/marmelab","html_url":"https://github.com/marmelab","followers_url":"https://api.github.com/users/marmelab/followers","following_url":"https://api.github.com/users/marmelab/following{/other_user}","gists_url":"https://api.github.com/users/marmelab/gists{/gist_id}","starred_url":"https://api.github.com/users/marmelab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marmelab/subscriptions","organizations_url":"https://api.github.com/users/marmelab/orgs","repos_url":"https://api.github.com/users/marmelab/repos","events_url":"https://api.github.com/users/marmelab/events{/privacy}","received_events_url":"https://api.github.com/users/marmelab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/marmelab/quarto-android","description":"Quarto game in react-native for Android","fork":false,"url":"https://api.github.com/repos/marmelab/quarto-android","forks_url":"https://api.github.com/repos/marmelab/quarto-android/forks","keys_url":"https://api.github.com/repos/marmelab/quarto-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marmelab/quarto-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marmelab/quarto-android/teams","hooks_url":"https://api.github.com/repos/marmelab/quarto-android/hooks","issue_events_url":"https://api.github.com/repos/marmelab/quarto-android/issues/events{/number}","events_url":"https://api.github.com/repos/marmelab/quarto-android/events","assignees_url":"https://api.github.com/repos/marmelab/quarto-android/assignees{/user}","branches_url":"https://api.github.com/repos/marmelab/quarto-android/branches{/branch}","tags_url":"https://api.github.com/repos/marmelab/quarto-android/tags","blobs_url":"https://api.github.com/repos/marmelab/quarto-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marmelab/quarto-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marmelab/quarto-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/marmelab/quarto-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marmelab/quarto-android/statuses/{sha}","languages_url":"https://api.github.com/repos/marmelab/quarto-android/languages","stargazers_url":"https://api.github.com/repos/marmelab/quarto-android/stargazers","contributors_url":"https://api.github.com/repos/marmelab/quarto-android/contributors","subscribers_url":"https://api.github.com/repos/marmelab/quarto-android/subscribers","subscription_url":"https://api.github.com/repos/marmelab/quarto-android/subscription","commits_url":"https://api.github.com/repos/marmelab/quarto-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/marmelab/quarto-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/marmelab/quarto-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/marmelab/quarto-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/marmelab/quarto-android/contents/{+path}","compare_url":"https://api.github.com/repos/marmelab/quarto-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marmelab/quarto-android/merges","archive_url":"https://api.github.com/repos/marmelab/quarto-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marmelab/quarto-android/downloads","issues_url":"https://api.github.com/repos/marmelab/quarto-android/issues{/number}","pulls_url":"https://api.github.com/repos/marmelab/quarto-android/pulls{/number}","milestones_url":"https://api.github.com/repos/marmelab/quarto-android/milestones{/number}","notifications_url":"https://api.github.com/repos/marmelab/quarto-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marmelab/quarto-android/labels{/name}","releases_url":"https://api.github.com/repos/marmelab/quarto-android/releases{/id}","deployments_url":"https://api.github.com/repos/marmelab/quarto-android/deployments","created_at":"2018-06-26T09:49:10Z","updated_at":"2018-06-29T07:09:50Z","pushed_at":"2018-06-29T07:09:50Z","git_url":"git://github.com/marmelab/quarto-android.git","ssh_url":"git@github.com:marmelab/quarto-android.git","clone_url":"https://github.com/marmelab/quarto-android.git","svn_url":"https://github.com/marmelab/quarto-android","homepage":null,"size":718,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/marmelab/quarto-android/pulls/3"},"html":{"href":"https://github.com/marmelab/quarto-android/pull/3"},"issue":{"href":"https://api.github.com/repos/marmelab/quarto-android/issues/3"},"comments":{"href":"https://api.github.com/repos/marmelab/quarto-android/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/marmelab/quarto-android/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/marmelab/quarto-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/marmelab/quarto-android/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/marmelab/quarto-android/statuses/0ae7f2d82ccd17b325c3b967402d6bbd8d5cc312"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"djhi"}}