Skip to content

Commit 8b56ed8

Browse files
feat(csharp): add IDisposable support and dispose the ingestion transporter on replacement (generated)
algolia/api-clients-automation#6492 Co-authored-by: algolia-api-clients-automation-bot[bot] <288895823+algolia-api-clients-automation-bot[bot]@users.noreply.github.com> Co-authored-by: Mario-Alexandru Dan <marioalexandrudan@gmail.com>
1 parent 916a27c commit 8b56ed8

14 files changed

Lines changed: 153 additions & 14 deletions

algoliasearch/Clients/AbtestingClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ AlgoliaHttpResponse StopABTestWithHTTPInfo(
808808
/// <summary>
809809
/// Represents a collection of functions to interact with the API endpoints
810810
/// </summary>
811-
public partial class AbtestingClient : IAbtestingClient
811+
public partial class AbtestingClient : IAbtestingClient, IDisposable
812812
{
813813
internal HttpTransport _transport;
814814
private readonly ILogger<AbtestingClient> _logger;
@@ -900,6 +900,15 @@ public void SetClientApiKey(string apiKey)
900900
_transport._algoliaConfig.SetClientApiKey(apiKey);
901901
}
902902

903+
/// <summary>
904+
/// Disposes the client and its underlying resources (the HTTP transport).
905+
/// </summary>
906+
public void Dispose()
907+
{
908+
_transport?.Dispose();
909+
GC.SuppressFinalize(this);
910+
}
911+
903912
/// <inheritdoc />
904913
public async Task<ABTestResponse> AddABTestsAsync(
905914
AddABTestsRequest addABTestsRequest,

algoliasearch/Clients/AbtestingV3Client.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ AlgoliaHttpResponse StopABTestWithHTTPInfo(
916916
/// <summary>
917917
/// Represents a collection of functions to interact with the API endpoints
918918
/// </summary>
919-
public partial class AbtestingV3Client : IAbtestingV3Client
919+
public partial class AbtestingV3Client : IAbtestingV3Client, IDisposable
920920
{
921921
internal HttpTransport _transport;
922922
private readonly ILogger<AbtestingV3Client> _logger;
@@ -1011,6 +1011,15 @@ public void SetClientApiKey(string apiKey)
10111011
_transport._algoliaConfig.SetClientApiKey(apiKey);
10121012
}
10131013

1014+
/// <summary>
1015+
/// Disposes the client and its underlying resources (the HTTP transport).
1016+
/// </summary>
1017+
public void Dispose()
1018+
{
1019+
_transport?.Dispose();
1020+
GC.SuppressFinalize(this);
1021+
}
1022+
10141023
/// <inheritdoc />
10151024
public async Task<ABTestResponse> AddABTestsAsync(
10161025
AddABTestsRequest addABTestsRequest,

algoliasearch/Clients/AgentStudioClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3408,7 +3408,7 @@ AlgoliaHttpResponse UpdateSecretKeyWithHTTPInfo(
34083408
"Agent Studio API is in beta and subject to breaking changes. See https://www.algolia.com/doc/rest-api/agent-studio",
34093409
false
34103410
)]
3411-
public partial class AgentStudioClient : IAgentStudioClient
3411+
public partial class AgentStudioClient : IAgentStudioClient, IDisposable
34123412
{
34133413
internal HttpTransport _transport;
34143414
private readonly ILogger<AgentStudioClient> _logger;
@@ -3497,6 +3497,15 @@ public void SetClientApiKey(string apiKey)
34973497
_transport._algoliaConfig.SetClientApiKey(apiKey);
34983498
}
34993499

3500+
/// <summary>
3501+
/// Disposes the client and its underlying resources (the HTTP transport).
3502+
/// </summary>
3503+
public void Dispose()
3504+
{
3505+
_transport?.Dispose();
3506+
GC.SuppressFinalize(this);
3507+
}
3508+
35003509
/// <inheritdoc />
35013510
public async Task<AllowedDomainListResponse> BulkCreateAllowedDomainsAsync(
35023511
string agentId,

algoliasearch/Clients/AnalyticsClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2520,7 +2520,7 @@ AlgoliaHttpResponse GetUsersCountWithHTTPInfo(
25202520
/// <summary>
25212521
/// Represents a collection of functions to interact with the API endpoints
25222522
/// </summary>
2523-
public partial class AnalyticsClient : IAnalyticsClient
2523+
public partial class AnalyticsClient : IAnalyticsClient, IDisposable
25242524
{
25252525
internal HttpTransport _transport;
25262526
private readonly ILogger<AnalyticsClient> _logger;
@@ -2612,6 +2612,15 @@ public void SetClientApiKey(string apiKey)
26122612
_transport._algoliaConfig.SetClientApiKey(apiKey);
26132613
}
26142614

2615+
/// <summary>
2616+
/// Disposes the client and its underlying resources (the HTTP transport).
2617+
/// </summary>
2618+
public void Dispose()
2619+
{
2620+
_transport?.Dispose();
2621+
GC.SuppressFinalize(this);
2622+
}
2623+
26152624
/// <inheritdoc />
26162625
public async Task<object> CustomDeleteAsync(
26172626
string path,

algoliasearch/Clients/CompositionClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ AlgoliaHttpResponse UpdateSortingStrategyCompositionWithHTTPInfo(
15241524
/// <summary>
15251525
/// Represents a collection of functions to interact with the API endpoints
15261526
/// </summary>
1527-
public partial class CompositionClient : ICompositionClient
1527+
public partial class CompositionClient : ICompositionClient, IDisposable
15281528
{
15291529
internal HttpTransport _transport;
15301530
private readonly ILogger<CompositionClient> _logger;
@@ -1613,6 +1613,15 @@ public void SetClientApiKey(string apiKey)
16131613
_transport._algoliaConfig.SetClientApiKey(apiKey);
16141614
}
16151615

1616+
/// <summary>
1617+
/// Disposes the client and its underlying resources (the HTTP transport).
1618+
/// </summary>
1619+
public void Dispose()
1620+
{
1621+
_transport?.Dispose();
1622+
GC.SuppressFinalize(this);
1623+
}
1624+
16161625
/// <inheritdoc />
16171626
public async Task<object> CustomDeleteAsync(
16181627
string path,

algoliasearch/Clients/IngestionClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5560,7 +5560,7 @@ AlgoliaHttpResponse ValidateSourceBeforeUpdateWithHTTPInfo(
55605560
/// <summary>
55615561
/// Represents a collection of functions to interact with the API endpoints
55625562
/// </summary>
5563-
public partial class IngestionClient : IIngestionClient
5563+
public partial class IngestionClient : IIngestionClient, IDisposable
55645564
{
55655565
internal HttpTransport _transport;
55665566
private readonly ILogger<IngestionClient> _logger;
@@ -5652,6 +5652,15 @@ public void SetClientApiKey(string apiKey)
56525652
_transport._algoliaConfig.SetClientApiKey(apiKey);
56535653
}
56545654

5655+
/// <summary>
5656+
/// Disposes the client and its underlying resources (the HTTP transport).
5657+
/// </summary>
5658+
public void Dispose()
5659+
{
5660+
_transport?.Dispose();
5661+
GC.SuppressFinalize(this);
5662+
}
5663+
56555664
/// <inheritdoc />
56565665
public async Task<AuthenticationCreateResponse> CreateAuthenticationAsync(
56575666
AuthenticationCreate authenticationCreate,

algoliasearch/Clients/InsightsClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ AlgoliaHttpResponse PushEventsWithHTTPInfo(
480480
/// <summary>
481481
/// Represents a collection of functions to interact with the API endpoints
482482
/// </summary>
483-
public partial class InsightsClient : IInsightsClient
483+
public partial class InsightsClient : IInsightsClient, IDisposable
484484
{
485485
internal HttpTransport _transport;
486486
private readonly ILogger<InsightsClient> _logger;
@@ -572,6 +572,15 @@ public void SetClientApiKey(string apiKey)
572572
_transport._algoliaConfig.SetClientApiKey(apiKey);
573573
}
574574

575+
/// <summary>
576+
/// Disposes the client and its underlying resources (the HTTP transport).
577+
/// </summary>
578+
public void Dispose()
579+
{
580+
_transport?.Dispose();
581+
GC.SuppressFinalize(this);
582+
}
583+
575584
/// <inheritdoc />
576585
public async Task<object> CustomDeleteAsync(
577586
string path,

algoliasearch/Clients/MonitoringClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ AlgoliaHttpResponse GetStatusWithHTTPInfo(
888888
/// <summary>
889889
/// Represents a collection of functions to interact with the API endpoints
890890
/// </summary>
891-
public partial class MonitoringClient : IMonitoringClient
891+
public partial class MonitoringClient : IMonitoringClient, IDisposable
892892
{
893893
internal HttpTransport _transport;
894894
private readonly ILogger<MonitoringClient> _logger;
@@ -977,6 +977,15 @@ public void SetClientApiKey(string apiKey)
977977
_transport._algoliaConfig.SetClientApiKey(apiKey);
978978
}
979979

980+
/// <summary>
981+
/// Disposes the client and its underlying resources (the HTTP transport).
982+
/// </summary>
983+
public void Dispose()
984+
{
985+
_transport?.Dispose();
986+
GC.SuppressFinalize(this);
987+
}
988+
980989
/// <inheritdoc />
981990
public async Task<object> CustomDeleteAsync(
982991
string path,

algoliasearch/Clients/PersonalizationClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ AlgoliaHttpResponse SetPersonalizationStrategyWithHTTPInfo(
624624
/// <summary>
625625
/// Represents a collection of functions to interact with the API endpoints
626626
/// </summary>
627-
public partial class PersonalizationClient : IPersonalizationClient
627+
public partial class PersonalizationClient : IPersonalizationClient, IDisposable
628628
{
629629
internal HttpTransport _transport;
630630
private readonly ILogger<PersonalizationClient> _logger;
@@ -719,6 +719,15 @@ public void SetClientApiKey(string apiKey)
719719
_transport._algoliaConfig.SetClientApiKey(apiKey);
720720
}
721721

722+
/// <summary>
723+
/// Disposes the client and its underlying resources (the HTTP transport).
724+
/// </summary>
725+
public void Dispose()
726+
{
727+
_transport?.Dispose();
728+
GC.SuppressFinalize(this);
729+
}
730+
722731
/// <inheritdoc />
723732
public async Task<object> CustomDeleteAsync(
724733
string path,

algoliasearch/Clients/QuerySuggestionsClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ AlgoliaHttpResponse UpdateConfigWithHTTPInfo(
860860
/// <summary>
861861
/// Represents a collection of functions to interact with the API endpoints
862862
/// </summary>
863-
public partial class QuerySuggestionsClient : IQuerySuggestionsClient
863+
public partial class QuerySuggestionsClient : IQuerySuggestionsClient, IDisposable
864864
{
865865
internal HttpTransport _transport;
866866
private readonly ILogger<QuerySuggestionsClient> _logger;
@@ -955,6 +955,15 @@ public void SetClientApiKey(string apiKey)
955955
_transport._algoliaConfig.SetClientApiKey(apiKey);
956956
}
957957

958+
/// <summary>
959+
/// Disposes the client and its underlying resources (the HTTP transport).
960+
/// </summary>
961+
public void Dispose()
962+
{
963+
_transport?.Dispose();
964+
GC.SuppressFinalize(this);
965+
}
966+
958967
/// <inheritdoc />
959968
public async Task<BaseResponse> CreateConfigAsync(
960969
ConfigurationWithIndex configurationWithIndex,

0 commit comments

Comments
 (0)