Skip to content

Commit

Permalink
feat: Add WriteSchemaAsync method to ISpiceDbClient
Browse files Browse the repository at this point in the history
A new method, WriteSchemaAsync, has been added to the ISpiceDbClient interface and its implementation in SpiceDbClient. This allows for writing a schema asynchronously.
  • Loading branch information
tanczosm committed Apr 17, 2024
1 parent 62f5457 commit 430db9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions SpiceDb/ISpiceDbClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public interface ISpiceDbClient

Task<List<string>> GetResourcePermissionsAsync(string resourceType, string permission, ResourceReference subject, ZedToken? zedToken = null, CacheFreshness cacheFreshness = CacheFreshness.AnyFreshness);
string ReadSchema();
Task WriteSchemaAsync(string schema);

Task ImportSchemaFromFileAsync(string filePath);

/// <summary>
Expand Down
5 changes: 5 additions & 0 deletions SpiceDb/SpiceDbClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,11 @@ public string ReadSchema()
return _spiceDbCore.Schema.ReadSchemaAsync().Result;
}

public async Task WriteSchemaAsync(string schema)
{
await _spiceDbCore.Schema.WriteSchemaAsync(schema);
}

public async Task ImportSchemaFromFileAsync(string filePath)
{
await ImportSchemaFromStringAsync(await File.ReadAllTextAsync(filePath));
Expand Down

0 comments on commit 430db9a

Please sign in to comment.