// ガジェットの初期化 function init() { var req = opensocial.newDataRequest(); // Viewerを取得 var viewerId = opensocial.IdSpec.PersonId.VIEWER; req.add(req.newFetchPersonRequest(viewerId), 'viewer'); // フレンドを取得 var friendsIdParams = {}; friendsIdParams[opensocial.IdSpec.Field.USER_ID] = viewerId; friendsIdParams[opensocial.IdSpec.Field.GROUP_ID] = 'FRIENDS'; var friendsIdSpec = opensocial.newIdSpec(friendsIdParams); req.add(req.newFetchPeopleRequest(friendsIdSpec), 'friends'); // リクエストを送信 req.send(receiveData); }
opensocial.DataRequestオブジェクトを作成。