Skip to content

Commit

Permalink
refactor(dotnet-sdk)!: rename BatchCheckResponse to prevent conflict …
Browse files Browse the repository at this point in the history
…with API

BREAKING CHANGE: The BatchCheckResponse class has been renamed to
ClientBatchCheckClientResponse due to a conflict with the upcoming BatchCheckResponse
class that is generated from the API with the introduction of the BatchCheck API
  • Loading branch information
ewanharris committed Dec 18, 2024
1 parent 6f9d1d3 commit 8f0a6c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions config/clients/dotnet/template/Client/Client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public class {{appShortName}}Client : IDisposable {
/**
* BatchCheck - Run a set of checks (evaluates)
*/
public async Task<BatchCheckResponse> BatchCheck(List<ClientCheckRequest> body,
public async Task<ClientBatchCheckClientResponse> BatchCheck(List<ClientCheckRequest> body,
IClientBatchCheckOptions? options = default,
CancellationToken cancellationToken = default) {
var responses = new ConcurrentBag<BatchCheckSingleResponse>();
Expand All @@ -321,7 +321,7 @@ public class {{appShortName}}Client : IDisposable {
}
});

return new BatchCheckResponse {Responses = responses.ToList()};
return new ClientBatchCheckClientResponse {Responses = responses.ToList()};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,27 @@ public class BatchCheckSingleResponse : IEquatable<BatchCheckSingleResponse>, IV
/// <summary>
/// CheckResponse
/// </summary>
[DataContract(Name = "BatchCheckResponse")]
public class BatchCheckResponse : IEquatable<BatchCheckResponse>, IValidatableObject {
[DataContract(Name = "ClientBatchCheckClientResponse")]
public class ClientBatchCheckClientResponse : IEquatable<ClientBatchCheckClientResponse>, IValidatableObject {
/// <summary>
/// Initializes a new instance of the <see cref="BatchCheckResponse" /> class.
/// Initializes a new instance of the <see cref="ClientBatchCheckClientResponse" /> class.
/// </summary>
public BatchCheckResponse() {
public ClientBatchCheckClientResponse() {
Responses = new List<BatchCheckSingleResponse>();
}

/// <summary>
/// Initializes a new instance of the <see cref="BatchCheckResponse" /> class.
/// Initializes a new instance of the <see cref="ClientBatchCheckClientResponse" /> class.
/// </summary>
public BatchCheckResponse(List<BatchCheckSingleResponse> responses) {
public ClientBatchCheckClientResponse(List<BatchCheckSingleResponse> responses) {
Responses = responses;
}

[DataMember(Name = "responses", EmitDefaultValue = true)]
[JsonPropertyName("responses")]
public List<BatchCheckSingleResponse> Responses { get; set; }

public bool Equals(BatchCheckResponse? other) => throw new NotImplementedException();
public bool Equals(ClientBatchCheckClientResponse? other) => throw new NotImplementedException();

public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) =>
throw new NotImplementedException();
Expand Down
2 changes: 1 addition & 1 deletion config/clients/dotnet/template/OpenFgaClientTests.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ public class {{appShortName}}ClientTests {
ItExpr.IsAny<CancellationToken>()
);

Assert.IsType<BatchCheckResponse>(response);
Assert.IsType<ClientBatchCheckClientResponse>(response);

var allowedResponses = response.Responses.FindAll(res => res.Allowed == true);
Assert.Equal(2, allowedResponses.Count);
Expand Down

0 comments on commit 8f0a6c2

Please sign in to comment.