private IList<friend_info> AreFriends(List<long> uids1, List<long> uids2, bool isAsync, AreFriendsCallback callback, Object state) { var parameterList = new Dictionary<string, string> { {"method", "facebook.friends.areFriends"} }; Utilities.AddList(parameterList, "uids1", uids1); Utilities.AddList(parameterList, "uids2", uids2); if(isAsync) { SendRequestAsync<friends_areFriends_response, IList<friend_info>>(parameterList, new FacebookCallCompleted<IList<friend_info>>(callback), state, "friend_info"); return null; } var response = SendRequest<friends_areFriends_response>(parameterList); return response == null ? null : response.friend_info; }
/// <summary> /// Returns whether or not each pair of specified users is friends with each other. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// List<long> u1 = new List<long> { Constants.Friend_UserId1 }; /// List<long> u2 = new List<long> { Constants.Friend_UserId2 }; /// api.Friends.AreFriendsAsync(u1, u2, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<friend_info> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uids1">A list of user ids matched with uids2.</param> /// <param name="uids2">A list of user ids matched with uids1.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns a list of friend_info elements corresponding to the lists passed. The are_friends subelement of each friend_info element is 0 or false if the users are not friends, and 1 or true if they are friends. Note that, for each pair, this function is symmetric. That is, it does not matter which user is in uids1 and which is in uids2.</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 AreFriendsAsync(List<long> uids1, List<long> uids2, AreFriendsCallback callback, Object state) { AreFriends(uids1, uids2, true, callback, state); }
/// <summary> /// Returns whether or not each pair of specified users is friends with each other. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// user u1 = api.Users.GetInfo(Constants.Friend_UserId1); /// user u2 = api.Users.GetInfo(Constants.Friend_UserId2); /// api.Friends.AreFriendsAsync(u1, u2, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<friend_info> result, Object state, FacebookException e) /// { /// var actual = result; /// }/// </code> /// </example> /// <param name="user1">A user to match against user2.</param> /// <param name="user2">A user to match against user1.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns a list of friend_info elements corresponding to the lists passed. The are_friends subelement of each friend_info element is 0 or false if the users are not friends, and 1 or true if they are friends. Note that, for each pair, this function is symmetric. That is, it does not matter which user is in uids1 and which is in uids2.</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 AreFriendsAsync(user user1, user user2, AreFriendsCallback callback, Object state) { var u1 = new List<long>(); var u2 = new List<long>(); u1.Add(user1.uid.Value); u2.Add(user2.uid.Value); AreFriendsAsync(u1, u2, callback, state); }
/// <summary> /// Returns whether or not each pair of specified users is friends with each other. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// api.Friends.AreFriendsAsync(Constants.Friend_UserId1, Constants.Friend_UserId2, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<friend_info> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uid1">A user id to match against uid2.</param> /// <param name="uid2">A user id to match against uid1.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns a list of friend_info elements corresponding to the lists passed. The are_friends subelement of each friend_info element is 0 or false if the users are not friends, and 1 or true if they are friends. Note that, for each pair, this function is symmetric. That is, it does not matter which user is in uids1 and which is in uids2.</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 AreFriendsAsync(long uid1, long uid2, AreFriendsCallback callback, Object state) { var u1 = new List<long>(); var u2 = new List<long>(); u1.Add(uid1); u2.Add(uid2); AreFriendsAsync(u1, u2, callback, state); }
/// <summary> /// Returns whether or not each pair of specified users is friends with each other. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.SessionSecret, Constants.SessionKey)); /// List<user> u1 = new List<user>(); /// List<user> u2 = new List<user>(); /// u1.Add(api.Users.GetInfo(Constants.Friend_UserId1)); /// u2.Add(api.Users.GetInfo(Constants.Friend_UserId2)); /// api.Friends.AreFriendsAsync(u1, u2, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<friend_info> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uids1">A list of user ids matched with uids2.</param> /// <param name="uids2">A list of user ids matched with uids1.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>Returns a list of friend_info elements corresponding to the lists passed. The are_friends subelement of each friend_info element is 0 or false if the users are not friends, and 1 or true if they are friends. Note that, for each pair, this function is symmetric. That is, it does not matter which user is in uids1 and which is in uids2.</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 AreFriendsAsync(List<user> uids1, List<user> uids2, AreFriendsCallback callback, Object state) { var u1 = (from u in uids1 select u.uid.Value).ToList(); var u2 = (from u in uids2 select u.uid.Value).ToList(); AreFriendsAsync(u1, u2, callback, state); }