Suppose I have an interface API and classes FacebookAPI and FlickrAPI that implements this interface,
public interface API {
Photo getPhoto(int id);
Album getAlbum(int id);
}
package api;
import domainObjects.Album;
import domainObjects.Photo;
public class FacebookAPI implements API{
@Override
public Photo getPhoto(int id) {
// TODO Auto-generated method stub
return null;
}
@Override
public Album getAlbum(int id) {
// TODO Auto-generated method stub
return null;
}
}
import domainObjects.Album;
import domainObjects.Photo;
public class FlickrAPI implements API{
@Override
public Photo getPhoto(int id) {
// TODO Auto-generated method stub
return null;
}
@Override
public Album getAlbum(int id) {
// TODO Auto-generated method stub
return null;
}
}
The issue is that I only know that at minimum both APIs(facebook and flickr) requires the photoId. Now suppose that to get a photo FacebookAPI requires AccessToken in addition to Id while FlickAPI requires APIKey + UserId in addition to photoId.
What Design Pattern can i use to solve this issue?