add logic, not working tho
This commit is contained in:
@@ -10,6 +10,10 @@ use common::proto::multieko2::table_definition::{
|
||||
table_definition_client::TableDefinitionClient,
|
||||
ProfileTreeResponse, PostTableDefinitionRequest, TableDefinitionResponse,
|
||||
};
|
||||
use common::proto::multieko2::table_script::{
|
||||
table_script_client::TableScriptClient,
|
||||
PostTableScriptRequest, TableScriptResponse,
|
||||
};
|
||||
use anyhow::Result;
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -17,6 +21,7 @@ pub struct GrpcClient {
|
||||
adresar_client: AdresarClient<Channel>,
|
||||
table_structure_client: TableStructureServiceClient<Channel>,
|
||||
table_definition_client: TableDefinitionClient<Channel>,
|
||||
table_script_client: TableScriptClient<Channel>,
|
||||
}
|
||||
|
||||
impl GrpcClient {
|
||||
@@ -24,11 +29,13 @@ impl GrpcClient {
|
||||
let adresar_client = AdresarClient::connect("http://[::1]:50051").await?;
|
||||
let table_structure_client = TableStructureServiceClient::connect("http://[::1]:50051").await?;
|
||||
let table_definition_client = TableDefinitionClient::connect("http://[::1]:50051").await?;
|
||||
let table_script_client = TableScriptClient::connect("http://[::1]:50051").await?;
|
||||
|
||||
Ok(Self {
|
||||
adresar_client,
|
||||
table_structure_client,
|
||||
table_definition_client,
|
||||
table_script_client,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -73,4 +80,11 @@ impl GrpcClient {
|
||||
let response = self.table_definition_client.post_table_definition(tonic_request).await?;
|
||||
Ok(response.into_inner())
|
||||
}
|
||||
|
||||
pub async fn post_table_script(&mut self, request: PostTableScriptRequest) -> Result<TableScriptResponse> {
|
||||
let tonic_request = tonic::Request::new(request);
|
||||
let response = self.table_script_client.post_table_script(tonic_request).await?;
|
||||
Ok(response.into_inner())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user