So I have a little bit of a problem. I working on a project in C# using The StackOveflow API. You can send it a request like so:
http://stackoverflow.com/users/rep/126196/2010-01-01/2010-03-13
And get back something like this JSON response:
[{"PostUrl":"1167342",
"PostTitle":"Are ref and out in C# the same a pointers in C++?",
"Rep":10},
{"PostUrl":"1290595",
"PostTitle":"Where can I find a good tutorial on bubbling?",
"Rep":10}
...
So my problem is that I have some methods like GetJsonResponse()
which return the above JSON and SaveTempFile()
which saves that JSON response to a temporary file for later use. I not sure if I should create a class for them, or what namespace to put them under. Right now my current namespace hierarchy is like so: StackOverflow.Api.Json
. So how should I organize these methods/classes/namespaces?
I would suggest you have a class representing a site, which knows about the URLs involved etc, then a method such as GetReputationChanges(int userId, DateTime from, DateTime to)
. That can return you a list of posts (where a post is another class).
All of this should be in the same namespace, IMO.
I have some of this already for my Reputation Tracker - I don't know to what extent this has already been built into the API that Kevin has built. You're aware that they're working on an official API though, right?