Example #1
0
        /// <summary>
        /// Adds annotations to document and saves output file into cloud storage
        /// </summary>
        /// <param name="request">Request. <see cref="AnnotateRequest" /></param>
        /// <returns><see cref="AnnotationApiLink"/></returns>
        public AnnotationApiLink Annotate(AnnotateRequest request)
        {
            // verify the required parameter 'options' is set
            if (request.options == null)
            {
                throw new ApiException(400, "Missing required parameter 'options' when calling Annotate");
            }

            // create path and map variables
            var resourcePath = this.configuration.GetServerUrl() + "/annotation/add";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            var postBody = SerializationHelper.Serialize(request.options); // http body (model) parameter
            var response = this.apiInvoker.InvokeApi(
                resourcePath,
                "POST",
                postBody,
                null,
                null);

            if (response != null)
            {
                return((AnnotationApiLink)SerializationHelper.Deserialize(response, typeof(AnnotationApiLink)));
            }

            return(null);
        }
Example #2
0
        public void TestAddAnnotationsManyPages(string filePath)
        {
            var fileInfo = new Model.FileInfo
            {
                FilePath = filePath
            };
            var options = new AnnotateOptions
            {
                FileInfo    = fileInfo,
                Annotations = GetAnnotationsManyPages(),
                OutputPath  = $"{DefaultOutputPath}/{Path.GetFileName(filePath)}"
            };
            var request = new AnnotateRequest(options);
            var result  = AnnotateApi.Annotate(request);

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.Href);
        }