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