Skip to main content

nil_client/client/cheat/
resources.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::resources::*;
8use nil_payload::response::cheat::resources::*;
9
10impl Client {
11  pub async fn cheat_get_resources(
12    &self,
13    req: CheatGetResourcesRequest,
14  ) -> Result<CheatGetResourcesResponse> {
15    http::json_put("cheat-get-resources")
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_set_food(&self, req: CheatSetFoodRequest) -> Result<()> {
27    http::post("cheat-set-food")
28      .body(req)
29      .server(self.server)
30      .maybe_authorization(self.authorization.as_ref())
31      .circuit_breaker(self.circuit_breaker())
32      .user_agent(&self.user_agent)
33      .send()
34      .await
35  }
36
37  pub async fn cheat_set_iron(&self, req: CheatSetIronRequest) -> Result<()> {
38    http::post("cheat-set-iron")
39      .body(req)
40      .server(self.server)
41      .maybe_authorization(self.authorization.as_ref())
42      .circuit_breaker(self.circuit_breaker())
43      .user_agent(&self.user_agent)
44      .send()
45      .await
46  }
47
48  pub async fn cheat_set_max_food(&self, req: CheatSetMaxFoodRequest) -> Result<()> {
49    http::post("cheat-set-max-food")
50      .body(req)
51      .server(self.server)
52      .maybe_authorization(self.authorization.as_ref())
53      .circuit_breaker(self.circuit_breaker())
54      .user_agent(&self.user_agent)
55      .send()
56      .await
57  }
58
59  pub async fn cheat_set_max_iron(&self, req: CheatSetMaxIronRequest) -> Result<()> {
60    http::post("cheat-set-max-iron")
61      .body(req)
62      .server(self.server)
63      .maybe_authorization(self.authorization.as_ref())
64      .circuit_breaker(self.circuit_breaker())
65      .user_agent(&self.user_agent)
66      .send()
67      .await
68  }
69
70  pub async fn cheat_set_max_resources(&self, req: CheatSetMaxResourcesRequest) -> Result<()> {
71    http::post("cheat-set-max-resources")
72      .body(req)
73      .server(self.server)
74      .maybe_authorization(self.authorization.as_ref())
75      .circuit_breaker(self.circuit_breaker())
76      .user_agent(&self.user_agent)
77      .send()
78      .await
79  }
80
81  pub async fn cheat_set_max_silo_resources(
82    &self,
83    req: CheatSetMaxSiloResourcesRequest,
84  ) -> Result<()> {
85    http::post("cheat-set-max-silo-resources")
86      .body(req)
87      .server(self.server)
88      .maybe_authorization(self.authorization.as_ref())
89      .circuit_breaker(self.circuit_breaker())
90      .user_agent(&self.user_agent)
91      .send()
92      .await
93  }
94
95  pub async fn cheat_set_max_stone(&self, req: CheatSetMaxStoneRequest) -> Result<()> {
96    http::post("cheat-set-max-stone")
97      .body(req)
98      .server(self.server)
99      .maybe_authorization(self.authorization.as_ref())
100      .circuit_breaker(self.circuit_breaker())
101      .user_agent(&self.user_agent)
102      .send()
103      .await
104  }
105
106  pub async fn cheat_set_max_warehouse_resources(
107    &self,
108    req: CheatSetMaxWarehouseResourcesRequest,
109  ) -> Result<()> {
110    http::post("cheat-set-max-warehouse-resources")
111      .body(req)
112      .server(self.server)
113      .maybe_authorization(self.authorization.as_ref())
114      .circuit_breaker(self.circuit_breaker())
115      .user_agent(&self.user_agent)
116      .send()
117      .await
118  }
119
120  pub async fn cheat_set_max_wood(&self, req: CheatSetMaxWoodRequest) -> Result<()> {
121    http::post("cheat-set-max-wood")
122      .body(req)
123      .server(self.server)
124      .maybe_authorization(self.authorization.as_ref())
125      .circuit_breaker(self.circuit_breaker())
126      .user_agent(&self.user_agent)
127      .send()
128      .await
129  }
130
131  pub async fn cheat_set_resources(&self, req: CheatSetResourcesRequest) -> Result<()> {
132    http::post("cheat-set-resources")
133      .body(req)
134      .server(self.server)
135      .maybe_authorization(self.authorization.as_ref())
136      .circuit_breaker(self.circuit_breaker())
137      .user_agent(&self.user_agent)
138      .send()
139      .await
140  }
141
142  pub async fn cheat_set_stone(&self, req: CheatSetStoneRequest) -> Result<()> {
143    http::post("cheat-set-stone")
144      .body(req)
145      .server(self.server)
146      .maybe_authorization(self.authorization.as_ref())
147      .circuit_breaker(self.circuit_breaker())
148      .user_agent(&self.user_agent)
149      .send()
150      .await
151  }
152
153  pub async fn cheat_set_wood(&self, req: CheatSetWoodRequest) -> Result<()> {
154    http::post("cheat-set-wood")
155      .body(req)
156      .server(self.server)
157      .maybe_authorization(self.authorization.as_ref())
158      .circuit_breaker(self.circuit_breaker())
159      .user_agent(&self.user_agent)
160      .send()
161      .await
162  }
163}