Skip to content

Commit e6b9148

Browse files
committed
Merge branch 'release/2.0.2'
2 parents 6aa615b + 119f2eb commit e6b9148

3 files changed

Lines changed: 25 additions & 13 deletions

File tree

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
⭐ For Gotenberg v7+. Beta⭐
2-
31
# <img src="https://github.com/ChangemakerStudios/GotenbergSharpApiClient/raw/master/lib/Resources/gotenbergSharpClient.PNG" width="24" height="24" /> Gotenberg.Sharp.Api.Client
42

5-
[![NuGet version](https://badge.fury.io/nu/Gotenberg.Sharp.Api.Client.svg)](https://badge.fury.io/nu/Gotenberg.Sharp.Api.Client) [![Build status](https://ci.appveyor.com/api/projects/status/s8lvj93xewlsylxh?svg=true)](https://ci.appveyor.com/project/Jaben/gotenbergsharpapiclient) [![Downloads](https://img.shields.io/nuget/dt/Gotenberg.Sharp.API.Client.svg?logo=nuget&color=purple)](https://www.nuget.org/packages/Gotenberg.Sharp.API.Client)
3+
[![NuGet version](https://badge.fury.io/nu/Gotenberg.Sharp.Api.Client.svg)](https://badge.fury.io/nu/Gotenberg.Sharp.Api.Client)
4+
[![Downloads](https://img.shields.io/nuget/dt/Gotenberg.Sharp.API.Client.svg?logo=nuget&color=purple)](https://www.nuget.org/packages/Gotenberg.Sharp.API.Client)
5+
![Build status](https://github.com/ChangemakerStudios/GotenbergSharpApiClient/actions/workflows/deploy.yml/badge.svg)
6+
7+
⭐ For Gotenberg v7+.⭐
68

7-
.NET C# Client for interacting with the [Gotenberg](https://gotenberg.dev/) micro-service's API. [Gotenberg](https://github.com/gotenberg/gotenberg) is a [Docker-powered stateless API](https://hub.docker.com/r/gotenberg/gotenberg/) for converting & merging HTML, Markdown and Office documents to PDF. The client supports a configurable [Polly](http://www.thepollyproject.org/) **retry policy** with exponential backoff for handling transient exceptions.
9+
.NET C# Client for interacting with the [Gotenberg](https://gotenberg.dev/) v7 micro-service's API. [Gotenberg](https://github.com/gotenberg/gotenberg) is a [Docker-powered stateless API](https://hub.docker.com/r/gotenberg/gotenberg/) for converting & merging HTML, Markdown and Office documents to PDF. The client supports a configurable [Polly](http://www.thepollyproject.org/) **retry policy** with exponential backoff for handling transient exceptions.
810

9-
*As of version [2.0.0-alpha0002](https://www.nuget.org/packages/Gotenberg.Sharp.API.Client/2.0.0-alpha0002#supportedframeworks-tab) Gotenberg.Sharp.API.Client targets net6.0, net5.0; netstandard 2.0 and 2.1*
1011

1112
# Getting Started
1213
*Pull the image from dockerhub.com*
@@ -17,11 +18,15 @@
1718
```powershell
1819
docker run --name gotenbee7x --rm -p 3000:3000 gotenberg/gotenberg:latest gotenberg --api-timeout=1800s --log-level=debug
1920
```
21+
2022
# .NET Core Project Setup
2123
*Install nuget package into your project*
2224
```powershell
2325
PM> Install-Package Gotenberg.Sharp.Api.Client
2426
```
27+
28+
*Note: Use v1.x nugets for Gotenberg v6.*
29+
2530
## AppSettings
2631
```json
2732
"GotenbergSharpClient": {

lib/Gotenberg.Sharp.Api.Client.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</Description>
2424
<IncludeSymbols>True</IncludeSymbols>
2525
<PackageReleaseNotes>
26-
Upgraded to support Gotenberg v7.
26+
Upgraded to support Gotenberg v7 -- this version no longer works with Gotenberg v6.
2727
</PackageReleaseNotes>
2828
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
2929
<PackageProjectUrl>https://github.com/ChangemakerStudios/GotenbergSharpApiClient</PackageProjectUrl>
@@ -38,7 +38,7 @@
3838
</ItemGroup>
3939

4040
<ItemGroup>
41-
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" />
41+
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" />
4242
<PackageReference Include="MimeMapping" Version="1.0.1.37" />
4343
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
4444
</ItemGroup>

lib/GotenbergSharpClient.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,20 @@ public async Task FireWebhookAndForgetAsync(IApiRequest request, CancellationTok
132132
async Task<Stream> ExecuteRequestAsync(IApiRequest request, CancellationToken cancelToken)
133133
{
134134
if (request == null) throw new ArgumentNullException(nameof(request));
135-
var response = await SendRequest(request, HttpCompletionOption.ResponseHeadersRead, cancelToken);
136135

137-
#if NET5_0_OR_GREATER
138-
return await response.Content.ReadAsStreamAsync(cancelToken);
139-
#else
140-
return await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
141-
#endif
136+
using var response = await this.SendRequest(request, HttpCompletionOption.ResponseHeadersRead, cancelToken);
137+
138+
var ms = new MemoryStream();
139+
140+
#if NET5_0_OR_GREATER
141+
await response.Content.CopyToAsync(ms, cancelToken);
142+
#else
143+
await response.Content.CopyToAsync(ms).ConfigureAwait(false);
144+
#endif
145+
146+
ms.Position = 0;
147+
148+
return ms;
142149
}
143150

144151
async Task<HttpResponseMessage> SendRequest(

0 commit comments

Comments
 (0)