Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/clients/dotnet/template/Client/Client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public class {{appShortName}}Client : IDisposable {
CancellationToken cancellationToken = default) =>
await api.WriteAuthorizationModel(GetStoreId(options), body, cancellationToken);

public async Task<WriteAuthorizationModelResponse> WriteAuthorizationModel(WriteAuthorizationModelRequest body,
IClientRequestOptionsWithStoreId? options = default,
CancellationToken cancellationToken = default) =>
await api.WriteAuthorizationModel(GetStoreId(options), body, cancellationToken);

/**
* ReadAuthorizationModel - Read the current authorization model
*/
Expand Down
10 changes: 10 additions & 0 deletions config/clients/dotnet/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ var response = await fgaClient.WriteAuthorizationModel(body);
// response.AuthorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1"
```

If you already have an authorization model represented as JSON (for example, stored on disk), you can deserialize it using the
`WriteAuthorizationModelRequest.FromJson` helper and pass it directly to the overload of `WriteAuthorizationModel` that accepts
`WriteAuthorizationModelRequest`:

```csharp
var modelJson = await File.ReadAllTextAsync("model.json");
var request = WriteAuthorizationModelRequest.FromJson(modelJson);
var response = await fgaClient.WriteAuthorizationModel(request);
```

#### Read a Single Authorization Model

Read a particular authorization model.
Expand Down
Loading