Create MatrixClient
With MatrixClient you have access to the whole library. It can be instantiated
by using MatrixClient.create(...). There are some mandatory parameters:
repositoriesModulewhich can be created by adding atrixnity-client-respository-*dependency and calling e.g.RepositoriesModule.room(...). Secrets are also stored in the repository. Therefore, you should encrypt it.mediaStoreModulewhich can be created by adding atrixnity-client-media-*dependency and calling e.g.MediaStoreModule.okio(...)cryptoDriverModulewhich can be created by adding atrixnity-cryptodriver-*dependency and calling e.g.CryptoDriverModule.vodozemac(...)authProviderDatawhich should be passed when an authentication is required (e.g. on login). It can be derived by calling e.g.MatrixClientAuthProviderData.oAuth2Login(...).
To get the baseUrl via server discovery you can use the .serverDiscovery() extension on UserIds or Strings.
Add HttpClientEngine
Although Ktors HttpClients used by Trixnity automatically use a HttpClientEngine defined in the
classpath, it is highly recommended to explicitly set a shared(!) HttpClientEngine in the configuration. Only that
way, it can be shared between all MatrixClient instances. Otherwise, each MatrixClient creates a new
HttpClientEngine, which can lead to performance issues on heavy resource usage of Ktor.