Ejemplo n.º 1
0
        public void CompareDocuments()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            using (FileStream fs0 = File.OpenRead(contractAFilePath))
            {
                using (FileStream fs1 = File.OpenRead(contractBFilePath))
                {
                    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: "application/pdf",
                                file2ContentType: "application/pdf",
                                file1Label: "Contract A",
                                file2Label: "Contract B"
                                );

                            Console.WriteLine(result.Response);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void ConvertToHtml()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            using (FileStream fs = File.OpenRead(contractAFilePath))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    fs.CopyTo(ms);
                    var result = service.ConvertToHtml(
                        file: ms,
                        filename: Path.GetFileName(contractAFilePath),
                        fileContentType: "application/pdf"
                        );

                    Console.WriteLine(result.Response);
                }
            }
        }
Ejemplo n.º 3
0
        public void ListBatches()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            var result = service.ListBatches();

            Console.WriteLine(result.Response);
        }
Ejemplo n.º 4
0
        public void DeleteFeedback()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            var result = service.DeleteFeedback(
                feedbackId: feedbackId
                );

            Console.WriteLine(result.Response);
        }
Ejemplo n.º 5
0
        public void UpdateBatch()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            var result = service.UpdateBatch(
                batchId: batchId,
                action: "rescan"
                );

            Console.WriteLine(result.Response);
        }
Ejemplo n.º 6
0
        public void CreateBatch()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            using (FileStream fsInput = File.OpenRead(objectStorageCredentialsInputFilepath))
            {
                using (FileStream fsOutput = File.OpenRead(objectStorageCredentialsOutputFilepath))
                {
                    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: "compare-comply-integration-test-bucket-input",
                                outputCredentialsFile: msOutput,
                                outputBucketLocation: "us-south",
                                outputBucketName: "compare-comply-integration-test-bucket-output"
                                );

                            batchId = result.Result.BatchId;
                            Console.WriteLine(result.Response);
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void AddFeedback()
        {
            IamConfig config = new IamConfig(
                apikey: apikey
                );

            CompareComplyService service = new CompareComplyService(versionDate, config);

            service.SetEndpoint(url);

            #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_123x",
                comment: "Test feedback comment"
                );

            feedbackId = result.Result.FeedbackId;

            Console.WriteLine(result.Response);
        }