holger-cli/src/generated/holger.account.v1.rs
// @generated by `cargo xtask gen-proto` (protox + tonic-build, no protoc).
// DO NOT EDIT BY HAND. Regenerate after changing proto/holger.proto.
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GrantRequest {
#[prost(string, tag = "1")]
pub repository: ::prost::alloc::string::String,
/// The person: their name on this server, or their subject (`passkey:…`).
#[prost(string, tag = "2")]
pub person: ::prost::alloc::string::String,
/// `read`, `write` (read and write) or `none` (revoke).
#[prost(string, tag = "3")]
pub access: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GrantReply {
#[prost(string, tag = "1")]
pub repository: ::prost::alloc::string::String,
/// Every grant the repository holds now.
#[prost(message, repeated, tag = "2")]
pub grants: ::prost::alloc::vec::Vec<RepositoryGrant>,
/// One sentence for the console.
#[prost(string, tag = "3")]
pub words: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RepositoryGrant {
/// The person's name here (their subject when no name is known).
#[prost(string, tag = "1")]
pub person: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub subject: ::prost::alloc::string::String,
/// `read` or `write`.
#[prost(string, tag = "3")]
pub access: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MyRepositoriesRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MyRepositoriesReply {
#[prost(message, repeated, tag = "1")]
pub repositories: ::prost::alloc::vec::Vec<MyRepository>,
/// The formats CreateRepository makes here for this caller ("cargo", "pip",
/// "npm", "maven", "raw", "oci"). Empty: this caller makes none.
#[prost(string, repeated, tag = "2")]
pub formats: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// One sentence for the console to show as it is: who may make one, or why
/// nothing is listed.
#[prost(string, tag = "3")]
pub words: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MyRepository {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// The client's word for its format: "cargo", "pip", "npm", "maven", "raw",
/// "oci", or the server's own type name for any other.
#[prost(string, tag = "2")]
pub format: ::prost::alloc::string::String,
/// Its reads need a credential of this server.
#[prost(bool, tag = "3")]
pub private: bool,
/// The principal it was made for; empty for the estate's own repositories and
/// for a sale whose buyer has not registered yet.
#[prost(string, tag = "4")]
pub owner: ::prost::alloc::string::String,
/// A door serves it now. False: it is made and is served from the next start
/// (`words` says why).
#[prost(bool, tag = "5")]
pub served: bool,
/// The client setup for this repository, written by this server.
#[prost(message, repeated, tag = "6")]
pub clients: ::prost::alloc::vec::Vec<ClientSetup>,
/// One sentence for the console to show as it is.
#[prost(string, tag = "7")]
pub words: ::prost::alloc::string::String,
/// ── Its plan, as this server holds it (the ONE shop's signed fact) ──
/// The plan's name; empty when nothing is bought for it (it is free).
#[prost(string, tag = "8")]
pub plan: ::prost::alloc::string::String,
/// This server's word for where the plan stands: "free", "paid", "grace",
/// "suspended", "retention", or "lapsed" (paid until a date that has passed,
/// and no renewal has reached this server: uploads are refused until it is
/// paid again).
#[prost(string, tag = "9")]
pub plan_state: ::prost::alloc::string::String,
/// Paid until, Unix milliseconds; 0 when the fact names no date.
#[prost(int64, tag = "10")]
pub paid_until_unix_ms: i64,
/// One sentence for the console to show as it is, about the plan.
#[prost(string, tag = "11")]
pub plan_words: ::prost::alloc::string::String,
/// The people its owner granted (lane P1): shown to its owner and to an admin only.
#[prost(message, repeated, tag = "12")]
pub grants: ::prost::alloc::vec::Vec<RepositoryGrant>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ClientSetup {
/// "cargo", "pip", "npm", "maven", "curl", "docker".
#[prost(string, tag = "1")]
pub client: ::prost::alloc::string::String,
/// Where the snippet goes ("~/.cargo/config.toml"), or "shell".
#[prost(string, tag = "2")]
pub file: ::prost::alloc::string::String,
/// The text, with YOUR-TOKEN where a token from My tokens goes.
#[prost(string, tag = "3")]
pub snippet: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateRepositoryRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// One of `MyRepositoriesReply.formats`.
#[prost(string, tag = "2")]
pub format: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateRepositoryReply {
#[prost(message, optional, tag = "1")]
pub repository: ::core::option::Option<MyRepository>,
/// One sentence for the console to show as it is.
#[prost(string, tag = "2")]
pub words: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod account_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct AccountServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AccountServiceClient<tonic::transport::Channel> {
/// 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: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> AccountServiceClient<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,
) -> AccountServiceClient<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,
{
AccountServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// The repositories the caller has here: the ones made for them (they are the
/// owner), and for an ADMIN of this server every repository but the estate's
/// system ones. Anonymous: none, with the words to sign in. Never refused.
pub async fn my_repositories(
&mut self,
request: impl tonic::IntoRequest<super::MyRepositoriesRequest>,
) -> std::result::Result<
tonic::Response<super::MyRepositoriesReply>,
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(
"/holger.account.v1.AccountService/MyRepositories",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("holger.account.v1.AccountService", "MyRepositories"),
);
self.inner.unary(req, path, codec).await
}
/// ADMIN of this server. Make a PRIVATE repository the caller owns, in one of
/// the formats `MyRepositoriesReply.formats` names. Its reads need a
/// credential of this server from the first request. The name is taken once:
/// a name this server serves or has made is ALREADY_EXISTS; a name that is no
/// repository name is INVALID_ARGUMENT; a format this server makes none of is
/// FAILED_PRECONDITION. A twin, a growth or a read-only server refuses as
/// every admin change does. The repository rides the twin and comes back with
/// a recharge, as a sold one does.
pub async fn create_repository(
&mut self,
request: impl tonic::IntoRequest<super::CreateRepositoryRequest>,
) -> std::result::Result<
tonic::Response<super::CreateRepositoryReply>,
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(
"/holger.account.v1.AccountService/CreateRepository",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"holger.account.v1.AccountService",
"CreateRepository",
),
);
self.inner.unary(req, path, codec).await
}
/// **The owner grants or revokes** (lane P1): a named person (their name here, or their
/// subject) may read, or read and write, one owner-only repository; `none` revokes. Its
/// OWNER only, or an admin of this server; every change is audited. The person keeps no
/// role elsewhere from it.
pub async fn grant(
&mut self,
request: impl tonic::IntoRequest<super::GrantRequest>,
) -> std::result::Result<tonic::Response<super::GrantReply>, 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(
"/holger.account.v1.AccountService/Grant",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("holger.account.v1.AccountService", "Grant"));
self.inner.unary(req, path, codec).await
}
}
}