summaryrefslogtreecommitdiff
path: root/src/client.rs
blob: f0b871bdb2c7e4486d46fabf922523dcc434ae3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// !Sample implementation of a gRPC Client for Clawflake, not meant to production!

use clawflake::clawflake_client::ClawflakeClient;
use clawflake::IdRequest;

pub mod clawflake {
    tonic::include_proto!("clawflake");
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let addr = "http://[::1]:50051";

    let mut client = ClawflakeClient::connect(addr).await?;

    println!("Client connected to {}", addr);
    let request = tonic::Request::new(IdRequest {});

    println!("Trying to get an ID");
    let response = client.get_id(request).await?;

    println!("Received: {:?}", response);

    Ok(())
}