Skip to content

Commit

Permalink
Merge branch 'release/2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaben committed Aug 10, 2024
2 parents 7d03f8d + eda6e96 commit 45bcdac
Show file tree
Hide file tree
Showing 68 changed files with 417 additions and 749 deletions.
74 changes: 74 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,77 @@

# IDE0042: Deconstruct variable declaration
dotnet_diagnostic.IDE0042.severity = none
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_indent_labels = one_less_than_current

[*.{cs,vb}]
#### Naming styles ####

# Naming rules

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Symbol specifications

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Naming styles

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
14 changes: 9 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [8.x]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Dotnet
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: ${{ matrix.dotnet-version }}

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
Expand All @@ -34,4 +37,5 @@ jobs:
- name: Publish
if: github.event_name != 'pull_request' && (github.ref_name == 'master')
run: |
dotnet nuget push **/*.nupkg --source 'https://api.nuget.org/v3/index.json' --skip-duplicate -k ${{ secrets.NUGETKEY }} --no-symbols 1
dotnet nuget push **/*.nupkg --source 'https://api.nuget.org/v3/index.json' -k ${{ secrets.NUGETKEY }} --skip-duplicate
dotnet nuget push **/*.snupkg --source 'https://api.nuget.org/v3/index.json' -k ${{ secrets.NUGETKEY }} --skip-duplicate
2 changes: 2 additions & 0 deletions GotenbergSharpApiClient.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
limitations under the License.</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Backoff/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cargman/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Consts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=deliverables/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=epub/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -24,6 +25,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=fodt/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gotenberg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gotenberg_0027s/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Jaben/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Libre/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pdfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=potm/@EntryIndexedValue">True</s:Boolean>
Expand Down
24 changes: 2 additions & 22 deletions lib/Domain/Builders/BaseBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using Gotenberg.Sharp.API.Client.Domain.Builders.Faceted;
using Gotenberg.Sharp.API.Client.Domain.Requests;
using Gotenberg.Sharp.API.Client.Domain.Requests.Facets;

using JetBrains.Annotations;

namespace Gotenberg.Sharp.API.Client.Domain.Builders;

public abstract class BaseBuilder<TRequest, TBuilder>
public abstract class BaseBuilder<TRequest, TBuilder>(TRequest request)
where TRequest : BuildRequestBase
where TBuilder : BaseBuilder<TRequest, TBuilder>
{
protected BaseBuilder(TRequest request)
{
this.Request = request;
}

protected const string CallBuildAsyncErrorMessage =
"Request has asynchronous items. Call BuildAsync instead.";

protected readonly List<Task> BuildTasks = new();

protected virtual TRequest Request { get; }
protected virtual TRequest Request { get; } = request;

[PublicAPI]
public TBuilder ConfigureRequest(Action<ConfigBuilder> action)
{
if (action == null) throw new ArgumentNullException(nameof(action));
Expand All @@ -54,23 +37,20 @@ public TBuilder ConfigureRequest(Action<ConfigBuilder> action)
return (TBuilder)this;
}

[PublicAPI]
public TBuilder ConfigureRequest(RequestConfig config)
{
this.Request.Config = config ?? throw new ArgumentNullException(nameof(config));

return (TBuilder)this;
}

[PublicAPI]
public virtual TRequest Build()
{
if (this.BuildTasks.Any()) throw new InvalidOperationException(CallBuildAsyncErrorMessage);

return this.Request;
}

[PublicAPI]
public virtual async Task<TRequest> BuildAsync()
{
if (this.BuildTasks.Any()) await Task.WhenAll(this.BuildTasks).ConfigureAwait(false);
Expand Down
26 changes: 4 additions & 22 deletions lib/Domain/Builders/BaseChromiumBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Threading.Tasks;

using Gotenberg.Sharp.API.Client.Domain.Builders.Faceted;
using Gotenberg.Sharp.API.Client.Domain.Requests;
using Gotenberg.Sharp.API.Client.Domain.Requests.Facets;

using JetBrains.Annotations;

namespace Gotenberg.Sharp.API.Client.Domain.Builders;

public abstract class BaseChromiumBuilder<TRequest, TBuilder> : BaseBuilder<TRequest, TBuilder>
public abstract class BaseChromiumBuilder<TRequest, TBuilder>(TRequest request)
: BaseBuilder<TRequest, TBuilder>(request)
where TRequest : ChromeRequest
where TBuilder : BaseChromiumBuilder<TRequest, TBuilder>
{
protected BaseChromiumBuilder([NotNull] TRequest request)
: base(request)
{
}

[PublicAPI]
public TBuilder WithDimensions(Action<DimensionBuilder> action)
{
if (action == null) throw new ArgumentNullException(nameof(action));
Expand All @@ -47,38 +33,34 @@ public TBuilder WithDimensions(Action<DimensionBuilder> action)
return (TBuilder)this;
}

[PublicAPI]
public TBuilder WithDimensions(Dimensions dimensions)
{
this.Request.Dimensions = dimensions ?? throw new ArgumentNullException(nameof(dimensions));
return (TBuilder)this;
}

[PublicAPI]
public TBuilder WithAssets(Action<AssetBuilder> action)
{
if (action == null) throw new ArgumentNullException(nameof(action));
action(new AssetBuilder(this.Request.Assets ??= new AssetDictionary()));
return (TBuilder)this;
}

[PublicAPI]
public TBuilder WithAsyncAssets(Func<AssetBuilder, Task> asyncAction)
{
if (asyncAction == null) throw new ArgumentNullException(nameof(asyncAction));
this.BuildTasks.Add(asyncAction(new AssetBuilder(this.Request.Assets ??= new AssetDictionary())));
this.BuildTasks.Add(
asyncAction(new AssetBuilder(this.Request.Assets ??= new AssetDictionary())));
return (TBuilder)this;
}

[PublicAPI]
public TBuilder SetConversionBehaviors(Action<HtmlConversionBehaviorBuilder> action)
{
if (action == null) throw new ArgumentNullException(nameof(action));
action(new HtmlConversionBehaviorBuilder(this.Request.ConversionBehaviors));
return (TBuilder)this;
}

[PublicAPI]
public TBuilder SetConversionBehaviors(HtmlConversionBehaviors behaviors)
{
this.Request.ConversionBehaviors =
Expand Down
21 changes: 5 additions & 16 deletions lib/Domain/Builders/BaseMergeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,28 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Threading.Tasks;

using Gotenberg.Sharp.API.Client.Domain.Builders.Faceted;
using Gotenberg.Sharp.API.Client.Domain.Requests;
using Gotenberg.Sharp.API.Client.Domain.Requests.Facets;

using JetBrains.Annotations;

namespace Gotenberg.Sharp.API.Client.Domain.Builders;

public abstract class BaseMergeBuilder<TRequest, TBuilder> : BaseBuilder<TRequest, TBuilder>
public abstract class BaseMergeBuilder<TRequest, TBuilder>(TRequest request)
: BaseBuilder<TRequest, TBuilder>(request)
where TRequest : BuildRequestBase
where TBuilder : BaseMergeBuilder<TRequest, TBuilder>
{
protected BaseMergeBuilder(TRequest request)
: base(request)
{
}

/// <summary>
/// This tells gotenberg to have OfficeLibre perform the conversion.
/// If you set <see cref="MergeOfficeRequest.UseNativePdfFormat" /> to true
/// then gotenberg will hand the work off to unoconv to do the work
/// </summary>
[PublicAPI]

public TBuilder SetPdfFormat(PdfFormats format)
{
this.Request.Format = format;
return (TBuilder)this;
}

[PublicAPI]

public TBuilder WithAssets(Action<AssetBuilder> action)
{
if (action == null) throw new ArgumentNullException(nameof(action));
Expand All @@ -55,7 +44,7 @@ public TBuilder WithAssets(Action<AssetBuilder> action)
return (TBuilder)this;
}

[PublicAPI]

public TBuilder WithAsyncAssets(Func<AssetBuilder, Task> asyncAction)
{
if (asyncAction == null) throw new ArgumentNullException(nameof(asyncAction));
Expand Down
Loading

0 comments on commit 45bcdac

Please sign in to comment.