Skip to content

Commit a1c2178

Browse files
committed
Updated sources
1 parent a1e5439 commit a1c2178

7 files changed

Lines changed: 4591 additions & 14 deletions

File tree

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# GroupDocs.Conversion Cloud SDK for .NET
2+
23
This repository contains GroupDocs.Conversion Cloud SDK for .NET source code. This SDK allows you to work with GroupDocs.Conversion Cloud REST APIs in your .NET applications.
34

4-
## How to use the SDK?
5-
The complete source code is available in this repository folder, you can either directly use it in your project via NuGet package manager. For more details, please visit our [documentation website](https://docs.groupdocs.cloud/conversion/available-sdks/).
5+
## How to use the SDK
6+
7+
The complete source code is available in this repository folder, you can either directly use it in your project via NuGet package manager. For more details, please visit our [documentation website](https://docs.groupdocs.cloud/display/conversioncloud/Available+SDKs#AvailableSDKs-.NET).
68

79
## Dependencies
10+
811
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json)
912

1013
## Getting Started
@@ -46,6 +49,17 @@ namespace Example
4649
```
4750

4851
## Licensing
52+
4953
All GroupDocs.Conversion Cloud SDKs are licensed under [MIT License](LICENSE).
5054

51-
[Home](https://www.groupdocs.cloud/) | [Product Page](https://products.groupdocs.cloud/conversion/net) | [Docs](https://docs.groupdocs.cloud/conversion/) | [Demos](https://products.groupdocs.app/conversion/family) | [API Reference](https://apireference.groupdocs.cloud/conversion/) | [Examples](https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet-samples) | [Blog](https://blog.groupdocs.cloud/category/conversion/) | [Free Support](https://forum.groupdocs.cloud/c/conversion) | [Free Trial](https://purchase.groupdocs.cloud/trial)
55+
## Resources
56+
57+
+[**Website**](https://www.groupdocs.cloud)
58+
+[**Product Home**](https://products.groupdocs.cloud/conversion)
59+
+[**Documentation**](https://docs.groupdocs.cloud/conversion)
60+
+[**Free Support Forum**](https://forum.groupdocs.cloud/c/conversion)
61+
+[**Blog**](https://blog.groupdocs.cloud/category/conversion)
62+
63+
## Contact Us
64+
65+
Your feedback is very important to us. Please feel free to contact us using our [Support Forums](https://forum.groupdocs.cloud/c/conversion).

src/GroupDocs.Conversion.Cloud.Sdk.Test/Api/ConvertApiTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,18 @@ public void ConvertDocumentDownloadTest(TestFile testFile, string targetFormat,
8484
Assert.IsNotNull(result);
8585
Assert.Greater(result.Length, 0);
8686
}
87+
88+
[Test]
89+
public void ConvertDocumentDirectTest()
90+
{
91+
var format = "pdf";
92+
var testFile = TestFiles.FourPagesDocx;
93+
94+
var request = new ConvertDocumentDirectRequest(format, GetTestFileStream(testFile));
95+
var result = ConvertApi.ConvertDocumentDirect(request);
96+
97+
Assert.IsNotNull(result);
98+
Assert.Greater(result.Length, 0);
99+
}
87100
}
88101
}

src/GroupDocs.Conversion.Cloud.Sdk/Api/ConvertApi.cs

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,48 @@ public Stream ConvertDocumentDownload(ConvertDocumentRequest request)
128128
null,
129129
null);
130130
}
131+
/// <summary>
132+
/// Converts input document file to format specified
133+
/// </summary>
134+
/// <param name="request">Request. <see cref="ConvertDocumentDirectRequest" /></param>
135+
/// <returns><see cref="System.IO.Stream"/></returns>
136+
public System.IO.Stream ConvertDocumentDirect(ConvertDocumentDirectRequest request)
137+
{
138+
// verify the required parameter 'format' is set
139+
if (request.format == null)
140+
{
141+
throw new ApiException(400, "Missing required parameter 'format' when calling ConvertDocumentDirect");
142+
}
143+
144+
// verify the required parameter 'file' is set
145+
if (request.File == null)
146+
{
147+
throw new ApiException(400, "Missing required parameter 'file' when calling ConvertDocumentDirect");
148+
}
149+
150+
// create path and map variables
151+
var resourcePath = this.configuration.GetServerUrl() + "/conversion";
152+
resourcePath = Regex
153+
.Replace(resourcePath, "\\*", string.Empty)
154+
.Replace("&amp;", "&")
155+
.Replace("/?", "?");
156+
var formParams = new Dictionary<string, object>();
157+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "format", request.format);
158+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fromPage", request.fromPage);
159+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "pagesCount", request.pagesCount);
160+
161+
if (request.File != null)
162+
{
163+
formParams.Add("file", this.apiInvoker.ToFileInfo(request.File, "File"));
164+
}
165+
166+
return this.apiInvoker.InvokeBinaryApi(
167+
resourcePath,
168+
"PUT",
169+
null,
170+
null,
171+
formParams);
172+
}
131173
}
132174
}
133175
// --------------------------------------------------------------------------------------------------------------------
@@ -186,3 +228,80 @@ public ConvertDocumentRequest(ConvertSettings convertSettings)
186228
public ConvertSettings convertSettings { get; set; }
187229
}
188230
}
231+
// --------------------------------------------------------------------------------------------------------------------
232+
// <copyright company="Aspose Pty Ltd" file="ConvertDocumentDirectRequest.cs">
233+
// Copyright (c) 2003-2020 Aspose Pty Ltd
234+
// </copyright>
235+
// <summary>
236+
// Permission is hereby granted, free of charge, to any person obtaining a copy
237+
// of this software and associated documentation files (the "Software"), to deal
238+
// in the Software without restriction, including without limitation the rights
239+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
240+
// copies of the Software, and to permit persons to whom the Software is
241+
// furnished to do so, subject to the following conditions:
242+
//
243+
// The above copyright notice and this permission notice shall be included in all
244+
// copies or substantial portions of the Software.
245+
//
246+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
247+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
248+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
249+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
250+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
251+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
252+
// SOFTWARE.
253+
// </summary>
254+
// --------------------------------------------------------------------------------------------------------------------
255+
256+
namespace GroupDocs.Conversion.Cloud.Sdk.Model.Requests
257+
{
258+
using GroupDocs.Conversion.Cloud.Sdk.Model;
259+
260+
/// <summary>
261+
/// Request model for <see cref="GroupDocs.Conversion.Cloud.Sdk.Api.ConvertApi.ConvertDocumentDirect" /> operation.
262+
/// </summary>
263+
public class ConvertDocumentDirectRequest
264+
{
265+
/// <summary>
266+
/// Initializes a new instance of the <see cref="ConvertDocumentDirectRequest"/> class.
267+
/// </summary>
268+
public ConvertDocumentDirectRequest()
269+
{
270+
}
271+
272+
/// <summary>
273+
/// Initializes a new instance of the <see cref="ConvertDocumentDirectRequest"/> class.
274+
/// </summary>
275+
/// <param name="format">Requested conversion format</param>
276+
/// <param name="file">Input file to convert</param>
277+
/// <param name="fromPage">Page start conversion from</param>
278+
/// <param name="pagesCount">Number of pages to convert</param>
279+
public ConvertDocumentDirectRequest(string format, System.IO.Stream file, int? fromPage = null, int? pagesCount = null)
280+
{
281+
this.format = format;
282+
this.File = file;
283+
this.fromPage = fromPage;
284+
this.pagesCount = pagesCount;
285+
}
286+
287+
/// <summary>
288+
/// Requested conversion format
289+
/// </summary>
290+
public string format { get; set; }
291+
292+
/// <summary>
293+
/// Input file to convert
294+
/// </summary>
295+
public System.IO.Stream File { get; set; }
296+
297+
/// <summary>
298+
/// Page start conversion from
299+
/// </summary>
300+
public int? fromPage { get; set; }
301+
302+
/// <summary>
303+
/// Number of pages to convert
304+
/// </summary>
305+
public int? pagesCount { get; set; }
306+
}
307+
}

src/GroupDocs.Conversion.Cloud.Sdk/Client/ApiInvoker.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public ApiInvoker(List<IRequestHandler> requestHandlers, int timeout)
4646
this.AddDefaultHeader(GroupDocsClientVersionHeaderName, string.Format("{0}.{1}", sdkVersion.Major, sdkVersion.Minor));
4747
this.requestHandlers = requestHandlers;
4848
this._timeout = timeout;
49+
ServicePointManager.SecurityProtocol = (SecurityProtocolType) (0xc0 | 0x300 | 0xc00);
4950
}
5051

5152
public string InvokeApi(

src/GroupDocs.Conversion.Cloud.Sdk/GroupDocs.Conversion.Cloud.Sdk.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,21 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net20</TargetFrameworks>
5-
<AssemblyVersion>20.3.0.0</AssemblyVersion>
6-
<FileVersion>20.3.0.0</FileVersion>
7-
<Version>20.3</Version>
5+
<AssemblyVersion>20.11.0.0</AssemblyVersion>
6+
<FileVersion>20.11.0.0</FileVersion>
7+
<Version>20.11</Version>
88
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
99
<Company>GroupDocs</Company>
1010
<Authors>GroupDocs Product Team</Authors>
1111
<Copyright>Aspose Pty Ltd.</Copyright>
12-
<Description>Convert image and documents using cloud SDKs for .NET, Java, PHP, Python, Ruby, Node.js. Use cURL commands to call document conversion REST APIs.</Description>
12+
<Description>Convert image and documents using cloud SDKs for .NET</Description>
1313
<PackageLicenseUrl>https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet/blob/master/LICENSE</PackageLicenseUrl>
1414
<PackageProjectUrl>https://products.groupdocs.cloud/conversion/family</PackageProjectUrl>
1515
<RepositoryUrl>https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet</RepositoryUrl>
1616
</PropertyGroup>
17+
<PropertyGroup>
18+
<DocumentationFile>GroupDocs.Conversion.Cloud.Sdk.xml</DocumentationFile>
19+
</PropertyGroup>
1720
<ItemGroup>
1821
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
1922
</ItemGroup>

0 commit comments

Comments
 (0)