Difference between TagMediaFeed and MediaFeed
mahmoudhanafy opened this issue · 2 comments
mahmoudhanafy commented
Why not only use one class ? What is the difference between them ?
I'm writing an application that fetch user posts and tag posts and I have to handle every one alone because they are not the same class, or there are no common super class between them that have the same functionality.
abargnesi commented
There does not seem to be a difference besides the toString
output.
This would be nice to consolidate to MediaFeed
and eliminate logic like the following:
TagMediaFeed firstTagFeed = client.getRecentMediaTags(tagName);
// Convert TagMediaFeed to MediaFeed to align types.
MediaFeed firstFeed = new MediaFeed();
firstFeed.setPagination(firstTagFeed.getPagination());
firstFeed.setMeta(firstTagFeed.getMeta());
firstFeed.setData(firstTagFeed.getData());
UnaryOperator<MediaFeed> nextFeed = mediaFeed -> {
try {
return client.getRecentMediaNextPage(mediaFeed.getPagination());
} catch (InstagramException e) {
throw new WrappedException(e);
}
};
try {
return Stream.iterate(firstFeed, nextFeed);
} catch (WrappedException we) {
throw (InstagramException) we.getCause();
}