{"action":"created","comment":{"url":"https://api.github.com/repos/ably/ably-go/pulls/comments/29126715","id":29126715,"diff_hunk":"@@ -27,36 +29,30 @@ func query(fn func(string, interface{}) (*http.Response, error)) QueryFunc {\n }\n \n type RestClient struct {\n-\tAuth *Auth\n-\n-\tRestEndpoint string\n-\tProtocol     string\n+\tOptions *ClientOptions\n+\tAuth    *Auth\n \n-\tHTTPClient *http.Client\n-\n-\tchannels map[string]*RestChannel\n-\tchanMtx  sync.Mutex\n+\tchansMtx sync.Mutex\n+\tchans    map[string]*RestChannel","path":"ably/rest_client.go","position":34,"original_position":34,"commit_id":"50beb4f94b6df73dba394f66bf6120a66e38b744","original_commit_id":"50beb4f94b6df73dba394f66bf6120a66e38b744","user":{"login":"rjeczalik","id":1162017,"avatar_url":"https://avatars.githubusercontent.com/u/1162017?v=3","gravatar_id":"","url":"https://api.github.com/users/rjeczalik","html_url":"https://github.com/rjeczalik","followers_url":"https://api.github.com/users/rjeczalik/followers","following_url":"https://api.github.com/users/rjeczalik/following{/other_user}","gists_url":"https://api.github.com/users/rjeczalik/gists{/gist_id}","starred_url":"https://api.github.com/users/rjeczalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjeczalik/subscriptions","organizations_url":"https://api.github.com/users/rjeczalik/orgs","repos_url":"https://api.github.com/users/rjeczalik/repos","events_url":"https://api.github.com/users/rjeczalik/events{/privacy}","received_events_url":"https://api.github.com/users/rjeczalik/received_events","type":"User","site_admin":false},"body":"Already fixed.","created_at":"2015-04-27T08:02:55Z","updated_at":"2015-04-27T08:02:55Z","html_url":"https://github.com/ably/ably-go/pull/24#discussion_r29126715","pull_request_url":"https://api.github.com/repos/ably/ably-go/pulls/24","_links":{"self":{"href":"https://api.github.com/repos/ably/ably-go/pulls/comments/29126715"},"html":{"href":"https://github.com/ably/ably-go/pull/24#discussion_r29126715"},"pull_request":{"href":"https://api.github.com/repos/ably/ably-go/pulls/24"}}},"pull_request":{"url":"https://api.github.com/repos/ably/ably-go/pulls/24","id":34107826,"html_url":"https://github.com/ably/ably-go/pull/24","diff_url":"https://github.com/ably/ably-go/pull/24.diff","patch_url":"https://github.com/ably/ably-go/pull/24.patch","issue_url":"https://api.github.com/repos/ably/ably-go/issues/24","number":24,"state":"open","locked":false,"title":"rest: improve RestClient API","user":{"login":"rjeczalik","id":1162017,"avatar_url":"https://avatars.githubusercontent.com/u/1162017?v=3","gravatar_id":"","url":"https://api.github.com/users/rjeczalik","html_url":"https://github.com/rjeczalik","followers_url":"https://api.github.com/users/rjeczalik/followers","following_url":"https://api.github.com/users/rjeczalik/following{/other_user}","gists_url":"https://api.github.com/users/rjeczalik/gists{/gist_id}","starred_url":"https://api.github.com/users/rjeczalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjeczalik/subscriptions","organizations_url":"https://api.github.com/users/rjeczalik/orgs","repos_url":"https://api.github.com/users/rjeczalik/repos","events_url":"https://api.github.com/users/rjeczalik/events{/privacy}","received_events_url":"https://api.github.com/users/rjeczalik/received_events","type":"User","site_admin":false},"body":"This CL cleans up RestClient API, fixing couple of incosistencies and\r\nshortcommings, like:\r\n\r\n  - when (*RestClient).Options is changed by the user, changes are\r\n    not reflected in *Auth\r\n  - all the tests were modyfing global client instance, not it's more\r\n    COW like\r\n  - ~~RestClient and ClientOptions are fully zero-value friendly~~\r\n  - ClientOptions properly manages TLS / NoTLS transitions\r\n\r\nRestClient would require more work, like support for token auth\r\n(it's using BasicAuth for requests), proper TLS/NoTLS testing. This is\r\nwhat I've seen from the code itself, possibly there's more if compared\r\nto SPEC.md.\r\n\r\n~~Changes in Go API:~~\r\n\r\n- ~~added function for initializing RestClient from key:~~\r\n\r\n  ```\r\n  client, err := ably.NewRestClient(\"xxx:xxx\")\r\n  ```\r\n\r\n- ~~RestClient can be initialized from ClientOptions for more control\r\n  over behaviour: (added correct handling of zero-value struct)~~\r\n\r\n  ```\r\n  opts := &ably.ClientOptions{Token: \"xxx\", Secret: \"xxx\"}\r\n  client := &alby.RestClient{Options: opts}\r\n  ```\r\n\r\n- ~~ClientOptions has no `Key` nor `NoTLS` fields, as it's not possible to\r\n  keep them in sync with dependant fields like Token, Secret for Key or\r\n  RestEndpoint, RealtimeEndpoint for `NoTLS`, e.g.~~\r\n\r\n  ```go\r\n  /* old API */\r\n  client := ably.NewRestClient(&ably.Options{Key: \"xxx:xxx\"})\r\n  // ...\r\n  client.Options.Key = \"yyy:yyy\"\r\n  // all calls to REST API are going to fail, as Token and Secret fields\r\n  // are still \"xxx\"\r\n\r\n  /* new API */\r\n  client, err := ably.NewRestClient(\"xxx:xxx\")\r\n  // ...\r\n  err := client.Options.SetKey(\"yyy:yyy\")\r\n  // correctly handled here\r\n  ```\r\n\r\n~~The same applies to NoTLS, where flipping its value should rewrite URLs\r\nof RestEndpoint and RealtimeEndpoint. With new API it's done with:~~\r\n\r\n  ```go\r\n  client.SetTLS(false)\r\n  ```\r\n\r\n/cc @kouno Please take a look.\r\n\r\nBTW I have trello dashboard for ably-go, as I needed to store somewhere my thoughts while working with current library: https://trello.com/b/pHESio8l/ably-go","created_at":"2015-04-25T15:19:55Z","updated_at":"2015-04-27T08:02:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b3968517770d084b616d2fe5db7f4ae720900b0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ably/ably-go/pulls/24/commits","review_comments_url":"https://api.github.com/repos/ably/ably-go/pulls/24/comments","review_comment_url":"https://api.github.com/repos/ably/ably-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ably/ably-go/issues/24/comments","statuses_url":"https://api.github.com/repos/ably/ably-go/statuses/50beb4f94b6df73dba394f66bf6120a66e38b744","head":{"label":"rjeczalik:devel","ref":"devel","sha":"50beb4f94b6df73dba394f66bf6120a66e38b744","user":{"login":"rjeczalik","id":1162017,"avatar_url":"https://avatars.githubusercontent.com/u/1162017?v=3","gravatar_id":"","url":"https://api.github.com/users/rjeczalik","html_url":"https://github.com/rjeczalik","followers_url":"https://api.github.com/users/rjeczalik/followers","following_url":"https://api.github.com/users/rjeczalik/following{/other_user}","gists_url":"https://api.github.com/users/rjeczalik/gists{/gist_id}","starred_url":"https://api.github.com/users/rjeczalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjeczalik/subscriptions","organizations_url":"https://api.github.com/users/rjeczalik/orgs","repos_url":"https://api.github.com/users/rjeczalik/repos","events_url":"https://api.github.com/users/rjeczalik/events{/privacy}","received_events_url":"https://api.github.com/users/rjeczalik/received_events","type":"User","site_admin":false},"repo":{"id":33247084,"name":"ably-go","full_name":"rjeczalik/ably-go","owner":{"login":"rjeczalik","id":1162017,"avatar_url":"https://avatars.githubusercontent.com/u/1162017?v=3","gravatar_id":"","url":"https://api.github.com/users/rjeczalik","html_url":"https://github.com/rjeczalik","followers_url":"https://api.github.com/users/rjeczalik/followers","following_url":"https://api.github.com/users/rjeczalik/following{/other_user}","gists_url":"https://api.github.com/users/rjeczalik/gists{/gist_id}","starred_url":"https://api.github.com/users/rjeczalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjeczalik/subscriptions","organizations_url":"https://api.github.com/users/rjeczalik/orgs","repos_url":"https://api.github.com/users/rjeczalik/repos","events_url":"https://api.github.com/users/rjeczalik/events{/privacy}","received_events_url":"https://api.github.com/users/rjeczalik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rjeczalik/ably-go","description":"(board: https://trello.com/b/pHESio8l/ably-go)","fork":true,"url":"https://api.github.com/repos/rjeczalik/ably-go","forks_url":"https://api.github.com/repos/rjeczalik/ably-go/forks","keys_url":"https://api.github.com/repos/rjeczalik/ably-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rjeczalik/ably-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rjeczalik/ably-go/teams","hooks_url":"https://api.github.com/repos/rjeczalik/ably-go/hooks","issue_events_url":"https://api.github.com/repos/rjeczalik/ably-go/issues/events{/number}","events_url":"https://api.github.com/repos/rjeczalik/ably-go/events","assignees_url":"https://api.github.com/repos/rjeczalik/ably-go/assignees{/user}","branches_url":"https://api.github.com/repos/rjeczalik/ably-go/branches{/branch}","tags_url":"https://api.github.com/repos/rjeczalik/ably-go/tags","blobs_url":"https://api.github.com/repos/rjeczalik/ably-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rjeczalik/ably-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rjeczalik/ably-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/rjeczalik/ably-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rjeczalik/ably-go/statuses/{sha}","languages_url":"https://api.github.com/repos/rjeczalik/ably-go/languages","stargazers_url":"https://api.github.com/repos/rjeczalik/ably-go/stargazers","contributors_url":"https://api.github.com/repos/rjeczalik/ably-go/contributors","subscribers_url":"https://api.github.com/repos/rjeczalik/ably-go/subscribers","subscription_url":"https://api.github.com/repos/rjeczalik/ably-go/subscription","commits_url":"https://api.github.com/repos/rjeczalik/ably-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/rjeczalik/ably-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/rjeczalik/ably-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/rjeczalik/ably-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/rjeczalik/ably-go/contents/{+path}","compare_url":"https://api.github.com/repos/rjeczalik/ably-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rjeczalik/ably-go/merges","archive_url":"https://api.github.com/repos/rjeczalik/ably-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rjeczalik/ably-go/downloads","issues_url":"https://api.github.com/repos/rjeczalik/ably-go/issues{/number}","pulls_url":"https://api.github.com/repos/rjeczalik/ably-go/pulls{/number}","milestones_url":"https://api.github.com/repos/rjeczalik/ably-go/milestones{/number}","notifications_url":"https://api.github.com/repos/rjeczalik/ably-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rjeczalik/ably-go/labels{/name}","releases_url":"https://api.github.com/repos/rjeczalik/ably-go/releases{/id}","created_at":"2015-04-01T12:48:55Z","updated_at":"2015-04-26T16:22:30Z","pushed_at":"2015-04-27T06:42:10Z","git_url":"git://github.com/rjeczalik/ably-go.git","ssh_url":"git@github.com:rjeczalik/ably-go.git","clone_url":"https://github.com/rjeczalik/ably-go.git","svn_url":"https://github.com/rjeczalik/ably-go","homepage":"","size":737,"stargazers_count":0,"watchers_count":0,"language":"Go","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":"ably:master","ref":"master","sha":"31bff19984b115fe959f1ca053e99765ee529cfd","user":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"repo":{"id":27377399,"name":"ably-go","full_name":"ably/ably-go","owner":{"login":"ably","id":1859245,"avatar_url":"https://avatars.githubusercontent.com/u/1859245?v=3","gravatar_id":"","url":"https://api.github.com/users/ably","html_url":"https://github.com/ably","followers_url":"https://api.github.com/users/ably/followers","following_url":"https://api.github.com/users/ably/following{/other_user}","gists_url":"https://api.github.com/users/ably/gists{/gist_id}","starred_url":"https://api.github.com/users/ably/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ably/subscriptions","organizations_url":"https://api.github.com/users/ably/orgs","repos_url":"https://api.github.com/users/ably/repos","events_url":"https://api.github.com/users/ably/events{/privacy}","received_events_url":"https://api.github.com/users/ably/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ably/ably-go","description":"Go client for Ably real-time messaging service","fork":false,"url":"https://api.github.com/repos/ably/ably-go","forks_url":"https://api.github.com/repos/ably/ably-go/forks","keys_url":"https://api.github.com/repos/ably/ably-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ably/ably-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ably/ably-go/teams","hooks_url":"https://api.github.com/repos/ably/ably-go/hooks","issue_events_url":"https://api.github.com/repos/ably/ably-go/issues/events{/number}","events_url":"https://api.github.com/repos/ably/ably-go/events","assignees_url":"https://api.github.com/repos/ably/ably-go/assignees{/user}","branches_url":"https://api.github.com/repos/ably/ably-go/branches{/branch}","tags_url":"https://api.github.com/repos/ably/ably-go/tags","blobs_url":"https://api.github.com/repos/ably/ably-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ably/ably-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ably/ably-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/ably/ably-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ably/ably-go/statuses/{sha}","languages_url":"https://api.github.com/repos/ably/ably-go/languages","stargazers_url":"https://api.github.com/repos/ably/ably-go/stargazers","contributors_url":"https://api.github.com/repos/ably/ably-go/contributors","subscribers_url":"https://api.github.com/repos/ably/ably-go/subscribers","subscription_url":"https://api.github.com/repos/ably/ably-go/subscription","commits_url":"https://api.github.com/repos/ably/ably-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/ably/ably-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/ably/ably-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/ably/ably-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/ably/ably-go/contents/{+path}","compare_url":"https://api.github.com/repos/ably/ably-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ably/ably-go/merges","archive_url":"https://api.github.com/repos/ably/ably-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ably/ably-go/downloads","issues_url":"https://api.github.com/repos/ably/ably-go/issues{/number}","pulls_url":"https://api.github.com/repos/ably/ably-go/pulls{/number}","milestones_url":"https://api.github.com/repos/ably/ably-go/milestones{/number}","notifications_url":"https://api.github.com/repos/ably/ably-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ably/ably-go/labels{/name}","releases_url":"https://api.github.com/repos/ably/ably-go/releases{/id}","created_at":"2014-12-01T11:57:59Z","updated_at":"2015-04-26T16:23:25Z","pushed_at":"2015-04-27T06:42:11Z","git_url":"git://github.com/ably/ably-go.git","ssh_url":"git@github.com:ably/ably-go.git","clone_url":"https://github.com/ably/ably-go.git","svn_url":"https://github.com/ably/ably-go","homepage":null,"size":1030,"stargazers_count":2,"watchers_count":2,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ably/ably-go/pulls/24"},"html":{"href":"https://github.com/ably/ably-go/pull/24"},"issue":{"href":"https://api.github.com/repos/ably/ably-go/issues/24"},"comments":{"href":"https://api.github.com/repos/ably/ably-go/issues/24/comments"},"review_comments":{"href":"https://api.github.com/repos/ably/ably-go/pulls/24/comments"},"review_comment":{"href":"https://api.github.com/repos/ably/ably-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ably/ably-go/pulls/24/commits"},"statuses":{"href":"https://api.github.com/repos/ably/ably-go/statuses/50beb4f94b6df73dba394f66bf6120a66e38b744"}}}}