From 47708a65b44b8d7801e865b44c29a5d483956e7c Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Thu, 13 Apr 2023 07:33:00 -0400 Subject: [PATCH 1/3] fix: interface for ClientListObjects --- README.md | 12 +++--- .../Client/OpenFgaClientTests.cs | 14 +++++-- src/OpenFga.Sdk/Client/Client.cs | 42 ++++++++++--------- .../Client/Model/ClientCheckRequest.cs | 3 +- .../Client/Model/ClientListObjectsRequest.cs | 7 +--- .../Model/ClientListRelationsRequest.cs | 5 +-- .../Client/Model/ClientTupleKey.cs | 12 +++++- .../Model/ClientWriteAssertionsRequest.cs | 2 +- 8 files changed, 57 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 9b380fe..516e640 100644 --- a/README.md +++ b/README.md @@ -671,11 +671,13 @@ var body = new ClientListObjectsRequest { User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation = "viewer", Type = "document", - ContextualTuples = new List() { - { - new("document:budget", "writer", "user:81684243-9356-4421-8fbf-a4f8d36aa31b") - } - } + ContextualTuples = new List { + new() { + User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", + Relation = "writer", + Object = "document:budget", + }, + }, }; var response = await fgaClient.ListObjects(body, options); diff --git a/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs b/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs index c74be8d..dcd3452 100644 --- a/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs +++ b/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs @@ -1158,9 +1158,17 @@ public async Task ListObjectsTest() { User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation = "can_read", Type = "document", - ContextualTuples = new List { - new("folder:product", "editor", "user:81684243-9356-4421-8fbf-a4f8d36aa31b"), - new("document:roadmap", "parent", "folder:product") + ContextualTuples = new List { + new() { + User = "folder:product", + Relation = "editor", + Object = "folder:product", + }, + new() { + User = "folder:product", + Relation = "parent", + Object = "document:roadmap", + }, } }; var response = await fgaClient.ListObjects(body, new ClientWriteOptions { diff --git a/src/OpenFga.Sdk/Client/Client.cs b/src/OpenFga.Sdk/Client/Client.cs index c212975..ff72672 100644 --- a/src/OpenFga.Sdk/Client/Client.cs +++ b/src/OpenFga.Sdk/Client/Client.cs @@ -64,7 +64,7 @@ public string? AuthorizationModelId { /** * ListStores - Get a paginated list of stores. */ - public async Task ListStores(ClientListStoresOptions? options = default, + public async Task ListStores(IClientListStoresOptions? options = default, CancellationToken cancellationToken = default) => await api.ListStores(options?.PageSize, options?.ContinuationToken, cancellationToken); @@ -96,7 +96,7 @@ public async Task DeleteStore(ClientRequestOptions? options = default, Cancellat * ReadAuthorizationModels - Read all authorization models */ public async Task ReadAuthorizationModels( - ClientReadAuthorizationModelsOptions? options = default, + IClientReadAuthorizationModelsOptions? options = default, CancellationToken cancellationToken = default) => await api.ReadAuthorizationModels(options?.PageSize, options?.ContinuationToken, cancellationToken); @@ -112,7 +112,7 @@ public async Task WriteAuthorizationModel(Write * ReadAuthorizationModel - Read the current authorization model */ public async Task ReadAuthorizationModel( - ClientReadAuthorizationModelOptions? options = default, + IClientReadAuthorizationModelOptions? options = default, CancellationToken cancellationToken = default) { var authorizationModelId = GetAuthorizationModelId(options); if (authorizationModelId == null) { @@ -160,7 +160,7 @@ await api.Read( /** * Write - Create or delete relationship tuples */ - public async Task Write(ClientWriteRequest body, ClientWriteOptions? options = default, + public async Task Write(ClientWriteRequest body, IClientWriteOptions? options = default, CancellationToken cancellationToken = default) { var maxPerChunk = options?.Transaction?.MaxPerChunk ?? @@ -184,10 +184,10 @@ public async Task Write(ClientWriteRequest body, ClientWrit return new ClientWriteResponse { Writes = body.Writes?.ConvertAll(tupleKey => - new ClientWriteSingleResponse { TupleKey = tupleKey, Status = ClientWriteStatus.SUCCESS }) ?? + new ClientWriteSingleResponse { TupleKey = tupleKey.ToTupleKey(), Status = ClientWriteStatus.SUCCESS }) ?? new List(), Deletes = body.Deletes?.ConvertAll(tupleKey => new ClientWriteSingleResponse { - TupleKey = tupleKey, + TupleKey = tupleKey.ToTupleKey(), Status = ClientWriteStatus.SUCCESS }) ?? new List() }; @@ -206,7 +206,7 @@ await Parallel.ForEachAsync(writeChunks, foreach (var tupleKey in writes) { writeResponses.Add(new ClientWriteSingleResponse { - TupleKey = tupleKey, + TupleKey = tupleKey.ToTupleKey(), Status = ClientWriteStatus.SUCCESS, }); } @@ -214,7 +214,7 @@ await Parallel.ForEachAsync(writeChunks, catch (Exception e) { foreach (var tupleKey in writes) { writeResponses.Add(new ClientWriteSingleResponse { - TupleKey = tupleKey, + TupleKey = tupleKey.ToTupleKey(), Status = ClientWriteStatus.FAILURE, Error = e, }); @@ -230,7 +230,7 @@ await Parallel.ForEachAsync(deleteChunks, foreach (var tupleKey in deletes) { deleteResponses.Add(new ClientWriteSingleResponse { - TupleKey = tupleKey, + TupleKey = tupleKey.ToTupleKey(), Status = ClientWriteStatus.SUCCESS, }); } @@ -238,7 +238,7 @@ await Parallel.ForEachAsync(deleteChunks, catch (Exception e) { foreach (var tupleKey in deletes) { deleteResponses.Add(new ClientWriteSingleResponse { - TupleKey = tupleKey, + TupleKey = tupleKey.ToTupleKey(), Status = ClientWriteStatus.FAILURE, Error = e, }); @@ -252,14 +252,14 @@ await Parallel.ForEachAsync(deleteChunks, /** * WriteTuples - Utility method to write tuples, wraps Write */ - public async Task WriteTuples(List body, ClientWriteOptions? options = default, + public async Task WriteTuples(List body, IClientWriteOptions? options = default, CancellationToken cancellationToken = default) => await Write(new ClientWriteRequest { Writes = body }, options, cancellationToken); /** * DeleteTuples - Utility method to delete tuples, wraps Write */ - public async Task DeleteTuples(List body, ClientWriteOptions? options = default, + public async Task DeleteTuples(List body, IClientWriteOptions? options = default, CancellationToken cancellationToken = default) => await Write(new ClientWriteRequest { Deletes = body }, options, cancellationToken); @@ -270,7 +270,7 @@ public async Task DeleteTuples(List body, C /** * Check - Check if a user has a particular relation with an object (evaluates) */ - public async Task Check(ClientCheckRequest body, + public async Task Check(IClientCheckRequest body, IClientRequestOptionsWithAuthZModelId? options = default, CancellationToken cancellationToken = default) => await api.Check( @@ -313,7 +313,7 @@ await Parallel.ForEachAsync(body, /** * Expand - Expands the relationships in userset tree format (evaluates) */ - public async Task Expand(ClientExpandRequest body, + public async Task Expand(IClientExpandRequest body, IClientRequestOptionsWithAuthZModelId? options = default, CancellationToken cancellationToken = default) => await api.Expand( @@ -325,21 +325,25 @@ await api.Expand( /** * ListObjects - List the objects of a particular type that the user has a certain relation to (evaluates) */ - public async Task ListObjects(ClientListObjectsRequest body, + public async Task ListObjects(IClientListObjectsRequest body, IClientRequestOptionsWithAuthZModelId? options = default, CancellationToken cancellationToken = default) => await api.ListObjects(new ListObjectsRequest { User = body.User, Relation = body.Relation, Type = body.Type, - ContextualTuples = new ContextualTupleKeys { TupleKeys = body.ContextualTuples ?? new List() }, + ContextualTuples = + new ContextualTupleKeys { + TupleKeys = body.ContextualTuples?.ConvertAll(tupleKey => tupleKey.ToTupleKey()) ?? + new List() + }, AuthorizationModelId = GetAuthorizationModelId(options) }); /** * ListRelations - List all the relations a user has with an object (evaluates) */ - public async Task ListRelations(ClientListRelationsRequest body, + public async Task ListRelations(IClientListRelationsRequest body, IClientBatchCheckOptions? options = default, CancellationToken cancellationToken = default) { if (body.Relations.Count == 0) { @@ -377,7 +381,7 @@ public async Task ListRelations(ClientListRelationsReques /** * ReadAssertions - Read assertions for a particular authorization model */ - public async Task ReadAssertions(ClientReadAssertionsOptions? options = default, + public async Task ReadAssertions(IClientReadAssertionsOptions? options = default, CancellationToken cancellationToken = default) { var authorizationModelId = GetAuthorizationModelId(options); if (authorizationModelId == null) { @@ -391,7 +395,7 @@ public async Task ReadAssertions(ClientReadAssertionsOpt * WriteAssertions - Updates assertions for a particular authorization model */ public async Task WriteAssertions(List body, - ClientWriteAssertionsOptions? options = default, + IClientWriteAssertionsOptions? options = default, CancellationToken cancellationToken = default) { var authorizationModelId = GetAuthorizationModelId(options); if (authorizationModelId == null) { diff --git a/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs index 618e6ec..f416c0f 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs @@ -18,11 +18,10 @@ namespace OpenFga.Sdk.Client.Model; -internal interface IClientCheckRequest { +public interface IClientCheckRequest: IClientContextualTuplesWrapper { public string User { get; set; } public string Relation { get; set; } public string Object { get; set; } - public List? ContextualTuples { get; set; } } /// diff --git a/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs index 18b35e7..f08556b 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs @@ -10,8 +10,6 @@ // NOTE: This file was auto generated. DO NOT EDIT. // - -using OpenFga.Sdk.Model; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; using System.Text.Json; @@ -19,11 +17,10 @@ namespace OpenFga.Sdk.Client.Model; -internal interface IClientListObjectsRequest { +public interface IClientListObjectsRequest: IClientContextualTuplesWrapper { public string User { get; set; } public string Relation { get; set; } public string Type { get; set; } - public List? ContextualTuples { get; set; } } /// @@ -57,7 +54,7 @@ public class ClientListObjectsRequest : IClientListObjectsRequest, IEquatable [DataMember(Name = "contextual_tuples", EmitDefaultValue = false)] [JsonPropertyName("contextual_tuples")] - public List? ContextualTuples { get; set; } + public List? ContextualTuples { get; set; } public bool Equals(ClientListObjectsRequest input) { if (input == null) { diff --git a/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs index 0beb74c..e369178 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs @@ -10,18 +10,15 @@ // NOTE: This file was auto generated. DO NOT EDIT. // - using System.ComponentModel.DataAnnotations; using System.Text.Json; namespace OpenFga.Sdk.Client.Model; -internal interface IClientListRelationsRequest { +public interface IClientListRelationsRequest : IClientContextualTuplesWrapper { public string User { get; set; } public string Object { get; set; } - public List ContextualTuples { get; set; } - public List Relations { get; set; } } diff --git a/src/OpenFga.Sdk/Client/Model/ClientTupleKey.cs b/src/OpenFga.Sdk/Client/Model/ClientTupleKey.cs index c89845d..026a2d8 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientTupleKey.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientTupleKey.cs @@ -19,7 +19,17 @@ namespace OpenFga.Sdk.Client.Model; -public class ClientTupleKey : TupleKey { +public interface IClientTupleKey { + public string User { get; set; } + public string Relation { get; set; } + public string Object { get; set; } +} + +public interface IClientContextualTuplesWrapper { + public List? ContextualTuples { get; set; } +} + +public class ClientTupleKey : IClientTupleKey { /// /// Gets or Sets Object /// diff --git a/src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsRequest.cs index 574a4f4..0b2162d 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsRequest.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsRequest.cs @@ -18,7 +18,7 @@ namespace OpenFga.Sdk.Client.Model; -internal interface IClientAssertion { +public interface IClientAssertion { public string User { get; set; } public string Relation { get; set; } public string Object { get; set; } From 02c4f151418fd4db744052bca71b0ed78081e92d Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Thu, 13 Apr 2023 09:42:59 -0400 Subject: [PATCH 2/3] fix: `ClientListObjects.ContextualTuples` is now `ClientTupleKey[]` - changed Client `WriteAuthorizationModel` now expects `ClientWriteAuthorizationModelRequest` instead of `WriteAuthorizationModelRequest` - changed a few interfaces to expect interfaces instead of classes --- .openapi-generator/FILES | 1 + CHANGELOG.md | 2 +- README.md | 5 +---- src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs | 2 +- .../Client/OpenFgaClientTests.cs | 10 +++++----- src/OpenFga.Sdk/Client/Client.cs | 8 ++++---- .../Client/Model/ClientCheckRequest.cs | 3 ++- .../Client/Model/ClientCreateStoreOptions.cs | 13 ++++++++++++ .../Client/Model/ClientListObjectsRequest.cs | 3 ++- .../Model/ClientListRelationsRequest.cs | 2 ++ .../ClientWriteAuthorizationModelRequest.cs | 20 +++++++++++++++++++ 11 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 src/OpenFga.Sdk/Client/Model/ClientWriteAuthorizationModelRequest.cs diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 86b8102..2cdeb89 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -110,6 +110,7 @@ src/OpenFga.Sdk/Client/Model/ClientRequestOptsWithAuthZModelId.cs src/OpenFga.Sdk/Client/Model/ClientTupleKey.cs src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsOptions.cs src/OpenFga.Sdk/Client/Model/ClientWriteAssertionsRequest.cs +src/OpenFga.Sdk/Client/Model/ClientWriteAuthorizationModelRequest.cs src/OpenFga.Sdk/Client/Model/ClientWriteOptions.cs src/OpenFga.Sdk/Client/Model/ClientWriteRequest.cs src/OpenFga.Sdk/Client/Model/ClientWriteResponse.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index d3eedf2..2c82636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ - feat(client): implement `BatchCheck` to check multiple tuples in parallel - feat(client): implement `ListRelations` to check in one call whether a user has multiple relations to an objects - feat(client): add support for a non-transactional `Write` -- chore(config): bump default max retries to `5` +- chore(config): bump default max retries to `15` - fix: retry on 5xx errors ## v0.2.1 diff --git a/README.md b/README.md index 516e640..db36f51 100644 --- a/README.md +++ b/README.md @@ -298,7 +298,7 @@ Create a new authorization model. ```csharp -var body = new WriteAuthorizationModelRequest { +var body = new ClientWriteAuthorizationModelRequest { SchemaVersion = "1.1", TypeDefinitions = new List { new() {Type = "user", Relations = new Dictionary()}, @@ -720,7 +720,6 @@ var options = new ClientReadAssertionsOptions { // You can rely on the model id set in the configuration or override it for this specific request AuthorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1", }; - var response = await fgaClient.ReadAssertions(options); ``` @@ -735,14 +734,12 @@ var options = new ClientWriteAssertionsOptions { // You can rely on the model id set in the configuration or override it for this specific request AuthorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1", }; - var body = new List() {new ClientAssertion() { User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation = "viewer", Object = "document:roadmap", Expectation = true, }}; - await fgaClient.WriteAssertions(body, options); ``` diff --git a/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs b/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs index 21d29c2..b474aa5 100644 --- a/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs +++ b/src/OpenFga.Sdk.Test/Api/OpenFgaApiTests.cs @@ -1435,7 +1435,7 @@ public async Task ListStoresTest() { } /// - /// Test ListStores does not crash in error handling + /// Test ListStores correctly returns FgaApiNotFoundError /// [Fact] public async Task ListStoresResponseErrorTest() { diff --git a/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs b/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs index dcd3452..5505e2d 100644 --- a/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs +++ b/src/OpenFga.Sdk.Test/Client/OpenFgaClientTests.cs @@ -306,7 +306,7 @@ public async Task DeleteStoreTest() { [Fact] public async Task WriteAuthorizationModelTest() { const string authorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1"; - var body = new WriteAuthorizationModelRequest { + var body = new ClientWriteAuthorizationModelRequest { SchemaVersion = "1.1", TypeDefinitions = new List { new() { @@ -1169,7 +1169,7 @@ public async Task ListObjectsTest() { Relation = "parent", Object = "document:roadmap", }, - } + }, }; var response = await fgaClient.ListObjects(body, new ClientWriteOptions { AuthorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1", @@ -1223,13 +1223,13 @@ public async Task ListRelationsTest() { var httpClient = new HttpClient(mockHandler.Object); var fgaClient = new OpenFgaClient(_config, httpClient); - ClientListRelationsRequest body = + var body = new ClientListRelationsRequest() { User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Object = "document:roadmap", Relations = new List { "can_view", "can_edit", "can_delete", "can_rename" }, ContextualTuples = new List() { - new ClientTupleKey { + new() { User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Relation = "editor", Object = "document:roadmap", @@ -1279,7 +1279,7 @@ public async Task ListRelationsNoRelationsProvidedTest() { new ClientListRelationsRequest() { User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b", Object = "document:roadmap", - Relations = new List {}, + Relations = new List { }, }; Task ApiError() => fgaClient.ListRelations(body); diff --git a/src/OpenFga.Sdk/Client/Client.cs b/src/OpenFga.Sdk/Client/Client.cs index ff72672..97370a6 100644 --- a/src/OpenFga.Sdk/Client/Client.cs +++ b/src/OpenFga.Sdk/Client/Client.cs @@ -103,7 +103,7 @@ public async Task ReadAuthorizationModels( /** * WriteAuthorizationModel - Create a new version of the authorization model */ - public async Task WriteAuthorizationModel(WriteAuthorizationModelRequest body, + public async Task WriteAuthorizationModel(ClientWriteAuthorizationModelRequest body, ClientRequestOptions? options = default, CancellationToken cancellationToken = default) => await api.WriteAuthorizationModel(body, cancellationToken); @@ -141,14 +141,14 @@ public async Task ReadLatestAuthorizationModel( * Read Changes - Read the list of historical relationship tuple writes and deletes */ public async Task ReadChanges(ClientReadChangesRequest body, - ClientReadChangesOptions? options = default, + IClientReadChangesOptions? options = default, CancellationToken cancellationToken = default) => await api.ReadChanges(body.Type, options?.PageSize, options?.ContinuationToken, cancellationToken); /** * Read - Read tuples previously written to the store (does not evaluate) */ - public async Task Read(ClientReadRequest body, ClientReadOptions? options = default, + public async Task Read(ClientReadRequest body, IClientReadOptions? options = default, CancellationToken cancellationToken = default) => await api.Read( new ReadRequest { @@ -349,7 +349,7 @@ public async Task ListRelations(IClientListRelationsReque if (body.Relations.Count == 0) { throw new FgaValidationError("At least 1 relation to check has to be provided when calling ListRelations"); } - + var responses = new ListRelationsResponse(); var batchCheckRequests = new List(); for (var index = 0; index < body.Relations.Count; index++) { diff --git a/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs index f416c0f..9414741 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs @@ -18,10 +18,11 @@ namespace OpenFga.Sdk.Client.Model; -public interface IClientCheckRequest: IClientContextualTuplesWrapper { +public interface IClientCheckRequest : IClientContextualTuplesWrapper { public string User { get; set; } public string Relation { get; set; } public string Object { get; set; } + public List? ContextualTuples { get; set; } } /// diff --git a/src/OpenFga.Sdk/Client/Model/ClientCreateStoreOptions.cs b/src/OpenFga.Sdk/Client/Model/ClientCreateStoreOptions.cs index 6139b1d..7326faf 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientCreateStoreOptions.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientCreateStoreOptions.cs @@ -1,3 +1,16 @@ +// +// OpenFGA/.NET SDK for OpenFGA +// +// API version: 0.1 +// Website: https://openfga.dev +// Documentation: https://openfga.dev/docs +// Support: https://discord.gg/8naAwJfWN6 +// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE) +// +// NOTE: This file was auto generated. DO NOT EDIT. +// + + namespace OpenFga.Sdk.Client.Model; public interface IClientCreateStoreOptions : ClientRequestOptions { } diff --git a/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs index f08556b..0e57a61 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientListObjectsRequest.cs @@ -10,6 +10,7 @@ // NOTE: This file was auto generated. DO NOT EDIT. // + using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; using System.Text.Json; @@ -17,7 +18,7 @@ namespace OpenFga.Sdk.Client.Model; -public interface IClientListObjectsRequest: IClientContextualTuplesWrapper { +public interface IClientListObjectsRequest : IClientContextualTuplesWrapper { public string User { get; set; } public string Relation { get; set; } public string Type { get; set; } diff --git a/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs index e369178..366a4ed 100644 --- a/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs +++ b/src/OpenFga.Sdk/Client/Model/ClientListRelationsRequest.cs @@ -10,10 +10,12 @@ // NOTE: This file was auto generated. DO NOT EDIT. // + using System.ComponentModel.DataAnnotations; using System.Text.Json; namespace OpenFga.Sdk.Client.Model; + public interface IClientListRelationsRequest : IClientContextualTuplesWrapper { public string User { get; set; } diff --git a/src/OpenFga.Sdk/Client/Model/ClientWriteAuthorizationModelRequest.cs b/src/OpenFga.Sdk/Client/Model/ClientWriteAuthorizationModelRequest.cs new file mode 100644 index 0000000..16487df --- /dev/null +++ b/src/OpenFga.Sdk/Client/Model/ClientWriteAuthorizationModelRequest.cs @@ -0,0 +1,20 @@ +// +// OpenFGA/.NET SDK for OpenFGA +// +// API version: 0.1 +// Website: https://openfga.dev +// Documentation: https://openfga.dev/docs +// Support: https://discord.gg/8naAwJfWN6 +// License: [Apache-2.0](https://github.com/openfga/dotnet-sdk/blob/main/LICENSE) +// +// NOTE: This file was auto generated. DO NOT EDIT. +// + + +using OpenFga.Sdk.Model; + +namespace OpenFga.Sdk.Client.Model; + +/// +public class ClientWriteAuthorizationModelRequest : WriteAuthorizationModelRequest { +} \ No newline at end of file From f0b76abf9c07b4c9ffe3e3cc76538f236a0234ac Mon Sep 17 00:00:00 2001 From: Raghd Hamzeh Date: Thu, 13 Apr 2023 09:43:38 -0400 Subject: [PATCH 3/3] release: v0.2.3 with a fix for the ClientListObjects interface - fix: changed interface of contextual tuples in `ClientListObjects` to be `ClientTupleKey` instead of `TupleKey` - fix: Client `WriteAuthorizationModel` now expects `ClientWriteAuthorizationModelRequest` instead of `WriteAuthorizationModelRequest` - chore: changed a few interfaces to expect interfaces instead of classes --- CHANGELOG.md | 7 +++++++ src/OpenFga.Sdk/Configuration/Configuration.cs | 2 +- src/OpenFga.Sdk/OpenFga.Sdk.csproj | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c82636..efcb2ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v0.2.3 + +### [0.2.3](https://github.com/openfga/dotnet-sdk/compare/v0.2.2...v0.2.3) (2023-04-13) +- fix: changed interface of contextual tuples in `ClientListObjects` to be `ClientTupleKey` instead of `TupleKey` +- fix: Client `WriteAuthorizationModel` now expects `ClientWriteAuthorizationModelRequest` instead of `WriteAuthorizationModelRequest` +- chore: changed a few interfaces to expect interfaces instead of classes + ## v0.2.2 ### [0.2.2](https://github.com/openfga/dotnet-sdk/compare/v0.2.1...v0.2.2) (2023-04-12) diff --git a/src/OpenFga.Sdk/Configuration/Configuration.cs b/src/OpenFga.Sdk/Configuration/Configuration.cs index ebe0540..c0bf832 100644 --- a/src/OpenFga.Sdk/Configuration/Configuration.cs +++ b/src/OpenFga.Sdk/Configuration/Configuration.cs @@ -60,7 +60,7 @@ public void IsValid() { /// Version of the package. /// /// Version of the package. - public const string Version = "0.2.2"; + public const string Version = "0.2.3"; #endregion Constants diff --git a/src/OpenFga.Sdk/OpenFga.Sdk.csproj b/src/OpenFga.Sdk/OpenFga.Sdk.csproj index 67e49d0..8b59160 100644 --- a/src/OpenFga.Sdk/OpenFga.Sdk.csproj +++ b/src/OpenFga.Sdk/OpenFga.Sdk.csproj @@ -12,7 +12,7 @@ .NET SDK for OpenFGA OpenFGA OpenFga.Sdk - 0.2.2 + 0.2.3 bin\$(Configuration)\$(TargetFramework)\OpenFga.Sdk.xml Apache-2.0 README.md