private IList<comment> GetComments(string post_id, bool isAsync, GetCommentsCallback callback, Object state) { var parameterList = new Dictionary<string, string> { { "method", "facebook.stream.getComments" } }; Utilities.AddRequiredParameter(parameterList, "post_id", post_id); if (isAsync) { SendRequestAsync<stream_getComments_response, IList<comment>>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted<IList<comment>>(callback), state, "comment"); return null; } var response = SendRequest<stream_getComments_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return response == null ? null : response.comment; }
/// <summary> /// This method returns all comments associated with a post in a user's stream. This method returns comments only if the user who owns the post (that is, the user published the post to his or her profile) has authorized your application. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new FBMLCanvasSession(Constants.WebApplicationKey, Constants.WebSecret)); /// api.Stream.GetCommentsAsync(Constants.PostId1, AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(IList<comment> result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="post_id">The ID for the post for which you're retrieving the comments.</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 a List of comments, where each comment contains the fields from the comment (FQL) table.</returns> public void GetCommentsAsync(string post_id, GetCommentsCallback callback, Object state) { GetComments(post_id, true, callback, state); }