pub struct ClientBuilder { /* private fields */ }
client
only.Expand description
A Client
builder.
This type can be used to construct a Client
through a few method calls.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn homeserver_url(self, url: String) -> ClientBuilder
pub fn homeserver_url(self, url: String) -> ClientBuilder
Set the homeserver URL.
The homeserver URL must be set before calling build()
or
http_client()
.
Sourcepub fn access_token(self, access_token: Option<String>) -> ClientBuilder
pub fn access_token(self, access_token: Option<String>) -> ClientBuilder
Set the access token.
Sourcepub fn supported_matrix_versions(
self,
versions: Vec<MatrixVersion>,
) -> ClientBuilder
pub fn supported_matrix_versions( self, versions: Vec<MatrixVersion>, ) -> ClientBuilder
Set the supported Matrix versions.
This method generally shouldn’t be called. The build()
or
http_client()
method will take care of doing a
get_supported_versions
request to find out about the supported versions.
Sourcepub async fn build<C>(
self,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: DefaultConstructibleHttpClient,
pub async fn build<C>(
self,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: DefaultConstructibleHttpClient,
Finish building the Client
.
Uses DefaultConstructibleHttpClient::default()
to create an HTTP client instance.
Unless the supported Matrix versions were manually set via
supported_matrix_versions
, this will do a
get_supported_versions
request to find out about the supported versions.
Sourcepub async fn http_client<C>(
self,
http_client: C,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: HttpClient,
pub async fn http_client<C>(
self,
http_client: C,
) -> Result<Client<C>, Error<<C as HttpClient>::Error, Error>>where
C: HttpClient,
Set the HTTP client to finish building the Client
.
Unless the supported Matrix versions were manually set via
supported_matrix_versions
, this will do a
get_supported_versions
request to find out about the supported versions.