Skip to main content

Module grpcschema

Module grpcschema 

Source
Available on crate feature grpcschema only.
Expand description

Fetches the protobuf schema of the Synthient gRPC API using gRPC server reflection. It needs the grpcschema feature.

let schema = synthient::grpcschema::fetch(std::env::var("SYNTHIENT_API_KEY")?).await?;
for file in &schema.descriptor_set.file {
    println!("{}", file.name());
}

Schema::descriptor_set can be encoded with prost::Message::encode_to_vec for tools such as grpcurl and buf. Unless plaintext is set, the connection uses rustls with the platform’s trusted certificates, whichever TLS feature the HTTP client uses.

Re-exports§

pub use prost;
pub use prost_types;

Structs§

Fetch
A schema fetch that runs when awaited. Create one with fetch.
Schema
The protobuf schema returned by fetch.
SchemaError
A failed schema fetch. explain describes common causes.

Enums§

Code
gRPC status codes used by Status.

Constants§

DEFAULT_ENDPOINT
The address of the Synthient gRPC API.

Functions§

fetch
Starts a fetch of the protobuf files that define the server’s services, along with all of their imports. api_key is sent as x-api-key metadata unless it is blank. Await the returned Fetch to run it, optionally after changing its options.