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  /// Endpoint: `PUT /get-precursor-coords`
12  pub async fn get_precursor_coords(
13    &self,
14    req: GetPrecursorCoordsRequest,
15  ) -> Result<GetPrecursorCoordsResponse> {
16    http::json_put("get-precursor-coords")
17      .body(req)
18      .server(self.server)
19      .circuit_breaker(self.circuit_breaker())
20      .retry(&self.retry)
21      .user_agent(&self.user_agent)
22      .send()
23      .await
24  }
25
26  /// Endpoint: `PUT /get-public-precursor`
27  pub async fn get_public_precursor(
28    &self,
29    req: GetPublicPrecursorRequest,
30  ) -> Result<GetPublicPrecursorResponse> {
31    http::json_put("get-public-precursor")
32      .body(req)
33      .server(self.server)
34      .circuit_breaker(self.circuit_breaker())
35      .retry(&self.retry)
36      .user_agent(&self.user_agent)
37      .send()
38      .await
39  }
40
41  /// Endpoint: `PUT /get-public-precursors`
42  pub async fn get_public_precursors(
43    &self,
44    req: GetPublicPrecursorsRequest,
45  ) -> Result<GetPublicPrecursorsResponse> {
46    http::json_put("get-public-precursors")
47      .body(req)
48      .server(self.server)
49      .circuit_breaker(self.circuit_breaker())
50      .retry(&self.retry)
51      .user_agent(&self.user_agent)
52      .send()
53      .await
54  }
55}