Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

...

Codeblock
languagec#
linenumberstrue
 private static string GetContext(int num, CongreeCheckresult result)
        {

            string pattern = @"<\?cngr-ctx-b " + num + @"\?>(.+)<\?cngr-ctx-e " + num + @"\?>";

            MatchCollection matches = Regex.Matches(result.ResultXml, pattern);
            if (matches.Count > 0) {
                return matches[0].Value;
            }
            return "";
        }


The method to store a paragraph related report is shown below:

Codeblock
languagec#
linenumberstrue
public void StoreParagraphReport(string sessionid, string paragraphid, CongreeRestApiSample.Reporting.Congree.ParagraphReport message)
        {
            var client = new RestClient(this.serverUrl + "/congree/api/Linguistic/Reporting/v1/Sessions/" + sessionid + "/Paragraphs/" + paragraphid);
            var request = new RestRequest(Method.PUT);
            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Authorization", "Bearer " + this.token);
            var jsonmessage = JsonConvert.SerializeObject(message);
            request.AddParameter("undefined", jsonmessage, ParameterType.RequestBody);
            IRestResponse response = client.Execute(request);
        }


The parameter message is an object of the class ParagraphReport shown below.

Codeblock
languagec#
linenumberstrue
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CongreeRestApiSample.Reporting.Congree
{
    public class Error
        
    {
        public int ErrorId { get; set; }
        public string ErrorType { get; set; }
        public string ErrorCode { get; set; }
        public string Notification { get; set; }
        public List<string> Proposals { get; set; }
        public string Status { get; set; }
    }

    public class ParagraphReport
    {
        public List<Error> Errors { get; set; }
        public string Context { get; set; }
    }
}


Property in Paragraph ReportProperty in CongreeCheckResult
ErrorIdId in Errors
ErrorTypeType in Errors
ErrorCodeCode in Errors
NotificationHeader in Descriptions/Description
ProposalsAn array containing the strings in Text in each Proposal
StatusThe information on the status, e.g. how the user dealt with the issue. Possible values are "Normal", "Ignored", "Disregarded"