Skip to main content

shinemonitor_api/
actions.rs

1//! GENERATED — do not edit. Run `python scripts/codegen.py`.
2//!
3//! Each method drives `ShineMonitorAPI::_request_with` for the
4//! corresponding documented vendor action.
5
6#![allow(clippy::too_many_arguments, dead_code)]
7
8use crate::{ApiError, ShineMonitorAPI};
9
10impl ShineMonitorAPI {
11    /// Action `updateToken` — chapter 2.
12    /// Vendor docs: https://api.shinemonitor.com/chapter2/updateToken.html
13    pub fn update_token(&self) -> Result<serde_json::Value, ApiError> {
14        let extra = String::new();
15        self._request_with("updateToken", &extra)
16    }
17
18    /// Action `queryAccountInfo` — chapter 2.
19    /// Vendor docs: https://api.shinemonitor.com/chapter2/queryAccountInfo.html
20    pub fn query_account_info(&self) -> Result<serde_json::Value, ApiError> {
21        let extra = String::new();
22        self._request_with("queryAccountInfo", &extra)
23    }
24
25    /// Action `updatePassword` — chapter 2.
26    /// Vendor docs: https://api.shinemonitor.com/chapter2/updatePassword.html
27    pub fn update_password(
28        &self,
29        old_pwd: &str,
30        new_pwd: &str,
31    ) -> Result<serde_json::Value, ApiError> {
32        let mut extra = String::new();
33        extra.push_str(&format!("&oldPwd={}", old_pwd));
34        extra.push_str(&format!("&newPwd={}", new_pwd));
35        self._request_with("updatePassword", &extra)
36    }
37
38    /// Action `queryPlants` — chapter 3.
39    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlants.html
40    pub fn query_plants(
41        &self,
42        status: Option<i64>,
43        order_by: Option<&str>,
44        plant_name: Option<&str>,
45        page: Option<i64>,
46        pagesize: Option<i64>,
47    ) -> Result<serde_json::Value, ApiError> {
48        let mut extra = String::new();
49        if let Some(v) = status {
50            extra.push_str(&format!("&status={}", v));
51        }
52        if let Some(v) = order_by {
53            extra.push_str(&format!("&orderBy={}", v));
54        }
55        if let Some(v) = plant_name {
56            extra.push_str(&format!("&plantName={}", v));
57        }
58        if let Some(v) = page {
59            extra.push_str(&format!("&page={}", v));
60        }
61        if let Some(v) = pagesize {
62            extra.push_str(&format!("&pagesize={}", v));
63        }
64        self._request_with("queryPlants", &extra)
65    }
66
67    /// Action `queryPlantInfo` — chapter 3.
68    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlantInfo.html
69    pub fn query_plant_info(&self, plantid: i64) -> Result<serde_json::Value, ApiError> {
70        let mut extra = String::new();
71        extra.push_str(&format!("&plantid={}", plantid));
72        self._request_with("queryPlantInfo", &extra)
73    }
74
75    /// Action `queryPlantCount` — chapter 3.
76    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlantCount.html
77    pub fn query_plant_count(&self) -> Result<serde_json::Value, ApiError> {
78        let extra = String::new();
79        self._request_with("queryPlantCount", &extra)
80    }
81
82    /// Action `queryPlantEnergyDay` — chapter 3.
83    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlantEnergyDay.html
84    pub fn query_plant_energy_day(
85        &self,
86        plantid: i64,
87        date: &str,
88    ) -> Result<serde_json::Value, ApiError> {
89        let mut extra = String::new();
90        extra.push_str(&format!("&plantid={}", plantid));
91        extra.push_str(&format!("&date={}", date));
92        self._request_with("queryPlantEnergyDay", &extra)
93    }
94
95    /// Action `queryPlantEnergyMonth` — chapter 3.
96    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlantEnergyMonth.html
97    pub fn query_plant_energy_month(
98        &self,
99        plantid: i64,
100        date: &str,
101    ) -> Result<serde_json::Value, ApiError> {
102        let mut extra = String::new();
103        extra.push_str(&format!("&plantid={}", plantid));
104        extra.push_str(&format!("&date={}", date));
105        self._request_with("queryPlantEnergyMonth", &extra)
106    }
107
108    /// Action `queryPlantEnergyYear` — chapter 3.
109    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlantEnergyYear.html
110    pub fn query_plant_energy_year(
111        &self,
112        plantid: i64,
113        date: &str,
114    ) -> Result<serde_json::Value, ApiError> {
115        let mut extra = String::new();
116        extra.push_str(&format!("&plantid={}", plantid));
117        extra.push_str(&format!("&date={}", date));
118        self._request_with("queryPlantEnergyYear", &extra)
119    }
120
121    /// Action `queryPlantEnergyTotal` — chapter 3.
122    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlantEnergyTotal.html
123    pub fn query_plant_energy_total(&self, plantid: i64) -> Result<serde_json::Value, ApiError> {
124        let mut extra = String::new();
125        extra.push_str(&format!("&plantid={}", plantid));
126        self._request_with("queryPlantEnergyTotal", &extra)
127    }
128
129    /// Action `queryPlantActiveOuputPowerCurrent` — chapter 3.
130    /// Vendor docs: https://api.shinemonitor.com/chapter3/queryPlantActiveOuputPowerCurrent.html
131    pub fn query_plant_active_ouput_power_current(
132        &self,
133        plantid: i64,
134    ) -> Result<serde_json::Value, ApiError> {
135        let mut extra = String::new();
136        extra.push_str(&format!("&plantid={}", plantid));
137        self._request_with("queryPlantActiveOuputPowerCurrent", &extra)
138    }
139
140    /// Action `queryCollectors` — chapter 4.
141    /// Vendor docs: https://api.shinemonitor.com/chapter4/queryCollectors.html
142    pub fn query_collectors(
143        &self,
144        page: Option<i64>,
145        pagesize: Option<i64>,
146    ) -> Result<serde_json::Value, ApiError> {
147        let mut extra = String::new();
148        if let Some(v) = page {
149            extra.push_str(&format!("&page={}", v));
150        }
151        if let Some(v) = pagesize {
152            extra.push_str(&format!("&pagesize={}", v));
153        }
154        self._request_with("queryCollectors", &extra)
155    }
156
157    /// Action `queryCollectorInfo` — chapter 4.
158    /// Vendor docs: https://api.shinemonitor.com/chapter4/queryCollectorInfo.html
159    pub fn query_collector_info(&self, pn: &str) -> Result<serde_json::Value, ApiError> {
160        let mut extra = String::new();
161        extra.push_str(&format!("&pn={}", pn));
162        self._request_with("queryCollectorInfo", &extra)
163    }
164
165    /// Action `queryCollectorStatus` — chapter 4.
166    /// Vendor docs: https://api.shinemonitor.com/chapter4/queryCollectorStatus.html
167    pub fn query_collector_status(&self, pn: &str) -> Result<serde_json::Value, ApiError> {
168        let mut extra = String::new();
169        extra.push_str(&format!("&pn={}", pn));
170        self._request_with("queryCollectorStatus", &extra)
171    }
172
173    /// Action `queryCollectorDevices` — chapter 4.
174    /// Vendor docs: https://api.shinemonitor.com/chapter4/queryCollectorDevices.html
175    pub fn query_collector_devices(&self, pn: &str) -> Result<serde_json::Value, ApiError> {
176        let mut extra = String::new();
177        extra.push_str(&format!("&pn={}", pn));
178        self._request_with("queryCollectorDevices", &extra)
179    }
180
181    /// Action `queryDevices` — chapter 5.
182    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDevices.html
183    pub fn query_devices(
184        &self,
185        page: Option<i64>,
186        pagesize: Option<i64>,
187    ) -> Result<serde_json::Value, ApiError> {
188        let mut extra = String::new();
189        if let Some(v) = page {
190            extra.push_str(&format!("&page={}", v));
191        }
192        if let Some(v) = pagesize {
193            extra.push_str(&format!("&pagesize={}", v));
194        }
195        self._request_with("queryDevices", &extra)
196    }
197
198    pub fn web_query_device_es(&self) -> Result<serde_json::Value, ApiError> {
199        let extra = String::new();
200        self._request_with("webQueryDeviceEs", &extra)
201    }
202
203    /// Action `queryDeviceCount` — chapter 5.
204    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceCount.html
205    pub fn query_device_count(&self) -> Result<serde_json::Value, ApiError> {
206        let extra = String::new();
207        self._request_with("queryDeviceCount", &extra)
208    }
209
210    /// Action `queryDeviceInfo` — chapter 5.
211    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceInfo.html
212    pub fn query_device_info(
213        &self,
214        pn: &str,
215        devcode: i64,
216        devaddr: i64,
217        sn: &str,
218    ) -> Result<serde_json::Value, ApiError> {
219        let mut extra = String::new();
220        extra.push_str(&format!("&pn={}", pn));
221        extra.push_str(&format!("&devcode={}", devcode));
222        extra.push_str(&format!("&devaddr={}", devaddr));
223        extra.push_str(&format!("&sn={}", sn));
224        self._request_with("queryDeviceInfo", &extra)
225    }
226
227    /// Action `queryDeviceLastData` — chapter 5.
228    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceLastData.html
229    pub fn query_device_last_data(
230        &self,
231        pn: &str,
232        devcode: i64,
233        devaddr: i64,
234        sn: &str,
235    ) -> Result<serde_json::Value, ApiError> {
236        let mut extra = String::new();
237        extra.push_str(&format!("&pn={}", pn));
238        extra.push_str(&format!("&devcode={}", devcode));
239        extra.push_str(&format!("&devaddr={}", devaddr));
240        extra.push_str(&format!("&sn={}", sn));
241        self._request_with("queryDeviceLastData", &extra)
242    }
243
244    pub fn query_sp_device_last_data(
245        &self,
246        pn: &str,
247        devcode: i64,
248        devaddr: i64,
249        sn: &str,
250    ) -> Result<serde_json::Value, ApiError> {
251        let mut extra = String::new();
252        extra.push_str(&format!("&pn={}", pn));
253        extra.push_str(&format!("&devcode={}", devcode));
254        extra.push_str(&format!("&devaddr={}", devaddr));
255        extra.push_str(&format!("&sn={}", sn));
256        self._request_with("querySPDeviceLastData", &extra)
257    }
258
259    /// Action `queryDeviceDataOneDay` — chapter 5.
260    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceDataOneDay.html
261    pub fn query_device_data_one_day(
262        &self,
263        pn: &str,
264        devcode: i64,
265        devaddr: i64,
266        sn: &str,
267        date: &str,
268    ) -> Result<serde_json::Value, ApiError> {
269        let mut extra = String::new();
270        extra.push_str(&format!("&pn={}", pn));
271        extra.push_str(&format!("&devcode={}", devcode));
272        extra.push_str(&format!("&devaddr={}", devaddr));
273        extra.push_str(&format!("&sn={}", sn));
274        extra.push_str(&format!("&date={}", date));
275        self._request_with("queryDeviceDataOneDay", &extra)
276    }
277
278    /// Action `queryDeviceStatus` — chapter 5.
279    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceStatus.html
280    pub fn query_device_status(
281        &self,
282        pn: &str,
283        devcode: i64,
284        devaddr: i64,
285        sn: &str,
286    ) -> Result<serde_json::Value, ApiError> {
287        let mut extra = String::new();
288        extra.push_str(&format!("&pn={}", pn));
289        extra.push_str(&format!("&devcode={}", devcode));
290        extra.push_str(&format!("&devaddr={}", devaddr));
291        extra.push_str(&format!("&sn={}", sn));
292        self._request_with("queryDeviceStatus", &extra)
293    }
294
295    /// Action `queryDeviceWarning` — chapter 5.
296    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceWarning.html
297    pub fn query_device_warning(
298        &self,
299        pn: &str,
300        devcode: i64,
301        devaddr: i64,
302        sn: &str,
303    ) -> Result<serde_json::Value, ApiError> {
304        let mut extra = String::new();
305        extra.push_str(&format!("&pn={}", pn));
306        extra.push_str(&format!("&devcode={}", devcode));
307        extra.push_str(&format!("&devaddr={}", devaddr));
308        extra.push_str(&format!("&sn={}", sn));
309        self._request_with("queryDeviceWarning", &extra)
310    }
311
312    /// Action `queryDeviceCtrlField` — chapter 5.
313    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceCtrlField.html
314    pub fn query_device_ctrl_field(
315        &self,
316        pn: &str,
317        devcode: i64,
318        devaddr: i64,
319        sn: &str,
320    ) -> Result<serde_json::Value, ApiError> {
321        let mut extra = String::new();
322        extra.push_str(&format!("&pn={}", pn));
323        extra.push_str(&format!("&devcode={}", devcode));
324        extra.push_str(&format!("&devaddr={}", devaddr));
325        extra.push_str(&format!("&sn={}", sn));
326        self._request_with("queryDeviceCtrlField", &extra)
327    }
328
329    /// Action `queryDeviceCtrlValue` — chapter 5.
330    /// Vendor docs: https://api.shinemonitor.com/chapter5/queryDeviceCtrlValue.html
331    pub fn query_device_ctrl_value(
332        &self,
333        pn: &str,
334        devcode: i64,
335        devaddr: i64,
336        sn: &str,
337        id: &str,
338    ) -> Result<serde_json::Value, ApiError> {
339        let mut extra = String::new();
340        extra.push_str(&format!("&pn={}", pn));
341        extra.push_str(&format!("&devcode={}", devcode));
342        extra.push_str(&format!("&devaddr={}", devaddr));
343        extra.push_str(&format!("&sn={}", sn));
344        extra.push_str(&format!("&id={}", id));
345        self._request_with("queryDeviceCtrlValue", &extra)
346    }
347
348    /// Action `ctrlDevice` — chapter 5.
349    /// Vendor docs: https://api.shinemonitor.com/chapter5/ctrlDevice.html
350    pub fn ctrl_device(
351        &self,
352        pn: &str,
353        devcode: i64,
354        devaddr: i64,
355        sn: &str,
356        id: &str,
357        val: &str,
358    ) -> Result<serde_json::Value, ApiError> {
359        let mut extra = String::new();
360        extra.push_str(&format!("&pn={}", pn));
361        extra.push_str(&format!("&devcode={}", devcode));
362        extra.push_str(&format!("&devaddr={}", devaddr));
363        extra.push_str(&format!("&sn={}", sn));
364        extra.push_str(&format!("&id={}", id));
365        extra.push_str(&format!("&val={}", val));
366        self._request_with("ctrlDevice", &extra)
367    }
368
369    /// Action `queryDeviceEnergyDay` — chapter 6.
370    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyDay.html
371    pub fn query_device_energy_day(
372        &self,
373        pn: &str,
374        devcode: i64,
375        devaddr: i64,
376        sn: &str,
377        date: &str,
378    ) -> Result<serde_json::Value, ApiError> {
379        let mut extra = String::new();
380        extra.push_str(&format!("&pn={}", pn));
381        extra.push_str(&format!("&devcode={}", devcode));
382        extra.push_str(&format!("&devaddr={}", devaddr));
383        extra.push_str(&format!("&sn={}", sn));
384        extra.push_str(&format!("&date={}", date));
385        self._request_with("queryDeviceEnergyDay", &extra)
386    }
387
388    /// Action `queryDeviceEnergyMonth` — chapter 6.
389    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyMonth.html
390    pub fn query_device_energy_month(
391        &self,
392        pn: &str,
393        devcode: i64,
394        devaddr: i64,
395        sn: &str,
396        date: &str,
397    ) -> Result<serde_json::Value, ApiError> {
398        let mut extra = String::new();
399        extra.push_str(&format!("&pn={}", pn));
400        extra.push_str(&format!("&devcode={}", devcode));
401        extra.push_str(&format!("&devaddr={}", devaddr));
402        extra.push_str(&format!("&sn={}", sn));
403        extra.push_str(&format!("&date={}", date));
404        self._request_with("queryDeviceEnergyMonth", &extra)
405    }
406
407    /// Action `queryDeviceEnergyYear` — chapter 6.
408    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyYear.html
409    pub fn query_device_energy_year(
410        &self,
411        pn: &str,
412        devcode: i64,
413        devaddr: i64,
414        sn: &str,
415        date: &str,
416    ) -> Result<serde_json::Value, ApiError> {
417        let mut extra = String::new();
418        extra.push_str(&format!("&pn={}", pn));
419        extra.push_str(&format!("&devcode={}", devcode));
420        extra.push_str(&format!("&devaddr={}", devaddr));
421        extra.push_str(&format!("&sn={}", sn));
422        extra.push_str(&format!("&date={}", date));
423        self._request_with("queryDeviceEnergyYear", &extra)
424    }
425
426    /// Action `queryDeviceEnergyTotal` — chapter 6.
427    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyTotal.html
428    pub fn query_device_energy_total(
429        &self,
430        pn: &str,
431        devcode: i64,
432        devaddr: i64,
433        sn: &str,
434    ) -> Result<serde_json::Value, ApiError> {
435        let mut extra = String::new();
436        extra.push_str(&format!("&pn={}", pn));
437        extra.push_str(&format!("&devcode={}", devcode));
438        extra.push_str(&format!("&devaddr={}", devaddr));
439        extra.push_str(&format!("&sn={}", sn));
440        self._request_with("queryDeviceEnergyTotal", &extra)
441    }
442
443    /// Action `queryDeviceActiveOuputPowerCurrent` — chapter 6.
444    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceActiveOuputPowerCurrent.html
445    pub fn query_device_active_ouput_power_current(
446        &self,
447        pn: &str,
448        devcode: i64,
449        devaddr: i64,
450        sn: &str,
451    ) -> Result<serde_json::Value, ApiError> {
452        let mut extra = String::new();
453        extra.push_str(&format!("&pn={}", pn));
454        extra.push_str(&format!("&devcode={}", devcode));
455        extra.push_str(&format!("&devaddr={}", devaddr));
456        extra.push_str(&format!("&sn={}", sn));
457        self._request_with("queryDeviceActiveOuputPowerCurrent", &extra)
458    }
459
460    /// Action `queryCameraInfo` — chapter 11.
461    /// Vendor docs: https://api.shinemonitor.com/chapter11/queryCameraInfo.html
462    pub fn query_camera_info(&self, cameraid: i64) -> Result<serde_json::Value, ApiError> {
463        let mut extra = String::new();
464        extra.push_str(&format!("&cameraid={}", cameraid));
465        self._request_with("queryCameraInfo", &extra)
466    }
467
468    /// Action `uploadImg` — chapter 84.
469    /// Vendor docs: https://api.shinemonitor.com/chapter84/uploadImg.html
470    pub fn upload_img(&self, fmt: &str) -> Result<serde_json::Value, ApiError> {
471        let mut extra = String::new();
472        extra.push_str(&format!("&fmt={}", fmt));
473        self._request_with("uploadImg", &extra)
474    }
475}