/**
 * Request Friends by OWNER (0.8)
 */

/**
 * 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 friends of the OWNER
 */
function request(id) {
  var params = {};
  params[opensocial.IdSpec.Field.USER_ID] = opensocial.IdSpec.PersonId.OWNER;
  params[opensocial.IdSpec.Field.GROUP_ID] = "FRIENDS";
  
  var idspec = opensocial.newIdSpec(params);

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


request();