Skip to main content

xmtp_api_backend/endpoints/backend/
get_configuration.rs

1use prost::{Message, bytes::Bytes};
2use std::borrow::Cow;
3use xmtp_proto::{
4    api::{BodyError, Endpoint},
5    backend_v1,
6};
7
8/// Read what the deployment publishes about itself. Unauthenticated, so this
9/// is the one call a client makes before it knows whether it needs a
10/// credential.
11#[derive(Clone, Debug, Default)]
12pub struct GetConfiguration(pub backend_v1::GetConfigurationRequest);
13
14/// The one gRPC path the client auth middleware never attaches a credential to.
15pub const GET_CONFIGURATION_PATH: &str = "/xmtp.backend.v1.ConfigurationService/GetConfiguration";
16
17impl Endpoint for GetConfiguration {
18    type Output = backend_v1::GetConfigurationResponse;
19    fn grpc_endpoint(&self) -> Cow<'static, str> {
20        GET_CONFIGURATION_PATH.into()
21    }
22    fn body(&self) -> Result<Bytes, BodyError> {
23        Ok(self.0.encode_to_vec().into())
24    }
25}