compiled, scuffed position
This commit is contained in:
@@ -7,10 +7,12 @@ use crossterm::{
|
|||||||
use ratatui::{backend::CrosstermBackend, Terminal};
|
use ratatui::{backend::CrosstermBackend, Terminal};
|
||||||
use std::io::{self, stdout};
|
use std::io::{self, stdout};
|
||||||
use tonic::transport::Channel;
|
use tonic::transport::Channel;
|
||||||
use crate::proto::multieko2::adresar_client::AdresarClient;
|
use crate::proto::multieko2::{
|
||||||
|
adresar_client::AdresarClient,
|
||||||
|
Empty, CountResponse, PositionRequest,
|
||||||
|
AdresarResponse, PostAdresarRequest
|
||||||
|
};
|
||||||
use crate::client::config::Config;
|
use crate::client::config::Config;
|
||||||
use crate::proto::multieko2::{Empty, CountResponse, PositionRequest, AdresarResponse};
|
|
||||||
use crate::proto::multieko2::PostAdresarRequest;
|
|
||||||
|
|
||||||
pub struct AppTerminal {
|
pub struct AppTerminal {
|
||||||
terminal: Terminal<CrosstermBackend<io::Stdout>>,
|
terminal: Terminal<CrosstermBackend<io::Stdout>>,
|
||||||
@@ -86,14 +88,14 @@ impl AppTerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a method to get the total count of Adresar entries
|
// Add a method to get the total count of Adresar entries
|
||||||
pub async fn get_adresar_count(&self) -> Result<u64, Box<dyn std::error::Error>> {
|
pub async fn get_adresar_count(&mut self) -> Result<u64, Box<dyn std::error::Error>> {
|
||||||
let request = tonic::Request::new(Empty {});
|
let request = tonic::Request::new(Empty::default());
|
||||||
let response: CountResponse = self.grpc_client.get_adresar_count(request).await?.into_inner();
|
let response: CountResponse = self.grpc_client.get_adresar_count(request).await?.into_inner();
|
||||||
Ok(response.count as u64)
|
Ok(response.count as u64)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a method to get an Adresar entry by its position
|
// Add a method to get an Adresar entry by its position
|
||||||
pub async fn get_adresar_by_position(&self, position: u64) -> Result<AdresarResponse, Box<dyn std::error::Error>> {
|
pub async fn get_adresar_by_position(&mut self, position: u64) -> Result<crate::proto::multieko2::AdresarResponse, Box<dyn std::error::Error>> {
|
||||||
let request = tonic::Request::new(PositionRequest { position: position as i64 });
|
let request = tonic::Request::new(PositionRequest { position: position as i64 });
|
||||||
let response: AdresarResponse = self.grpc_client.get_adresar_by_position(request).await?.into_inner();
|
let response: AdresarResponse = self.grpc_client.get_adresar_by_position(request).await?.into_inner();
|
||||||
Ok(response)
|
Ok(response)
|
||||||
|
|||||||
Reference in New Issue
Block a user