11use std:: sync:: { Arc , Mutex } ;
22
3- use ruma:: api:: { client:: discovery:: get_supported_versions, MatrixVersion , SendAccessToken } ;
3+ use ruma:: api:: {
4+ client:: discovery:: get_supported_versions, MatrixVersion , SendAccessToken , SupportedVersions ,
5+ } ;
46
57use super :: { Client , ClientData } ;
68use crate :: { DefaultConstructibleHttpClient , Error , HttpClient , HttpClientExt } ;
@@ -11,7 +13,7 @@ use crate::{DefaultConstructibleHttpClient, Error, HttpClient, HttpClientExt};
1113pub struct ClientBuilder {
1214 homeserver_url : Option < String > ,
1315 access_token : Option < String > ,
14- supported_matrix_versions : Option < Vec < MatrixVersion > > ,
16+ supported_matrix_versions : Option < SupportedVersions > ,
1517}
1618
1719impl ClientBuilder {
@@ -37,7 +39,7 @@ impl ClientBuilder {
3739 /// This method generally *shouldn't* be called. The [`build()`][Self::build] or
3840 /// [`http_client()`][Self::http_client] method will take care of doing a
3941 /// [`get_supported_versions`] request to find out about the supported versions.
40- pub fn supported_matrix_versions ( self , versions : Vec < MatrixVersion > ) -> Self {
42+ pub fn supported_matrix_versions ( self , versions : SupportedVersions ) -> Self {
4143 Self { supported_matrix_versions : Some ( versions) , ..self }
4244 }
4345
@@ -76,12 +78,14 @@ impl ClientBuilder {
7678 . send_matrix_request (
7779 & homeserver_url,
7880 SendAccessToken :: None ,
79- & [ MatrixVersion :: V1_0 ] ,
81+ & SupportedVersions {
82+ versions : [ MatrixVersion :: V1_0 ] . into ( ) ,
83+ features : Default :: default ( ) ,
84+ } ,
8085 get_supported_versions:: Request :: new ( ) ,
8186 )
8287 . await ?
83- . known_versions ( )
84- . collect ( ) ,
88+ . as_supported_versions ( ) ,
8589 } ;
8690
8791 Ok ( Client ( Arc :: new ( ClientData {
0 commit comments