I\'m trying to get all post messages using restfb, my code is as follows
public Connection publicSearchMessages(Date fromDate, Date toDate) {
Co
As I tested recently, You don't have to specify anything. Connection class implements Iterable in this way:
So basically all you need to do is this:
Connection messages = publicFbClient.fetchConnection("search",
Post.class,
Parameter.with("q", "Watermelon"),
Parameter.with("since", fromDate),
Parameter.with("until", toDate),
Parameter.with("type", "post"));
for (List feedConnectionPage : messages) {
for (Post post : myFeedConnectionPage) {
// do stuff with post
}
}
If you want to have some kind of method that returns results I would be very careful, because you can be returning thousands of results and crawling through them may take some time (from seconds to minutes or even hours) and result object array is going to be really big. Better idea is to use some asynchronous call and check out results of method periodically.
Though it seems that parameter "since" is ignored. Posts are fetched from newest to oldest and I think that it somehow leave out this parameter when doing paging.
Hope I made it more clear for you :)