Skip to content

Commit d047d64

Browse files
authored
Update dotnet, node, web, and cli with new proto service rename (#233)
* Change API a little bit * Update protos and autogen for dotnet * Update node and web * Cli update
1 parent e7a412c commit d047d64

File tree

19 files changed

+214
-99
lines changed

19 files changed

+214
-99
lines changed

cli/src/proto/services/account/v1/mod.rs

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,127 @@ pub mod account_service_client {
234234
}
235235
}
236236
}
237+
#[doc = r" Generated client implementations."]
238+
pub mod account_client {
239+
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
240+
use tonic::codegen::*;
241+
#[derive(Debug, Clone)]
242+
pub struct AccountClient<T> {
243+
inner: tonic::client::Grpc<T>,
244+
}
245+
impl AccountClient<tonic::transport::Channel> {
246+
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
247+
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
248+
where
249+
D: std::convert::TryInto<tonic::transport::Endpoint>,
250+
D::Error: Into<StdError>,
251+
{
252+
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
253+
Ok(Self::new(conn))
254+
}
255+
}
256+
impl<T> AccountClient<T>
257+
where
258+
T: tonic::client::GrpcService<tonic::body::BoxBody>,
259+
T::ResponseBody: Body + Send + 'static,
260+
T::Error: Into<StdError>,
261+
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
262+
{
263+
pub fn new(inner: T) -> Self {
264+
let inner = tonic::client::Grpc::new(inner);
265+
Self { inner }
266+
}
267+
pub fn with_interceptor<F>(
268+
inner: T,
269+
interceptor: F,
270+
) -> AccountClient<InterceptedService<T, F>>
271+
where
272+
F: tonic::service::Interceptor,
273+
T: tonic::codegen::Service<
274+
http::Request<tonic::body::BoxBody>,
275+
Response = http::Response<
276+
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
277+
>,
278+
>,
279+
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
280+
Into<StdError> + Send + Sync,
281+
{
282+
AccountClient::new(InterceptedService::new(inner, interceptor))
283+
}
284+
#[doc = r" Compress requests with `gzip`."]
285+
#[doc = r""]
286+
#[doc = r" This requires the server to support it otherwise it might respond with an"]
287+
#[doc = r" error."]
288+
pub fn send_gzip(mut self) -> Self {
289+
self.inner = self.inner.send_gzip();
290+
self
291+
}
292+
#[doc = r" Enable decompressing responses with `gzip`."]
293+
pub fn accept_gzip(mut self) -> Self {
294+
self.inner = self.inner.accept_gzip();
295+
self
296+
}
297+
#[doc = " Sign in to an already existing account"]
298+
pub async fn sign_in(
299+
&mut self,
300+
request: impl tonic::IntoRequest<super::SignInRequest>,
301+
) -> Result<tonic::Response<super::SignInResponse>, tonic::Status> {
302+
self.inner.ready().await.map_err(|e| {
303+
tonic::Status::new(
304+
tonic::Code::Unknown,
305+
format!("Service was not ready: {}", e.into()),
306+
)
307+
})?;
308+
let codec = tonic::codec::ProstCodec::default();
309+
let path = http::uri::PathAndQuery::from_static("/services.account.v1.Account/SignIn");
310+
self.inner.unary(request.into_request(), path, codec).await
311+
}
312+
#[doc = " Get account information"]
313+
pub async fn info(
314+
&mut self,
315+
request: impl tonic::IntoRequest<super::InfoRequest>,
316+
) -> Result<tonic::Response<super::InfoResponse>, tonic::Status> {
317+
self.inner.ready().await.map_err(|e| {
318+
tonic::Status::new(
319+
tonic::Code::Unknown,
320+
format!("Service was not ready: {}", e.into()),
321+
)
322+
})?;
323+
let codec = tonic::codec::ProstCodec::default();
324+
let path = http::uri::PathAndQuery::from_static("/services.account.v1.Account/Info");
325+
self.inner.unary(request.into_request(), path, codec).await
326+
}
327+
#[doc = " List all connected devices"]
328+
pub async fn list_devices(
329+
&mut self,
330+
request: impl tonic::IntoRequest<super::ListDevicesRequest>,
331+
) -> Result<tonic::Response<super::ListDevicesResponse>, tonic::Status> {
332+
self.inner.ready().await.map_err(|e| {
333+
tonic::Status::new(
334+
tonic::Code::Unknown,
335+
format!("Service was not ready: {}", e.into()),
336+
)
337+
})?;
338+
let codec = tonic::codec::ProstCodec::default();
339+
let path =
340+
http::uri::PathAndQuery::from_static("/services.account.v1.Account/ListDevices");
341+
self.inner.unary(request.into_request(), path, codec).await
342+
}
343+
#[doc = " Revoke device access to the account's cloud wallet"]
344+
pub async fn revoke_device(
345+
&mut self,
346+
request: impl tonic::IntoRequest<super::RevokeDeviceRequest>,
347+
) -> Result<tonic::Response<super::RevokeDeviceResponse>, tonic::Status> {
348+
self.inner.ready().await.map_err(|e| {
349+
tonic::Status::new(
350+
tonic::Code::Unknown,
351+
format!("Service was not ready: {}", e.into()),
352+
)
353+
})?;
354+
let codec = tonic::codec::ProstCodec::default();
355+
let path =
356+
http::uri::PathAndQuery::from_static("/services.account.v1.Account/RevokeDevice");
357+
self.inner.unary(request.into_request(), path, codec).await
358+
}
359+
}
360+
}

cli/src/proto/services/universalwallet/v1/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ pub struct DeleteItemRequest {}
4747
#[derive(Clone, PartialEq, ::prost::Message)]
4848
pub struct DeleteItemResponse {}
4949
#[doc = r" Generated client implementations."]
50-
pub mod wallet_service_client {
50+
pub mod universal_wallet_client {
5151
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5252
use tonic::codegen::*;
5353
#[derive(Debug, Clone)]
54-
pub struct WalletServiceClient<T> {
54+
pub struct UniversalWalletClient<T> {
5555
inner: tonic::client::Grpc<T>,
5656
}
57-
impl WalletServiceClient<tonic::transport::Channel> {
57+
impl UniversalWalletClient<tonic::transport::Channel> {
5858
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
5959
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
6060
where
@@ -65,7 +65,7 @@ pub mod wallet_service_client {
6565
Ok(Self::new(conn))
6666
}
6767
}
68-
impl<T> WalletServiceClient<T>
68+
impl<T> UniversalWalletClient<T>
6969
where
7070
T: tonic::client::GrpcService<tonic::body::BoxBody>,
7171
T::ResponseBody: Body + Send + 'static,
@@ -79,7 +79,7 @@ pub mod wallet_service_client {
7979
pub fn with_interceptor<F>(
8080
inner: T,
8181
interceptor: F,
82-
) -> WalletServiceClient<InterceptedService<T, F>>
82+
) -> UniversalWalletClient<InterceptedService<T, F>>
8383
where
8484
F: tonic::service::Interceptor,
8585
T: tonic::codegen::Service<
@@ -91,7 +91,7 @@ pub mod wallet_service_client {
9191
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
9292
Into<StdError> + Send + Sync,
9393
{
94-
WalletServiceClient::new(InterceptedService::new(inner, interceptor))
94+
UniversalWalletClient::new(InterceptedService::new(inner, interceptor))
9595
}
9696
#[doc = r" Compress requests with `gzip`."]
9797
#[doc = r""]
@@ -119,7 +119,7 @@ pub mod wallet_service_client {
119119
})?;
120120
let codec = tonic::codec::ProstCodec::default();
121121
let path = http::uri::PathAndQuery::from_static(
122-
"/services.universalwallet.v1.WalletService/Search",
122+
"/services.universalwallet.v1.UniversalWallet/Search",
123123
);
124124
self.inner.unary(request.into_request(), path, codec).await
125125
}
@@ -136,7 +136,7 @@ pub mod wallet_service_client {
136136
})?;
137137
let codec = tonic::codec::ProstCodec::default();
138138
let path = http::uri::PathAndQuery::from_static(
139-
"/services.universalwallet.v1.WalletService/InsertItem",
139+
"/services.universalwallet.v1.UniversalWallet/InsertItem",
140140
);
141141
self.inner.unary(request.into_request(), path, codec).await
142142
}
@@ -153,7 +153,7 @@ pub mod wallet_service_client {
153153
})?;
154154
let codec = tonic::codec::ProstCodec::default();
155155
let path = http::uri::PathAndQuery::from_static(
156-
"/services.universalwallet.v1.WalletService/Deleteitem",
156+
"/services.universalwallet.v1.UniversalWallet/Deleteitem",
157157
);
158158
self.inner.unary(request.into_request(), path, codec).await
159159
}

cli/src/proto/services/verifiablecredentials/v1/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ pub struct SendResponse {
6464
pub status: i32,
6565
}
6666
#[doc = r" Generated client implementations."]
67-
pub mod credential_client {
67+
pub mod verifiable_credential_client {
6868
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
6969
use tonic::codegen::*;
7070
#[derive(Debug, Clone)]
71-
pub struct CredentialClient<T> {
71+
pub struct VerifiableCredentialClient<T> {
7272
inner: tonic::client::Grpc<T>,
7373
}
74-
impl CredentialClient<tonic::transport::Channel> {
74+
impl VerifiableCredentialClient<tonic::transport::Channel> {
7575
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
7676
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
7777
where
@@ -82,7 +82,7 @@ pub mod credential_client {
8282
Ok(Self::new(conn))
8383
}
8484
}
85-
impl<T> CredentialClient<T>
85+
impl<T> VerifiableCredentialClient<T>
8686
where
8787
T: tonic::client::GrpcService<tonic::body::BoxBody>,
8888
T::ResponseBody: Body + Send + 'static,
@@ -96,7 +96,7 @@ pub mod credential_client {
9696
pub fn with_interceptor<F>(
9797
inner: T,
9898
interceptor: F,
99-
) -> CredentialClient<InterceptedService<T, F>>
99+
) -> VerifiableCredentialClient<InterceptedService<T, F>>
100100
where
101101
F: tonic::service::Interceptor,
102102
T: tonic::codegen::Service<
@@ -108,7 +108,7 @@ pub mod credential_client {
108108
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
109109
Into<StdError> + Send + Sync,
110110
{
111-
CredentialClient::new(InterceptedService::new(inner, interceptor))
111+
VerifiableCredentialClient::new(InterceptedService::new(inner, interceptor))
112112
}
113113
#[doc = r" Compress requests with `gzip`."]
114114
#[doc = r""]
@@ -135,7 +135,7 @@ pub mod credential_client {
135135
})?;
136136
let codec = tonic::codec::ProstCodec::default();
137137
let path = http::uri::PathAndQuery::from_static(
138-
"/services.verifiablecredentials.v1.Credential/Issue",
138+
"/services.verifiablecredentials.v1.VerifiableCredential/Issue",
139139
);
140140
self.inner.unary(request.into_request(), path, codec).await
141141
}
@@ -151,7 +151,7 @@ pub mod credential_client {
151151
})?;
152152
let codec = tonic::codec::ProstCodec::default();
153153
let path = http::uri::PathAndQuery::from_static(
154-
"/services.verifiablecredentials.v1.Credential/IssueFromTemplate",
154+
"/services.verifiablecredentials.v1.VerifiableCredential/IssueFromTemplate",
155155
);
156156
self.inner.unary(request.into_request(), path, codec).await
157157
}
@@ -167,7 +167,7 @@ pub mod credential_client {
167167
})?;
168168
let codec = tonic::codec::ProstCodec::default();
169169
let path = http::uri::PathAndQuery::from_static(
170-
"/services.verifiablecredentials.v1.Credential/CreateProof",
170+
"/services.verifiablecredentials.v1.VerifiableCredential/CreateProof",
171171
);
172172
self.inner.unary(request.into_request(), path, codec).await
173173
}
@@ -183,7 +183,7 @@ pub mod credential_client {
183183
})?;
184184
let codec = tonic::codec::ProstCodec::default();
185185
let path = http::uri::PathAndQuery::from_static(
186-
"/services.verifiablecredentials.v1.Credential/VerifyProof",
186+
"/services.verifiablecredentials.v1.VerifiableCredential/VerifyProof",
187187
);
188188
self.inner.unary(request.into_request(), path, codec).await
189189
}
@@ -199,7 +199,7 @@ pub mod credential_client {
199199
})?;
200200
let codec = tonic::codec::ProstCodec::default();
201201
let path = http::uri::PathAndQuery::from_static(
202-
"/services.verifiablecredentials.v1.Credential/Send",
202+
"/services.verifiablecredentials.v1.VerifiableCredential/Send",
203203
);
204204
self.inner.unary(request.into_request(), path, codec).await
205205
}

cli/src/services/issuer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use trinsic::proto::services::common::v1::{json_payload::Json, JsonPayload};
22
use trinsic::proto::services::verifiablecredentials::v1::{
3-
credential_client::CredentialClient, CreateProofRequest, IssueRequest, VerifyProofRequest,
3+
verifiable_credential_client::VerifiableCredentialClient, CreateProofRequest, IssueRequest, VerifyProofRequest,
44
};
55
use trinsic::proto::JsonPretty;
66
use trinsic::utils::{read_file_as_string, write_file};
@@ -28,7 +28,7 @@ async fn issue(args: &IssueArgs, config: DefaultConfig) {
2828
let document: trinsic::proto::google::protobuf::Struct =
2929
trinsic::proto::google::protobuf::Struct::from_vec(&document).unwrap();
3030

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

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

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

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

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

102102
let request = tonic::Request::new(VerifyProofRequest {
103103
proof_document: Some(JsonPayload {

cli/src/services/wallet.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use trinsic::proto::google::protobuf::Struct;
88
use trinsic::proto::services::common::v1::json_payload::Json;
99
use trinsic::proto::services::common::v1::{JsonPayload, ServerConfig};
1010
use trinsic::proto::services::universalwallet::v1::{
11-
wallet_service_client::WalletServiceClient, InsertItemRequest, SearchRequest,
11+
universal_wallet_client::UniversalWalletClient, InsertItemRequest, SearchRequest,
1212
};
13-
use trinsic::proto::services::verifiablecredentials::v1::credential_client::CredentialClient;
13+
use trinsic::proto::services::verifiablecredentials::v1::verifiable_credential_client::VerifiableCredentialClient;
1414
use trinsic::proto::services::verifiablecredentials::v1::send_request::DeliveryMethod;
1515
use trinsic::proto::services::verifiablecredentials::v1::SendRequest;
1616
use trinsic::utils::read_file_as_string;
@@ -37,7 +37,7 @@ async fn search(args: &SearchArgs, config: DefaultConfig) {
3737
.await
3838
.expect("Unable to connect to server");
3939

40-
let mut client = WalletServiceClient::with_interceptor(channel, config);
40+
let mut client = UniversalWalletClient::with_interceptor(channel, config);
4141

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

77-
let mut client = WalletServiceClient::with_interceptor(channel, config);
77+
let mut client = UniversalWalletClient::with_interceptor(channel, config);
7878

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

108-
let mut client = CredentialClient::with_interceptor(channel, config);
108+
let mut client = VerifiableCredentialClient::with_interceptor(channel, config);
109109

110110
let response = client
111111
.send(SendRequest {

0 commit comments

Comments
 (0)