index.js
function (tagArgs) {
  if (!APIKey) {
    throw new Error('flickr_api_key configuration is required');
  }

  var tag = tagUtil.convertAttr(tagArgs);

  
    return new Promise(function (resolve, reject) {
      
      var flJson = getFlickrCacheJson(tag.id);
  
      if(!flJson){
        // console.log("[api access getInfo]photoId= " + tag.id);
        var url = 'https://api.flickr.com/services/rest/?method=flickr.photos.getInfo' +
          '&api_key=' + APIKey +
          '&photo_id=' + tag.id +
          '&format=json' +
          '&nojsoncallback=1';

        https.get(url, function (res) {
          var data = '';

          res.on('data', function (chunk) {
            data += chunk;
          });

          res.on('end', function () {
            var json = JSON.parse(data);
            if (json.stat === 'ok') {
                
                pushFlickrJson(json);
                resolve(tagUtil.imgFormat(tag, json));
                
            } else {
              return reject('Flickr Tag Error: ' + tag.id + ' ' +  json.message);
            }
          });

        }).on('error', function (e) {
          return reject('Fetch Flickr API error: ' + e);
        });
        
      }else{
        // console.log("[cache getInfo]photoId= " + tag.id);
        return resolve(tagUtil.imgFormat(tag, flJson));
      }
      
    });
  
}
function (tagArgs) {
  if (!APIKey) {
    throw new Error('flickr_api_key configuration is required');
  }

  var tag = tagUtil.convertAttr(tagArgs);

  
    return new Promise(function (resolve, reject) {
      
      var flJson = getFlickrCacheJson(tag.id);
  
      if(!flJson){
        // console.log("[api access getInfo]photoId= " + tag.id);
        var url = 'https://api.flickr.com/services/rest/?method=flickr.photos.getInfo' +
          '&api_key=' + APIKey +
          '&photo_id=' + tag.id +
          '&format=json' +
          '&nojsoncallback=1';

        https.get(url, function (res) {
          var data = '';

          res.on('data', function (chunk) {
            data += chunk;
          });

          res.on('end', function () {
            var json = JSON.parse(data);
            if (json.stat === 'ok') {
                
                pushFlickrJson(json);
                resolve(tagUtil.imgFormat(tag, json));
                
            } else {
              return reject('Flickr Tag Error: ' + tag.id + ' ' +  json.message);
            }
          });

        }).on('error', function (e) {
          return reject('Fetch Flickr API error: ' + e);
        });
        
      }else{
        // console.log("[cache getInfo]photoId= " + tag.id);
        return resolve(tagUtil.imgFormat(tag, flJson));
      }
      
    });
  
}
promise Flickr API request
@param  {Array} tagArgs Tag args ex: ['15905712665', 'z']
@resolve {Object} image attrs