###Relational Queries
When JSON results are received from the API, they are used to build domain objects from the Soapi.Domain
namespace.
Upon these objects are strategically placed queries, the same queries you will find rooted on the Site
object, that are pre-keyed to return data for that object.
NOTE:
Query methods are upper-cased to make it clear that it is a query method, not a property.
user.reputation
(a json property)user.Reputation()
(an api query)
answer.comments
(a json property)answer.Comments()
(an api query)
Soapi.Domain.User
user.Answers().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/answers
user.Badges().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/badges
user.Comments().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/comments
user.CommentsTo(18).invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/comments/18
user.Favorites().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/favorites
user.Mentioned().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/mentioned
user.Questions().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/questions
user.Reputation().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/reputation
user.Tags().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/tags
user.Timeline().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/users/14/timeline
Soapi.Domain.Answer
answer.Comments().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/answers/1305/comments
answer.Revisions().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/revisions/1305
answer.Revisions().ByRevisionGuid("0eabd918-e2c9-4176-8dbd-d56fc8bd1dd2").invoke(/*handlers here*/);
http://api.stackapps.com/1.0/revisions/1305/0eabd918-e2c9-4176-8dbd-d56fc8bd1dd2
Soapi.Domain.Question
question.Answers().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/questions/386/answers
question.Comments().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/questions/386/comments
question.Timeline().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/questions/386/timeline
question.Revisions().invoke(/*handlers here*/);
http://api.stackapps.com/1.0/revisions/386
question.Revisions().ByRevisionGuid("e452e755-a3fe-45d0-976f-e319ec460200").invoke(/*handlers here*/);
http://api.stackapps.com/1.0/revisions/386/e452e755-a3fe-45d0-976f-e319ec460200
Where you see .invoke(/*handlers here*/)
is where you would implement a standard asynchronous pattern as described in the next post.....
NEXT: Soapi.JS2 Async Pattern