@@ -31,58 +31,52 @@ pub enum GetStateError {
31
31
32
32
33
33
pub fn create_state ( configuration : & configuration:: Configuration , create_state_request : models:: CreateStateRequest ) -> Result < ( ) , Error < CreateStateError > > {
34
- let local_var_configuration = configuration;
34
+ // add a prefix to parameters to efficiently prevent name collisions
35
+ let p_create_state_request = create_state_request;
35
36
36
- let local_var_client = & local_var_configuration. client ;
37
+ let uri_str = format ! ( "{}/state" , configuration. base_path) ;
38
+ let mut req_builder = configuration. client . request ( reqwest:: Method :: POST , & uri_str) ;
37
39
38
- let local_var_uri_str = format ! ( "{}/state" , local_var_configuration. base_path) ;
39
- let mut local_var_req_builder = local_var_client. request ( reqwest:: Method :: POST , local_var_uri_str. as_str ( ) ) ;
40
-
41
- if let Some ( ref local_var_user_agent) = local_var_configuration. user_agent {
42
- local_var_req_builder = local_var_req_builder. header ( reqwest:: header:: USER_AGENT , local_var_user_agent. clone ( ) ) ;
40
+ if let Some ( ref user_agent) = configuration. user_agent {
41
+ req_builder = req_builder. header ( reqwest:: header:: USER_AGENT , user_agent. clone ( ) ) ;
43
42
}
44
- local_var_req_builder = local_var_req_builder . json ( & create_state_request ) ;
43
+ req_builder = req_builder . json ( & p_create_state_request ) ;
45
44
46
- let local_var_req = local_var_req_builder . build ( ) ?;
47
- let local_var_resp = local_var_client . execute ( local_var_req ) ?;
45
+ let req = req_builder . build ( ) ?;
46
+ let resp = configuration . client . execute ( req ) ?;
48
47
49
- let local_var_status = local_var_resp . status ( ) ;
48
+ let status = resp . status ( ) ;
50
49
51
- if !local_var_status . is_client_error ( ) && !local_var_status . is_server_error ( ) {
50
+ if !status . is_client_error ( ) && !status . is_server_error ( ) {
52
51
Ok ( ( ) )
53
52
} else {
54
- let local_var_content = local_var_resp. text ( ) ?;
55
- let local_var_entity: Option < CreateStateError > = serde_json:: from_str ( & local_var_content) . ok ( ) ;
56
- let local_var_error = ResponseContent { status : local_var_status, content : local_var_content, entity : local_var_entity } ;
57
- Err ( Error :: ResponseError ( local_var_error) )
53
+ let content = resp. text ( ) ?;
54
+ let entity: Option < CreateStateError > = serde_json:: from_str ( & content) . ok ( ) ;
55
+ Err ( Error :: ResponseError ( ResponseContent { status, content, entity } ) )
58
56
}
59
57
}
60
58
61
59
pub fn get_state ( configuration : & configuration:: Configuration , ) -> Result < models:: GetState200Response , Error < GetStateError > > {
62
- let local_var_configuration = configuration;
63
-
64
- let local_var_client = & local_var_configuration. client ;
65
60
66
- let local_var_uri_str = format ! ( "{}/state" , local_var_configuration . base_path) ;
67
- let mut local_var_req_builder = local_var_client . request ( reqwest:: Method :: GET , local_var_uri_str . as_str ( ) ) ;
61
+ let uri_str = format ! ( "{}/state" , configuration . base_path) ;
62
+ let mut req_builder = configuration . client . request ( reqwest:: Method :: GET , & uri_str ) ;
68
63
69
- if let Some ( ref local_var_user_agent ) = local_var_configuration . user_agent {
70
- local_var_req_builder = local_var_req_builder . header ( reqwest:: header:: USER_AGENT , local_var_user_agent . clone ( ) ) ;
64
+ if let Some ( ref user_agent ) = configuration . user_agent {
65
+ req_builder = req_builder . header ( reqwest:: header:: USER_AGENT , user_agent . clone ( ) ) ;
71
66
}
72
67
73
- let local_var_req = local_var_req_builder . build ( ) ?;
74
- let local_var_resp = local_var_client . execute ( local_var_req ) ?;
68
+ let req = req_builder . build ( ) ?;
69
+ let resp = configuration . client . execute ( req ) ?;
75
70
76
- let local_var_status = local_var_resp . status ( ) ;
71
+ let status = resp . status ( ) ;
77
72
78
- if !local_var_status . is_client_error ( ) && !local_var_status . is_server_error ( ) {
79
- let local_var_content = local_var_resp . text ( ) ?;
80
- serde_json:: from_str ( & local_var_content ) . map_err ( Error :: from)
73
+ if !status . is_client_error ( ) && !status . is_server_error ( ) {
74
+ let content = resp . text ( ) ?;
75
+ serde_json:: from_str ( & content ) . map_err ( Error :: from)
81
76
} else {
82
- let local_var_content = local_var_resp. text ( ) ?;
83
- let local_var_entity: Option < GetStateError > = serde_json:: from_str ( & local_var_content) . ok ( ) ;
84
- let local_var_error = ResponseContent { status : local_var_status, content : local_var_content, entity : local_var_entity } ;
85
- Err ( Error :: ResponseError ( local_var_error) )
77
+ let content = resp. text ( ) ?;
78
+ let entity: Option < GetStateError > = serde_json:: from_str ( & content) . ok ( ) ;
79
+ Err ( Error :: ResponseError ( ResponseContent { status, content, entity } ) )
86
80
}
87
81
}
88
82
0 commit comments