/**
 * Request by ID (0.8)
 */

/**
 * This function just calls the supplied callback with the ID of the owner.  
 * This is obfuscated because it is not part of the sample code, I just need
 * a valid ID number
 */
function getOwnerId(b){var r=opensocial.newDataRequest();
                       r.add(r.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER),"r");
                       r.send(function(a){b(a.get("r").getData().getId())})};

/**
 * Prints the supplied person's name
 */
function printPerson(person) {
  output(person.getDisplayName());
};

/**
 * Callback to handle the query's response
 */
function response(data) {
  data.get("req").getData().each(printPerson);
};

/**
 * Makes a request for the person with the supplied user ID
 */
function request(id) {
  var params = {};
  params[opensocial.IdSpec.Field.USER_ID] = id;
  params[opensocial.IdSpec.Field.NETWORK_DISTANCE] = 0;
  
  var idspec = opensocial.newIdSpec(params);

  var req = opensocial.newDataRequest();
  req.add(req.newFetchPeopleRequest(idspec), "req");
  req.send(response);
};


getOwnerId(request);