Skip to main content

nil_client/client/cheat/
npc.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::cheat::npc::*;
8use nil_payload::response::cheat::npc::*;
9
10impl Client {
11  pub async fn cheat_get_ethics(
12    &self,
13    req: CheatGetEthicsRequest,
14  ) -> Result<CheatGetEthicsResponse> {
15    http::json_put("cheat-get-ethics")
16      .body(req)
17      .server(self.server)
18      .maybe_authorization(self.authorization.as_ref())
19      .circuit_breaker(self.circuit_breaker())
20      .retry(&self.retry)
21      .user_agent(&self.user_agent)
22      .send()
23      .await
24  }
25
26  pub async fn cheat_set_bot_ethics(&self, req: CheatSetBotEthicsRequest) -> Result<()> {
27    http::post("cheat-set-bot-ethics")
28      .body(req)
29      .server(self.server)
30      .maybe_authorization(self.authorization.as_ref())
31      .circuit_breaker(self.circuit_breaker())
32      .user_agent(&self.user_agent)
33      .send()
34      .await
35  }
36
37  pub async fn cheat_spawn_bot(&self, req: CheatSpawnBotRequest) -> Result<CheatSpawnBotResponse> {
38    http::json_post("cheat-spawn-bot")
39      .body(req)
40      .server(self.server)
41      .maybe_authorization(self.authorization.as_ref())
42      .circuit_breaker(self.circuit_breaker())
43      .user_agent(&self.user_agent)
44      .send()
45      .await
46  }
47}