{"action":"created","comment":{"url":"https://api.github.com/repos/timehop/apns/pulls/comments/25799490","id":25799490,"diff_hunk":"@@ -0,0 +1,233 @@\n+package apns\n+\n+import (\n+\t\"container/list\"\n+\t\"errors\"\n+\t\"io\"\n+\t\"sync\"\n+)\n+\n+type SessionError struct {\n+\tNotification Notification\n+\tErr          Error\n+}\n+\n+func (s SessionError) Error() string {\n+\treturn s.Err.Error()\n+}\n+\n+type Session interface {\n+\tSend(n Notification) error\n+\tConnect() error\n+\tRequeueableNotifications() []Notification\n+\tDisconnect()\n+\tDisconnected() bool\n+}\n+\n+type buffer struct {\n+\tsize int\n+\tm    sync.Mutex\n+\t*list.List\n+}\n+\n+func newBuffer(size int) *buffer {\n+\treturn &buffer{size, sync.Mutex{}, list.New()}\n+}\n+\n+func (b *buffer) Add(v interface{}) *list.Element {\n+\tb.m.Lock()\n+\tdefer b.m.Unlock()\n+\n+\te := b.PushBack(v)\n+\n+\tif b.Len() > b.size {\n+\t\tb.Remove(b.Front())\n+\t}\n+\n+\treturn e\n+}\n+\n+type sessionState int\n+\n+const (\n+\tsessionStateNew          sessionState = iota\n+\tsessionStateConnected    sessionState = iota","path":"session.go","position":54,"original_position":54,"commit_id":"d01f235d05c648f1dd84c495fb3c29fae25bcaa9","original_commit_id":"d01f235d05c648f1dd84c495fb3c29fae25bcaa9","user":{"login":"nathany","id":4566,"avatar_url":"https://avatars.githubusercontent.com/u/4566?v=3","gravatar_id":"","url":"https://api.github.com/users/nathany","html_url":"https://github.com/nathany","followers_url":"https://api.github.com/users/nathany/followers","following_url":"https://api.github.com/users/nathany/following{/other_user}","gists_url":"https://api.github.com/users/nathany/gists{/gist_id}","starred_url":"https://api.github.com/users/nathany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nathany/subscriptions","organizations_url":"https://api.github.com/users/nathany/orgs","repos_url":"https://api.github.com/users/nathany/repos","events_url":"https://api.github.com/users/nathany/events{/privacy}","received_events_url":"https://api.github.com/users/nathany/received_events","type":"User","site_admin":false},"body":"But maybe this could all just be a `connected` boolean that begins is false? Is \"New\" necessary?","created_at":"2015-03-04T18:31:29Z","updated_at":"2015-03-04T18:31:29Z","html_url":"https://github.com/timehop/apns/pull/33#discussion_r25799490","pull_request_url":"https://api.github.com/repos/timehop/apns/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/timehop/apns/pulls/comments/25799490"},"html":{"href":"https://github.com/timehop/apns/pull/33#discussion_r25799490"},"pull_request":{"href":"https://api.github.com/repos/timehop/apns/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/timehop/apns/pulls/33","id":30294799,"html_url":"https://github.com/timehop/apns/pull/33","diff_url":"https://github.com/timehop/apns/pull/33.diff","patch_url":"https://github.com/timehop/apns/pull/33.patch","issue_url":"https://api.github.com/repos/timehop/apns/issues/33","number":33,"state":"open","locked":false,"title":"Refactor synchronous interface","user":{"login":"bdotdub","id":5719,"avatar_url":"https://avatars.githubusercontent.com/u/5719?v=3","gravatar_id":"","url":"https://api.github.com/users/bdotdub","html_url":"https://github.com/bdotdub","followers_url":"https://api.github.com/users/bdotdub/followers","following_url":"https://api.github.com/users/bdotdub/following{/other_user}","gists_url":"https://api.github.com/users/bdotdub/gists{/gist_id}","starred_url":"https://api.github.com/users/bdotdub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdotdub/subscriptions","organizations_url":"https://api.github.com/users/bdotdub/orgs","repos_url":"https://api.github.com/users/bdotdub/repos","events_url":"https://api.github.com/users/bdotdub/events{/privacy}","received_events_url":"https://api.github.com/users/bdotdub/received_events","type":"User","site_admin":false},"body":"~~~~~~~~~~~~~~~~ **DO NOT MERGE** ~~~~~~~~~~~~~~~~\r\n\r\nOpened in response to #31 for inline comments","created_at":"2015-03-02T16:01:16Z","updated_at":"2015-03-04T18:31:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d0609149c22970d0a0b2b0c874d73bd30d70a883","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/timehop/apns/pulls/33/commits","review_comments_url":"https://api.github.com/repos/timehop/apns/pulls/33/comments","review_comment_url":"https://api.github.com/repos/timehop/apns/pulls/comments{/number}","comments_url":"https://api.github.com/repos/timehop/apns/issues/33/comments","statuses_url":"https://api.github.com/repos/timehop/apns/statuses/d01f235d05c648f1dd84c495fb3c29fae25bcaa9","head":{"label":"timehop:refactor-synchronous-interface","ref":"refactor-synchronous-interface","sha":"d01f235d05c648f1dd84c495fb3c29fae25bcaa9","user":{"login":"timehop","id":1259053,"avatar_url":"https://avatars.githubusercontent.com/u/1259053?v=3","gravatar_id":"","url":"https://api.github.com/users/timehop","html_url":"https://github.com/timehop","followers_url":"https://api.github.com/users/timehop/followers","following_url":"https://api.github.com/users/timehop/following{/other_user}","gists_url":"https://api.github.com/users/timehop/gists{/gist_id}","starred_url":"https://api.github.com/users/timehop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timehop/subscriptions","organizations_url":"https://api.github.com/users/timehop/orgs","repos_url":"https://api.github.com/users/timehop/repos","events_url":"https://api.github.com/users/timehop/events{/privacy}","received_events_url":"https://api.github.com/users/timehop/received_events","type":"Organization","site_admin":false},"repo":{"id":21331272,"name":"apns","full_name":"timehop/apns","owner":{"login":"timehop","id":1259053,"avatar_url":"https://avatars.githubusercontent.com/u/1259053?v=3","gravatar_id":"","url":"https://api.github.com/users/timehop","html_url":"https://github.com/timehop","followers_url":"https://api.github.com/users/timehop/followers","following_url":"https://api.github.com/users/timehop/following{/other_user}","gists_url":"https://api.github.com/users/timehop/gists{/gist_id}","starred_url":"https://api.github.com/users/timehop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timehop/subscriptions","organizations_url":"https://api.github.com/users/timehop/orgs","repos_url":"https://api.github.com/users/timehop/repos","events_url":"https://api.github.com/users/timehop/events{/privacy}","received_events_url":"https://api.github.com/users/timehop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/timehop/apns","description":"A Go package to interface with the Apple Push Notification Service","fork":false,"url":"https://api.github.com/repos/timehop/apns","forks_url":"https://api.github.com/repos/timehop/apns/forks","keys_url":"https://api.github.com/repos/timehop/apns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/timehop/apns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/timehop/apns/teams","hooks_url":"https://api.github.com/repos/timehop/apns/hooks","issue_events_url":"https://api.github.com/repos/timehop/apns/issues/events{/number}","events_url":"https://api.github.com/repos/timehop/apns/events","assignees_url":"https://api.github.com/repos/timehop/apns/assignees{/user}","branches_url":"https://api.github.com/repos/timehop/apns/branches{/branch}","tags_url":"https://api.github.com/repos/timehop/apns/tags","blobs_url":"https://api.github.com/repos/timehop/apns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/timehop/apns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/timehop/apns/git/refs{/sha}","trees_url":"https://api.github.com/repos/timehop/apns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/timehop/apns/statuses/{sha}","languages_url":"https://api.github.com/repos/timehop/apns/languages","stargazers_url":"https://api.github.com/repos/timehop/apns/stargazers","contributors_url":"https://api.github.com/repos/timehop/apns/contributors","subscribers_url":"https://api.github.com/repos/timehop/apns/subscribers","subscription_url":"https://api.github.com/repos/timehop/apns/subscription","commits_url":"https://api.github.com/repos/timehop/apns/commits{/sha}","git_commits_url":"https://api.github.com/repos/timehop/apns/git/commits{/sha}","comments_url":"https://api.github.com/repos/timehop/apns/comments{/number}","issue_comment_url":"https://api.github.com/repos/timehop/apns/issues/comments{/number}","contents_url":"https://api.github.com/repos/timehop/apns/contents/{+path}","compare_url":"https://api.github.com/repos/timehop/apns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/timehop/apns/merges","archive_url":"https://api.github.com/repos/timehop/apns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/timehop/apns/downloads","issues_url":"https://api.github.com/repos/timehop/apns/issues{/number}","pulls_url":"https://api.github.com/repos/timehop/apns/pulls{/number}","milestones_url":"https://api.github.com/repos/timehop/apns/milestones{/number}","notifications_url":"https://api.github.com/repos/timehop/apns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/timehop/apns/labels{/name}","releases_url":"https://api.github.com/repos/timehop/apns/releases{/id}","created_at":"2014-06-29T20:08:22Z","updated_at":"2015-03-04T14:59:15Z","pushed_at":"2015-03-02T16:38:45Z","git_url":"git://github.com/timehop/apns.git","ssh_url":"git@github.com:timehop/apns.git","clone_url":"https://github.com/timehop/apns.git","svn_url":"https://github.com/timehop/apns","homepage":"https://godoc.org/github.com/timehop/apns","size":555,"stargazers_count":40,"watchers_count":40,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":13,"forks":7,"open_issues":13,"watchers":40,"default_branch":"master"}},"base":{"label":"timehop:master","ref":"master","sha":"80d1440cb4441ae2a7a1a9cb6c8ab713051aacfc","user":{"login":"timehop","id":1259053,"avatar_url":"https://avatars.githubusercontent.com/u/1259053?v=3","gravatar_id":"","url":"https://api.github.com/users/timehop","html_url":"https://github.com/timehop","followers_url":"https://api.github.com/users/timehop/followers","following_url":"https://api.github.com/users/timehop/following{/other_user}","gists_url":"https://api.github.com/users/timehop/gists{/gist_id}","starred_url":"https://api.github.com/users/timehop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timehop/subscriptions","organizations_url":"https://api.github.com/users/timehop/orgs","repos_url":"https://api.github.com/users/timehop/repos","events_url":"https://api.github.com/users/timehop/events{/privacy}","received_events_url":"https://api.github.com/users/timehop/received_events","type":"Organization","site_admin":false},"repo":{"id":21331272,"name":"apns","full_name":"timehop/apns","owner":{"login":"timehop","id":1259053,"avatar_url":"https://avatars.githubusercontent.com/u/1259053?v=3","gravatar_id":"","url":"https://api.github.com/users/timehop","html_url":"https://github.com/timehop","followers_url":"https://api.github.com/users/timehop/followers","following_url":"https://api.github.com/users/timehop/following{/other_user}","gists_url":"https://api.github.com/users/timehop/gists{/gist_id}","starred_url":"https://api.github.com/users/timehop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timehop/subscriptions","organizations_url":"https://api.github.com/users/timehop/orgs","repos_url":"https://api.github.com/users/timehop/repos","events_url":"https://api.github.com/users/timehop/events{/privacy}","received_events_url":"https://api.github.com/users/timehop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/timehop/apns","description":"A Go package to interface with the Apple Push Notification Service","fork":false,"url":"https://api.github.com/repos/timehop/apns","forks_url":"https://api.github.com/repos/timehop/apns/forks","keys_url":"https://api.github.com/repos/timehop/apns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/timehop/apns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/timehop/apns/teams","hooks_url":"https://api.github.com/repos/timehop/apns/hooks","issue_events_url":"https://api.github.com/repos/timehop/apns/issues/events{/number}","events_url":"https://api.github.com/repos/timehop/apns/events","assignees_url":"https://api.github.com/repos/timehop/apns/assignees{/user}","branches_url":"https://api.github.com/repos/timehop/apns/branches{/branch}","tags_url":"https://api.github.com/repos/timehop/apns/tags","blobs_url":"https://api.github.com/repos/timehop/apns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/timehop/apns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/timehop/apns/git/refs{/sha}","trees_url":"https://api.github.com/repos/timehop/apns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/timehop/apns/statuses/{sha}","languages_url":"https://api.github.com/repos/timehop/apns/languages","stargazers_url":"https://api.github.com/repos/timehop/apns/stargazers","contributors_url":"https://api.github.com/repos/timehop/apns/contributors","subscribers_url":"https://api.github.com/repos/timehop/apns/subscribers","subscription_url":"https://api.github.com/repos/timehop/apns/subscription","commits_url":"https://api.github.com/repos/timehop/apns/commits{/sha}","git_commits_url":"https://api.github.com/repos/timehop/apns/git/commits{/sha}","comments_url":"https://api.github.com/repos/timehop/apns/comments{/number}","issue_comment_url":"https://api.github.com/repos/timehop/apns/issues/comments{/number}","contents_url":"https://api.github.com/repos/timehop/apns/contents/{+path}","compare_url":"https://api.github.com/repos/timehop/apns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/timehop/apns/merges","archive_url":"https://api.github.com/repos/timehop/apns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/timehop/apns/downloads","issues_url":"https://api.github.com/repos/timehop/apns/issues{/number}","pulls_url":"https://api.github.com/repos/timehop/apns/pulls{/number}","milestones_url":"https://api.github.com/repos/timehop/apns/milestones{/number}","notifications_url":"https://api.github.com/repos/timehop/apns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/timehop/apns/labels{/name}","releases_url":"https://api.github.com/repos/timehop/apns/releases{/id}","created_at":"2014-06-29T20:08:22Z","updated_at":"2015-03-04T14:59:15Z","pushed_at":"2015-03-02T16:38:45Z","git_url":"git://github.com/timehop/apns.git","ssh_url":"git@github.com:timehop/apns.git","clone_url":"https://github.com/timehop/apns.git","svn_url":"https://github.com/timehop/apns","homepage":"https://godoc.org/github.com/timehop/apns","size":555,"stargazers_count":40,"watchers_count":40,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":13,"forks":7,"open_issues":13,"watchers":40,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/timehop/apns/pulls/33"},"html":{"href":"https://github.com/timehop/apns/pull/33"},"issue":{"href":"https://api.github.com/repos/timehop/apns/issues/33"},"comments":{"href":"https://api.github.com/repos/timehop/apns/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/timehop/apns/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/timehop/apns/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/timehop/apns/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/timehop/apns/statuses/d01f235d05c648f1dd84c495fb3c29fae25bcaa9"}}}}