Skip to content

systeminit/spicedb-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spicedb-client

Experimental ergonomic(-ish) Rust client for the SpiceDB gRPC API.

Warning

Experimental!

Features

  • More ergonomic wrappers around the auto-generated Tonic gRPC APIs
  • Builder traits to simplify creating requests.

Installation

Add this to your Cargo.toml:

[dependencies]
spicedb-client = "0.1.1"

Usage

use spicedb_client::SpicedbClient;
use spicedb_client::reader::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let spicedb_url = std::env::var("SPICEDB_URL")
        .unwrap_or_else(|_| "http://localhost:50051".to_string());

    let preshared_key = std::env::var("SPICEDB_PRESHARED_KEY")
        .unwrap_or_else(|_| "spicedb".to_string());

    let mut client = SpicedbClient::from_url_and_preshared_key(spicedb_url, preshared_key)
        .await
        .unwrap();

    // Read schema
    let response = client.read_schema().await.unwrap();
    let schema = response.schema_text();

    println!("Schema: {:?}", schema);

    Ok(())
}

Documentation

See docs.rs/spicedb-client.

Contributing

We welcome contributions!

License

This project is licensed under Apache 2.0.

Acknowledgements

This client is based on the official AuthZed SpiceDB API and uses Tonic for to generate the gRPC client.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%