Skip to content

Commit e0d6289

Browse files
committed
Renamed to "page properties" added support for OmitBackground and GenerateDocumentOutline.
1 parent a2a9a8c commit e0d6289

11 files changed

Lines changed: 275 additions & 245 deletions

lib/Domain/Builders/BaseChromiumBuilder.cs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,44 @@ public abstract class BaseChromiumBuilder<TRequest, TBuilder>(TRequest request)
2020
where TRequest : ChromeRequest
2121
where TBuilder : BaseChromiumBuilder<TRequest, TBuilder>
2222
{
23-
public TBuilder WithDimensions(Action<DimensionBuilder> action)
23+
[Obsolete("Use WithPageProperties")]
24+
public TBuilder WithDimensions(Action<PagePropertyBuilder> action)
2425
{
2526
if (action == null) throw new ArgumentNullException(nameof(action));
2627

27-
var builder = new DimensionBuilder(this.Request.Dimensions);
28+
var builder = new PagePropertyBuilder(this.Request.PageProperties);
2829

2930
action(builder);
3031

31-
this.Request.Dimensions = builder.GetDimensions();
32+
this.Request.PageProperties = builder.GetPageProperties();
3233

3334
return (TBuilder)this;
3435
}
3536

36-
public TBuilder WithDimensions(Dimensions dimensions)
37+
[Obsolete("Use WithPageProperties")]
38+
public TBuilder WithDimensions(PageProperties pageProperties)
3739
{
38-
this.Request.Dimensions = dimensions ?? throw new ArgumentNullException(nameof(dimensions));
40+
this.Request.PageProperties = pageProperties ?? throw new ArgumentNullException(nameof(pageProperties));
41+
return (TBuilder)this;
42+
}
43+
44+
public TBuilder WithPageProperties(Action<PagePropertyBuilder> action)
45+
{
46+
if (action == null) throw new ArgumentNullException(nameof(action));
47+
48+
var builder = new PagePropertyBuilder(this.Request.PageProperties);
49+
50+
action(builder);
51+
52+
this.Request.PageProperties = builder.GetPageProperties();
53+
54+
return (TBuilder)this;
55+
}
56+
57+
public TBuilder WithPageProperties(PageProperties pageProperties)
58+
{
59+
this.Request.PageProperties = pageProperties ?? throw new ArgumentNullException(nameof(pageProperties));
60+
3961
return (TBuilder)this;
4062
}
4163

lib/Domain/Builders/Faceted/DimensionBuilder.cs

Lines changed: 0 additions & 147 deletions
This file was deleted.

lib/Domain/Builders/Faceted/DocumentBuilder.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2024 Chris Mohan, Jaben Cargman
1+
// Copyright 2019-2025 Chris Mohan, Jaben Cargman
22
// and GotenbergSharpApiClient Contributors
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,8 +13,6 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515

16-
17-
1816
namespace Gotenberg.Sharp.API.Client.Domain.Builders.Faceted;
1917

2018
/// <summary>
@@ -36,33 +34,28 @@ public DocumentBuilder(FullDocument content, Action<bool> setContainsMarkdown)
3634

3735
#region body
3836

39-
4037
public DocumentBuilder ContainsMarkdown(bool containsMarkdown = true)
4138
{
4239
this._setContainsMarkdown(containsMarkdown);
4340
return this;
4441
}
4542

46-
4743
public DocumentBuilder SetBody(ContentItem body)
4844
{
4945
this._content.Body = body ?? throw new ArgumentNullException(nameof(body));
5046
return this;
5147
}
5248

53-
5449
public DocumentBuilder SetBody(string body)
5550
{
5651
return this.SetBody(new ContentItem(body));
5752
}
5853

59-
6054
public DocumentBuilder SetBody(byte[] body)
6155
{
6256
return this.SetBody(new ContentItem(body));
6357
}
6458

65-
6659
public DocumentBuilder SetBody(Stream body)
6760
{
6861
return this.SetBody(new ContentItem(body));
@@ -72,26 +65,22 @@ public DocumentBuilder SetBody(Stream body)
7265

7366
#region header
7467

75-
7668
public DocumentBuilder SetHeader(ContentItem header)
7769
{
7870
this._content.Header = header ?? throw new ArgumentNullException(nameof(header));
7971
return this;
8072
}
8173

82-
8374
public DocumentBuilder SetHeader(string header)
8475
{
8576
return this.SetHeader(new ContentItem(header));
8677
}
8778

88-
8979
public DocumentBuilder SetHeader(byte[] header)
9080
{
9181
return this.SetHeader(new ContentItem(header));
9282
}
9383

94-
9584
public DocumentBuilder SetHeader(Stream header)
9685
{
9786
return this.SetHeader(new ContentItem(header));
@@ -101,26 +90,22 @@ public DocumentBuilder SetHeader(Stream header)
10190

10291
#region footer
10392

104-
10593
public DocumentBuilder SetFooter(ContentItem footer)
10694
{
10795
this._content.Footer = footer ?? throw new ArgumentNullException(nameof(footer));
10896
return this;
10997
}
11098

111-
11299
public DocumentBuilder SetFooter(string footer)
113100
{
114101
return this.SetFooter(new ContentItem(footer));
115102
}
116103

117-
118104
public DocumentBuilder SetFooter(byte[] footer)
119105
{
120106
return this.SetFooter(new ContentItem(footer));
121107
}
122108

123-
124109
public DocumentBuilder SetFooter(Stream footer)
125110
{
126111
return this.SetFooter(new ContentItem(footer));

0 commit comments

Comments
 (0)