@@ -90,9 +90,30 @@ pub use wasm::*;
90
90
#[ cfg( not( target_arch = "wasm32" ) ) ]
91
91
mod not_wasm {
92
92
use super :: * ;
93
+ use xmtp_proto:: api_client:: ApiBuilder ;
93
94
use xmtp_proto:: xmtp:: mls:: api:: v1:: WelcomeMessage ;
94
95
#[ derive( Clone ) ]
95
96
pub struct ApiClient ;
97
+ pub struct MockApiBuilder ;
98
+
99
+ impl ApiBuilder for MockApiBuilder {
100
+ type Output = ApiClient ;
101
+ type Error = MockError ;
102
+
103
+ fn set_libxmtp_version ( & mut self , version : String ) -> Result < ( ) , Self :: Error > {
104
+ Ok ( ( ) )
105
+ }
106
+ fn set_app_version ( & mut self , version : String ) -> Result < ( ) , Self :: Error > {
107
+ Ok ( ( ) )
108
+ }
109
+ fn set_host ( & mut self , host : String ) {
110
+ }
111
+ fn set_payer ( & mut self , _host : String ) { }
112
+ fn set_tls ( & mut self , tls : bool ) { }
113
+ async fn build ( self ) -> Result < Self :: Output , Self :: Error > {
114
+ Ok ( ApiClient )
115
+ }
116
+ }
96
117
97
118
mock ! {
98
119
pub ApiClient { }
@@ -142,12 +163,23 @@ mod not_wasm {
142
163
-> Result <VerifySmartContractWalletSignaturesResponse , MockError >;
143
164
}
144
165
145
- #[ async_trait:: async_trait]
146
166
impl XmtpTestClient for ApiClient {
147
- type Builder = ApiClient ;
148
- async fn create_local( ) -> Self { ApiClient }
149
- async fn create_dev( ) -> Self { ApiClient }
167
+ type Builder = MockApiBuilder ;
168
+ fn create_local( ) -> MockApiBuilder { MockApiBuilder }
169
+ fn create_dev( ) -> MockApiBuilder { MockApiBuilder }
170
+ }
171
+ /*
172
+ impl ApiBuilder for ApiClient {
173
+ type Output = ApiClient;
174
+ type Error = MockError;
175
+ fn set_libxmtp_version(&mut self, version: String) -> Result<(), Self::Error>;
176
+ fn set_app_version(&mut self, version: String) -> Result<(), Self::Error>;
177
+ fn set_host(&mut self, host: String);
178
+ fn set_payer(&mut self, _host: String);
179
+ fn set_tls(&mut self, tls: bool);
180
+ async fn build(self) -> Result<Self::Output, Self::Error>;
150
181
}
182
+ */
151
183
}
152
184
}
153
185
@@ -208,9 +240,9 @@ mod wasm {
208
240
209
241
#[ async_trait:: async_trait( ?Send ) ]
210
242
impl XmtpTestClient for ApiClient {
211
- type Builder = ApiClient ;
212
- async fn create_local( ) -> Self { ApiClient }
213
- async fn create_dev( ) -> Self { ApiClient }
243
+ type Builder = ( ) ;
244
+ fn create_local( ) -> ( ) { ( ) }
245
+ fn create_dev( ) -> ( ) { ( ) }
214
246
}
215
247
}
216
248
}
0 commit comments