pub struct KaslServer { /* private fields */ }Expand description
A client bound to one kasl-server instance.
Implementations§
Source§impl KaslServer
impl KaslServer
Sourcepub fn new(config: &KaslServerConfig) -> Result<Self>
pub fn new(config: &KaslServerConfig) -> Result<Self>
Builds a client for the configured server.
A configured CA certificate is added to the trust store rather than replacing it: a company CA for the server and public CAs for everything else is the normal self-hosted arrangement.
Sourcepub async fn health(&self) -> Result<Health>
pub async fn health(&self) -> Result<Health>
Asks the server whether it is serviceable, and which version it runs.
Unauthenticated: this is the call that tells a misspelled URL from a bad token, so it must not need the token to answer.
Sourcepub async fn identify(&self, token: &str) -> Result<AgentIdentity>
pub async fn identify(&self, token: &str) -> Result<AgentIdentity>
Resolves the agent token to the person it reports for.
Doubles as the token check: the server refuses an unknown, revoked, or
deactivated token with 401, which is reported as such rather than as
a transport failure.
Sourcepub async fn upload_day(
&self,
token: &str,
day: &DayUpload,
) -> Result<DayAccepted, UploadError>
pub async fn upload_day( &self, token: &str, day: &DayUpload, ) -> Result<DayAccepted, UploadError>
Sends one day to POST /api/v1/days.
The last upload wins on the server, so re-sending a day corrects it
and sending the same day twice changes nothing (ADR 0004). That makes
a retry safe by construction, which is what the failure split here is
for: UploadError separates a payload the server will never take
from a server that could not answer this time.
Trait Implementations§
Source§impl Clone for KaslServer
impl Clone for KaslServer
Source§fn clone(&self) -> KaslServer
fn clone(&self) -> KaslServer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more