Skip to content

Commit f1e16b3

Browse files
chore: 🐝 Update SDK - Generate SDK 2.3.0
1 parent 87d728a commit f1e16b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+391
-86
lines changed

.speakeasy/gen.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
lockVersion: 2.0.0
22
id: dff72156-4bdf-460f-b5b3-0759c9c474fb
33
management:
4-
docChecksum: 17e3a6a1b92b2eaa8841305d2a79d0b7
4+
docChecksum: 1ed16180031b75d1c05ad1f63ffac2e1
55
docVersion: 1.0.0
6-
speakeasyVersion: 1.636.3
7-
generationVersion: 2.723.11
8-
releaseVersion: 2.2.5
9-
configChecksum: 15968e8281c7dfa12f4dfadbf699e392
6+
speakeasyVersion: 1.637.2
7+
generationVersion: 2.727.9
8+
releaseVersion: 2.3.0
9+
configChecksum: cf3883848019438f6e079d7fdd8b0adb
1010
repoURL: https://github.com/gr4vy/gr4vy-csharp.git
1111
published: true
1212
features:
1313
csharp:
1414
additionalDependencies: 0.1.0
1515
constsAndDefaults: 0.0.1
16-
core: 3.13.0
16+
core: 3.15.0
1717
flattening: 2.81.3
1818
globalSecurity: 2.83.8
1919
globalSecurityCallbacks: 0.1.0
@@ -26,7 +26,7 @@ features:
2626
methodArguments: 0.2.1
2727
nameOverrides: 2.81.2
2828
nullables: 0.1.1
29-
pagination: 0.2.7
29+
pagination: 0.2.8
3030
responseFormat: 0.0.4
3131
retries: 0.0.1
3232
sdkHooks: 0.2.0

.speakeasy/gen.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ generation:
1717
oAuth2ClientCredentialsEnabled: false
1818
oAuth2PasswordEnabled: false
1919
hoistGlobalSecurity: true
20+
schemas:
21+
allOfMergeStrategy: shallowMerge
2022
tests:
2123
generateTests: true
2224
generateNewTests: false
2325
skipResponseBodyAssertions: false
2426
csharp:
25-
version: 2.2.5
27+
version: 2.3.0
2628
additionalDependencies:
2729
- package: System.IdentityModel.Tokens.Jwt
2830
version: 8.9.0

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.636.3
1+
speakeasyVersion: 1.637.2
22
sources:
33
-OAS:
44
sourceNamespace: openapi
@@ -8,20 +8,20 @@ sources:
88
- latest
99
openapi:
1010
sourceNamespace: openapi
11-
sourceRevisionDigest: sha256:7ffeacf9c329f5d5a216e221e2957a14ac2214feec7eae4778b8b00af0be3a9f
12-
sourceBlobDigest: sha256:a1126d87e0477ed653becaa04025fb6068f98ec8d39a7be0053ab8eba0098192
11+
sourceRevisionDigest: sha256:0b3ca98f309c36026af7bf15628652d6ca35e2b6e08c4dff6aa7129b32ff9aa0
12+
sourceBlobDigest: sha256:7506908ba8a68c436f0f2920fee78e24331c5a6d0453940f911f18eb0925fde3
1313
tags:
1414
- latest
15-
- speakeasy-sdk-regen-1760457371
15+
- speakeasy-sdk-regen-1760986688
1616
- 1.0.0
1717
targets:
1818
csharp:
1919
source: openapi
2020
sourceNamespace: openapi
21-
sourceRevisionDigest: sha256:7ffeacf9c329f5d5a216e221e2957a14ac2214feec7eae4778b8b00af0be3a9f
22-
sourceBlobDigest: sha256:a1126d87e0477ed653becaa04025fb6068f98ec8d39a7be0053ab8eba0098192
21+
sourceRevisionDigest: sha256:0b3ca98f309c36026af7bf15628652d6ca35e2b6e08c4dff6aa7129b32ff9aa0
22+
sourceBlobDigest: sha256:7506908ba8a68c436f0f2920fee78e24331c5a6d0453940f911f18eb0925fde3
2323
codeSamplesNamespace: openapi-csharp-code-samples
24-
codeSamplesRevisionDigest: sha256:e501f70f472c5271f677667b391aa9aecd7285f4b1b55487e92d936a31ad6bbd
24+
codeSamplesRevisionDigest: sha256:08af13c5c9db8d8d3701e3e7fadefe9e87e4456096e9248fce59e84dd1f62a26
2525
workflow:
2626
workflowVersion: 1.0.0
2727
speakeasyVersion: latest

NUGET.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,4 +378,150 @@ var res = await sdk.AccountUpdater.Jobs.CreateAsync(accountUpdaterJobCreate: new
378378
```
379379
<!-- End Server Selection [server] -->
380380

381+
<!-- Start Custom HTTP Client [http-client] -->
382+
## Custom HTTP Client
383+
384+
The C# SDK makes API calls using an `ISpeakeasyHttpClient` that wraps the native
385+
[HttpClient](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient). This
386+
client provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle
387+
errors and response.
388+
389+
The `ISpeakeasyHttpClient` interface allows you to either use the default `SpeakeasyHttpClient` that comes with the SDK,
390+
or provide your own custom implementation with customized configuration such as custom message handlers, timeouts,
391+
connection pooling, and other HTTP client settings.
392+
393+
The following example shows how to create a custom HTTP client with request modification and error handling:
394+
395+
```csharp
396+
using Gr4vy;
397+
using Gr4vy.Utils;
398+
using System.Net.Http;
399+
using System.Threading;
400+
using System.Threading.Tasks;
401+
402+
// Create a custom HTTP client
403+
public class CustomHttpClient : ISpeakeasyHttpClient
404+
{
405+
private readonly ISpeakeasyHttpClient _defaultClient;
406+
407+
public CustomHttpClient()
408+
{
409+
_defaultClient = new SpeakeasyHttpClient();
410+
}
411+
412+
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
413+
{
414+
// Add custom header and timeout
415+
request.Headers.Add("x-custom-header", "custom value");
416+
request.Headers.Add("x-request-timeout", "30");
417+
418+
try
419+
{
420+
var response = await _defaultClient.SendAsync(request, cancellationToken);
421+
// Log successful response
422+
Console.WriteLine($"Request successful: {response.StatusCode}");
423+
return response;
424+
}
425+
catch (Exception error)
426+
{
427+
// Log error
428+
Console.WriteLine($"Request failed: {error.Message}");
429+
throw;
430+
}
431+
}
432+
433+
public void Dispose()
434+
{
435+
_httpClient?.Dispose();
436+
_defaultClient?.Dispose();
437+
}
438+
}
439+
440+
// Use the custom HTTP client with the SDK
441+
var customHttpClient = new CustomHttpClient();
442+
var sdk = new Gr4vy(client: customHttpClient);
443+
```
444+
445+
<details>
446+
<summary>You can also provide a completely custom HTTP client with your own configuration:</summary>
447+
448+
```csharp
449+
using Gr4vy.Utils;
450+
using System.Net.Http;
451+
using System.Threading;
452+
using System.Threading.Tasks;
453+
454+
// Custom HTTP client with custom configuration
455+
public class AdvancedHttpClient : ISpeakeasyHttpClient
456+
{
457+
private readonly HttpClient _httpClient;
458+
459+
public AdvancedHttpClient()
460+
{
461+
var handler = new HttpClientHandler()
462+
{
463+
MaxConnectionsPerServer = 10,
464+
// ServerCertificateCustomValidationCallback = customCertValidation, // Custom SSL validation if needed
465+
};
466+
467+
_httpClient = new HttpClient(handler)
468+
{
469+
Timeout = TimeSpan.FromSeconds(30)
470+
};
471+
}
472+
473+
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
474+
{
475+
return await _httpClient.SendAsync(request, cancellationToken ?? CancellationToken.None);
476+
}
477+
478+
public void Dispose()
479+
{
480+
_httpClient?.Dispose();
481+
}
482+
}
483+
484+
var sdk = Gr4vy.Builder()
485+
.WithClient(new AdvancedHttpClient())
486+
.Build();
487+
```
488+
</details>
489+
490+
<details>
491+
<summary>For simple debugging, you can enable request/response logging by implementing a custom client:</summary>
492+
493+
```csharp
494+
public class LoggingHttpClient : ISpeakeasyHttpClient
495+
{
496+
private readonly ISpeakeasyHttpClient _innerClient;
497+
498+
public LoggingHttpClient(ISpeakeasyHttpClient innerClient = null)
499+
{
500+
_innerClient = innerClient ?? new SpeakeasyHttpClient();
501+
}
502+
503+
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
504+
{
505+
// Log request
506+
Console.WriteLine($"Sending {request.Method} request to {request.RequestUri}");
507+
508+
var response = await _innerClient.SendAsync(request, cancellationToken);
509+
510+
// Log response
511+
Console.WriteLine($"Received {response.StatusCode} response");
512+
513+
return response;
514+
}
515+
516+
public void Dispose() => _innerClient?.Dispose();
517+
}
518+
519+
var sdk = new Gr4vy(client: new LoggingHttpClient());
520+
```
521+
</details>
522+
523+
The SDK also provides built-in hook support through the `SDKConfiguration.Hooks` system, which automatically handles
524+
`BeforeRequestAsync`, `AfterSuccessAsync`, and `AfterErrorAsync` hooks for advanced request lifecycle management.
525+
<!-- End Custom HTTP Client [http-client] -->
526+
381527
<!-- Placeholder for Future Speakeasy SDK Sections -->

README.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ This SDK is designed to simplify development, reduce boilerplate code, and help
3939
* [Retries](#retries)
4040
* [Error Handling](#error-handling)
4141
* [Server Selection](#server-selection)
42+
* [Custom HTTP Client](#custom-http-client)
4243
* [Development](#development)
4344
* [Testing](#testing)
4445
* [Contributions](#contributions)
@@ -708,6 +709,152 @@ var res = await sdk.AccountUpdater.Jobs.CreateAsync(accountUpdaterJobCreate: new
708709
```
709710
<!-- End Server Selection [server] -->
710711

712+
<!-- Start Custom HTTP Client [http-client] -->
713+
## Custom HTTP Client
714+
715+
The C# SDK makes API calls using an `ISpeakeasyHttpClient` that wraps the native
716+
[HttpClient](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient). This
717+
client provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle
718+
errors and response.
719+
720+
The `ISpeakeasyHttpClient` interface allows you to either use the default `SpeakeasyHttpClient` that comes with the SDK,
721+
or provide your own custom implementation with customized configuration such as custom message handlers, timeouts,
722+
connection pooling, and other HTTP client settings.
723+
724+
The following example shows how to create a custom HTTP client with request modification and error handling:
725+
726+
```csharp
727+
using Gr4vy;
728+
using Gr4vy.Utils;
729+
using System.Net.Http;
730+
using System.Threading;
731+
using System.Threading.Tasks;
732+
733+
// Create a custom HTTP client
734+
public class CustomHttpClient : ISpeakeasyHttpClient
735+
{
736+
private readonly ISpeakeasyHttpClient _defaultClient;
737+
738+
public CustomHttpClient()
739+
{
740+
_defaultClient = new SpeakeasyHttpClient();
741+
}
742+
743+
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
744+
{
745+
// Add custom header and timeout
746+
request.Headers.Add("x-custom-header", "custom value");
747+
request.Headers.Add("x-request-timeout", "30");
748+
749+
try
750+
{
751+
var response = await _defaultClient.SendAsync(request, cancellationToken);
752+
// Log successful response
753+
Console.WriteLine($"Request successful: {response.StatusCode}");
754+
return response;
755+
}
756+
catch (Exception error)
757+
{
758+
// Log error
759+
Console.WriteLine($"Request failed: {error.Message}");
760+
throw;
761+
}
762+
}
763+
764+
public void Dispose()
765+
{
766+
_httpClient?.Dispose();
767+
_defaultClient?.Dispose();
768+
}
769+
}
770+
771+
// Use the custom HTTP client with the SDK
772+
var customHttpClient = new CustomHttpClient();
773+
var sdk = new Gr4vy(client: customHttpClient);
774+
```
775+
776+
<details>
777+
<summary>You can also provide a completely custom HTTP client with your own configuration:</summary>
778+
779+
```csharp
780+
using Gr4vy.Utils;
781+
using System.Net.Http;
782+
using System.Threading;
783+
using System.Threading.Tasks;
784+
785+
// Custom HTTP client with custom configuration
786+
public class AdvancedHttpClient : ISpeakeasyHttpClient
787+
{
788+
private readonly HttpClient _httpClient;
789+
790+
public AdvancedHttpClient()
791+
{
792+
var handler = new HttpClientHandler()
793+
{
794+
MaxConnectionsPerServer = 10,
795+
// ServerCertificateCustomValidationCallback = customCertValidation, // Custom SSL validation if needed
796+
};
797+
798+
_httpClient = new HttpClient(handler)
799+
{
800+
Timeout = TimeSpan.FromSeconds(30)
801+
};
802+
}
803+
804+
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
805+
{
806+
return await _httpClient.SendAsync(request, cancellationToken ?? CancellationToken.None);
807+
}
808+
809+
public void Dispose()
810+
{
811+
_httpClient?.Dispose();
812+
}
813+
}
814+
815+
var sdk = Gr4vy.Builder()
816+
.WithClient(new AdvancedHttpClient())
817+
.Build();
818+
```
819+
</details>
820+
821+
<details>
822+
<summary>For simple debugging, you can enable request/response logging by implementing a custom client:</summary>
823+
824+
```csharp
825+
public class LoggingHttpClient : ISpeakeasyHttpClient
826+
{
827+
private readonly ISpeakeasyHttpClient _innerClient;
828+
829+
public LoggingHttpClient(ISpeakeasyHttpClient innerClient = null)
830+
{
831+
_innerClient = innerClient ?? new SpeakeasyHttpClient();
832+
}
833+
834+
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken? cancellationToken = null)
835+
{
836+
// Log request
837+
Console.WriteLine($"Sending {request.Method} request to {request.RequestUri}");
838+
839+
var response = await _innerClient.SendAsync(request, cancellationToken);
840+
841+
// Log response
842+
Console.WriteLine($"Received {response.StatusCode} response");
843+
844+
return response;
845+
}
846+
847+
public void Dispose() => _innerClient?.Dispose();
848+
}
849+
850+
var sdk = new Gr4vy(client: new LoggingHttpClient());
851+
```
852+
</details>
853+
854+
The SDK also provides built-in hook support through the `SDKConfiguration.Hooks` system, which automatically handles
855+
`BeforeRequestAsync`, `AfterSuccessAsync`, and `AfterErrorAsync` hooks for advanced request lifecycle management.
856+
<!-- End Custom HTTP Client [http-client] -->
857+
711858
<!-- Placeholder for Future Speakeasy SDK Sections -->
712859

713860
# Development

0 commit comments

Comments
 (0)