{"action":"closed","number":45,"pull_request":{"url":"https://api.github.com/repos/zhyu/nadia/pulls/45","id":122105004,"html_url":"https://github.com/zhyu/nadia/pull/45","diff_url":"https://github.com/zhyu/nadia/pull/45.diff","patch_url":"https://github.com/zhyu/nadia/pull/45.patch","issue_url":"https://api.github.com/repos/zhyu/nadia/issues/45","number":45,"state":"closed","locked":false,"title":"Ignore keys with nil values when serializing InlineKeyboardButton","user":{"login":"dotboris","id":1874242,"avatar_url":"https://avatars3.githubusercontent.com/u/1874242?v=4","gravatar_id":"","url":"https://api.github.com/users/dotboris","html_url":"https://github.com/dotboris","followers_url":"https://api.github.com/users/dotboris/followers","following_url":"https://api.github.com/users/dotboris/following{/other_user}","gists_url":"https://api.github.com/users/dotboris/gists{/gist_id}","starred_url":"https://api.github.com/users/dotboris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotboris/subscriptions","organizations_url":"https://api.github.com/users/dotboris/orgs","repos_url":"https://api.github.com/users/dotboris/repos","events_url":"https://api.github.com/users/dotboris/events{/privacy}","received_events_url":"https://api.github.com/users/dotboris/received_events","type":"User","site_admin":false},"body":"Fixes #44 \r\n\r\nThis PR makes it so that serializing a `InlineKeyboardButton` struct will not include keys whose values are `nil`.\r\n\r\nThe [telegram bot api doc for InlineKeyboardButton](https://core.telegram.org/bots/api#inlinekeyboardbutton) states:\r\n\r\n> This object represents one button of an inline keyboard. You must use exactly one of the optional fields.\r\n\r\nBecause of the way `Poison` serializes structs, a serialized `InlineKeyboardButton` will always have a all keys present. This tends to confuse the telegram bot api.\r\n\r\nIn cases where we use the `url` key, everything is fine, but in cases where we use another fields (like `callback_data`), we get a validation error. The telegram bot api seems to see the `url` key set to nil and complains that it's not a string.\r\n\r\nTo prevent this issue, this PR implements the `Poison.Encoder` protocol for `InlineKeyboardButton` and ignores all keys have `nil` values.\r\n\r\nI have searched through the Telegram bot api doc and it seems like this is the only type that behaves this way.","created_at":"2017-05-23T22:00:35Z","updated_at":"2017-07-21T12:09:42Z","closed_at":"2017-07-21T12:09:41Z","merged_at":"2017-07-21T12:09:41Z","merge_commit_sha":"c74bad6eb033fe3b54e402be49d60ef8da779a27","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/zhyu/nadia/pulls/45/commits","review_comments_url":"https://api.github.com/repos/zhyu/nadia/pulls/45/comments","review_comment_url":"https://api.github.com/repos/zhyu/nadia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zhyu/nadia/issues/45/comments","statuses_url":"https://api.github.com/repos/zhyu/nadia/statuses/43bb7bd79a01b3828a682a0f0dc6f5aa81a7d44f","head":{"label":"dotboris:remove-nil-values-in-markup","ref":"remove-nil-values-in-markup","sha":"43bb7bd79a01b3828a682a0f0dc6f5aa81a7d44f","user":{"login":"dotboris","id":1874242,"avatar_url":"https://avatars3.githubusercontent.com/u/1874242?v=4","gravatar_id":"","url":"https://api.github.com/users/dotboris","html_url":"https://github.com/dotboris","followers_url":"https://api.github.com/users/dotboris/followers","following_url":"https://api.github.com/users/dotboris/following{/other_user}","gists_url":"https://api.github.com/users/dotboris/gists{/gist_id}","starred_url":"https://api.github.com/users/dotboris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotboris/subscriptions","organizations_url":"https://api.github.com/users/dotboris/orgs","repos_url":"https://api.github.com/users/dotboris/repos","events_url":"https://api.github.com/users/dotboris/events{/privacy}","received_events_url":"https://api.github.com/users/dotboris/received_events","type":"User","site_admin":false},"repo":{"id":92114543,"name":"nadia","full_name":"dotboris/nadia","owner":{"login":"dotboris","id":1874242,"avatar_url":"https://avatars3.githubusercontent.com/u/1874242?v=4","gravatar_id":"","url":"https://api.github.com/users/dotboris","html_url":"https://github.com/dotboris","followers_url":"https://api.github.com/users/dotboris/followers","following_url":"https://api.github.com/users/dotboris/following{/other_user}","gists_url":"https://api.github.com/users/dotboris/gists{/gist_id}","starred_url":"https://api.github.com/users/dotboris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotboris/subscriptions","organizations_url":"https://api.github.com/users/dotboris/orgs","repos_url":"https://api.github.com/users/dotboris/repos","events_url":"https://api.github.com/users/dotboris/events{/privacy}","received_events_url":"https://api.github.com/users/dotboris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dotboris/nadia","description":"Telegram Bot API Wrapper written in Elixir","fork":true,"url":"https://api.github.com/repos/dotboris/nadia","forks_url":"https://api.github.com/repos/dotboris/nadia/forks","keys_url":"https://api.github.com/repos/dotboris/nadia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotboris/nadia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotboris/nadia/teams","hooks_url":"https://api.github.com/repos/dotboris/nadia/hooks","issue_events_url":"https://api.github.com/repos/dotboris/nadia/issues/events{/number}","events_url":"https://api.github.com/repos/dotboris/nadia/events","assignees_url":"https://api.github.com/repos/dotboris/nadia/assignees{/user}","branches_url":"https://api.github.com/repos/dotboris/nadia/branches{/branch}","tags_url":"https://api.github.com/repos/dotboris/nadia/tags","blobs_url":"https://api.github.com/repos/dotboris/nadia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotboris/nadia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotboris/nadia/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotboris/nadia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotboris/nadia/statuses/{sha}","languages_url":"https://api.github.com/repos/dotboris/nadia/languages","stargazers_url":"https://api.github.com/repos/dotboris/nadia/stargazers","contributors_url":"https://api.github.com/repos/dotboris/nadia/contributors","subscribers_url":"https://api.github.com/repos/dotboris/nadia/subscribers","subscription_url":"https://api.github.com/repos/dotboris/nadia/subscription","commits_url":"https://api.github.com/repos/dotboris/nadia/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotboris/nadia/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotboris/nadia/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotboris/nadia/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotboris/nadia/contents/{+path}","compare_url":"https://api.github.com/repos/dotboris/nadia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotboris/nadia/merges","archive_url":"https://api.github.com/repos/dotboris/nadia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotboris/nadia/downloads","issues_url":"https://api.github.com/repos/dotboris/nadia/issues{/number}","pulls_url":"https://api.github.com/repos/dotboris/nadia/pulls{/number}","milestones_url":"https://api.github.com/repos/dotboris/nadia/milestones{/number}","notifications_url":"https://api.github.com/repos/dotboris/nadia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotboris/nadia/labels{/name}","releases_url":"https://api.github.com/repos/dotboris/nadia/releases{/id}","deployments_url":"https://api.github.com/repos/dotboris/nadia/deployments","created_at":"2017-05-23T01:18:27Z","updated_at":"2017-05-23T01:18:29Z","pushed_at":"2017-06-12T23:53:52Z","git_url":"git://github.com/dotboris/nadia.git","ssh_url":"git@github.com:dotboris/nadia.git","clone_url":"https://github.com/dotboris/nadia.git","svn_url":"https://github.com/dotboris/nadia","homepage":null,"size":121,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_projects":true,"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":"zhyu:master","ref":"master","sha":"10a57022794ef8ffa8c83b465f0427d02dca8e95","user":{"login":"zhyu","id":1728523,"avatar_url":"https://avatars1.githubusercontent.com/u/1728523?v=4","gravatar_id":"","url":"https://api.github.com/users/zhyu","html_url":"https://github.com/zhyu","followers_url":"https://api.github.com/users/zhyu/followers","following_url":"https://api.github.com/users/zhyu/following{/other_user}","gists_url":"https://api.github.com/users/zhyu/gists{/gist_id}","starred_url":"https://api.github.com/users/zhyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhyu/subscriptions","organizations_url":"https://api.github.com/users/zhyu/orgs","repos_url":"https://api.github.com/users/zhyu/repos","events_url":"https://api.github.com/users/zhyu/events{/privacy}","received_events_url":"https://api.github.com/users/zhyu/received_events","type":"User","site_admin":false},"repo":{"id":40744380,"name":"nadia","full_name":"zhyu/nadia","owner":{"login":"zhyu","id":1728523,"avatar_url":"https://avatars1.githubusercontent.com/u/1728523?v=4","gravatar_id":"","url":"https://api.github.com/users/zhyu","html_url":"https://github.com/zhyu","followers_url":"https://api.github.com/users/zhyu/followers","following_url":"https://api.github.com/users/zhyu/following{/other_user}","gists_url":"https://api.github.com/users/zhyu/gists{/gist_id}","starred_url":"https://api.github.com/users/zhyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhyu/subscriptions","organizations_url":"https://api.github.com/users/zhyu/orgs","repos_url":"https://api.github.com/users/zhyu/repos","events_url":"https://api.github.com/users/zhyu/events{/privacy}","received_events_url":"https://api.github.com/users/zhyu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhyu/nadia","description":"Telegram Bot API Wrapper written in Elixir","fork":false,"url":"https://api.github.com/repos/zhyu/nadia","forks_url":"https://api.github.com/repos/zhyu/nadia/forks","keys_url":"https://api.github.com/repos/zhyu/nadia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhyu/nadia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhyu/nadia/teams","hooks_url":"https://api.github.com/repos/zhyu/nadia/hooks","issue_events_url":"https://api.github.com/repos/zhyu/nadia/issues/events{/number}","events_url":"https://api.github.com/repos/zhyu/nadia/events","assignees_url":"https://api.github.com/repos/zhyu/nadia/assignees{/user}","branches_url":"https://api.github.com/repos/zhyu/nadia/branches{/branch}","tags_url":"https://api.github.com/repos/zhyu/nadia/tags","blobs_url":"https://api.github.com/repos/zhyu/nadia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhyu/nadia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhyu/nadia/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhyu/nadia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhyu/nadia/statuses/{sha}","languages_url":"https://api.github.com/repos/zhyu/nadia/languages","stargazers_url":"https://api.github.com/repos/zhyu/nadia/stargazers","contributors_url":"https://api.github.com/repos/zhyu/nadia/contributors","subscribers_url":"https://api.github.com/repos/zhyu/nadia/subscribers","subscription_url":"https://api.github.com/repos/zhyu/nadia/subscription","commits_url":"https://api.github.com/repos/zhyu/nadia/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhyu/nadia/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhyu/nadia/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhyu/nadia/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhyu/nadia/contents/{+path}","compare_url":"https://api.github.com/repos/zhyu/nadia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhyu/nadia/merges","archive_url":"https://api.github.com/repos/zhyu/nadia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhyu/nadia/downloads","issues_url":"https://api.github.com/repos/zhyu/nadia/issues{/number}","pulls_url":"https://api.github.com/repos/zhyu/nadia/pulls{/number}","milestones_url":"https://api.github.com/repos/zhyu/nadia/milestones{/number}","notifications_url":"https://api.github.com/repos/zhyu/nadia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhyu/nadia/labels{/name}","releases_url":"https://api.github.com/repos/zhyu/nadia/releases{/id}","deployments_url":"https://api.github.com/repos/zhyu/nadia/deployments","created_at":"2015-08-15T02:50:36Z","updated_at":"2017-07-20T07:03:39Z","pushed_at":"2017-07-21T12:09:41Z","git_url":"git://github.com/zhyu/nadia.git","ssh_url":"git@github.com:zhyu/nadia.git","clone_url":"https://github.com/zhyu/nadia.git","svn_url":"https://github.com/zhyu/nadia","homepage":null,"size":117,"stargazers_count":116,"watchers_count":116,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":8,"forks":33,"open_issues":8,"watchers":116,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zhyu/nadia/pulls/45"},"html":{"href":"https://github.com/zhyu/nadia/pull/45"},"issue":{"href":"https://api.github.com/repos/zhyu/nadia/issues/45"},"comments":{"href":"https://api.github.com/repos/zhyu/nadia/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/zhyu/nadia/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/zhyu/nadia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zhyu/nadia/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/zhyu/nadia/statuses/43bb7bd79a01b3828a682a0f0dc6f5aa81a7d44f"}},"merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"zhyu","id":1728523,"avatar_url":"https://avatars1.githubusercontent.com/u/1728523?v=4","gravatar_id":"","url":"https://api.github.com/users/zhyu","html_url":"https://github.com/zhyu","followers_url":"https://api.github.com/users/zhyu/followers","following_url":"https://api.github.com/users/zhyu/following{/other_user}","gists_url":"https://api.github.com/users/zhyu/gists{/gist_id}","starred_url":"https://api.github.com/users/zhyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhyu/subscriptions","organizations_url":"https://api.github.com/users/zhyu/orgs","repos_url":"https://api.github.com/users/zhyu/repos","events_url":"https://api.github.com/users/zhyu/events{/privacy}","received_events_url":"https://api.github.com/users/zhyu/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"maintainer_can_modify":false,"commits":5,"additions":22,"deletions":0,"changed_files":2}}
{"actor":{"display_login":"zhyu"}}