@@ -33,6 +33,7 @@ fn generate_async_request_executor(
33
33
parsed_enum : & ParsedEnum ,
34
34
crate_config : & CrateConfig ,
35
35
) -> TokenStream {
36
+ let crate_ident = & config. crate_ident ;
36
37
let static_api_base_url_type = & config. static_types . api_base_url ;
37
38
let static_wp_authentication_type = & config. static_types . wp_authentication ;
38
39
let static_request_executor_type = & crate_config. request_executor ;
@@ -94,6 +95,7 @@ fn generate_async_request_executor(
94
95
& variant. variant_ident ,
95
96
& context_and_filter_handler,
96
97
) ;
98
+ let fn_parse_as_response_type_ident = ident_fn_parse_as_response_type ( & response_type_ident) ;
97
99
let response_params_type = response_params_type ( variant. attr . params . as_ref ( ) , variant. attr . request_type ) ;
98
100
let response_pagination_params_fields = response_params_type. as_ref ( ) . map ( |p| {
99
101
quote ! {
@@ -126,10 +128,10 @@ fn generate_async_request_executor(
126
128
pub struct #response_type_ident {
127
129
pub data: #output_type,
128
130
#[ serde( skip) ]
129
- pub header_map: std:: sync:: Arc <crate :: request:: WpNetworkHeaderMap >,
131
+ pub header_map: std:: sync:: Arc <#crate_ident :: request:: WpNetworkHeaderMap >,
130
132
#response_pagination_params_fields
131
133
}
132
- impl From <#response_type_ident> for crate :: request:: ParsedResponse <#output_type, #parsed_response_params_type> {
134
+ impl From <#response_type_ident> for #crate_ident :: request:: ParsedResponse <#output_type, #parsed_response_params_type> {
133
135
fn from( value: #response_type_ident) -> Self {
134
136
Self {
135
137
data: value. data,
@@ -138,15 +140,20 @@ fn generate_async_request_executor(
138
140
}
139
141
}
140
142
}
141
- impl From <crate :: request:: ParsedResponse <#output_type, #parsed_response_params_type>> for #response_type_ident {
142
- fn from( value: crate :: request:: ParsedResponse <#output_type, #parsed_response_params_type>) -> Self {
143
+ impl From <#crate_ident :: request:: ParsedResponse <#output_type, #parsed_response_params_type>> for #response_type_ident {
144
+ fn from( value: #crate_ident :: request:: ParsedResponse <#output_type, #parsed_response_params_type>) -> Self {
143
145
Self {
144
146
data: value. data,
145
147
header_map: value. header_map,
146
148
#from_parsed_response_impl_for_pagination_params
147
149
}
148
150
}
149
151
}
152
+
153
+ #[ uniffi:: export]
154
+ fn #fn_parse_as_response_type_ident( response: #crate_ident:: request:: WpNetworkResponse ) -> Result <#response_type_ident, #error_type> {
155
+ response. parse( )
156
+ }
150
157
}
151
158
} )
152
159
. collect :: < TokenStream > ( )
0 commit comments