pca9956b_api/
lib.rs

1#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
2
3use futures::Stream;
4use std::io::Error;
5
6#[deprecated(note = "Import swagger-rs directly")]
7pub use swagger::{ApiError, ContextWrapper};
8#[deprecated(note = "Import futures directly")]
9pub use futures::Future;
10
11pub const BASE_PATH: &'static str = "";
12pub const API_VERSION: &'static str = "0.1.2";
13
14#[derive(Debug, PartialEq)]
15#[must_use]
16pub enum ClearErrorResponse {
17    /// OK
18    OK
19    ,
20    /// Bad Request
21    BadRequest
22    (models::BadRequest)
23    ,
24    /// Operation Failed
25    OperationFailed
26    (models::OpError)
27}
28
29#[derive(Debug, PartialEq)]
30#[must_use]
31pub enum GetAddrEnabledResponse {
32    /// OK
33    OK
34    (bool)
35    ,
36    /// Bad Request
37    BadRequest
38    (models::BadRequest)
39    ,
40    /// Operation Failed
41    OperationFailed
42    (models::OpError)
43}
44
45#[derive(Debug, PartialEq)]
46#[must_use]
47pub enum GetAddrInfoResponse {
48    /// OK
49    OK
50    (models::AddrInfo)
51    ,
52    /// Bad Request
53    BadRequest
54    (models::BadRequest)
55    ,
56    /// Operation Failed
57    OperationFailed
58    (models::OpError)
59}
60
61#[derive(Debug, PartialEq)]
62#[must_use]
63pub enum GetAddrValueResponse {
64    /// OK
65    OK
66    (i32)
67    ,
68    /// Bad Request
69    BadRequest
70    (models::BadRequest)
71    ,
72    /// Operation Failed
73    OperationFailed
74    (models::OpError)
75}
76
77#[derive(Debug, PartialEq)]
78#[must_use]
79pub enum GetApiResponse {
80    /// OK
81    OK
82    (String)
83    ,
84    /// File not found
85    FileNotFound
86    (String)
87}
88
89#[derive(Debug, PartialEq)]
90#[must_use]
91pub enum GetConfigResponse {
92    /// OK
93    OK
94    (models::Config)
95    ,
96    /// Bad Request
97    BadRequest
98    (models::BadRequest)
99    ,
100    /// Operation Failed
101    OperationFailed
102    (models::OpError)
103}
104
105#[derive(Debug, PartialEq)]
106#[must_use]
107pub enum GetCurrentResponse {
108    /// OK
109    OK
110    (i32)
111    ,
112    /// Bad Request
113    BadRequest
114    (models::BadRequest)
115    ,
116    /// Operation Failed
117    OperationFailed
118    (models::OpError)
119}
120
121#[derive(Debug, PartialEq)]
122#[must_use]
123pub enum GetErrorResponse {
124    /// OK
125    OK
126    (bool)
127    ,
128    /// Bad Request
129    BadRequest
130    (models::BadRequest)
131    ,
132    /// Operation Failed
133    OperationFailed
134    (models::OpError)
135}
136
137#[derive(Debug, PartialEq)]
138#[must_use]
139pub enum GetErrorsResponse {
140    /// OK
141    OK
142    (models::LedErrors)
143    ,
144    /// Bad Request
145    BadRequest
146    (models::BadRequest)
147    ,
148    /// Operation Failed
149    OperationFailed
150    (models::OpError)
151}
152
153#[derive(Debug, PartialEq)]
154#[must_use]
155pub enum GetFreqResponse {
156    /// OK
157    OK
158    (i32)
159    ,
160    /// Bad Request
161    BadRequest
162    (models::BadRequest)
163    ,
164    /// Operation Failed
165    OperationFailed
166    (models::OpError)
167}
168
169#[derive(Debug, PartialEq)]
170#[must_use]
171pub enum GetGroupResponse {
172    /// OK
173    OK
174    (models::Group)
175    ,
176    /// Bad Request
177    BadRequest
178    (models::BadRequest)
179    ,
180    /// Operation Failed
181    OperationFailed
182    (models::OpError)
183}
184
185#[derive(Debug, PartialEq)]
186#[must_use]
187pub enum GetLedCurrentResponse {
188    /// OK
189    OK
190    (i32)
191    ,
192    /// Bad Request
193    BadRequest
194    (models::BadRequest)
195    ,
196    /// Operation Failed
197    OperationFailed
198    (models::OpError)
199}
200
201#[derive(Debug, PartialEq)]
202#[must_use]
203pub enum GetLedErrorResponse {
204    /// OK
205    OK
206    (models::LedError)
207    ,
208    /// Bad Request
209    BadRequest
210    (models::BadRequest)
211    ,
212    /// Operation Failed
213    OperationFailed
214    (models::OpError)
215}
216
217#[derive(Debug, PartialEq)]
218#[must_use]
219pub enum GetLedInfoResponse {
220    /// OK
221    OK
222    (models::LedInfo)
223    ,
224    /// Bad Request
225    BadRequest
226    (models::BadRequest)
227    ,
228    /// Operation Failed
229    OperationFailed
230    (models::OpError)
231}
232
233#[derive(Debug, PartialEq)]
234#[must_use]
235pub enum GetLedInfoAllResponse {
236    /// OK
237    OK
238    (models::LedInfoArray)
239    ,
240    /// Bad Request
241    BadRequest
242    (models::BadRequest)
243    ,
244    /// Operation Failed
245    OperationFailed
246    (models::OpError)
247}
248
249#[derive(Debug, PartialEq)]
250#[must_use]
251pub enum GetLedPwmResponse {
252    /// OK
253    OK
254    (i32)
255    ,
256    /// Bad Request
257    BadRequest
258    (models::BadRequest)
259    ,
260    /// Operation Failed
261    OperationFailed
262    (models::OpError)
263}
264
265#[derive(Debug, PartialEq)]
266#[must_use]
267pub enum GetLedStateResponse {
268    /// OK
269    OK
270    (models::LedState)
271    ,
272    /// Bad Request
273    BadRequest
274    (models::BadRequest)
275    ,
276    /// Operation Failed
277    OperationFailed
278    (models::OpError)
279}
280
281#[derive(Debug, PartialEq)]
282#[must_use]
283pub enum GetOffsetResponse {
284    /// OK
285    OK
286    (i32)
287    ,
288    /// Bad Request
289    BadRequest
290    (models::BadRequest)
291    ,
292    /// Operation Failed
293    OperationFailed
294    (models::OpError)
295}
296
297#[derive(Debug, PartialEq)]
298#[must_use]
299pub enum GetOutputChangeResponse {
300    /// OK
301    OK
302    (models::OutputChange)
303    ,
304    /// Bad Request
305    BadRequest
306    (models::BadRequest)
307    ,
308    /// Operation Failed
309    OperationFailed
310    (models::OpError)
311}
312
313#[derive(Debug, PartialEq)]
314#[must_use]
315pub enum GetOverTempResponse {
316    /// OK
317    OK
318    (bool)
319    ,
320    /// Bad Request
321    BadRequest
322    (models::BadRequest)
323    ,
324    /// Operation Failed
325    OperationFailed
326    (models::OpError)
327}
328
329#[derive(Debug, PartialEq)]
330#[must_use]
331pub enum GetPwmResponse {
332    /// OK
333    OK
334    (i32)
335    ,
336    /// Bad Request
337    BadRequest
338    (models::BadRequest)
339    ,
340    /// Operation Failed
341    OperationFailed
342    (models::OpError)
343}
344
345#[derive(Debug, PartialEq)]
346#[must_use]
347pub enum GetSleepResponse {
348    /// OK
349    OK
350    (bool)
351    ,
352    /// Bad Request
353    BadRequest
354    (models::BadRequest)
355    ,
356    /// Operation Failed
357    OperationFailed
358    (models::OpError)
359}
360
361#[derive(Debug, PartialEq)]
362#[must_use]
363pub enum ResetResponse {
364    /// OK
365    OK
366    ,
367    /// Bad Request
368    BadRequest
369    (models::BadRequest)
370    ,
371    /// Operation Failed
372    OperationFailed
373    (models::OpError)
374}
375
376#[derive(Debug, PartialEq)]
377#[must_use]
378pub enum SetAddrEnabledResponse {
379    /// OK
380    OK
381    ,
382    /// Bad Request
383    BadRequest
384    (models::BadRequest)
385    ,
386    /// Operation Failed
387    OperationFailed
388    (models::OpError)
389}
390
391#[derive(Debug, PartialEq)]
392#[must_use]
393pub enum SetAddrValueResponse {
394    /// OK
395    OK
396    ,
397    /// Bad Request
398    BadRequest
399    (models::BadRequest)
400    ,
401    /// Operation Failed
402    OperationFailed
403    (models::OpError)
404}
405
406#[derive(Debug, PartialEq)]
407#[must_use]
408pub enum SetConfigResponse {
409    /// OK
410    OK
411    ,
412    /// Bad Request
413    BadRequest
414    (models::BadRequest)
415    ,
416    /// Operation Failed
417    OperationFailed
418    (models::OpError)
419}
420
421#[derive(Debug, PartialEq)]
422#[must_use]
423pub enum SetCurrentResponse {
424    /// OK
425    OK
426    ,
427    /// Bad Request
428    BadRequest
429    (models::BadRequest)
430    ,
431    /// Operation Failed
432    OperationFailed
433    (models::OpError)
434}
435
436#[derive(Debug, PartialEq)]
437#[must_use]
438pub enum SetFreqResponse {
439    /// OK
440    OK
441    ,
442    /// Bad Request
443    BadRequest
444    (models::BadRequest)
445    ,
446    /// Operation Failed
447    OperationFailed
448    (models::OpError)
449}
450
451#[derive(Debug, PartialEq)]
452#[must_use]
453pub enum SetGroupResponse {
454    /// OK
455    OK
456    ,
457    /// Bad Request
458    BadRequest
459    (models::BadRequest)
460    ,
461    /// Operation Failed
462    OperationFailed
463    (models::OpError)
464}
465
466#[derive(Debug, PartialEq)]
467#[must_use]
468pub enum SetLedCurrentResponse {
469    /// OK
470    OK
471    ,
472    /// Bad Request
473    BadRequest
474    (models::BadRequest)
475    ,
476    /// Operation Failed
477    OperationFailed
478    (models::OpError)
479}
480
481#[derive(Debug, PartialEq)]
482#[must_use]
483pub enum SetLedErrorResponse {
484    /// OK
485    OK
486    ,
487    /// Bad Request
488    BadRequest
489    (models::BadRequest)
490    ,
491    /// Operation Failed
492    OperationFailed
493    (models::OpError)
494}
495
496#[derive(Debug, PartialEq)]
497#[must_use]
498pub enum SetLedInfoResponse {
499    /// OK
500    OK
501    ,
502    /// Bad Request
503    BadRequest
504    (models::BadRequest)
505    ,
506    /// Operation Failed
507    OperationFailed
508    (models::OpError)
509}
510
511#[derive(Debug, PartialEq)]
512#[must_use]
513pub enum SetLedInfoAllResponse {
514    /// OK
515    OK
516    ,
517    /// Bad Request
518    BadRequest
519    (models::BadRequest)
520    ,
521    /// Operation Failed
522    OperationFailed
523    (models::OpError)
524}
525
526#[derive(Debug, PartialEq)]
527#[must_use]
528pub enum SetLedPwmResponse {
529    /// OK
530    OK
531    ,
532    /// Bad Request
533    BadRequest
534    (models::BadRequest)
535    ,
536    /// Operation Failed
537    OperationFailed
538    (models::OpError)
539}
540
541#[derive(Debug, PartialEq)]
542#[must_use]
543pub enum SetLedStateResponse {
544    /// OK
545    OK
546    ,
547    /// Bad Request
548    BadRequest
549    (models::BadRequest)
550    ,
551    /// Operation Failed
552    OperationFailed
553    (models::OpError)
554}
555
556#[derive(Debug, PartialEq)]
557#[must_use]
558pub enum SetOffsetResponse {
559    /// OK
560    OK
561    ,
562    /// Bad Request
563    BadRequest
564    (models::BadRequest)
565    ,
566    /// Operation Failed
567    OperationFailed
568    (models::OpError)
569}
570
571#[derive(Debug, PartialEq)]
572#[must_use]
573pub enum SetOutputChangeResponse {
574    /// OK
575    OK
576    ,
577    /// Bad Request
578    BadRequest
579    (models::BadRequest)
580    ,
581    /// Operation Failed
582    OperationFailed
583    (models::OpError)
584}
585
586#[derive(Debug, PartialEq)]
587#[must_use]
588pub enum SetPwmResponse {
589    /// OK
590    OK
591    ,
592    /// Bad Request
593    BadRequest
594    (models::BadRequest)
595    ,
596    /// Operation Failed
597    OperationFailed
598    (models::OpError)
599}
600
601#[derive(Debug, PartialEq)]
602#[must_use]
603pub enum SetSleepResponse {
604    /// OK
605    OK
606    ,
607    /// Bad Request
608    BadRequest
609    (models::BadRequest)
610    ,
611    /// Operation Failed
612    OperationFailed
613    (models::OpError)
614}
615
616/// API
617pub trait Api<C> {
618    fn clear_error(
619        &self,
620        bus_id: i32,
621        addr: i32,
622        context: &C) -> Box<dyn Future<Item=ClearErrorResponse, Error=ApiError> + Send>;
623
624    fn get_addr_enabled(
625        &self,
626        bus_id: i32,
627        addr: i32,
628        num: i32,
629        context: &C) -> Box<dyn Future<Item=GetAddrEnabledResponse, Error=ApiError> + Send>;
630
631    fn get_addr_info(
632        &self,
633        bus_id: i32,
634        addr: i32,
635        num: i32,
636        context: &C) -> Box<dyn Future<Item=GetAddrInfoResponse, Error=ApiError> + Send>;
637
638    fn get_addr_value(
639        &self,
640        bus_id: i32,
641        addr: i32,
642        num: i32,
643        context: &C) -> Box<dyn Future<Item=GetAddrValueResponse, Error=ApiError> + Send>;
644
645    fn get_api(
646        &self,
647        context: &C) -> Box<dyn Future<Item=GetApiResponse, Error=ApiError> + Send>;
648
649    fn get_config(
650        &self,
651        bus_id: i32,
652        addr: i32,
653        context: &C) -> Box<dyn Future<Item=GetConfigResponse, Error=ApiError> + Send>;
654
655    fn get_current(
656        &self,
657        bus_id: i32,
658        addr: i32,
659        context: &C) -> Box<dyn Future<Item=GetCurrentResponse, Error=ApiError> + Send>;
660
661    fn get_error(
662        &self,
663        bus_id: i32,
664        addr: i32,
665        context: &C) -> Box<dyn Future<Item=GetErrorResponse, Error=ApiError> + Send>;
666
667    fn get_errors(
668        &self,
669        bus_id: i32,
670        addr: i32,
671        context: &C) -> Box<dyn Future<Item=GetErrorsResponse, Error=ApiError> + Send>;
672
673    fn get_freq(
674        &self,
675        bus_id: i32,
676        addr: i32,
677        context: &C) -> Box<dyn Future<Item=GetFreqResponse, Error=ApiError> + Send>;
678
679    fn get_group(
680        &self,
681        bus_id: i32,
682        addr: i32,
683        context: &C) -> Box<dyn Future<Item=GetGroupResponse, Error=ApiError> + Send>;
684
685    fn get_led_current(
686        &self,
687        bus_id: i32,
688        addr: i32,
689        led: i32,
690        context: &C) -> Box<dyn Future<Item=GetLedCurrentResponse, Error=ApiError> + Send>;
691
692    fn get_led_error(
693        &self,
694        bus_id: i32,
695        addr: i32,
696        led: i32,
697        context: &C) -> Box<dyn Future<Item=GetLedErrorResponse, Error=ApiError> + Send>;
698
699    fn get_led_info(
700        &self,
701        bus_id: i32,
702        addr: i32,
703        led: i32,
704        context: &C) -> Box<dyn Future<Item=GetLedInfoResponse, Error=ApiError> + Send>;
705
706    fn get_led_info_all(
707        &self,
708        bus_id: i32,
709        addr: i32,
710        context: &C) -> Box<dyn Future<Item=GetLedInfoAllResponse, Error=ApiError> + Send>;
711
712    fn get_led_pwm(
713        &self,
714        bus_id: i32,
715        addr: i32,
716        led: i32,
717        context: &C) -> Box<dyn Future<Item=GetLedPwmResponse, Error=ApiError> + Send>;
718
719    fn get_led_state(
720        &self,
721        bus_id: i32,
722        addr: i32,
723        led: i32,
724        context: &C) -> Box<dyn Future<Item=GetLedStateResponse, Error=ApiError> + Send>;
725
726    fn get_offset(
727        &self,
728        bus_id: i32,
729        addr: i32,
730        context: &C) -> Box<dyn Future<Item=GetOffsetResponse, Error=ApiError> + Send>;
731
732    fn get_output_change(
733        &self,
734        bus_id: i32,
735        addr: i32,
736        context: &C) -> Box<dyn Future<Item=GetOutputChangeResponse, Error=ApiError> + Send>;
737
738    fn get_over_temp(
739        &self,
740        bus_id: i32,
741        addr: i32,
742        context: &C) -> Box<dyn Future<Item=GetOverTempResponse, Error=ApiError> + Send>;
743
744    fn get_pwm(
745        &self,
746        bus_id: i32,
747        addr: i32,
748        context: &C) -> Box<dyn Future<Item=GetPwmResponse, Error=ApiError> + Send>;
749
750    fn get_sleep(
751        &self,
752        bus_id: i32,
753        addr: i32,
754        context: &C) -> Box<dyn Future<Item=GetSleepResponse, Error=ApiError> + Send>;
755
756    fn reset(
757        &self,
758        bus_id: i32,
759        context: &C) -> Box<dyn Future<Item=ResetResponse, Error=ApiError> + Send>;
760
761    fn set_addr_enabled(
762        &self,
763        bus_id: i32,
764        addr: i32,
765        num: i32,
766        enabled: bool,
767        context: &C) -> Box<dyn Future<Item=SetAddrEnabledResponse, Error=ApiError> + Send>;
768
769    fn set_addr_value(
770        &self,
771        bus_id: i32,
772        addr: i32,
773        num: i32,
774        addr_val: i32,
775        context: &C) -> Box<dyn Future<Item=SetAddrValueResponse, Error=ApiError> + Send>;
776
777    fn set_config(
778        &self,
779        bus_id: i32,
780        addr: i32,
781        config: models::Config,
782        context: &C) -> Box<dyn Future<Item=SetConfigResponse, Error=ApiError> + Send>;
783
784    fn set_current(
785        &self,
786        bus_id: i32,
787        addr: i32,
788        current: i32,
789        context: &C) -> Box<dyn Future<Item=SetCurrentResponse, Error=ApiError> + Send>;
790
791    fn set_freq(
792        &self,
793        bus_id: i32,
794        addr: i32,
795        freq: i32,
796        context: &C) -> Box<dyn Future<Item=SetFreqResponse, Error=ApiError> + Send>;
797
798    fn set_group(
799        &self,
800        bus_id: i32,
801        addr: i32,
802        group: models::Group,
803        context: &C) -> Box<dyn Future<Item=SetGroupResponse, Error=ApiError> + Send>;
804
805    fn set_led_current(
806        &self,
807        bus_id: i32,
808        addr: i32,
809        led: i32,
810        current: i32,
811        context: &C) -> Box<dyn Future<Item=SetLedCurrentResponse, Error=ApiError> + Send>;
812
813    fn set_led_error(
814        &self,
815        bus_id: i32,
816        addr: i32,
817        led: i32,
818        error: models::LedError,
819        context: &C) -> Box<dyn Future<Item=SetLedErrorResponse, Error=ApiError> + Send>;
820
821    fn set_led_info(
822        &self,
823        bus_id: i32,
824        addr: i32,
825        led: i32,
826        led_info: models::LedInfo,
827        context: &C) -> Box<dyn Future<Item=SetLedInfoResponse, Error=ApiError> + Send>;
828
829    fn set_led_info_all(
830        &self,
831        bus_id: i32,
832        addr: i32,
833        led_info_array: models::LedInfoArray,
834        context: &C) -> Box<dyn Future<Item=SetLedInfoAllResponse, Error=ApiError> + Send>;
835
836    fn set_led_pwm(
837        &self,
838        bus_id: i32,
839        addr: i32,
840        led: i32,
841        pwm: i32,
842        context: &C) -> Box<dyn Future<Item=SetLedPwmResponse, Error=ApiError> + Send>;
843
844    fn set_led_state(
845        &self,
846        bus_id: i32,
847        addr: i32,
848        led: i32,
849        state: models::LedState,
850        context: &C) -> Box<dyn Future<Item=SetLedStateResponse, Error=ApiError> + Send>;
851
852    fn set_offset(
853        &self,
854        bus_id: i32,
855        addr: i32,
856        offset: i32,
857        context: &C) -> Box<dyn Future<Item=SetOffsetResponse, Error=ApiError> + Send>;
858
859    fn set_output_change(
860        &self,
861        bus_id: i32,
862        addr: i32,
863        output_change: models::OutputChange,
864        context: &C) -> Box<dyn Future<Item=SetOutputChangeResponse, Error=ApiError> + Send>;
865
866    fn set_pwm(
867        &self,
868        bus_id: i32,
869        addr: i32,
870        pwm: i32,
871        context: &C) -> Box<dyn Future<Item=SetPwmResponse, Error=ApiError> + Send>;
872
873    fn set_sleep(
874        &self,
875        bus_id: i32,
876        addr: i32,
877        sleep: bool,
878        context: &C) -> Box<dyn Future<Item=SetSleepResponse, Error=ApiError> + Send>;
879
880}
881
882/// API without a `Context`
883pub trait ApiNoContext {
884    fn clear_error(
885        &self,
886        bus_id: i32,
887        addr: i32,
888        ) -> Box<dyn Future<Item=ClearErrorResponse, Error=ApiError> + Send>;
889
890    fn get_addr_enabled(
891        &self,
892        bus_id: i32,
893        addr: i32,
894        num: i32,
895        ) -> Box<dyn Future<Item=GetAddrEnabledResponse, Error=ApiError> + Send>;
896
897    fn get_addr_info(
898        &self,
899        bus_id: i32,
900        addr: i32,
901        num: i32,
902        ) -> Box<dyn Future<Item=GetAddrInfoResponse, Error=ApiError> + Send>;
903
904    fn get_addr_value(
905        &self,
906        bus_id: i32,
907        addr: i32,
908        num: i32,
909        ) -> Box<dyn Future<Item=GetAddrValueResponse, Error=ApiError> + Send>;
910
911    fn get_api(
912        &self,
913        ) -> Box<dyn Future<Item=GetApiResponse, Error=ApiError> + Send>;
914
915    fn get_config(
916        &self,
917        bus_id: i32,
918        addr: i32,
919        ) -> Box<dyn Future<Item=GetConfigResponse, Error=ApiError> + Send>;
920
921    fn get_current(
922        &self,
923        bus_id: i32,
924        addr: i32,
925        ) -> Box<dyn Future<Item=GetCurrentResponse, Error=ApiError> + Send>;
926
927    fn get_error(
928        &self,
929        bus_id: i32,
930        addr: i32,
931        ) -> Box<dyn Future<Item=GetErrorResponse, Error=ApiError> + Send>;
932
933    fn get_errors(
934        &self,
935        bus_id: i32,
936        addr: i32,
937        ) -> Box<dyn Future<Item=GetErrorsResponse, Error=ApiError> + Send>;
938
939    fn get_freq(
940        &self,
941        bus_id: i32,
942        addr: i32,
943        ) -> Box<dyn Future<Item=GetFreqResponse, Error=ApiError> + Send>;
944
945    fn get_group(
946        &self,
947        bus_id: i32,
948        addr: i32,
949        ) -> Box<dyn Future<Item=GetGroupResponse, Error=ApiError> + Send>;
950
951    fn get_led_current(
952        &self,
953        bus_id: i32,
954        addr: i32,
955        led: i32,
956        ) -> Box<dyn Future<Item=GetLedCurrentResponse, Error=ApiError> + Send>;
957
958    fn get_led_error(
959        &self,
960        bus_id: i32,
961        addr: i32,
962        led: i32,
963        ) -> Box<dyn Future<Item=GetLedErrorResponse, Error=ApiError> + Send>;
964
965    fn get_led_info(
966        &self,
967        bus_id: i32,
968        addr: i32,
969        led: i32,
970        ) -> Box<dyn Future<Item=GetLedInfoResponse, Error=ApiError> + Send>;
971
972    fn get_led_info_all(
973        &self,
974        bus_id: i32,
975        addr: i32,
976        ) -> Box<dyn Future<Item=GetLedInfoAllResponse, Error=ApiError> + Send>;
977
978    fn get_led_pwm(
979        &self,
980        bus_id: i32,
981        addr: i32,
982        led: i32,
983        ) -> Box<dyn Future<Item=GetLedPwmResponse, Error=ApiError> + Send>;
984
985    fn get_led_state(
986        &self,
987        bus_id: i32,
988        addr: i32,
989        led: i32,
990        ) -> Box<dyn Future<Item=GetLedStateResponse, Error=ApiError> + Send>;
991
992    fn get_offset(
993        &self,
994        bus_id: i32,
995        addr: i32,
996        ) -> Box<dyn Future<Item=GetOffsetResponse, Error=ApiError> + Send>;
997
998    fn get_output_change(
999        &self,
1000        bus_id: i32,
1001        addr: i32,
1002        ) -> Box<dyn Future<Item=GetOutputChangeResponse, Error=ApiError> + Send>;
1003
1004    fn get_over_temp(
1005        &self,
1006        bus_id: i32,
1007        addr: i32,
1008        ) -> Box<dyn Future<Item=GetOverTempResponse, Error=ApiError> + Send>;
1009
1010    fn get_pwm(
1011        &self,
1012        bus_id: i32,
1013        addr: i32,
1014        ) -> Box<dyn Future<Item=GetPwmResponse, Error=ApiError> + Send>;
1015
1016    fn get_sleep(
1017        &self,
1018        bus_id: i32,
1019        addr: i32,
1020        ) -> Box<dyn Future<Item=GetSleepResponse, Error=ApiError> + Send>;
1021
1022    fn reset(
1023        &self,
1024        bus_id: i32,
1025        ) -> Box<dyn Future<Item=ResetResponse, Error=ApiError> + Send>;
1026
1027    fn set_addr_enabled(
1028        &self,
1029        bus_id: i32,
1030        addr: i32,
1031        num: i32,
1032        enabled: bool,
1033        ) -> Box<dyn Future<Item=SetAddrEnabledResponse, Error=ApiError> + Send>;
1034
1035    fn set_addr_value(
1036        &self,
1037        bus_id: i32,
1038        addr: i32,
1039        num: i32,
1040        addr_val: i32,
1041        ) -> Box<dyn Future<Item=SetAddrValueResponse, Error=ApiError> + Send>;
1042
1043    fn set_config(
1044        &self,
1045        bus_id: i32,
1046        addr: i32,
1047        config: models::Config,
1048        ) -> Box<dyn Future<Item=SetConfigResponse, Error=ApiError> + Send>;
1049
1050    fn set_current(
1051        &self,
1052        bus_id: i32,
1053        addr: i32,
1054        current: i32,
1055        ) -> Box<dyn Future<Item=SetCurrentResponse, Error=ApiError> + Send>;
1056
1057    fn set_freq(
1058        &self,
1059        bus_id: i32,
1060        addr: i32,
1061        freq: i32,
1062        ) -> Box<dyn Future<Item=SetFreqResponse, Error=ApiError> + Send>;
1063
1064    fn set_group(
1065        &self,
1066        bus_id: i32,
1067        addr: i32,
1068        group: models::Group,
1069        ) -> Box<dyn Future<Item=SetGroupResponse, Error=ApiError> + Send>;
1070
1071    fn set_led_current(
1072        &self,
1073        bus_id: i32,
1074        addr: i32,
1075        led: i32,
1076        current: i32,
1077        ) -> Box<dyn Future<Item=SetLedCurrentResponse, Error=ApiError> + Send>;
1078
1079    fn set_led_error(
1080        &self,
1081        bus_id: i32,
1082        addr: i32,
1083        led: i32,
1084        error: models::LedError,
1085        ) -> Box<dyn Future<Item=SetLedErrorResponse, Error=ApiError> + Send>;
1086
1087    fn set_led_info(
1088        &self,
1089        bus_id: i32,
1090        addr: i32,
1091        led: i32,
1092        led_info: models::LedInfo,
1093        ) -> Box<dyn Future<Item=SetLedInfoResponse, Error=ApiError> + Send>;
1094
1095    fn set_led_info_all(
1096        &self,
1097        bus_id: i32,
1098        addr: i32,
1099        led_info_array: models::LedInfoArray,
1100        ) -> Box<dyn Future<Item=SetLedInfoAllResponse, Error=ApiError> + Send>;
1101
1102    fn set_led_pwm(
1103        &self,
1104        bus_id: i32,
1105        addr: i32,
1106        led: i32,
1107        pwm: i32,
1108        ) -> Box<dyn Future<Item=SetLedPwmResponse, Error=ApiError> + Send>;
1109
1110    fn set_led_state(
1111        &self,
1112        bus_id: i32,
1113        addr: i32,
1114        led: i32,
1115        state: models::LedState,
1116        ) -> Box<dyn Future<Item=SetLedStateResponse, Error=ApiError> + Send>;
1117
1118    fn set_offset(
1119        &self,
1120        bus_id: i32,
1121        addr: i32,
1122        offset: i32,
1123        ) -> Box<dyn Future<Item=SetOffsetResponse, Error=ApiError> + Send>;
1124
1125    fn set_output_change(
1126        &self,
1127        bus_id: i32,
1128        addr: i32,
1129        output_change: models::OutputChange,
1130        ) -> Box<dyn Future<Item=SetOutputChangeResponse, Error=ApiError> + Send>;
1131
1132    fn set_pwm(
1133        &self,
1134        bus_id: i32,
1135        addr: i32,
1136        pwm: i32,
1137        ) -> Box<dyn Future<Item=SetPwmResponse, Error=ApiError> + Send>;
1138
1139    fn set_sleep(
1140        &self,
1141        bus_id: i32,
1142        addr: i32,
1143        sleep: bool,
1144        ) -> Box<dyn Future<Item=SetSleepResponse, Error=ApiError> + Send>;
1145
1146}
1147
1148/// Trait to extend an API to make it easy to bind it to a context.
1149pub trait ContextWrapperExt<'a, C> where Self: Sized {
1150    /// Binds this API to a context.
1151    fn with_context(self: &'a Self, context: C) -> ContextWrapper<'a, Self, C>;
1152}
1153
1154impl<'a, T: Api<C> + Sized, C> ContextWrapperExt<'a, C> for T {
1155    fn with_context(self: &'a T, context: C) -> ContextWrapper<'a, T, C> {
1156         ContextWrapper::<T, C>::new(self, context)
1157    }
1158}
1159
1160impl<'a, T: Api<C>, C> ApiNoContext for ContextWrapper<'a, T, C> {
1161    fn clear_error(
1162        &self,
1163        bus_id: i32,
1164        addr: i32,
1165        ) -> Box<dyn Future<Item=ClearErrorResponse, Error=ApiError> + Send>
1166    {
1167        self.api().clear_error(bus_id, addr, &self.context())
1168    }
1169
1170    fn get_addr_enabled(
1171        &self,
1172        bus_id: i32,
1173        addr: i32,
1174        num: i32,
1175        ) -> Box<dyn Future<Item=GetAddrEnabledResponse, Error=ApiError> + Send>
1176    {
1177        self.api().get_addr_enabled(bus_id, addr, num, &self.context())
1178    }
1179
1180    fn get_addr_info(
1181        &self,
1182        bus_id: i32,
1183        addr: i32,
1184        num: i32,
1185        ) -> Box<dyn Future<Item=GetAddrInfoResponse, Error=ApiError> + Send>
1186    {
1187        self.api().get_addr_info(bus_id, addr, num, &self.context())
1188    }
1189
1190    fn get_addr_value(
1191        &self,
1192        bus_id: i32,
1193        addr: i32,
1194        num: i32,
1195        ) -> Box<dyn Future<Item=GetAddrValueResponse, Error=ApiError> + Send>
1196    {
1197        self.api().get_addr_value(bus_id, addr, num, &self.context())
1198    }
1199
1200    fn get_api(
1201        &self,
1202        ) -> Box<dyn Future<Item=GetApiResponse, Error=ApiError> + Send>
1203    {
1204        self.api().get_api(&self.context())
1205    }
1206
1207    fn get_config(
1208        &self,
1209        bus_id: i32,
1210        addr: i32,
1211        ) -> Box<dyn Future<Item=GetConfigResponse, Error=ApiError> + Send>
1212    {
1213        self.api().get_config(bus_id, addr, &self.context())
1214    }
1215
1216    fn get_current(
1217        &self,
1218        bus_id: i32,
1219        addr: i32,
1220        ) -> Box<dyn Future<Item=GetCurrentResponse, Error=ApiError> + Send>
1221    {
1222        self.api().get_current(bus_id, addr, &self.context())
1223    }
1224
1225    fn get_error(
1226        &self,
1227        bus_id: i32,
1228        addr: i32,
1229        ) -> Box<dyn Future<Item=GetErrorResponse, Error=ApiError> + Send>
1230    {
1231        self.api().get_error(bus_id, addr, &self.context())
1232    }
1233
1234    fn get_errors(
1235        &self,
1236        bus_id: i32,
1237        addr: i32,
1238        ) -> Box<dyn Future<Item=GetErrorsResponse, Error=ApiError> + Send>
1239    {
1240        self.api().get_errors(bus_id, addr, &self.context())
1241    }
1242
1243    fn get_freq(
1244        &self,
1245        bus_id: i32,
1246        addr: i32,
1247        ) -> Box<dyn Future<Item=GetFreqResponse, Error=ApiError> + Send>
1248    {
1249        self.api().get_freq(bus_id, addr, &self.context())
1250    }
1251
1252    fn get_group(
1253        &self,
1254        bus_id: i32,
1255        addr: i32,
1256        ) -> Box<dyn Future<Item=GetGroupResponse, Error=ApiError> + Send>
1257    {
1258        self.api().get_group(bus_id, addr, &self.context())
1259    }
1260
1261    fn get_led_current(
1262        &self,
1263        bus_id: i32,
1264        addr: i32,
1265        led: i32,
1266        ) -> Box<dyn Future<Item=GetLedCurrentResponse, Error=ApiError> + Send>
1267    {
1268        self.api().get_led_current(bus_id, addr, led, &self.context())
1269    }
1270
1271    fn get_led_error(
1272        &self,
1273        bus_id: i32,
1274        addr: i32,
1275        led: i32,
1276        ) -> Box<dyn Future<Item=GetLedErrorResponse, Error=ApiError> + Send>
1277    {
1278        self.api().get_led_error(bus_id, addr, led, &self.context())
1279    }
1280
1281    fn get_led_info(
1282        &self,
1283        bus_id: i32,
1284        addr: i32,
1285        led: i32,
1286        ) -> Box<dyn Future<Item=GetLedInfoResponse, Error=ApiError> + Send>
1287    {
1288        self.api().get_led_info(bus_id, addr, led, &self.context())
1289    }
1290
1291    fn get_led_info_all(
1292        &self,
1293        bus_id: i32,
1294        addr: i32,
1295        ) -> Box<dyn Future<Item=GetLedInfoAllResponse, Error=ApiError> + Send>
1296    {
1297        self.api().get_led_info_all(bus_id, addr, &self.context())
1298    }
1299
1300    fn get_led_pwm(
1301        &self,
1302        bus_id: i32,
1303        addr: i32,
1304        led: i32,
1305        ) -> Box<dyn Future<Item=GetLedPwmResponse, Error=ApiError> + Send>
1306    {
1307        self.api().get_led_pwm(bus_id, addr, led, &self.context())
1308    }
1309
1310    fn get_led_state(
1311        &self,
1312        bus_id: i32,
1313        addr: i32,
1314        led: i32,
1315        ) -> Box<dyn Future<Item=GetLedStateResponse, Error=ApiError> + Send>
1316    {
1317        self.api().get_led_state(bus_id, addr, led, &self.context())
1318    }
1319
1320    fn get_offset(
1321        &self,
1322        bus_id: i32,
1323        addr: i32,
1324        ) -> Box<dyn Future<Item=GetOffsetResponse, Error=ApiError> + Send>
1325    {
1326        self.api().get_offset(bus_id, addr, &self.context())
1327    }
1328
1329    fn get_output_change(
1330        &self,
1331        bus_id: i32,
1332        addr: i32,
1333        ) -> Box<dyn Future<Item=GetOutputChangeResponse, Error=ApiError> + Send>
1334    {
1335        self.api().get_output_change(bus_id, addr, &self.context())
1336    }
1337
1338    fn get_over_temp(
1339        &self,
1340        bus_id: i32,
1341        addr: i32,
1342        ) -> Box<dyn Future<Item=GetOverTempResponse, Error=ApiError> + Send>
1343    {
1344        self.api().get_over_temp(bus_id, addr, &self.context())
1345    }
1346
1347    fn get_pwm(
1348        &self,
1349        bus_id: i32,
1350        addr: i32,
1351        ) -> Box<dyn Future<Item=GetPwmResponse, Error=ApiError> + Send>
1352    {
1353        self.api().get_pwm(bus_id, addr, &self.context())
1354    }
1355
1356    fn get_sleep(
1357        &self,
1358        bus_id: i32,
1359        addr: i32,
1360        ) -> Box<dyn Future<Item=GetSleepResponse, Error=ApiError> + Send>
1361    {
1362        self.api().get_sleep(bus_id, addr, &self.context())
1363    }
1364
1365    fn reset(
1366        &self,
1367        bus_id: i32,
1368        ) -> Box<dyn Future<Item=ResetResponse, Error=ApiError> + Send>
1369    {
1370        self.api().reset(bus_id, &self.context())
1371    }
1372
1373    fn set_addr_enabled(
1374        &self,
1375        bus_id: i32,
1376        addr: i32,
1377        num: i32,
1378        enabled: bool,
1379        ) -> Box<dyn Future<Item=SetAddrEnabledResponse, Error=ApiError> + Send>
1380    {
1381        self.api().set_addr_enabled(bus_id, addr, num, enabled, &self.context())
1382    }
1383
1384    fn set_addr_value(
1385        &self,
1386        bus_id: i32,
1387        addr: i32,
1388        num: i32,
1389        addr_val: i32,
1390        ) -> Box<dyn Future<Item=SetAddrValueResponse, Error=ApiError> + Send>
1391    {
1392        self.api().set_addr_value(bus_id, addr, num, addr_val, &self.context())
1393    }
1394
1395    fn set_config(
1396        &self,
1397        bus_id: i32,
1398        addr: i32,
1399        config: models::Config,
1400        ) -> Box<dyn Future<Item=SetConfigResponse, Error=ApiError> + Send>
1401    {
1402        self.api().set_config(bus_id, addr, config, &self.context())
1403    }
1404
1405    fn set_current(
1406        &self,
1407        bus_id: i32,
1408        addr: i32,
1409        current: i32,
1410        ) -> Box<dyn Future<Item=SetCurrentResponse, Error=ApiError> + Send>
1411    {
1412        self.api().set_current(bus_id, addr, current, &self.context())
1413    }
1414
1415    fn set_freq(
1416        &self,
1417        bus_id: i32,
1418        addr: i32,
1419        freq: i32,
1420        ) -> Box<dyn Future<Item=SetFreqResponse, Error=ApiError> + Send>
1421    {
1422        self.api().set_freq(bus_id, addr, freq, &self.context())
1423    }
1424
1425    fn set_group(
1426        &self,
1427        bus_id: i32,
1428        addr: i32,
1429        group: models::Group,
1430        ) -> Box<dyn Future<Item=SetGroupResponse, Error=ApiError> + Send>
1431    {
1432        self.api().set_group(bus_id, addr, group, &self.context())
1433    }
1434
1435    fn set_led_current(
1436        &self,
1437        bus_id: i32,
1438        addr: i32,
1439        led: i32,
1440        current: i32,
1441        ) -> Box<dyn Future<Item=SetLedCurrentResponse, Error=ApiError> + Send>
1442    {
1443        self.api().set_led_current(bus_id, addr, led, current, &self.context())
1444    }
1445
1446    fn set_led_error(
1447        &self,
1448        bus_id: i32,
1449        addr: i32,
1450        led: i32,
1451        error: models::LedError,
1452        ) -> Box<dyn Future<Item=SetLedErrorResponse, Error=ApiError> + Send>
1453    {
1454        self.api().set_led_error(bus_id, addr, led, error, &self.context())
1455    }
1456
1457    fn set_led_info(
1458        &self,
1459        bus_id: i32,
1460        addr: i32,
1461        led: i32,
1462        led_info: models::LedInfo,
1463        ) -> Box<dyn Future<Item=SetLedInfoResponse, Error=ApiError> + Send>
1464    {
1465        self.api().set_led_info(bus_id, addr, led, led_info, &self.context())
1466    }
1467
1468    fn set_led_info_all(
1469        &self,
1470        bus_id: i32,
1471        addr: i32,
1472        led_info_array: models::LedInfoArray,
1473        ) -> Box<dyn Future<Item=SetLedInfoAllResponse, Error=ApiError> + Send>
1474    {
1475        self.api().set_led_info_all(bus_id, addr, led_info_array, &self.context())
1476    }
1477
1478    fn set_led_pwm(
1479        &self,
1480        bus_id: i32,
1481        addr: i32,
1482        led: i32,
1483        pwm: i32,
1484        ) -> Box<dyn Future<Item=SetLedPwmResponse, Error=ApiError> + Send>
1485    {
1486        self.api().set_led_pwm(bus_id, addr, led, pwm, &self.context())
1487    }
1488
1489    fn set_led_state(
1490        &self,
1491        bus_id: i32,
1492        addr: i32,
1493        led: i32,
1494        state: models::LedState,
1495        ) -> Box<dyn Future<Item=SetLedStateResponse, Error=ApiError> + Send>
1496    {
1497        self.api().set_led_state(bus_id, addr, led, state, &self.context())
1498    }
1499
1500    fn set_offset(
1501        &self,
1502        bus_id: i32,
1503        addr: i32,
1504        offset: i32,
1505        ) -> Box<dyn Future<Item=SetOffsetResponse, Error=ApiError> + Send>
1506    {
1507        self.api().set_offset(bus_id, addr, offset, &self.context())
1508    }
1509
1510    fn set_output_change(
1511        &self,
1512        bus_id: i32,
1513        addr: i32,
1514        output_change: models::OutputChange,
1515        ) -> Box<dyn Future<Item=SetOutputChangeResponse, Error=ApiError> + Send>
1516    {
1517        self.api().set_output_change(bus_id, addr, output_change, &self.context())
1518    }
1519
1520    fn set_pwm(
1521        &self,
1522        bus_id: i32,
1523        addr: i32,
1524        pwm: i32,
1525        ) -> Box<dyn Future<Item=SetPwmResponse, Error=ApiError> + Send>
1526    {
1527        self.api().set_pwm(bus_id, addr, pwm, &self.context())
1528    }
1529
1530    fn set_sleep(
1531        &self,
1532        bus_id: i32,
1533        addr: i32,
1534        sleep: bool,
1535        ) -> Box<dyn Future<Item=SetSleepResponse, Error=ApiError> + Send>
1536    {
1537        self.api().set_sleep(bus_id, addr, sleep, &self.context())
1538    }
1539
1540}
1541
1542#[cfg(feature = "client")]
1543pub mod client;
1544
1545// Re-export Client as a top-level name
1546#[cfg(feature = "client")]
1547pub use client::Client;
1548
1549#[cfg(feature = "server")]
1550pub mod server;
1551
1552// Re-export router() as a top-level name
1553#[cfg(feature = "server")]
1554pub use self::server::Service;
1555
1556#[cfg(feature = "server")]
1557pub mod context;
1558
1559pub mod models;
1560
1561#[cfg(any(feature = "client", feature = "server"))]
1562pub(crate) mod header;