Skip to content

Commit

Permalink
Update dotnet, node, web, and cli with new proto service rename (#233)
Browse files Browse the repository at this point in the history
* Change API a little bit

* Update protos and autogen for dotnet

* Update node and web

* Cli update
  • Loading branch information
tmarkovski authored Nov 24, 2021
1 parent e7a412c commit d047d64
Show file tree
Hide file tree
Showing 19 changed files with 214 additions and 99 deletions.
124 changes: 124 additions & 0 deletions cli/src/proto/services/account/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,127 @@ pub mod account_service_client {
}
}
}
#[doc = r" Generated client implementations."]
pub mod account_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct AccountClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AccountClient<tonic::transport::Channel> {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AccountClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> AccountClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
AccountClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Sign in to an already existing account"]
pub async fn sign_in(
&mut self,
request: impl tonic::IntoRequest<super::SignInRequest>,
) -> Result<tonic::Response<super::SignInResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/services.account.v1.Account/SignIn");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Get account information"]
pub async fn info(
&mut self,
request: impl tonic::IntoRequest<super::InfoRequest>,
) -> Result<tonic::Response<super::InfoResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/services.account.v1.Account/Info");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " List all connected devices"]
pub async fn list_devices(
&mut self,
request: impl tonic::IntoRequest<super::ListDevicesRequest>,
) -> Result<tonic::Response<super::ListDevicesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/services.account.v1.Account/ListDevices");
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Revoke device access to the account's cloud wallet"]
pub async fn revoke_device(
&mut self,
request: impl tonic::IntoRequest<super::RevokeDeviceRequest>,
) -> Result<tonic::Response<super::RevokeDeviceResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/services.account.v1.Account/RevokeDevice");
self.inner.unary(request.into_request(), path, codec).await
}
}
}
18 changes: 9 additions & 9 deletions cli/src/proto/services/universalwallet/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ pub struct DeleteItemRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteItemResponse {}
#[doc = r" Generated client implementations."]
pub mod wallet_service_client {
pub mod universal_wallet_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct WalletServiceClient<T> {
pub struct UniversalWalletClient<T> {
inner: tonic::client::Grpc<T>,
}
impl WalletServiceClient<tonic::transport::Channel> {
impl UniversalWalletClient<tonic::transport::Channel> {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
Expand All @@ -65,7 +65,7 @@ pub mod wallet_service_client {
Ok(Self::new(conn))
}
}
impl<T> WalletServiceClient<T>
impl<T> UniversalWalletClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
Expand All @@ -79,7 +79,7 @@ pub mod wallet_service_client {
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> WalletServiceClient<InterceptedService<T, F>>
) -> UniversalWalletClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
Expand All @@ -91,7 +91,7 @@ pub mod wallet_service_client {
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
WalletServiceClient::new(InterceptedService::new(inner, interceptor))
UniversalWalletClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
Expand Down Expand Up @@ -119,7 +119,7 @@ pub mod wallet_service_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.universalwallet.v1.WalletService/Search",
"/services.universalwallet.v1.UniversalWallet/Search",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand All @@ -136,7 +136,7 @@ pub mod wallet_service_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.universalwallet.v1.WalletService/InsertItem",
"/services.universalwallet.v1.UniversalWallet/InsertItem",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand All @@ -153,7 +153,7 @@ pub mod wallet_service_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.universalwallet.v1.WalletService/Deleteitem",
"/services.universalwallet.v1.UniversalWallet/Deleteitem",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand Down
22 changes: 11 additions & 11 deletions cli/src/proto/services/verifiablecredentials/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ pub struct SendResponse {
pub status: i32,
}
#[doc = r" Generated client implementations."]
pub mod credential_client {
pub mod verifiable_credential_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct CredentialClient<T> {
pub struct VerifiableCredentialClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CredentialClient<tonic::transport::Channel> {
impl VerifiableCredentialClient<tonic::transport::Channel> {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
Expand All @@ -82,7 +82,7 @@ pub mod credential_client {
Ok(Self::new(conn))
}
}
impl<T> CredentialClient<T>
impl<T> VerifiableCredentialClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
Expand All @@ -96,7 +96,7 @@ pub mod credential_client {
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> CredentialClient<InterceptedService<T, F>>
) -> VerifiableCredentialClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
Expand All @@ -108,7 +108,7 @@ pub mod credential_client {
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
CredentialClient::new(InterceptedService::new(inner, interceptor))
VerifiableCredentialClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
Expand All @@ -135,7 +135,7 @@ pub mod credential_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.verifiablecredentials.v1.Credential/Issue",
"/services.verifiablecredentials.v1.VerifiableCredential/Issue",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand All @@ -151,7 +151,7 @@ pub mod credential_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.verifiablecredentials.v1.Credential/IssueFromTemplate",
"/services.verifiablecredentials.v1.VerifiableCredential/IssueFromTemplate",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand All @@ -167,7 +167,7 @@ pub mod credential_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.verifiablecredentials.v1.Credential/CreateProof",
"/services.verifiablecredentials.v1.VerifiableCredential/CreateProof",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand All @@ -183,7 +183,7 @@ pub mod credential_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.verifiablecredentials.v1.Credential/VerifyProof",
"/services.verifiablecredentials.v1.VerifiableCredential/VerifyProof",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand All @@ -199,7 +199,7 @@ pub mod credential_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/services.verifiablecredentials.v1.Credential/Send",
"/services.verifiablecredentials.v1.VerifiableCredential/Send",
);
self.inner.unary(request.into_request(), path, codec).await
}
Expand Down
8 changes: 4 additions & 4 deletions cli/src/services/issuer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use trinsic::proto::services::common::v1::{json_payload::Json, JsonPayload};
use trinsic::proto::services::verifiablecredentials::v1::{
credential_client::CredentialClient, CreateProofRequest, IssueRequest, VerifyProofRequest,
verifiable_credential_client::VerifiableCredentialClient, CreateProofRequest, IssueRequest, VerifyProofRequest,
};
use trinsic::proto::JsonPretty;
use trinsic::utils::{read_file_as_string, write_file};
Expand Down Expand Up @@ -28,7 +28,7 @@ async fn issue(args: &IssueArgs, config: DefaultConfig) {
let document: trinsic::proto::google::protobuf::Struct =
trinsic::proto::google::protobuf::Struct::from_vec(&document).unwrap();

let mut client = grpc_client_with_auth!(CredentialClient<Channel>, config);
let mut client = grpc_client_with_auth!(VerifiableCredentialClient<Channel>, config);

let request = tonic::Request::new(IssueRequest {
document: Some(JsonPayload {
Expand Down Expand Up @@ -62,7 +62,7 @@ async fn create_proof(args: &CreateProofArgs, config: DefaultConfig) {
let document: trinsic::proto::google::protobuf::Struct =
trinsic::proto::google::protobuf::Struct::from_vec(&document).unwrap();

let mut client = grpc_client_with_auth!(CredentialClient<Channel>, config);
let mut client = grpc_client_with_auth!(VerifiableCredentialClient<Channel>, config);

let request = tonic::Request::new(CreateProofRequest {
reveal_document: Some(JsonPayload {
Expand Down Expand Up @@ -97,7 +97,7 @@ async fn verify_proof(args: &VerifyProofArgs, config: DefaultConfig) {
let document: trinsic::proto::google::protobuf::Struct =
trinsic::proto::google::protobuf::Struct::from_vec(&document).unwrap();

let mut client = grpc_client_with_auth!(CredentialClient<Channel>, config);
let mut client = grpc_client_with_auth!(VerifiableCredentialClient<Channel>, config);

let request = tonic::Request::new(VerifyProofRequest {
proof_document: Some(JsonPayload {
Expand Down
10 changes: 5 additions & 5 deletions cli/src/services/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use trinsic::proto::google::protobuf::Struct;
use trinsic::proto::services::common::v1::json_payload::Json;
use trinsic::proto::services::common::v1::{JsonPayload, ServerConfig};
use trinsic::proto::services::universalwallet::v1::{
wallet_service_client::WalletServiceClient, InsertItemRequest, SearchRequest,
universal_wallet_client::UniversalWalletClient, InsertItemRequest, SearchRequest,
};
use trinsic::proto::services::verifiablecredentials::v1::credential_client::CredentialClient;
use trinsic::proto::services::verifiablecredentials::v1::verifiable_credential_client::VerifiableCredentialClient;
use trinsic::proto::services::verifiablecredentials::v1::send_request::DeliveryMethod;
use trinsic::proto::services::verifiablecredentials::v1::SendRequest;
use trinsic::utils::read_file_as_string;
Expand All @@ -37,7 +37,7 @@ async fn search(args: &SearchArgs, config: DefaultConfig) {
.await
.expect("Unable to connect to server");

let mut client = WalletServiceClient::with_interceptor(channel, config);
let mut client = UniversalWalletClient::with_interceptor(channel, config);

let request = tonic::Request::new(SearchRequest {
query: query.clone(),
Expand Down Expand Up @@ -74,7 +74,7 @@ async fn insert_item(args: &InsertItemArgs, config: DefaultConfig) {
.await
.expect("Unable to connect to server");

let mut client = WalletServiceClient::with_interceptor(channel, config);
let mut client = UniversalWalletClient::with_interceptor(channel, config);

let response = client
.insert_item(InsertItemRequest {
Expand Down Expand Up @@ -105,7 +105,7 @@ async fn send(args: &SendArgs, config: DefaultConfig) {
.await
.expect("Unable to connect to server");

let mut client = CredentialClient::with_interceptor(channel, config);
let mut client = VerifiableCredentialClient::with_interceptor(channel, config);

let response = client
.send(SendRequest {
Expand Down
Loading

0 comments on commit d047d64

Please sign in to comment.