#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetSnippetsRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub since: i64,
#[prost(string, tag = "3")]
pub library_id: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub limit: i32,
#[prost(int32, tag = "5")]
pub offset: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PushSnippetsRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub library_id: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub snippets: ::prost::alloc::vec::Vec<Snippet>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PushSnippetsResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(int32, tag = "3")]
pub accepted_count: i32,
#[prost(int32, tag = "4")]
pub rejected_count: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "2")]
pub local_snippets: ::prost::alloc::vec::Vec<Snippet>,
#[prost(int64, tag = "3")]
pub last_sync_timestamp: i64,
#[prost(string, tag = "4")]
pub library_id: ::prost::alloc::string::String,
#[prost(int32, tag = "5")]
pub limit: i32,
#[prost(int32, tag = "6")]
pub offset: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "3")]
pub snippets: ::prost::alloc::vec::Vec<Snippet>,
#[prost(int64, tag = "4")]
pub server_timestamp: i64,
#[prost(int32, tag = "5")]
pub skipped_count: i32,
#[prost(string, repeated, tag = "6")]
pub skipped_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "7")]
pub has_more: bool,
#[prost(int32, tag = "8")]
pub total_count: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Snippet {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub command: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "4")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int64, tag = "5")]
pub created_at: i64,
#[prost(int64, tag = "6")]
pub updated_at: i64,
#[prost(string, tag = "7")]
pub device_id: ::prost::alloc::string::String,
#[prost(bool, tag = "8")]
pub deleted: bool,
#[prost(bool, tag = "9")]
pub encrypted: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SnippetList {
#[prost(message, repeated, tag = "1")]
pub snippets: ::prost::alloc::vec::Vec<Snippet>,
#[prost(int32, tag = "2")]
pub total_count: i32,
#[prost(bool, tag = "3")]
pub has_more: bool,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HealthResponse {
#[prost(bool, tag = "1")]
pub healthy: bool,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RegisterRequest {
#[prost(string, tag = "1")]
pub device_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RegisterResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub api_key: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub message: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub device_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateLibraryRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateLibraryResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub library_id: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListLibrariesRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(int32, tag = "2")]
pub limit: i32,
#[prost(int32, tag = "3")]
pub offset: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListLibrariesResponse {
#[prost(message, repeated, tag = "1")]
pub libraries: ::prost::alloc::vec::Vec<Library>,
#[prost(int32, tag = "2")]
pub total_count: i32,
#[prost(bool, tag = "3")]
pub has_more: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteLibraryRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub library_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteLibraryResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Library {
#[prost(string, tag = "1")]
pub id: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub created_at: i64,
#[prost(int64, tag = "4")]
pub snippet_count: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ListPremadeLibrariesRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPremadeLibrariesResponse {
#[prost(message, repeated, tag = "1")]
pub libraries: ::prost::alloc::vec::Vec<PremadeLibrary>,
#[prost(bool, tag = "2")]
pub has_more: bool,
#[prost(int32, tag = "3")]
pub total_count: i32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PremadeLibrary {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub filename: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub description: ::prost::alloc::string::String,
#[prost(int32, tag = "4")]
pub snippet_count: i32,
#[prost(string, repeated, tag = "5")]
pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetPremadeLibraryRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub filename: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetPremadeLibraryResponse {
#[prost(bool, tag = "1")]
pub success: bool,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub content: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub message: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SearchPremadeLibrariesRequest {
#[prost(string, tag = "1")]
pub api_key: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub query: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SearchPremadeLibrariesResponse {
#[prost(message, repeated, tag = "1")]
pub libraries: ::prost::alloc::vec::Vec<PremadeLibrary>,
#[prost(int32, tag = "2")]
pub total_count: i32,
}
pub mod snippet_sync_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::http::Uri;
use tonic::codegen::*;
#[derive(Debug, Clone)]
pub struct SnippetSyncClient<T> {
inner: tonic::client::Grpc<T>,
}
impl SnippetSyncClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SnippetSyncClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> SnippetSyncClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
Into<StdError> + std::marker::Send + std::marker::Sync,
{
SnippetSyncClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn get_snippets(
&mut self,
request: impl tonic::IntoRequest<super::GetSnippetsRequest>,
) -> std::result::Result<tonic::Response<super::SnippetList>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/GetSnippets");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "GetSnippets"));
self.inner.unary(req, path, codec).await
}
pub async fn push_snippets(
&mut self,
request: impl tonic::IntoRequest<super::PushSnippetsRequest>,
) -> std::result::Result<tonic::Response<super::PushSnippetsResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/PushSnippets");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "PushSnippets"));
self.inner.unary(req, path, codec).await
}
pub async fn sync(
&mut self,
request: impl tonic::IntoRequest<super::SyncRequest>,
) -> std::result::Result<tonic::Response<super::SyncResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/Sync");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "Sync"));
self.inner.unary(req, path, codec).await
}
pub async fn health(
&mut self,
request: impl tonic::IntoRequest<super::HealthRequest>,
) -> std::result::Result<tonic::Response<super::HealthResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/Health");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "Health"));
self.inner.unary(req, path, codec).await
}
pub async fn register(
&mut self,
request: impl tonic::IntoRequest<super::RegisterRequest>,
) -> std::result::Result<tonic::Response<super::RegisterResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/Register");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "Register"));
self.inner.unary(req, path, codec).await
}
pub async fn create_library(
&mut self,
request: impl tonic::IntoRequest<super::CreateLibraryRequest>,
) -> std::result::Result<tonic::Response<super::CreateLibraryResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/CreateLibrary");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "CreateLibrary"));
self.inner.unary(req, path, codec).await
}
pub async fn list_libraries(
&mut self,
request: impl tonic::IntoRequest<super::ListLibrariesRequest>,
) -> std::result::Result<tonic::Response<super::ListLibrariesResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/ListLibraries");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "ListLibraries"));
self.inner.unary(req, path, codec).await
}
pub async fn delete_library(
&mut self,
request: impl tonic::IntoRequest<super::DeleteLibraryRequest>,
) -> std::result::Result<tonic::Response<super::DeleteLibraryResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/DeleteLibrary");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("snip_proto.SnippetSync", "DeleteLibrary"));
self.inner.unary(req, path, codec).await
}
pub async fn list_premade_libraries(
&mut self,
request: impl tonic::IntoRequest<super::ListPremadeLibrariesRequest>,
) -> std::result::Result<tonic::Response<super::ListPremadeLibrariesResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/snip_proto.SnippetSync/ListPremadeLibraries",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"snip_proto.SnippetSync",
"ListPremadeLibraries",
));
self.inner.unary(req, path, codec).await
}
pub async fn get_premade_library(
&mut self,
request: impl tonic::IntoRequest<super::GetPremadeLibraryRequest>,
) -> std::result::Result<tonic::Response<super::GetPremadeLibraryResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path =
http::uri::PathAndQuery::from_static("/snip_proto.SnippetSync/GetPremadeLibrary");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"snip_proto.SnippetSync",
"GetPremadeLibrary",
));
self.inner.unary(req, path, codec).await
}
pub async fn search_premade_libraries(
&mut self,
request: impl tonic::IntoRequest<super::SearchPremadeLibrariesRequest>,
) -> std::result::Result<
tonic::Response<super::SearchPremadeLibrariesResponse>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/snip_proto.SnippetSync/SearchPremadeLibraries",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new(
"snip_proto.SnippetSync",
"SearchPremadeLibraries",
));
self.inner.unary(req, path, codec).await
}
}
}
pub mod snippet_sync_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value
)]
use tonic::codegen::*;
#[async_trait]
pub trait SnippetSync: std::marker::Send + std::marker::Sync + 'static {
async fn get_snippets(
&self,
request: tonic::Request<super::GetSnippetsRequest>,
) -> std::result::Result<tonic::Response<super::SnippetList>, tonic::Status>;
async fn push_snippets(
&self,
request: tonic::Request<super::PushSnippetsRequest>,
) -> std::result::Result<tonic::Response<super::PushSnippetsResponse>, tonic::Status>;
async fn sync(
&self,
request: tonic::Request<super::SyncRequest>,
) -> std::result::Result<tonic::Response<super::SyncResponse>, tonic::Status>;
async fn health(
&self,
request: tonic::Request<super::HealthRequest>,
) -> std::result::Result<tonic::Response<super::HealthResponse>, tonic::Status>;
async fn register(
&self,
request: tonic::Request<super::RegisterRequest>,
) -> std::result::Result<tonic::Response<super::RegisterResponse>, tonic::Status>;
async fn create_library(
&self,
request: tonic::Request<super::CreateLibraryRequest>,
) -> std::result::Result<tonic::Response<super::CreateLibraryResponse>, tonic::Status>;
async fn list_libraries(
&self,
request: tonic::Request<super::ListLibrariesRequest>,
) -> std::result::Result<tonic::Response<super::ListLibrariesResponse>, tonic::Status>;
async fn delete_library(
&self,
request: tonic::Request<super::DeleteLibraryRequest>,
) -> std::result::Result<tonic::Response<super::DeleteLibraryResponse>, tonic::Status>;
async fn list_premade_libraries(
&self,
request: tonic::Request<super::ListPremadeLibrariesRequest>,
) -> std::result::Result<tonic::Response<super::ListPremadeLibrariesResponse>, tonic::Status>;
async fn get_premade_library(
&self,
request: tonic::Request<super::GetPremadeLibraryRequest>,
) -> std::result::Result<tonic::Response<super::GetPremadeLibraryResponse>, tonic::Status>;
async fn search_premade_libraries(
&self,
request: tonic::Request<super::SearchPremadeLibrariesRequest>,
) -> std::result::Result<
tonic::Response<super::SearchPremadeLibrariesResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct SnippetSyncServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> SnippetSyncServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for SnippetSyncServer<T>
where
T: SnippetSync,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/snip_proto.SnippetSync/GetSnippets" => {
#[allow(non_camel_case_types)]
struct GetSnippetsSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::GetSnippetsRequest> for GetSnippetsSvc<T> {
type Response = super::SnippetList;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetSnippetsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::get_snippets(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetSnippetsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/PushSnippets" => {
#[allow(non_camel_case_types)]
struct PushSnippetsSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::PushSnippetsRequest>
for PushSnippetsSvc<T>
{
type Response = super::PushSnippetsResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::PushSnippetsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::push_snippets(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = PushSnippetsSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/Sync" => {
#[allow(non_camel_case_types)]
struct SyncSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::SyncRequest> for SyncSvc<T> {
type Response = super::SyncResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::SyncRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as SnippetSync>::sync(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SyncSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/Health" => {
#[allow(non_camel_case_types)]
struct HealthSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::HealthRequest> for HealthSvc<T> {
type Response = super::HealthResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::HealthRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as SnippetSync>::health(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = HealthSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/Register" => {
#[allow(non_camel_case_types)]
struct RegisterSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::RegisterRequest> for RegisterSvc<T> {
type Response = super::RegisterResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::RegisterRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as SnippetSync>::register(&inner, request).await };
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = RegisterSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/CreateLibrary" => {
#[allow(non_camel_case_types)]
struct CreateLibrarySvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::CreateLibraryRequest>
for CreateLibrarySvc<T>
{
type Response = super::CreateLibraryResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::CreateLibraryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::create_library(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = CreateLibrarySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/ListLibraries" => {
#[allow(non_camel_case_types)]
struct ListLibrariesSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::ListLibrariesRequest>
for ListLibrariesSvc<T>
{
type Response = super::ListLibrariesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ListLibrariesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::list_libraries(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListLibrariesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/DeleteLibrary" => {
#[allow(non_camel_case_types)]
struct DeleteLibrarySvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync> tonic::server::UnaryService<super::DeleteLibraryRequest>
for DeleteLibrarySvc<T>
{
type Response = super::DeleteLibraryResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::DeleteLibraryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::delete_library(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = DeleteLibrarySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/ListPremadeLibraries" => {
#[allow(non_camel_case_types)]
struct ListPremadeLibrariesSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync>
tonic::server::UnaryService<super::ListPremadeLibrariesRequest>
for ListPremadeLibrariesSvc<T>
{
type Response = super::ListPremadeLibrariesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::ListPremadeLibrariesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::list_premade_libraries(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListPremadeLibrariesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/GetPremadeLibrary" => {
#[allow(non_camel_case_types)]
struct GetPremadeLibrarySvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync>
tonic::server::UnaryService<super::GetPremadeLibraryRequest>
for GetPremadeLibrarySvc<T>
{
type Response = super::GetPremadeLibraryResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::GetPremadeLibraryRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::get_premade_library(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = GetPremadeLibrarySvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/snip_proto.SnippetSync/SearchPremadeLibraries" => {
#[allow(non_camel_case_types)]
struct SearchPremadeLibrariesSvc<T: SnippetSync>(pub Arc<T>);
impl<T: SnippetSync>
tonic::server::UnaryService<super::SearchPremadeLibrariesRequest>
for SearchPremadeLibrariesSvc<T>
{
type Response = super::SearchPremadeLibrariesResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(
&mut self,
request: tonic::Request<super::SearchPremadeLibrariesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SnippetSync>::search_premade_libraries(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = SearchPremadeLibrariesSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => Box::pin(async move {
let mut response = http::Response::new(tonic::body::Body::default());
let headers = response.headers_mut();
headers.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
}),
}
}
}
impl<T> Clone for SnippetSyncServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
pub const SERVICE_NAME: &str = "snip_proto.SnippetSync";
impl<T> tonic::server::NamedService for SnippetSyncServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}