Whilst writing some blog posts about the authentication which I’ve been implementing, I’ve come to the realization, almost as an after thought, that even though I’ve still not got a lot of the main Github API implemented, the way I’ve envisioned the API working, from a user point of view, is sort of a bit shit.
var userApi = new UserApi(); var user = userApi.GetUser("example");
Pretty straightforward, right? What about the as yet unwritten GistApi?
var gistApi = new GistApi(); var gist = gistApi.GetGist(...);
Again, pretty straightforward. But I see a pattern forming. What am I going to do when it comes to the RepositoryApi?
var reposApi = new RepositoryApi(); var repo = reposApi.GetRepository(...);
Well, that is starting to look pretty fucking stupid. I’ve caught myself doing it with other methods as well. I simply cannot believe I’ve let myself be so stupid. At least there is not that much implemented where I’ll have to refactor loads of shit.