I am not sure if this is the best subsite to ask this question, but I'm pretty sure it doesn't fit on the normal or facebook SO page...
I've been asked to make a general API for connecting to several Social Media platforms (at the moment Facebook and Twitter).
I have already realised both of them seperately. Meaning I retrieve the data I need from both Facebook and Twitter and hold the data in it's own dataclass. In my case a list of FacebookTimelineItems and a list of TwitterTimelineItems.
now the hard part is taking the parts that are used in both (username, id, message and such) and make 1 general class that is eventually passed on to who/whatever sent the call to my API.
these are two pics of the data classes I have:
probably not 100% correct but it gives an idea what it looks like.
Now I've been having several idea about how to go about and generalize the two, which is harder then I thought at first.
Create an interface (TimelineItem) and let the other classes extend that one. this way I'll always be sure I have a class that contains at least the basic info I need. downside is that deserializing the JSON seems to be a nightmare.
Use the two dataclasses I have and combine them into a new class afterwards, then pass that one back to whoever requested it. This would probably work but I get the idea it's not the best way to tackle this problem, and is pretty dodgy IF I get it working.
Or, in case of the other two being nearly impossible. Keep the two seperated in the front end, and go sit in the corner crying because I've just figured out you can't lump together facebook and twitter...
Note: I don't have to make the front end part (view), I just make sure the Model is nicely filled with data :)
I hope I placed this in the right section, if I didn't I apologise and would like to know where I should go with my question.
Thanks in advance for any replied/ideas/opinions on this.