Skip to main content

nil_client/client/cheat/
city.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::city::*;
8use nil_payload::response::cheat::city::*;
9
10impl Client {
11  pub async fn cheat_get_cities(
12    &self,
13    req: CheatGetCitiesRequest,
14  ) -> Result<CheatGetCitiesResponse> {
15    http::json_put("cheat-get-cities")
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_get_city(&self, req: CheatGetCityRequest) -> Result<CheatGetCityResponse> {
27    http::json_put("cheat-get-city")
28      .body(req)
29      .server(self.server)
30      .maybe_authorization(self.authorization.as_ref())
31      .circuit_breaker(self.circuit_breaker())
32      .retry(&self.retry)
33      .user_agent(&self.user_agent)
34      .send()
35      .await
36  }
37
38  pub async fn cheat_set_stability(&self, req: CheatSetStabilityRequest) -> Result<()> {
39    http::post("cheat-set-stability")
40      .body(req)
41      .server(self.server)
42      .maybe_authorization(self.authorization.as_ref())
43      .circuit_breaker(self.circuit_breaker())
44      .user_agent(&self.user_agent)
45      .send()
46      .await
47  }
48
49  pub async fn cheat_spawn_city(&self, req: CheatSpawnCityRequest) -> Result<()> {
50    http::post("cheat-spawn-city")
51      .body(req)
52      .server(self.server)
53      .maybe_authorization(self.authorization.as_ref())
54      .circuit_breaker(self.circuit_breaker())
55      .user_agent(&self.user_agent)
56      .send()
57      .await
58  }
59}