Skip to content

Instantly share code, notes, and snippets.

@micmath
Created June 14, 2011 10:32

Revisions

  1. micmath created this gist Jun 14, 2011.
    32 changes: 32 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    /**
    * Construct the Foursquare.Photos module.
    * @param {Object} config A valid configuration.
    * @module node-foursquare/Photos
    */
    module.exports = function(config) {
    var core = require("./core")(config),
    logger = require('log4js')(config.log4js).getLogger("node-foursquare.Photos");

    /**
    * Retrieve a photo from Foursquare.
    * @memberof module:node-foursquare/Photos
    * @param {String} photoId The id of the Photo to retreive.
    * @param {String} accessToken The access token provided by Foursquare for the current user.
    * @param {Function} callback The function to call with results, function({Error} error, {Object} results).
    * @see https://developer.foursquare.com/docs/photos/photos.html
    */
    function getPhoto(photoId, accessToken, callback) {
    logger.debug("ENTERING: Photos.getPhoto");

    if(!photoId) {
    logger.error("getPhoto: photoId is required.");
    callback(new Error("Photos.getPhoto: photoId is required."));
    return;
    }
    core.callApi("/photos/" + photoId, accessToken, "photo", null, callback);
    }

    return {
    "getPhoto" : getPhoto
    }
    };