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 `ctrlDevice` — chapter 5.
313    /// Vendor docs: https://api.shinemonitor.com/chapter5/ctrlDevice.html
314    pub fn ctrl_device(
315        &self,
316        pn: &str,
317        devcode: i64,
318        devaddr: i64,
319        sn: &str,
320        id: &str,
321        val: &str,
322    ) -> Result<serde_json::Value, ApiError> {
323        let mut extra = String::new();
324        extra.push_str(&format!("&pn={}", pn));
325        extra.push_str(&format!("&devcode={}", devcode));
326        extra.push_str(&format!("&devaddr={}", devaddr));
327        extra.push_str(&format!("&sn={}", sn));
328        extra.push_str(&format!("&id={}", id));
329        extra.push_str(&format!("&val={}", val));
330        self._request_with("ctrlDevice", &extra)
331    }
332
333    /// Action `queryDeviceEnergyDay` — chapter 6.
334    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyDay.html
335    pub fn query_device_energy_day(
336        &self,
337        pn: &str,
338        devcode: i64,
339        devaddr: i64,
340        sn: &str,
341        date: &str,
342    ) -> Result<serde_json::Value, ApiError> {
343        let mut extra = String::new();
344        extra.push_str(&format!("&pn={}", pn));
345        extra.push_str(&format!("&devcode={}", devcode));
346        extra.push_str(&format!("&devaddr={}", devaddr));
347        extra.push_str(&format!("&sn={}", sn));
348        extra.push_str(&format!("&date={}", date));
349        self._request_with("queryDeviceEnergyDay", &extra)
350    }
351
352    /// Action `queryDeviceEnergyMonth` — chapter 6.
353    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyMonth.html
354    pub fn query_device_energy_month(
355        &self,
356        pn: &str,
357        devcode: i64,
358        devaddr: i64,
359        sn: &str,
360        date: &str,
361    ) -> Result<serde_json::Value, ApiError> {
362        let mut extra = String::new();
363        extra.push_str(&format!("&pn={}", pn));
364        extra.push_str(&format!("&devcode={}", devcode));
365        extra.push_str(&format!("&devaddr={}", devaddr));
366        extra.push_str(&format!("&sn={}", sn));
367        extra.push_str(&format!("&date={}", date));
368        self._request_with("queryDeviceEnergyMonth", &extra)
369    }
370
371    /// Action `queryDeviceEnergyYear` — chapter 6.
372    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyYear.html
373    pub fn query_device_energy_year(
374        &self,
375        pn: &str,
376        devcode: i64,
377        devaddr: i64,
378        sn: &str,
379        date: &str,
380    ) -> Result<serde_json::Value, ApiError> {
381        let mut extra = String::new();
382        extra.push_str(&format!("&pn={}", pn));
383        extra.push_str(&format!("&devcode={}", devcode));
384        extra.push_str(&format!("&devaddr={}", devaddr));
385        extra.push_str(&format!("&sn={}", sn));
386        extra.push_str(&format!("&date={}", date));
387        self._request_with("queryDeviceEnergyYear", &extra)
388    }
389
390    /// Action `queryDeviceEnergyTotal` — chapter 6.
391    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceEnergyTotal.html
392    pub fn query_device_energy_total(
393        &self,
394        pn: &str,
395        devcode: i64,
396        devaddr: i64,
397        sn: &str,
398    ) -> Result<serde_json::Value, ApiError> {
399        let mut extra = String::new();
400        extra.push_str(&format!("&pn={}", pn));
401        extra.push_str(&format!("&devcode={}", devcode));
402        extra.push_str(&format!("&devaddr={}", devaddr));
403        extra.push_str(&format!("&sn={}", sn));
404        self._request_with("queryDeviceEnergyTotal", &extra)
405    }
406
407    /// Action `queryDeviceActiveOuputPowerCurrent` — chapter 6.
408    /// Vendor docs: https://api.shinemonitor.com/chapter6/queryDeviceActiveOuputPowerCurrent.html
409    pub fn query_device_active_ouput_power_current(
410        &self,
411        pn: &str,
412        devcode: i64,
413        devaddr: i64,
414        sn: &str,
415    ) -> Result<serde_json::Value, ApiError> {
416        let mut extra = String::new();
417        extra.push_str(&format!("&pn={}", pn));
418        extra.push_str(&format!("&devcode={}", devcode));
419        extra.push_str(&format!("&devaddr={}", devaddr));
420        extra.push_str(&format!("&sn={}", sn));
421        self._request_with("queryDeviceActiveOuputPowerCurrent", &extra)
422    }
423
424    /// Action `queryCameraInfo` — chapter 11.
425    /// Vendor docs: https://api.shinemonitor.com/chapter11/queryCameraInfo.html
426    pub fn query_camera_info(&self, cameraid: i64) -> Result<serde_json::Value, ApiError> {
427        let mut extra = String::new();
428        extra.push_str(&format!("&cameraid={}", cameraid));
429        self._request_with("queryCameraInfo", &extra)
430    }
431
432    /// Action `uploadImg` — chapter 84.
433    /// Vendor docs: https://api.shinemonitor.com/chapter84/uploadImg.html
434    pub fn upload_img(&self, fmt: &str) -> Result<serde_json::Value, ApiError> {
435        let mut extra = String::new();
436        extra.push_str(&format!("&fmt={}", fmt));
437        self._request_with("uploadImg", &extra)
438    }
439}