{"action":"created","comment":{"url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/comments/59586938","id":59586938,"diff_hunk":"@@ -95,4 +130,55 @@ export default class Client {\n   on(event, cb) {\n     this.eventEmitter.on(event, cb);\n   }\n+\n+  /* ---- HELPERS ---- */\n+  get(path, options) {\n+    const _options = options || {};\n+    _options.method = 'get';\n+    return this.fetch(path, _options);\n+  }\n+\n+  post(path, body, options) {\n+    let _options = { ...this.defaults.post };\n+    _options.body = JSON.stringify(body);\n+    _options = merge.recursive(true, _options, options);\n+    _options.method = 'post';\n+    return this.fetch(path, _options);\n+  }\n+\n+  put(path, body, options) {\n+    let _options = { ...this.defaults.put };\n+    _options.body = JSON.stringify(body);\n+    _options = merge.recursive(true, _options, options);\n+    _options.method = 'put';\n+    return this.fetch(path, _options);\n+  }\n+\n+  patch(path, body, options) {\n+    let _options = { ...this.defaults.patch };\n+    _options.body = JSON.stringify(body);\n+    _options = merge.recursive(true, _options, options);\n+    _options.method = 'patch';\n+    return this.fetch(path, _options);\n+  }\n+\n+  delete(path, options) {\n+    const _options = options || {};\n+    _options.method = 'delete';\n+    return this.fetch(path, _options);\n+  }\n+\n+  upload(path, input, options) {\n+    const _options = options || {};\n+    _options.method = 'post';\n+\n+    const data = new FormData();\n+    let i;\n+    for (i = 0; i < input.files.length; i++) {\n+      data.append('files[]', input.files[i]);","path":"src/client.js","position":105,"original_position":105,"commit_id":"636a652b2381654c9a083c0a496b1750ca0d4fb5","original_commit_id":"2016800efa86c9ad52aa2c9fffc47877bb03562e","user":{"login":"spruce-bruce","id":59978,"avatar_url":"https://avatars.githubusercontent.com/u/59978?v=3","gravatar_id":"","url":"https://api.github.com/users/spruce-bruce","html_url":"https://github.com/spruce-bruce","followers_url":"https://api.github.com/users/spruce-bruce/followers","following_url":"https://api.github.com/users/spruce-bruce/following{/other_user}","gists_url":"https://api.github.com/users/spruce-bruce/gists{/gist_id}","starred_url":"https://api.github.com/users/spruce-bruce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spruce-bruce/subscriptions","organizations_url":"https://api.github.com/users/spruce-bruce/orgs","repos_url":"https://api.github.com/users/spruce-bruce/repos","events_url":"https://api.github.com/users/spruce-bruce/events{/privacy}","received_events_url":"https://api.github.com/users/spruce-bruce/received_events","type":"User","site_admin":false},"body":"OK - I'm going to take upload out of this PR then and create a new issue for that just so I can get the other stuff merged in.\r\n\r\nI'll work on the form stuff next.","created_at":"2016-04-13T17:11:48Z","updated_at":"2016-04-13T17:11:48Z","html_url":"https://github.com/synapsestudios/synapi-client/pull/20#discussion_r59586938","pull_request_url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/comments/59586938"},"html":{"href":"https://github.com/synapsestudios/synapi-client/pull/20#discussion_r59586938"},"pull_request":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20","id":66257633,"html_url":"https://github.com/synapsestudios/synapi-client/pull/20","diff_url":"https://github.com/synapsestudios/synapi-client/pull/20.diff","patch_url":"https://github.com/synapsestudios/synapi-client/pull/20.patch","issue_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/20","number":20,"state":"open","locked":false,"title":"Helpers","user":{"login":"spruce-bruce","id":59978,"avatar_url":"https://avatars.githubusercontent.com/u/59978?v=3","gravatar_id":"","url":"https://api.github.com/users/spruce-bruce","html_url":"https://github.com/spruce-bruce","followers_url":"https://api.github.com/users/spruce-bruce/followers","following_url":"https://api.github.com/users/spruce-bruce/following{/other_user}","gists_url":"https://api.github.com/users/spruce-bruce/gists{/gist_id}","starred_url":"https://api.github.com/users/spruce-bruce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spruce-bruce/subscriptions","organizations_url":"https://api.github.com/users/spruce-bruce/orgs","repos_url":"https://api.github.com/users/spruce-bruce/repos","events_url":"https://api.github.com/users/spruce-bruce/events{/privacy}","received_events_url":"https://api.github.com/users/spruce-bruce/received_events","type":"User","site_admin":false},"body":"For #6.\r\n\r\nOn the fence about the structure of defaults. I kind of wanted to allow put, post, patch, get, etc to have their own default headers, but now that I think about it, they'll probably always want to be the same.\r\n\r\nIt's also probably not great to assume in patch/put/post that the body should be encoded as JSON. I was thinking about taking out the json encoding and just adding it to the json decoding middleware. So that middleware will use the onStart() to encode the body as JSON and onSuccess() to decode the response JSON. As long as we check the Content-Type of the request for json then this should be fine.","created_at":"2016-04-13T02:34:01Z","updated_at":"2016-04-13T17:11:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f4a4356a5392e7ab3db9852462d72429a5899d4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20/commits","review_comments_url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20/comments","review_comment_url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/20/comments","statuses_url":"https://api.github.com/repos/synapsestudios/synapi-client/statuses/636a652b2381654c9a083c0a496b1750ca0d4fb5","head":{"label":"synapsestudios:helpers","ref":"helpers","sha":"636a652b2381654c9a083c0a496b1750ca0d4fb5","user":{"login":"synapsestudios","id":197868,"avatar_url":"https://avatars.githubusercontent.com/u/197868?v=3","gravatar_id":"","url":"https://api.github.com/users/synapsestudios","html_url":"https://github.com/synapsestudios","followers_url":"https://api.github.com/users/synapsestudios/followers","following_url":"https://api.github.com/users/synapsestudios/following{/other_user}","gists_url":"https://api.github.com/users/synapsestudios/gists{/gist_id}","starred_url":"https://api.github.com/users/synapsestudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synapsestudios/subscriptions","organizations_url":"https://api.github.com/users/synapsestudios/orgs","repos_url":"https://api.github.com/users/synapsestudios/repos","events_url":"https://api.github.com/users/synapsestudios/events{/privacy}","received_events_url":"https://api.github.com/users/synapsestudios/received_events","type":"Organization","site_admin":false},"repo":{"id":55457827,"name":"synapi-client","full_name":"synapsestudios/synapi-client","owner":{"login":"synapsestudios","id":197868,"avatar_url":"https://avatars.githubusercontent.com/u/197868?v=3","gravatar_id":"","url":"https://api.github.com/users/synapsestudios","html_url":"https://github.com/synapsestudios","followers_url":"https://api.github.com/users/synapsestudios/followers","following_url":"https://api.github.com/users/synapsestudios/following{/other_user}","gists_url":"https://api.github.com/users/synapsestudios/gists{/gist_id}","starred_url":"https://api.github.com/users/synapsestudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synapsestudios/subscriptions","organizations_url":"https://api.github.com/users/synapsestudios/orgs","repos_url":"https://api.github.com/users/synapsestudios/repos","events_url":"https://api.github.com/users/synapsestudios/events{/privacy}","received_events_url":"https://api.github.com/users/synapsestudios/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/synapsestudios/synapi-client","description":"http client library based on fetch","fork":false,"url":"https://api.github.com/repos/synapsestudios/synapi-client","forks_url":"https://api.github.com/repos/synapsestudios/synapi-client/forks","keys_url":"https://api.github.com/repos/synapsestudios/synapi-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/synapsestudios/synapi-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/synapsestudios/synapi-client/teams","hooks_url":"https://api.github.com/repos/synapsestudios/synapi-client/hooks","issue_events_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/events{/number}","events_url":"https://api.github.com/repos/synapsestudios/synapi-client/events","assignees_url":"https://api.github.com/repos/synapsestudios/synapi-client/assignees{/user}","branches_url":"https://api.github.com/repos/synapsestudios/synapi-client/branches{/branch}","tags_url":"https://api.github.com/repos/synapsestudios/synapi-client/tags","blobs_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/synapsestudios/synapi-client/statuses/{sha}","languages_url":"https://api.github.com/repos/synapsestudios/synapi-client/languages","stargazers_url":"https://api.github.com/repos/synapsestudios/synapi-client/stargazers","contributors_url":"https://api.github.com/repos/synapsestudios/synapi-client/contributors","subscribers_url":"https://api.github.com/repos/synapsestudios/synapi-client/subscribers","subscription_url":"https://api.github.com/repos/synapsestudios/synapi-client/subscription","commits_url":"https://api.github.com/repos/synapsestudios/synapi-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/synapsestudios/synapi-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/synapsestudios/synapi-client/contents/{+path}","compare_url":"https://api.github.com/repos/synapsestudios/synapi-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/synapsestudios/synapi-client/merges","archive_url":"https://api.github.com/repos/synapsestudios/synapi-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/synapsestudios/synapi-client/downloads","issues_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues{/number}","pulls_url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls{/number}","milestones_url":"https://api.github.com/repos/synapsestudios/synapi-client/milestones{/number}","notifications_url":"https://api.github.com/repos/synapsestudios/synapi-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/synapsestudios/synapi-client/labels{/name}","releases_url":"https://api.github.com/repos/synapsestudios/synapi-client/releases{/id}","deployments_url":"https://api.github.com/repos/synapsestudios/synapi-client/deployments","created_at":"2016-04-05T01:25:41Z","updated_at":"2016-04-06T23:01:13Z","pushed_at":"2016-04-13T16:57:33Z","git_url":"git://github.com/synapsestudios/synapi-client.git","ssh_url":"git@github.com:synapsestudios/synapi-client.git","clone_url":"https://github.com/synapsestudios/synapi-client.git","svn_url":"https://github.com/synapsestudios/synapi-client","homepage":null,"size":52,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"synapsestudios:master","ref":"master","sha":"026748d064e9f412d10b33867d32cdc871f5fa65","user":{"login":"synapsestudios","id":197868,"avatar_url":"https://avatars.githubusercontent.com/u/197868?v=3","gravatar_id":"","url":"https://api.github.com/users/synapsestudios","html_url":"https://github.com/synapsestudios","followers_url":"https://api.github.com/users/synapsestudios/followers","following_url":"https://api.github.com/users/synapsestudios/following{/other_user}","gists_url":"https://api.github.com/users/synapsestudios/gists{/gist_id}","starred_url":"https://api.github.com/users/synapsestudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synapsestudios/subscriptions","organizations_url":"https://api.github.com/users/synapsestudios/orgs","repos_url":"https://api.github.com/users/synapsestudios/repos","events_url":"https://api.github.com/users/synapsestudios/events{/privacy}","received_events_url":"https://api.github.com/users/synapsestudios/received_events","type":"Organization","site_admin":false},"repo":{"id":55457827,"name":"synapi-client","full_name":"synapsestudios/synapi-client","owner":{"login":"synapsestudios","id":197868,"avatar_url":"https://avatars.githubusercontent.com/u/197868?v=3","gravatar_id":"","url":"https://api.github.com/users/synapsestudios","html_url":"https://github.com/synapsestudios","followers_url":"https://api.github.com/users/synapsestudios/followers","following_url":"https://api.github.com/users/synapsestudios/following{/other_user}","gists_url":"https://api.github.com/users/synapsestudios/gists{/gist_id}","starred_url":"https://api.github.com/users/synapsestudios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/synapsestudios/subscriptions","organizations_url":"https://api.github.com/users/synapsestudios/orgs","repos_url":"https://api.github.com/users/synapsestudios/repos","events_url":"https://api.github.com/users/synapsestudios/events{/privacy}","received_events_url":"https://api.github.com/users/synapsestudios/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/synapsestudios/synapi-client","description":"http client library based on fetch","fork":false,"url":"https://api.github.com/repos/synapsestudios/synapi-client","forks_url":"https://api.github.com/repos/synapsestudios/synapi-client/forks","keys_url":"https://api.github.com/repos/synapsestudios/synapi-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/synapsestudios/synapi-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/synapsestudios/synapi-client/teams","hooks_url":"https://api.github.com/repos/synapsestudios/synapi-client/hooks","issue_events_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/events{/number}","events_url":"https://api.github.com/repos/synapsestudios/synapi-client/events","assignees_url":"https://api.github.com/repos/synapsestudios/synapi-client/assignees{/user}","branches_url":"https://api.github.com/repos/synapsestudios/synapi-client/branches{/branch}","tags_url":"https://api.github.com/repos/synapsestudios/synapi-client/tags","blobs_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/synapsestudios/synapi-client/statuses/{sha}","languages_url":"https://api.github.com/repos/synapsestudios/synapi-client/languages","stargazers_url":"https://api.github.com/repos/synapsestudios/synapi-client/stargazers","contributors_url":"https://api.github.com/repos/synapsestudios/synapi-client/contributors","subscribers_url":"https://api.github.com/repos/synapsestudios/synapi-client/subscribers","subscription_url":"https://api.github.com/repos/synapsestudios/synapi-client/subscription","commits_url":"https://api.github.com/repos/synapsestudios/synapi-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/synapsestudios/synapi-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/synapsestudios/synapi-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/synapsestudios/synapi-client/contents/{+path}","compare_url":"https://api.github.com/repos/synapsestudios/synapi-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/synapsestudios/synapi-client/merges","archive_url":"https://api.github.com/repos/synapsestudios/synapi-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/synapsestudios/synapi-client/downloads","issues_url":"https://api.github.com/repos/synapsestudios/synapi-client/issues{/number}","pulls_url":"https://api.github.com/repos/synapsestudios/synapi-client/pulls{/number}","milestones_url":"https://api.github.com/repos/synapsestudios/synapi-client/milestones{/number}","notifications_url":"https://api.github.com/repos/synapsestudios/synapi-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/synapsestudios/synapi-client/labels{/name}","releases_url":"https://api.github.com/repos/synapsestudios/synapi-client/releases{/id}","deployments_url":"https://api.github.com/repos/synapsestudios/synapi-client/deployments","created_at":"2016-04-05T01:25:41Z","updated_at":"2016-04-06T23:01:13Z","pushed_at":"2016-04-13T16:57:33Z","git_url":"git://github.com/synapsestudios/synapi-client.git","ssh_url":"git@github.com:synapsestudios/synapi-client.git","clone_url":"https://github.com/synapsestudios/synapi-client.git","svn_url":"https://github.com/synapsestudios/synapi-client","homepage":null,"size":52,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20"},"html":{"href":"https://github.com/synapsestudios/synapi-client/pull/20"},"issue":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/issues/20"},"comments":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/synapsestudios/synapi-client/statuses/636a652b2381654c9a083c0a496b1750ca0d4fb5"}}}}