Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
943 B · 41 lines
Rust
at develop
123456789101112131415161718192021222324252627282930313233343536373839404142use reqwest::{Method, header::HeaderMap};use serde::Deserialize;use serde_json::{Map, Value};
use crate::{Error, PocketBase};
#[derive(Clone, Debug)]/// Service that handles the Health APIs.pub struct HealthService<'a> { /// Reference to the PocketBase client. pub(super) client: &'a PocketBase, /// Optional comma-separated list of fields to include in the response. pub(super) fields: Option<String>,}
#[derive(Clone, Debug, Deserialize)]pub struct HealthCheck { /// Status message. pub message: String, /// Additional data. pub data: Map<String, Value>,}
impl HealthService<'_> { /// Checks the health status of the api. pub async fn check(self) -> Result<HealthCheck, Error> { let mut params = Vec::new(); if let Some(fields) = self.fields { params.push(("fields", fields)); } self.client .send( "/api/health", Method::GET, HeaderMap::new(), ¶ms, None::<&()>, ) .await }}