@@ -37,6 +37,7 @@ impl<C: hyper::client::Connect> AppsApiClient<C> {
37
37
}
38
38
39
39
pub trait AppsApi {
40
+ fn delete_using_delete ( & self , any_state_app_id : i64 ) -> Box < Future < Item = :: models:: GenericApiResponse , Error = Error < serde_json:: Value > > > ;
40
41
fn get_app_types_using_get ( & self , ) -> Box < dyn Future < Item = :: models:: GenericApiResponse , Error = Error < serde_json:: Value > > > ;
41
42
fn get_using_get ( & self , any_state_app_id : i64 ) -> Box < dyn Future < Item = :: models:: GenericApiResponse , Error = Error < serde_json:: Value > > > ;
42
43
fn invite_app_guests_using_post ( & self , invitation : :: models:: Invitation ) -> Box < dyn Future < Item = :: models:: GenericApiResponse , Error = Error < serde_json:: Value > > > ;
@@ -46,8 +47,73 @@ pub trait AppsApi {
46
47
fn update_using_put1 ( & self , dto : :: models:: UpdateAppInfo , any_state_app_id : i64 ) -> Box < dyn Future < Item = :: models:: GenericApiResponse , Error = Error < serde_json:: Value > > > ;
47
48
}
48
49
49
-
50
50
impl < C : hyper:: client:: Connect > AppsApi for AppsApiClient < C > {
51
+ fn delete_using_delete ( & self , any_state_app_id : i64 ) -> Box < Future < Item = :: models:: GenericApiResponse , Error = Error < serde_json:: Value > > > {
52
+ let configuration: & configuration:: Configuration < C > = self . configuration . borrow ( ) ;
53
+
54
+ let mut auth_headers = HashMap :: < String , String > :: new ( ) ;
55
+ let mut auth_query = HashMap :: < String , String > :: new ( ) ;
56
+ if let Some ( ref apikey) = configuration. api_key {
57
+ let key = apikey. key . clone ( ) ;
58
+ let val = match apikey. prefix {
59
+ Some ( ref prefix) => format ! ( "{} {}" , prefix, key) ,
60
+ None => key,
61
+ } ;
62
+ auth_headers. insert ( "Authorization" . to_owned ( ) , val) ;
63
+ } ;
64
+ let method = hyper:: Method :: Delete ;
65
+
66
+ let query_string = {
67
+ let mut query = :: url:: form_urlencoded:: Serializer :: new ( String :: new ( ) ) ;
68
+ for ( key, val) in & auth_query {
69
+ query. append_pair ( key, val) ;
70
+ }
71
+ query. finish ( )
72
+ } ;
73
+ let uri_str = format ! ( "{}/users-web/api/v3/apps/{anyStateAppId}?{}" , configuration. base_path, query_string, anyStateAppId=any_state_app_id) ;
74
+
75
+ // TODO(farcaller): handle error
76
+ // if let Err(e) = uri {
77
+ // return Box::new(futures::future::err(e));
78
+ // }
79
+ let mut uri: hyper:: Uri = uri_str. parse ( ) . unwrap ( ) ;
80
+
81
+ let mut req = hyper:: Request :: new ( method, uri) ;
82
+
83
+ if let Some ( ref user_agent) = configuration. user_agent {
84
+ req. headers_mut ( ) . set ( UserAgent :: new ( Cow :: Owned ( user_agent. clone ( ) ) ) ) ;
85
+ }
86
+
87
+
88
+ for ( key, val) in auth_headers {
89
+ req. headers_mut ( ) . set_raw ( key, val) ;
90
+ }
91
+
92
+
93
+ // send request
94
+ Box :: new (
95
+ configuration. client . request ( req)
96
+ . map_err ( |e| Error :: from ( e) )
97
+ . and_then ( |resp| {
98
+ let status = resp. status ( ) ;
99
+ resp. body ( ) . concat2 ( )
100
+ . and_then ( move |body| Ok ( ( status, body) ) )
101
+ . map_err ( |e| Error :: from ( e) )
102
+ } )
103
+ . and_then ( |( status, body) | {
104
+ if status. is_success ( ) {
105
+ Ok ( body)
106
+ } else {
107
+ Err ( Error :: from ( ( status, & * body) ) )
108
+ }
109
+ } )
110
+ . and_then ( |body| {
111
+ let parsed: Result < :: models:: GenericApiResponse , _ > = serde_json:: from_slice ( & body) ;
112
+ parsed. map_err ( |e| Error :: from ( e) )
113
+ } )
114
+ )
115
+ }
116
+
51
117
fn get_app_types_using_get ( & self , ) -> Box < dyn Future < Item = :: models:: GenericApiResponse , Error = Error < serde_json:: Value > > > {
52
118
let configuration: & configuration:: Configuration < C > = self . configuration . borrow ( ) ;
53
119
0 commit comments