I'm not sure what's the code inside that sample which is fetching the user details, so I can not suggest you some changes to fetch the username.
Anyways, that sample must be providing you the user_id
. So, you can make this call to get the username of that friend-
/{user-id}?fields=username