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  /// Endpoint: `PUT /cheat-get-resources`
12  pub async fn cheat_get_resources(
13    &self,
14    req: CheatGetResourcesRequest,
15  ) -> Result<CheatGetResourcesResponse> {
16    http::json_put("cheat-get-resources")
17      .body(req)
18      .server(self.server)
19      .maybe_authorization(self.authorization.as_ref())
20      .circuit_breaker(self.circuit_breaker())
21      .retry(&self.retry)
22      .user_agent(&self.user_agent)
23      .send()
24      .await
25  }
26
27  /// Endpoint: `POST /cheat-set-food`
28  pub async fn cheat_set_food(&self, req: CheatSetFoodRequest) -> Result<()> {
29    http::post("cheat-set-food")
30      .body(req)
31      .server(self.server)
32      .maybe_authorization(self.authorization.as_ref())
33      .circuit_breaker(self.circuit_breaker())
34      .user_agent(&self.user_agent)
35      .send()
36      .await
37  }
38
39  /// Endpoint: `POST /cheat-set-iron`
40  pub async fn cheat_set_iron(&self, req: CheatSetIronRequest) -> Result<()> {
41    http::post("cheat-set-iron")
42      .body(req)
43      .server(self.server)
44      .maybe_authorization(self.authorization.as_ref())
45      .circuit_breaker(self.circuit_breaker())
46      .user_agent(&self.user_agent)
47      .send()
48      .await
49  }
50
51  /// Endpoint: `POST /cheat-set-max-food`
52  pub async fn cheat_set_max_food(&self, req: CheatSetMaxFoodRequest) -> Result<()> {
53    http::post("cheat-set-max-food")
54      .body(req)
55      .server(self.server)
56      .maybe_authorization(self.authorization.as_ref())
57      .circuit_breaker(self.circuit_breaker())
58      .user_agent(&self.user_agent)
59      .send()
60      .await
61  }
62
63  /// Endpoint: `POST /cheat-set-max-iron`
64  pub async fn cheat_set_max_iron(&self, req: CheatSetMaxIronRequest) -> Result<()> {
65    http::post("cheat-set-max-iron")
66      .body(req)
67      .server(self.server)
68      .maybe_authorization(self.authorization.as_ref())
69      .circuit_breaker(self.circuit_breaker())
70      .user_agent(&self.user_agent)
71      .send()
72      .await
73  }
74
75  /// Endpoint: `POST /cheat-set-max-resources`
76  pub async fn cheat_set_max_resources(&self, req: CheatSetMaxResourcesRequest) -> Result<()> {
77    http::post("cheat-set-max-resources")
78      .body(req)
79      .server(self.server)
80      .maybe_authorization(self.authorization.as_ref())
81      .circuit_breaker(self.circuit_breaker())
82      .user_agent(&self.user_agent)
83      .send()
84      .await
85  }
86
87  /// Endpoint: `POST /cheat-set-max-silo-resources`
88  pub async fn cheat_set_max_silo_resources(
89    &self,
90    req: CheatSetMaxSiloResourcesRequest,
91  ) -> Result<()> {
92    http::post("cheat-set-max-silo-resources")
93      .body(req)
94      .server(self.server)
95      .maybe_authorization(self.authorization.as_ref())
96      .circuit_breaker(self.circuit_breaker())
97      .user_agent(&self.user_agent)
98      .send()
99      .await
100  }
101
102  /// Endpoint: `POST /cheat-set-max-stone`
103  pub async fn cheat_set_max_stone(&self, req: CheatSetMaxStoneRequest) -> Result<()> {
104    http::post("cheat-set-max-stone")
105      .body(req)
106      .server(self.server)
107      .maybe_authorization(self.authorization.as_ref())
108      .circuit_breaker(self.circuit_breaker())
109      .user_agent(&self.user_agent)
110      .send()
111      .await
112  }
113
114  /// Endpoint: `POST /cheat-set-max-warehouse-resources`
115  pub async fn cheat_set_max_warehouse_resources(
116    &self,
117    req: CheatSetMaxWarehouseResourcesRequest,
118  ) -> Result<()> {
119    http::post("cheat-set-max-warehouse-resources")
120      .body(req)
121      .server(self.server)
122      .maybe_authorization(self.authorization.as_ref())
123      .circuit_breaker(self.circuit_breaker())
124      .user_agent(&self.user_agent)
125      .send()
126      .await
127  }
128
129  /// Endpoint: `POST /cheat-set-max-wood`
130  pub async fn cheat_set_max_wood(&self, req: CheatSetMaxWoodRequest) -> Result<()> {
131    http::post("cheat-set-max-wood")
132      .body(req)
133      .server(self.server)
134      .maybe_authorization(self.authorization.as_ref())
135      .circuit_breaker(self.circuit_breaker())
136      .user_agent(&self.user_agent)
137      .send()
138      .await
139  }
140
141  /// Endpoint: `POST /cheat-set-resources`
142  pub async fn cheat_set_resources(&self, req: CheatSetResourcesRequest) -> Result<()> {
143    http::post("cheat-set-resources")
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  /// Endpoint: `POST /cheat-set-stone`
154  pub async fn cheat_set_stone(&self, req: CheatSetStoneRequest) -> Result<()> {
155    http::post("cheat-set-stone")
156      .body(req)
157      .server(self.server)
158      .maybe_authorization(self.authorization.as_ref())
159      .circuit_breaker(self.circuit_breaker())
160      .user_agent(&self.user_agent)
161      .send()
162      .await
163  }
164
165  /// Endpoint: `POST /cheat-set-wood`
166  pub async fn cheat_set_wood(&self, req: CheatSetWoodRequest) -> Result<()> {
167    http::post("cheat-set-wood")
168      .body(req)
169      .server(self.server)
170      .maybe_authorization(self.authorization.as_ref())
171      .circuit_breaker(self.circuit_breaker())
172      .user_agent(&self.user_agent)
173      .send()
174      .await
175  }
176}