albumId ption

The "options" object passed to "getPhotos" now looks for an "albumId" property and retrieves only photos for this specific album.

Updated sample code.

Implemented feedback
This commit is contained in:
z1c0
2016-10-08 16:03:01 +02:00
parent 66a5cf7c64
commit 11a25a2f09
2 changed files with 5 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ const picasa = new Picasa()
const options = {
maxResults : 10 // by default get all
albumId : "6338620891611370881" // by default all photos are selected
}
picasa.getPhotos(accessToken, options, (error, photos) => {
@@ -109,4 +110,4 @@ MIT ©
Play around https://developers.google.com/oauthplayground/?code=4/usq8QmuezR3Au_0UKyj9-UXmf6Bw_ij8KFWgIziYbpM#
Picasa Docs https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol
Picasa Docs https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol

View File

@@ -112,10 +112,12 @@ function getPhotos (accessToken, options, callback) {
if (options.maxResults) accessTokenParams['max-results'] = options.maxResults
const albumPart = options.albumId ? `/albumid/${options.albumId}` : '';
const requestQuery = querystring.stringify(accessTokenParams)
const requestOptions = {
url : `${PICASA_SCOPE}${PICASA_API_FEED_PATH}?${requestQuery}`,
url : `${PICASA_SCOPE}${PICASA_API_FEED_PATH}${albumPart}?${requestQuery}`,
headers: {
'GData-Version': '2'
}