Commit Graph

276 Commits

Author SHA1 Message Date
Kévin Commaille
3a94c2115f sdk: Add store opening errors to ClientBuildError 2022-03-15 14:43:02 +01:00
Jonas Platte
15df8fef95 Fix broken tests 2022-03-14 15:08:54 +01:00
Jonas Platte
8df7e1cc8b Fix hanging tests 2022-03-14 15:08:48 +01:00
Jonas Platte
7b2dfa39cf Remove Client::get_supported_versions
This is now always done as part of constructing the Client, unless the
user actively opted out.
2022-03-14 12:57:58 +01:00
Jonas Platte
fdc8f79728 Merge branch 'main' into jplatte/server-versions 2022-03-14 12:56:57 +01:00
Jonas Platte
718fa18e7f Merge branch 'main' into jplatte/client-builder 2022-03-14 11:26:45 +01:00
Jonas Platte
a2ad774112 Add ClientBuilder::server_name 2022-03-14 10:02:31 +01:00
Jonas Platte
d94ba8c64f Remove Client::for_user_id 2022-03-14 10:02:31 +01:00
Jonas Platte
81d07d886c Rename Client::{new_from_user_id => for_user_id} 2022-03-13 19:56:26 +01:00
Jonas Platte
147e948fe6 Replace ClientConfig with ClientBuilder
This includes a few not-strictly-related changes that made sense to do at the
same time:

* Check for a functioning homeserver via get_supported_versions regardless of
  whether a homeserver URL or user ID was supplied
* Rename use_discovery_response to respect_login_well_known
* Small appservice documentation improvement because those docs had to be
  touched anyways
* Some test refactorings in tests that had to be touched anyways
2022-03-13 19:56:26 +01:00
Kévin Commaille
d8c7fbd9dc sdk: Create Encryption struct
Lower the API surface of Client
2022-03-12 13:30:55 +01:00
Jonas Platte
bd7fbea155 Fix intra-doc link 2022-03-11 18:04:32 +01:00
Jonas Platte
628e2fb716 Allow configuring assert_identity on the client level only
Completely removing it from RequestConfig is left up to a future refactoring.
2022-03-11 15:31:11 +01:00
Jonas Platte
cfdf4a032e Rename BaseClient::{new_with_store_config => with_store_config} 2022-03-11 12:36:08 +01:00
Jonas Platte
e60b07336d Rename Client::{new_with_config => with_config} 2022-03-11 12:36:08 +01:00
Jonas Platte
48660c482f Use regular builder pattern for ClientConfig::store_config 2022-03-11 12:36:00 +01:00
Jonas Platte
27ee7c32ca Remove new_with_* constructors for StoreConfig
The regular builder pattern works just fine for the stores.
2022-03-11 11:49:01 +01:00
Kévin Commaille
597999acba sdk-base: Add constructors with stores for StoreConfig 2022-03-10 17:29:19 +01:00
Kévin Commaille
d7673257b4 stores: Rename make_config to make_store_config 2022-03-10 17:29:19 +01:00
Kévin Commaille
54c8b4f8bb sdk-base: Remove BaseClientConfig 2022-03-10 17:29:15 +01:00
Kévin Commaille
ad31540b10 sdk: Don't enable store encryption by default 2022-03-10 17:28:34 +01:00
Kévin Commaille
8c7bbb0e07 sdk: Update store setup instructions for encryption. 2022-03-10 17:22:36 +01:00
Kévin Commaille
0f60dfcfc5 sdk: Re-export stores and store config 2022-03-10 17:15:18 +01:00
Kévin Commaille
0ea12b3b4a base: Separate store config from the client config 2022-03-10 17:15:18 +01:00
Kévin Commaille
28a83da421 sdk: Remove default store constructors 2022-03-10 17:15:14 +01:00
Jonas Platte
65e7688a3f Don't require discovery to be mocked in tests 2022-03-10 16:05:51 +01:00
Jonas Platte
b1f2adf9c0 Ensure random request with Request: Send gets a Send future as well 2022-03-10 15:01:10 +01:00
Jonas Platte
81cea84a37 Fetch supported matrix versions from server in initialization 2022-03-10 15:00:40 +01:00
Jonas Platte
1dec224210 Use fine-grained *EventType types 2022-03-10 13:54:00 +01:00
Jonas Platte
4d16370dba Merge pull request #527 from matrix-org/jplatte/wasm-ci 2022-03-10 13:49:16 +01:00
Jonas Platte
ff15ccaf28 Merge pull request #525 from matrix-org/jplatte/refactor 2022-03-10 12:56:05 +01:00
Jonas Platte
6af9285874 Don't use Raw::from_json where it's not needed 2022-03-10 11:59:31 +01:00
Jonas Platte
ea2c9a2986 ci: Use clippy instead of check for wasm checks 2022-03-10 11:28:55 +01:00
Jonas Platte
b777617515 Replace matches! with == 2022-03-10 10:12:53 +01:00
Jonas Platte
8a60154882 Use only #[warn], not #[deny] for lints
CI passes `-D warnings` to clippy, so there it will be an error either way.
For local development it is nice not to block compilation of dependent
crates on lints though.
2022-03-09 18:13:04 +01:00
Jonas Platte
d2e70c16b4 Deduplicate lint configuration 2022-03-09 18:09:02 +01:00
Jonas Platte
e6d20265bf Allow rustfmt to format the encryption module again 2022-03-09 18:01:48 +01:00
Jonas Platte
5602deb226 Move encryption module docs into a separate markdown file 2022-03-09 18:00:57 +01:00
Jonas Platte
e4289405f5 Stop importing Result as StdResult
The SDK's Result aliases can optionally take the error parameter, so
there is no need to disambiguate this way.
2022-03-09 17:56:26 +01:00
Jonas Platte
76973fdc30 Improve consistency across sending requests with/out identity assertion 2022-03-09 16:48:28 +01:00
Jonas Platte
d5d6b80e08 Inline single-callsite request serialization functions 2022-03-09 15:13:06 +01:00
Jonas Platte
1ed2b8841d Simplify HTTP request serialization logic
… the removed AuthenticationRequired branch was not necessary, Ruma's
`try_into_http_request` will take care of reporting the error.
2022-03-09 15:13:06 +01:00
Jonas Platte
a33898847b Reduce duration of holding session lock
… by cloning the access token out.
2022-03-09 15:13:06 +01:00
Jonas Platte
2c181bca4f Consistently use .to_owned() instead of .to_string() for &str => String 2022-03-09 12:41:57 +01:00
Jonas Platte
b67c51c267 Remove unnecessary double reference 2022-03-09 12:41:57 +01:00
Julian Sparber
38cbf24e8e Add back homeserver logging for sso login
We can't use `.await` inside `info!()` because of
https://github.com/rust-lang/rust/issues/93274
2022-03-07 14:12:00 +01:00
Julian Sparber
642c4f5cfc Ensure Client::login_with_sso() to be send
This removes the `info!()` log because of
https://github.com/rust-lang/rust/issues/93274
2022-03-07 13:11:52 +01:00
Damir Jelić
89e4d47ee1 chore: Bump the dashmap version across our crates 2022-03-07 09:58:00 +01:00
Jonas Platte
abe0bf0a29 Enable some useful non-default rustc lints 2022-03-04 11:35:24 +01:00
Benjamin Kampmann
4e6b80d7df fix docs 2022-03-03 13:05:32 +01:00