gewe_http/personal/
safety.rs1use crate::client::GeweHttpClient;
2use gewe_core::{GetSafetyInfoRequest, GetSafetyInfoResponse, GeweError};
3use tracing::instrument;
4
5impl GeweHttpClient {
6 #[instrument(skip(self))]
7 pub async fn get_safety_info(
8 &self,
9 req: GetSafetyInfoRequest<'_>,
10 ) -> Result<GetSafetyInfoResponse, GeweError> {
11 let env = self
12 .post_api::<_, GetSafetyInfoResponse>("gewe/v2/api/personal/getSafetyInfo", &req)
13 .await?;
14 env.data.ok_or(GeweError::MissingData)
15 }
16}
17
18#[cfg(test)]
19mod tests {
20 use super::*;
21
22 #[test]
23 fn test_get_safety_info_request() {
24 let req = GetSafetyInfoRequest { app_id: "test_app" };
25 let json = serde_json::to_string(&req).expect("Failed to serialize");
26 assert!(json.contains("appId"));
27 }
28}