Skip to main content

nil_client/client/cheat/
military.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::military::army::Army;
8use nil_core::military::army::personnel::ArmyPersonnel;
9use nil_payload::cheat::military::*;
10
11impl Client {
12  pub async fn cheat_get_idle_armies_at(
13    &self,
14    req: CheatGetIdleArmiesAtRequest,
15  ) -> Result<Vec<Army>> {
16    http::json_post("cheat-get-idle-armies-at")
17      .body(req)
18      .server(self.server)
19      .maybe_authorization(self.authorization.as_ref())
20      .user_agent(&self.user_agent)
21      .send()
22      .await
23  }
24
25  pub async fn cheat_get_idle_personnel_at(
26    &self,
27    req: CheatGetIdlePersonnelAtRequest,
28  ) -> Result<ArmyPersonnel> {
29    http::json_post("cheat-get-idle-personnel-at")
30      .body(req)
31      .server(self.server)
32      .maybe_authorization(self.authorization.as_ref())
33      .user_agent(&self.user_agent)
34      .send()
35      .await
36  }
37
38  pub async fn cheat_spawn_personnel(&self, req: CheatSpawnPersonnelRequest) -> Result<()> {
39    http::post("cheat-spawn-personnel")
40      .body(req)
41      .server(self.server)
42      .maybe_authorization(self.authorization.as_ref())
43      .user_agent(&self.user_agent)
44      .send()
45      .await
46  }
47}