public void BarCodePutBarCodeGenerateFile(BarCodePutBarCodeGenerateFileRequest request) =>
 _instance.BarCodePutBarCodeGenerateFile(request);
Beispiel #2
0
        /// <summary>
        /// Generate barcode and save on server.
        /// </summary>
        /// <param name="request">Request. <see cref="BarCodePutBarCodeGenerateFileRequest" /></param>
        /// <returns><see cref="AsposeResponse"/></returns>
        public AsposeResponse BarCodePutBarCodeGenerateFile(BarCodePutBarCodeGenerateFileRequest request)
        {
            // verify the required parameter 'name' is set
            if (request.name == null)
            {
                throw new ApiException(400, "Missing required parameter 'name' when calling BarCodePutBarCodeGenerateFile");
            }

            // verify the required parameter 'file' is set
            if (request.File == null)
            {
                throw new ApiException(400, "Missing required parameter 'file' when calling BarCodePutBarCodeGenerateFile");
            }

            // create path and map variables
            var resourcePath = this.configuration.GetApiRootUrl() + "/barcode/{name}/generate";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            var formParams = new Dictionary <string, object>();

            resourcePath = UrlHelper.AddPathParameter(resourcePath, "name", request.name);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "text", request.text);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "type", request.type);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "format", request.format);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "resolutionX", request.resolutionX);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "resolutionY", request.resolutionY);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "dimensionX", request.dimensionX);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "dimensionY", request.dimensionY);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "codeLocation", request.codeLocation);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "grUnit", request.grUnit);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "autoSize", request.autoSize);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "barHeight", request.barHeight);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "imageHeight", request.imageHeight);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "imageWidth", request.imageWidth);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "imageQuality", request.imageQuality);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "rotAngle", request.rotAngle);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "topMargin", request.topMargin);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "bottomMargin", request.bottomMargin);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "leftMargin", request.leftMargin);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "rightMargin", request.rightMargin);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "enableChecksum", request.enableChecksum);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.storage);
            resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.folder);

            if (request.File != null)
            {
                formParams.Add("file", this.apiInvoker.ToFileInfo(request.File, "File"));
            }

            try
            {
                var response = this.apiInvoker.InvokeApi(
                    resourcePath,
                    "PUT",
                    null,
                    null,
                    formParams);
                if (response != null)
                {
                    return((AsposeResponse)SerializationHelper.Deserialize(response, typeof(AsposeResponse)));
                }

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

                throw;
            }
        }