{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaWeb/GitHub.jl/issues/42","labels_url":"https://api.github.com/repos/JuliaWeb/GitHub.jl/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/JuliaWeb/GitHub.jl/issues/42/comments","events_url":"https://api.github.com/repos/JuliaWeb/GitHub.jl/issues/42/events","html_url":"https://github.com/JuliaWeb/GitHub.jl/pull/42","id":116494817,"number":42,"title":"[WIP] Refactor package for increased code reuse and type-certainty + API simplifications","user":{"login":"jrevels","id":3277443,"avatar_url":"https://avatars.githubusercontent.com/u/3277443?v=3","gravatar_id":"","url":"https://api.github.com/users/jrevels","html_url":"https://github.com/jrevels","followers_url":"https://api.github.com/users/jrevels/followers","following_url":"https://api.github.com/users/jrevels/following{/other_user}","gists_url":"https://api.github.com/users/jrevels/gists{/gist_id}","starred_url":"https://api.github.com/users/jrevels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrevels/subscriptions","organizations_url":"https://api.github.com/users/jrevels/orgs","repos_url":"https://api.github.com/users/jrevels/repos","events_url":"https://api.github.com/users/jrevels/events{/privacy}","received_events_url":"https://api.github.com/users/jrevels/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-12T07:22:57Z","updated_at":"2015-11-15T17:48:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaWeb/GitHub.jl/pulls/42","html_url":"https://github.com/JuliaWeb/GitHub.jl/pull/42","diff_url":"https://github.com/JuliaWeb/GitHub.jl/pull/42.diff","patch_url":"https://github.com/JuliaWeb/GitHub.jl/pull/42.patch"},"body":"So, this is a doozy of a PR, but it seemed like it'd be a lot of work to decouple the bulk of the changes here into multiple PRs...apologies to any concerned parties if it's tough to review. \r\n\r\nThere are some breaking changes here, but I'm hoping they'll be fairly uncontroversial. In summary, this PR cuts about ~500 LOC while adding both features and tests, in addition to simplifying the API (expect the LOC count to shift as I add more tests, though).\r\n\r\n**What this PR accomplishes**\r\n\r\n- Previously untyped fields of `GitHubType`s are now annotated as `Nullable`s (most of them concrete), so that a majority of field accesses from a given type will now be type-certain.\r\n\r\n- JSON `Dict`s can be easily translated into `GitHubType`s using the `json2github` method. The reverse is also implemented; `GitHubType`s and collections containing `GitHubType`s can easily be translated to valid JSON objects via `github2json`. These new methods eliminate most of the package's \"manual\" parsing code.\r\n\r\n- DateTime strings are now handled properly (resolves #36).\r\n\r\n- The user can now pass in a string, number, or a relevant `GitHubType` object to any relevant argument of an API function, without being tied to a specific set of method signatures. `GitHubType`s can also be used in parameters passed to API functions. This is all accomplished without method duplication, for the most part, so a lot of repeat definition were able to be chopped out (resolves #25)\r\n\r\n- In a lot of cases, the GitHub API relies on the client providing parameters along with requests. GitHub.jl previously had some support for these in the form of keyword args, but keyword \"coverage\" among the various methods was inconsistent. With this PR, all parameters to all API functions are now passed as a `Dict` to the `params` keyword arg.  This *greatly* simplifies both usage and implementation of GitHub.jl's methods.\r\n\r\n- `File` was removed in favor of `Content`, which supports both files and directories.\r\n\r\n- `User` and `Organization` were removed in favor of `Owner`, which encompasses both types. This cleans up a lot of code and fixes some type stability issues (parsing as `User` vs. `Organization` was previously decided by checking a dictionary value in many cases).\r\n\r\n- There were a couple of seldom-used `Exception` types floating around, along with some duplicate error-handling code. Thus, I condensed the repeat error-handling down to a single method and made sure it was used consistently.\r\n\r\n- Condensed pretty-printing of `GitHubType`s down to a single `show`/`showcompact` definition\r\n\r\n- Refactored my recently added `Event`/`Status` code to be more inline with the package's API\r\n\r\n\r\n<p></p>\r\n **TODO: Tests**\r\n\r\nSince this PR is already oversized, I figure I may as well take care of some of the testing we need to do. I've already added some basic parsing tests for `Owner` - I plan on doing the same for all of the other `GitHubType`s before merging this, to ensure that I didn't break anything *too* badly.\r\n\r\nOnce this gets merged, I'd like to build out the network-dependent test suite. After that, the only thing left to do before tagging a new release will be a documentation update.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JuliaWeb/GitHub.jl/issues/comments/156838035","html_url":"https://github.com/JuliaWeb/GitHub.jl/pull/42#issuecomment-156838035","issue_url":"https://api.github.com/repos/JuliaWeb/GitHub.jl/issues/42","id":156838035,"user":{"login":"IainNZ","id":692635,"avatar_url":"https://avatars.githubusercontent.com/u/692635?v=3","gravatar_id":"","url":"https://api.github.com/users/IainNZ","html_url":"https://github.com/IainNZ","followers_url":"https://api.github.com/users/IainNZ/followers","following_url":"https://api.github.com/users/IainNZ/following{/other_user}","gists_url":"https://api.github.com/users/IainNZ/gists{/gist_id}","starred_url":"https://api.github.com/users/IainNZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IainNZ/subscriptions","organizations_url":"https://api.github.com/users/IainNZ/orgs","repos_url":"https://api.github.com/users/IainNZ/repos","events_url":"https://api.github.com/users/IainNZ/events{/privacy}","received_events_url":"https://api.github.com/users/IainNZ/received_events","type":"User","site_admin":false},"created_at":"2015-11-15T17:48:44Z","updated_at":"2015-11-15T17:48:44Z","body":"Just saw this, neat!"}}