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_core::continent::Coord;
8use nil_core::npc::precursor::PublicPrecursor;
9use nil_payload::npc::precursor::*;
10
11impl Client {
12  pub async fn get_precursor_coords(&self, req: GetPrecursorCoordsRequest) -> Result<Vec<Coord>> {
13    http::json_post("get-precursor-coords")
14      .body(req)
15      .server(self.server)
16      .user_agent(&self.user_agent)
17      .send()
18      .await
19  }
20
21  pub async fn get_public_precursor(
22    &self,
23    req: GetPublicPrecursorRequest,
24  ) -> Result<PublicPrecursor> {
25    http::json_post("get-public-precursor")
26      .body(req)
27      .server(self.server)
28      .user_agent(&self.user_agent)
29      .send()
30      .await
31  }
32
33  pub async fn get_public_precursors(
34    &self,
35    req: GetPublicPrecursorsRequest,
36  ) -> Result<Vec<PublicPrecursor>> {
37    http::json_post("get-public-precursors")
38      .body(req)
39      .server(self.server)
40      .user_agent(&self.user_agent)
41      .send()
42      .await
43  }
44}