private void ApproveRequest(IAsyncResult ar) { HttpWebRequest request = (HttpWebRequest)ar.AsyncState; Stream stream = request.EndGetRequestStream(ar); Reddit.WritePostBody(stream, new { id = FullName, uh = Reddit.User.Modhash }); request.BeginGetResponse(new AsyncCallback(ApproveResponse), request); }
private void CommentRequest(IAsyncResult ar) { StateObject postState = (StateObject)ar.AsyncState; HttpWebRequest request = postState.Request; Stream stream = request.EndGetRequestStream(ar); Reddit.WritePostBody(stream, new { text = (String)postState.ParameterValue, thing_id = FullName, uh = Reddit.User.Modhash }); }
private void ReplyRequest(IAsyncResult ar) { CommentState commentState = (CommentState)ar.AsyncState; HttpWebRequest request = commentState.AsyncRequest; Stream stream = request.EndGetRequestStream(ar); Reddit.WritePostBody(stream, new { text = (String)commentState.ParameterValue, thing_id = FullName, uh = Reddit.User.Modhash, api_type = "json" //r = Subreddit }); }
private void EditTextRequest(IAsyncResult ar) { CommentState commentState = (CommentState)ar.AsyncState; HttpWebRequest request = commentState.AsyncRequest; Stream stream = request.EndGetRequestStream(ar); Reddit.WritePostBody(stream, new { api_type = "json", text = (String)commentState.ParameterValue, thing_id = FullName, uh = Reddit.User.Modhash }); request.BeginGetResponse(new AsyncCallback(EditTextResponse), commentState); }
private void DistinguishRequest(IAsyncResult ar) { CommentState commentState = (CommentState)ar.AsyncState; DistinguishType distinguishType = (DistinguishType)commentState.ParameterValue; HttpWebRequest request = commentState.AsyncRequest; Stream stream = request.EndGetRequestStream(ar); string how; switch (distinguishType) { case DistinguishType.Admin: how = "admin"; break; case DistinguishType.Moderator: how = "yes"; break; case DistinguishType.None: how = "no"; break; default: how = "special"; break; } Reddit.WritePostBody(stream, new { how, id = Id, uh = Reddit.User.Modhash }); request.BeginGetResponse(new AsyncCallback(DistinguishResponse), commentState); }