-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation
Getting albums of photos with descriptions requires three flickr Api call in this order: photosets.getList -> photosets.getPhotos -> photos.getInfo.
Photosets.getList takes API_Key returns an array of albums. Each album contains information such as album ID and album Name. Photosets.getPhotos takes API_Key and album ID, returns an array of all photos that belong to that album. Each photo contains information such as Photo ID and Photo Name. Photo ID will be used to find photo description. Photos.getInfo takes API_Key and photo ID, returns photo Description.
Step 1 Fetch Photosets.getList -> returns Promise -> resolve promise to get list of album IDs
Step 2 Map over album IDs (dog album, cat album) -> call fetch Photosets.getPhotos over all albums (in this case cats and dogs) -> returns [promise, promise] -> resolve using Promise.all (Promise.all is used to resolve array of promise before moving on) -> resolve to get list of photo IDs
Step 3 Map over albums -> Map photo IDs -> fetch Photos.getInfo -> returns Promise, Promise], [Promise, Promise, Promise (each promise is a photo ID containing photo description), for simplicity [album_A, album_B] -> [Promise.all(album_A), Promise.all(album_B)]