public void PutBarcodeGenerateFileTest() { // Arrange var request = new PutBarcodeGenerateFileRequest( "Test_PutBarcodeGenerateFile.png", type: EncodeBarcodeType.Code128.ToString(), text: "Hello!", folder: TempFolderPath ); // Act ResultImageInfo response = _api.PutBarcodeGenerateFile(request); // Assert Assert.True(response.FileSize > 0); Assert.True(response.ImageWidth > 0); Assert.True(response.ImageHeight > 0); }
/// <summary> /// Generate barcode and save on server (from query params or from file with json or xml content) /// </summary> /// <param name="request">Request. <see cref="PutBarcodeGenerateFileRequest" /></param> /// <returns> /// <see cref="ResultImageInfo" /> /// </returns> public ResultImageInfo PutBarcodeGenerateFile(PutBarcodeGenerateFileRequest request) { // verify the required parameter 'name' is set if (request.name == null) { throw new ApiException(400, "Missing required parameter 'name' when calling PutBarcodeGenerateFile"); } // verify the required parameter 'type' is set if (request.Type == null) { throw new ApiException(400, "Missing required parameter 'type' when calling PutBarcodeGenerateFile"); } // verify the required parameter 'text' is set if (request.Text == null) { throw new ApiException(400, "Missing required parameter 'text' when calling PutBarcodeGenerateFile"); } // create path and map variables string resourcePath = _configuration.GetApiRootUrl() + "/barcode/{name}/generate"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); resourcePath = UrlHelper.AddPathParameter(resourcePath, "name", request.name); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "type", request.Type); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "text", request.Text); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "twoDDisplayText", request.TwoDDisplayText); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "textLocation", request.TextLocation); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "textAlignment", request.TextAlignment); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "textColor", request.TextColor); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fontSizeMode", request.FontSizeMode); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "noWrap", request.NoWrap); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "resolution", request.Resolution); 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, "textSpace", request.TextSpace); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "units", request.Units); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "sizeMode", request.SizeMode); 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, "rotationAngle", request.RotationAngle); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "backColor", request.BackColor); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "barColor", request.BarColor); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "borderColor", request.BorderColor); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "borderWidth", request.BorderWidth); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "borderDashStyle", request.BorderDashStyle); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "borderVisible", request.BorderVisible); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "enableChecksum", request.EnableChecksum); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "enableEscape", request.EnableEscape); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "filledBars", request.FilledBars); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "alwaysShowChecksum", request.AlwaysShowChecksum); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "wideNarrowRatio", request.WideNarrowRatio); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "validateText", request.ValidateText); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "supplementData", request.SupplementData); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "supplementSpace", request.SupplementSpace); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "barWidthReduction", request.BarWidthReduction); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.storage); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.folder); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "format", request.format); string response = _apiInvoker.InvokeApi( resourcePath, "PUT", null, null, null); if (response != null) { return((ResultImageInfo)SerializationHelper.Deserialize(response, typeof(ResultImageInfo))); } return(null); }