//Retrieve All Friend public static void GetFriends(GetFriendsCallback callback) { RestClient.Get($"{databaseURL}friend.json").Then(response => { var responseJson = response.Text; var data = fsJsonParser.Parse(responseJson); object deserialized = null; serializer.TryDeserialize(data, typeof(Dictionary <string, Friend>), ref deserialized); var friends = deserialized as Dictionary <string, Friend>; callback(friends); }); }
private IList<long> Get(long uid, long flid, bool isAsync, GetFriendsCallback callback, Object state) { var parameterList = new Dictionary<string, string> {{"method", "facebook.friends.get"}}; Utilities.AddOptionalParameter(parameterList, "flid", flid); Utilities.AddOptionalParameter(parameterList, "uid", uid); if(isAsync) { SendRequestAsync<friends_get_response, IList<long>>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<IList<long>>(callback), state, "uid"); return null; } var response = SendRequest<friends_get_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? null : response.uid; }
/// <summary> /// Returns the identifiers for the current user's Facebook friends. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// api.Friends.GetAsync(Constants.UserId, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<long> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uid">The user ID for the user whose friends you want to return.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>The List of friend IDs returned are the friends that are visible to the Facebook Platform. If no friends are found, the method returns an empty friends_get_response element.</returns> /// <remarks>The first array specifies one half of each pair, the second array the other half; therefore, they must be of equal size.</remarks> public void GetAsync(long uid, GetFriendsCallback callback, Object state) { GetAsync(uid, 0, callback, state); }
/// <summary> /// Returns the identifiers for the current user's Facebook friends. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// api.Friends.GetAsync(Constants.UserId, Constants.FriendListId, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<long> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uid">The user ID for the user whose friends you want to return.</param> /// <param name="flid">Returns the friends in a friend list.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>The List of friend IDs returned are the friends that are visible to the Facebook Platform. If no friends are found, the method returns an empty friends_get_response element.</returns> /// <remarks>The first array specifies one half of each pair, the second array the other half; therefore, they must be of equal size.</remarks> public void GetAsync(long uid, long flid, GetFriendsCallback callback, Object state) { Get(uid, flid, true, callback, state); }
/// <summary> /// Returns the identifiers for the current user's Facebook friends. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// api.Friends.GetAsync(AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<long> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>The List of friend IDs returned are the friends that are visible to the Facebook Platform. If no friends are found, the method returns an empty friends_get_response element.</returns> /// <remarks>The first array specifies one half of each pair, the second array the other half; therefore, they must be of equal size.</remarks> public void GetAsync(GetFriendsCallback callback, Object state) { GetAsync(0, 0, callback, state); }