-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To try this out, run: cargo run api grpc --port 8888 Then run cargo run api_client
- Loading branch information
Showing
4 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "api_client" | ||
version.workspace = true | ||
license.workspace = true | ||
rust-version.workspace = true | ||
edition.workspace = true | ||
readme.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
documentation.workspace = true | ||
categories.workspace = true | ||
keywords.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
tonic.workspace = true | ||
jj-api.workspace = true | ||
tokio = { workspace = true, features = ["full"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use jj_api::client::JjServiceClient; | ||
use jj_api::rpc::ListWorkspacesRequest; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let mut client = JjServiceClient::connect("http://[::1]:8888").await?; | ||
|
||
let request = tonic::Request::new(ListWorkspacesRequest::default()); | ||
|
||
let response = client.list_workspaces(request).await?; | ||
|
||
println!("RESPONSE={:?}", response); | ||
|
||
Ok(()) | ||
} |