Skip to main content

nil_client/client/
report.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use super::Client;
5use crate::error::Result;
6use crate::http;
7use nil_core::report::ReportKind;
8use nil_payload::report::*;
9
10impl Client {
11  pub async fn get_report(&self, req: GetReportRequest) -> Result<ReportKind> {
12    http::json_post("get-report")
13      .body(req)
14      .server(self.server)
15      .maybe_authorization(self.authorization.as_ref())
16      .user_agent(&self.user_agent)
17      .send()
18      .await
19  }
20
21  pub async fn get_reports(&self, req: GetReportsRequest) -> Result<Vec<ReportKind>> {
22    http::json_post("get-reports")
23      .body(req)
24      .server(self.server)
25      .maybe_authorization(self.authorization.as_ref())
26      .user_agent(&self.user_agent)
27      .send()
28      .await
29  }
30}