Exemplo n.º 1
0
        public async Task <OperationResult> ReportComment(String access, Int32 commentId, ReasonMode reason)
        {
            var http = new HttpUtility();

            var body = new StringContent(String.Format("reason={0}&reason_type={1}&resource_id={2}&type=comment", reason.Reason, reason.Type, commentId));

            body.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");

            var response =
                await
                http.PostAsync(Utility.Instance.BaseUri, String.Format("comments/{0}/voters", commentId), body,
                               access);

            if (false == String.IsNullOrEmpty(response.Json))
            {
                var json = response.Json;
                //json = Regex.Unescape(json);

                var obj = JsonConvert.DeserializeObject <Operation>(json);

                return(new OperationResult(obj));
            }
            else
            {
                var json = response.Error;
                //json = Regex.Unescape(json);

                return(new OperationResult(new Exception(json)));
            }
        }
Exemplo n.º 2
0
 public Task <OperationResult> ReportComment(String access, Int32 commentId, ReasonMode reason)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 3
0
        public async Task <OperationResult> ReportComment(String access, Int32 commentId, ReasonMode reason)
        {
            var api    = new CommentApi();
            var result = await api.ReportComment(access, commentId, reason);

            return(result);
        }