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