/// <summary> /// This method removes a like a user added to a post. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// api.Stream.RemoveLikeAsync(Constants.UserId, Constants.PostId1, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uid">The user ID of the user who liked the post. If this parameter is not specified, then it defaults to the session user. Note: This parameter applies only to Web applications. Facebook ignores this parameter if it is passed by a desktop application.</param> /// <param name="postId">The ID of the post.</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 true on success, or false and an error code if it fails.</returns> public void RemoveLikeAsync(long uid, string postId, RemoveLikeCallback callback, Object state) { RemoveLike(uid, postId, true, callback, state); }
private bool RemoveLike(long uid, string post_id, bool isAsync, RemoveLikeCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.stream.removeLike" } }; Utilities.AddOptionalParameter(parameterList, "uid", uid); Utilities.AddRequiredParameter(parameterList, "post_id", post_id); if (isAsync) { SendRequestAsync<stream_removeLike_response, bool>(parameterList, uid <= 0, new FacebookCallCompleted<bool>(callback), state); return true; } var response = SendRequest<stream_removeLike_response>(parameterList, uid <= 0); return response == null ? true : response.TypedValue; }
/// <summary> /// This method removes a like a user added to a post. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Session.UserId = Constants.UserId; /// api.Stream.RemoveLikeAsync(Constants.PostId1, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="postId">The ID of the post.</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 true on success, or false and an error code if it fails.</returns> public void RemoveLikeAsync(string postId, RemoveLikeCallback callback, Object state) { RemoveLike(Session.UserId, postId, true, callback, state); }