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_fill_world(&self, req: CheatFillWorldRequest) -> Result<()> {
12    http::post("cheat-fill-world")
13      .body(req)
14      .server(self.server)
15      .maybe_authorization(self.authorization.as_ref())
16      .circuit_breaker(self.circuit_breaker())
17      .user_agent(&self.user_agent)
18      .send()
19      .await
20  }
21
22  pub async fn cheat_get_cities(
23    &self,
24    req: CheatGetCitiesRequest,
25  ) -> Result<CheatGetCitiesResponse> {
26    http::json_put("cheat-get-cities")
27      .body(req)
28      .server(self.server)
29      .maybe_authorization(self.authorization.as_ref())
30      .circuit_breaker(self.circuit_breaker())
31      .retry(&self.retry)
32      .user_agent(&self.user_agent)
33      .send()
34      .await
35  }
36
37  pub async fn cheat_get_city(&self, req: CheatGetCityRequest) -> Result<CheatGetCityResponse> {
38    http::json_put("cheat-get-city")
39      .body(req)
40      .server(self.server)
41      .maybe_authorization(self.authorization.as_ref())
42      .circuit_breaker(self.circuit_breaker())
43      .retry(&self.retry)
44      .user_agent(&self.user_agent)
45      .send()
46      .await
47  }
48
49  pub async fn cheat_set_stability(&self, req: CheatSetStabilityRequest) -> Result<()> {
50    http::post("cheat-set-stability")
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
60  pub async fn cheat_spawn_city(&self, req: CheatSpawnCityRequest) -> Result<()> {
61    http::post("cheat-spawn-city")
62      .body(req)
63      .server(self.server)
64      .maybe_authorization(self.authorization.as_ref())
65      .circuit_breaker(self.circuit_breaker())
66      .user_agent(&self.user_agent)
67      .send()
68      .await
69  }
70}