Skip to main content

nil_client/client/npc/
bot.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::bot::PublicBot;
9use nil_payload::npc::bot::*;
10
11impl Client {
12  pub async fn get_bot_coords(&self, req: GetBotCoordsRequest) -> Result<Vec<Coord>> {
13    http::json_post("get-bot-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_bot(&self, req: GetPublicBotRequest) -> Result<PublicBot> {
22    http::json_post("get-public-bot")
23      .body(req)
24      .server(self.server)
25      .user_agent(&self.user_agent)
26      .send()
27      .await
28  }
29
30  pub async fn get_public_bots(&self, req: GetPublicBotsRequest) -> Result<Vec<PublicBot>> {
31    http::json_post("get-public-bots")
32      .body(req)
33      .server(self.server)
34      .user_agent(&self.user_agent)
35      .send()
36      .await
37  }
38}