nil-client 0.5.4

Multiplayer strategy game
Documentation
// Copyright (C) Call of Nil contributors
// SPDX-License-Identifier: AGPL-3.0-only

use crate::client::Client;
use crate::error::Result;
use crate::http;
use nil_payload::request::cheat::npc::*;
use nil_payload::response::cheat::npc::*;

impl Client {
  pub async fn cheat_get_ethics(
    &self,
    req: CheatGetEthicsRequest,
  ) -> Result<CheatGetEthicsResponse> {
    http::json_put("cheat-get-ethics")
      .body(req)
      .server(self.server)
      .maybe_authorization(self.authorization.as_ref())
      .circuit_breaker(self.circuit_breaker())
      .retry(&self.retry)
      .user_agent(&self.user_agent)
      .send()
      .await
  }

  pub async fn cheat_set_bot_ethics(&self, req: CheatSetBotEthicsRequest) -> Result<()> {
    http::post("cheat-set-bot-ethics")
      .body(req)
      .server(self.server)
      .maybe_authorization(self.authorization.as_ref())
      .circuit_breaker(self.circuit_breaker())
      .user_agent(&self.user_agent)
      .send()
      .await
  }

  pub async fn cheat_spawn_bot(&self, req: CheatSpawnBotRequest) -> Result<CheatSpawnBotResponse> {
    http::json_post("cheat-spawn-bot")
      .body(req)
      .server(self.server)
      .maybe_authorization(self.authorization.as_ref())
      .circuit_breaker(self.circuit_breaker())
      .user_agent(&self.user_agent)
      .send()
      .await
  }
}