public void CompareDocuments() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); using (FileStream fs0 = File.OpenRead("{path-to-file-1}")) { using (FileStream fs1 = File.OpenRead("{path-to-file-2}")) { using (MemoryStream ms0 = new MemoryStream()) { using (MemoryStream ms1 = new MemoryStream()) { fs0.CopyTo(ms0); fs1.CopyTo(ms1); var result = service.CompareDocuments( file1: ms0, file2: ms1, file1ContentType: "{file-1-content-type}", file2ContentType: "{file-2-content-type}", file1Label: "{file-1-label}", file2Label: "{file-2-label}" ); Console.WriteLine(result.Response); } } } } }
public void ListBatches() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); var result = service.ListBatches(); Console.WriteLine(result.Response); }
public void DeleteFeedback() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); var result = service.DeleteFeedback( feedbackId: "{feedback-id}" ); Console.WriteLine(result.Response); }
public void UpdateBatch() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); var result = service.UpdateBatch( batchId: "{batch-id}", action: "rescan" ); Console.WriteLine(result.Response); }
public void ClassifyElements() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); using (FileStream fs = File.OpenRead("{path-to-file}")) { using (MemoryStream ms = new MemoryStream()) { fs.CopyTo(ms); var result = service.ClassifyElements( file: ms, fileContentType: "{file-content-type}" ); Console.WriteLine(result.Response); } } }
public void CreateBatch() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); using (FileStream fsInput = File.OpenRead("{object-storage-input-credentials-filepath}")) { using (FileStream fsOutput = File.OpenRead("{object-storage-output-credentials-filepath}")) { using (MemoryStream msInput = new MemoryStream()) { using (MemoryStream msOutput = new MemoryStream()) { fsInput.CopyTo(msInput); fsOutput.CopyTo(msOutput); var result = service.CreateBatch( function: "html_conversion", inputCredentialsFile: msInput, inputBucketLocation: "us-south", inputBucketName: "bucket-input", outputCredentialsFile: msOutput, outputBucketLocation: "us-south", outputBucketName: "bucket-output" ); batchId = result.Result.BatchId; Console.WriteLine(result.Response); } } } } }
//[TestMethod, ExpectedException(typeof(AggregateException))] public void ConvertToHtml_Catch_Exception() { IClient client = CreateClient(); IRequest request = Substitute.For <IRequest>(); client.PostAsync(Arg.Any <string>()) .Returns(x => { throw new AggregateException(new ServiceResponseException(Substitute.For <IResponse>(), Substitute.For <HttpResponseMessage>(HttpStatusCode.BadRequest), string.Empty)); }); CompareComplyService service = new CompareComplyService(client); service.SetServiceUrl("https://www.serviceurl.com"); service.VersionDate = "2018-02-16"; using (MemoryStream fs = new MemoryStream()) { service.ConvertToHtml(fs, "filename"); } }
public void AddFeedback() { IamAuthenticator authenticator = new IamAuthenticator( apikey: "{apikey}"); CompareComplyService service = new CompareComplyService("2018-10-15", authenticator); service.SetServiceUrl("{serviceUrl}"); #region feedbackData FeedbackDataInput feedbackData = new FeedbackDataInput() { FeedbackType = "element_classification", Document = new ShortDoc() { Hash = "", Title = "doc title" }, ModelId = "contracts", ModelVersion = "11.00", Location = new Location() { Begin = 241, End = 237 }, Text = "1. IBM will provide a Senior Managing Consultant / expert resource, for up to 80 hours, to assist Florida Power & Light (FPL) with the creation of an IT infrastructure unit cost model for existing infrastructure.", OriginalLabels = new OriginalLabelsIn() { Types = new List <TypeLabel>() { new TypeLabel() { Label = new Label() { Nature = "Obligation", Party = "IBM" }, ProvenanceIds = new List <string>() { "85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795" } }, new TypeLabel() { Label = new Label() { Nature = "End User", Party = "Exclusion" }, ProvenanceIds = new List <string>() { "85f5981a-ba91-44f5-9efa-0bd22e64b7bc", "ce0480a1-5ef1-4c3e-9861-3743b5610795" } } }, Categories = new List <Category>() { new Category() { Label = Category.LabelEnumValue.RESPONSIBILITIES, ProvenanceIds = new List <string>() { } }, new Category() { Label = Category.LabelEnumValue.AMENDMENTS, ProvenanceIds = new List <string>() { } } } }, UpdatedLabels = new UpdatedLabelsIn() { Types = new List <TypeLabel>() { new TypeLabel() { Label = new Label() { Nature = "Obligation", Party = "IBM" } }, new TypeLabel() { Label = new Label() { Nature = "Disclaimer", Party = "buyer" } } }, Categories = new List <Category>() { new Category() { Label = Category.LabelEnumValue.RESPONSIBILITIES, }, new Category() { Label = Category.LabelEnumValue.AUDITS } } } }; #endregion var result = service.AddFeedback( feedbackData: feedbackData, userId: "{user-id}", comment: "{user-comment}" ); feedbackId = result.Result.FeedbackId; Console.WriteLine(result.Response); }