Skip to main content

nil_client/client/npc/
precursor.rs

1// Copyright (C) Call of Nil contributors
2// SPDX-License-Identifier: AGPL-3.0-only
3
4use crate::client::Client;
5use crate::error::Result;
6use crate::http;
7use nil_payload::request::npc::precursor::*;
8use nil_payload::response::npc::precursor::*;
9
10impl Client {
11  pub async fn get_precursor_coords(
12    &self,
13    req: GetPrecursorCoordsRequest,
14  ) -> Result<GetPrecursorCoordsResponse> {
15    http::json_put("get-precursor-coords")
16      .body(req)
17      .server(self.server)
18      .circuit_breaker(self.circuit_breaker())
19      .retry(&self.retry)
20      .user_agent(&self.user_agent)
21      .send()
22      .await
23  }
24
25  pub async fn get_public_precursor(
26    &self,
27    req: GetPublicPrecursorRequest,
28  ) -> Result<GetPublicPrecursorResponse> {
29    http::json_put("get-public-precursor")
30      .body(req)
31      .server(self.server)
32      .circuit_breaker(self.circuit_breaker())
33      .retry(&self.retry)
34      .user_agent(&self.user_agent)
35      .send()
36      .await
37  }
38
39  pub async fn get_public_precursors(
40    &self,
41    req: GetPublicPrecursorsRequest,
42  ) -> Result<GetPublicPrecursorsResponse> {
43    http::json_put("get-public-precursors")
44      .body(req)
45      .server(self.server)
46      .circuit_breaker(self.circuit_breaker())
47      .retry(&self.retry)
48      .user_agent(&self.user_agent)
49      .send()
50      .await
51  }
52}