/// <summary> /// Returns the identifiers for the requested users' Mutual 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.GetMutualFriendsAsync(Constants.Friend_UserId1, Constants.UserId, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<long> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="target_uid">The user ID of one of the target user whose mutual friends you want to retrieve.</param> /// <param name="source_uid">The user ID of the other user for which you are getting mutual friends of. Defaults to the current session user.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>This method returns an List of user IDs of the mutual friends, or an error code.</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 GetMutualFriendsAsync(long target_uid, long? source_uid, GetMutualFriendsCallback callback, Object state) { GetMutualFriends(target_uid, source_uid, true, callback, state); }
private List<long> GetMutualFriends(long target_uid, long? source_uid, bool isAsync, GetMutualFriendsCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.friends.getMutualFriends" } }; Utilities.AddRequiredParameter(parameterList, "target_uid", target_uid); Utilities.AddOptionalParameter(parameterList, "source_uid", source_uid); if (isAsync) { SendRequestAsync<friends_getMutualFriends_response, IList<long>>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<IList<long>>(callback), state, "uid"); return null; } #if !SILVERLIGHT var response = SendRequest<friends_getMutualFriends_response>(parameterList, Session is DesktopSession || source_uid == null); #else var response = SendRequest<friends_getMutualFriends_response>(parameterList, source_uid == null); #endif return response == null ? null : response.uid; }
/// <summary> /// Returns the identifiers for the requested users' Mutual 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.GetMutualFriendsAsync(Constants.UserId, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<long> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="target_uid">The user ID of one of the target user whose mutual friends you want to retrieve.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>This method returns an List of user IDs of the mutual friends, or an error code.</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 GetMutualFriendsAsync(long target_uid, GetMutualFriendsCallback callback, Object state) { GetMutualFriendsAsync(target_uid, null, callback, state); }