Skip to content

Commit cf7d535

Browse files
feat(client): allow omitting all params object when all optional
1 parent 19debc8 commit cf7d535

File tree

12 files changed

+20
-12
lines changed

12 files changed

+20
-12
lines changed

src/Scrapegraphai.Tests/Services/Credits/CreditServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class CreditServiceTest : TestBase
77
[Fact(Skip = "Prism tests are disabled")]
88
public async Task Retrieve_Works()
99
{
10-
var credit = await this.client.Credits.Retrieve(new());
10+
var credit = await this.client.Credits.Retrieve();
1111
credit.Validate();
1212
}
1313
}

src/Scrapegraphai.Tests/Services/Healthz/HealthzServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class HealthzServiceTest : TestBase
77
[Fact(Skip = "Prism tests are disabled")]
88
public async Task Check_Works()
99
{
10-
var response = await this.client.Healthz.Check(new());
10+
var response = await this.client.Healthz.Check();
1111
response.Validate();
1212
}
1313
}

src/Scrapegraphai.Tests/Services/Smartscraper/SmartscraperServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public async Task Retrieve_Works()
2525
[Fact(Skip = "Prism tests are disabled")]
2626
public async Task List_Works()
2727
{
28-
var smartscrapers = await this.client.Smartscraper.List(new());
28+
var smartscrapers = await this.client.Smartscraper.List();
2929
smartscrapers.Validate();
3030
}
3131
}

src/Scrapegraphai.Tests/Services/Validate/ValidateServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class ValidateServiceTest : TestBase
77
[Fact(Skip = "Prism tests are disabled")]
88
public async Task APIKey_Works()
99
{
10-
var response = await this.client.Validate.APIKey(new());
10+
var response = await this.client.Validate.APIKey();
1111
response.Validate();
1212
}
1313
}

src/Scrapegraphai/Services/Credits/CreditService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ public CreditService(IScrapegraphaiClient client)
1515
_client = client;
1616
}
1717

18-
public async Task<CreditRetrieveResponse> Retrieve(CreditRetrieveParams parameters)
18+
public async Task<CreditRetrieveResponse> Retrieve(CreditRetrieveParams? parameters = null)
1919
{
20+
parameters ??= new();
21+
2022
using HttpRequestMessage request = new(HttpMethod.Get, parameters.Url(this._client));
2123
parameters.AddHeadersToRequest(request, this._client);
2224
using HttpResponseMessage response = await this

src/Scrapegraphai/Services/Credits/ICreditService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ public interface ICreditService
88
/// <summary>
99
/// Retrieve the current credit balance and usage for the authenticated user
1010
/// </summary>
11-
Task<CreditRetrieveResponse> Retrieve(CreditRetrieveParams parameters);
11+
Task<CreditRetrieveResponse> Retrieve(CreditRetrieveParams? parameters = null);
1212
}

src/Scrapegraphai/Services/Healthz/HealthzService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ public HealthzService(IScrapegraphaiClient client)
1515
_client = client;
1616
}
1717

18-
public async Task<HealthzCheckResponse> Check(HealthzCheckParams parameters)
18+
public async Task<HealthzCheckResponse> Check(HealthzCheckParams? parameters = null)
1919
{
20+
parameters ??= new();
21+
2022
using HttpRequestMessage request = new(HttpMethod.Get, parameters.Url(this._client));
2123
parameters.AddHeadersToRequest(request, this._client);
2224
using HttpResponseMessage response = await this

src/Scrapegraphai/Services/Healthz/IHealthzService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ public interface IHealthzService
88
/// <summary>
99
/// Check the health status of the service
1010
/// </summary>
11-
Task<HealthzCheckResponse> Check(HealthzCheckParams parameters);
11+
Task<HealthzCheckResponse> Check(HealthzCheckParams? parameters = null);
1212
}

src/Scrapegraphai/Services/Smartscraper/ISmartscraperService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ public interface ISmartscraperService
1919
/// <summary>
2020
/// Retrieve the status and results of a scraping operation
2121
/// </summary>
22-
Task<SmartscraperListResponse> List(SmartscraperListParams parameters);
22+
Task<SmartscraperListResponse> List(SmartscraperListParams? parameters = null);
2323
}

src/Scrapegraphai/Services/Smartscraper/SmartscraperService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ await response.Content.ReadAsStreamAsync().ConfigureAwait(false),
6060
) ?? throw new NullReferenceException();
6161
}
6262

63-
public async Task<SmartscraperListResponse> List(SmartscraperListParams parameters)
63+
public async Task<SmartscraperListResponse> List(SmartscraperListParams? parameters = null)
6464
{
65+
parameters ??= new();
66+
6567
using HttpRequestMessage request = new(HttpMethod.Get, parameters.Url(this._client));
6668
parameters.AddHeadersToRequest(request, this._client);
6769
using HttpResponseMessage response = await this

0 commit comments

Comments
 (0)