Example #1
0
        public void ComparisonImagesTest()
        {
            string outPath = "result.docx";
            ComparisonImagesRequest request = new ComparisonImagesRequest(GetComparisonRequest("source.docx", new List <string> {
                "target.docx"
            }), outPath);
            var response = ComparisonApi.ComparisonImages(request);

            Assert.IsInstanceOf <List <Link> >(response, "response is List<Link>");
        }
Example #2
0
        /// <summary>
        /// Returns images of document with the result of comparison
        /// </summary>
        /// <param name="request">Request. <see cref="ComparisonImagesRequest" /></param>
        /// <returns><see cref="List<Link>"/></returns>
        public List <Link> ComparisonImages(ComparisonImagesRequest request)
        {
            // create path and map variables
            var resourcePath = this.configuration.GetApiRootUrl() + "/comparison/compareDocuments/images";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "outFolder", request.OutFolder);
            var postBody = SerializationHelper.Serialize(request.Request); // http body (model) parameter

            try
            {
                var response = this.apiInvoker.InvokeApi(
                    resourcePath,
                    "POST",
                    postBody,
                    null,
                    null);
                if (response != null)
                {
                    return((List <Link>)SerializationHelper.Deserialize(response, typeof(List <Link>)));
                }

                return(null);
            }
            catch (ApiException ex)
            {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }

                throw;
            }
        }