bobolounna / restfb

Automatically exported from code.google.com/p/restfb
0 stars 0 forks source link

User object's additional fields #195

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Some users (i.e. company page owners) have additional fields, e.g. "likes", 
"founded", "category", etc. It would be great to have them as optional fields 
in the User object. Here are some examples:

http://graph.facebook.com/OrangeESP
http://graph.facebook.com/mtv
http://graph.facebook.com/GrupoBBVA

Original issue reported on code.google.com by jdanilew...@trendit.es on 12 Jun 2012 at 12:02

GoogleCodeExporter commented 8 years ago
Are these users or pages?  Try mapping to the Page type and see if that works 
for you.

Original comment by m...@xmog.com on 12 Jun 2012 at 1:31

GoogleCodeExporter commented 8 years ago
Good point. Now I can see that from the library perspective these are Pages 
indeed, however when retrieving Posts (from any wall feed or search) these 
objects may be their authors. Their IDs passed in "from" field are 
undistinguishable from User IDs, so one never knows which object type to apply 
when fetching the "author" of a post.

Thus effectively it is not a bug, but the question remains if there is any 
(automatic) way of fetching the author's data only once, determine its type and 
fill the appropriate object on the fly. I guess all one can do is to perform 
manual JSON object parsing.

Original comment by jdanilew...@trendit.es on 12 Jun 2012 at 2:06

GoogleCodeExporter commented 8 years ago
Sorry for the slow response.  Yes, unfortunately if there's a mixed bag of 
elements returned, you're probably best off mapping to a List of JsonObject and 
examining each one and manually mapping to User or Page as appropriate using 
JsonMapper :(

I don't think there's a better way around this, but if you can think of one, 
please let me know! Thanks.

Original comment by m...@xmog.com on 12 Jul 2012 at 2:20