Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!(client): replace the optional RequestConfig arg to Client::send() with a with_request_config() builder method #4443

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Dec 19, 2024

Instead of Client::send(request, request_config), consumers can now do Client::send(request).with_request_config(request_config). The parameter is still Optional to avoid messy patterns, when the request_config is an Option passed from the caller.

The messy pattern would look like this, if with_request_config took a RequestConfig and not an Option<RequestConfig>:

let mut send_req = client.send(req);
if let Some(request_config) = request_config {
  send_req = send_req.with_request_config(request_config);
}

@bnjbvr bnjbvr requested a review from a team as a code owner December 19, 2024 16:08
@bnjbvr bnjbvr requested review from poljar and removed request for a team December 19, 2024 16:08
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 89.60000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 85.42%. Comparing base (bc8c4f5) to head (f17bef9).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/notification_settings/mod.rs 80.95% 4 Missing ⚠️
crates/matrix-sdk/src/encryption/mod.rs 83.33% 2 Missing ⚠️
crates/matrix-sdk/src/media.rs 77.77% 2 Missing ⚠️
crates/matrix-sdk/src/sliding_sync/mod.rs 66.66% 2 Missing ⚠️
crates/matrix-sdk/src/client/mod.rs 93.33% 1 Missing ⚠️
...ates/matrix-sdk/src/encryption/verification/sas.rs 0.00% 1 Missing ⚠️
crates/matrix-sdk/src/widget/matrix.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4443      +/-   ##
==========================================
- Coverage   85.42%   85.42%   -0.01%     
==========================================
  Files         283      283              
  Lines       31556    31566      +10     
==========================================
+ Hits        26958    26966       +8     
- Misses       4598     4600       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bnjbvr bnjbvr force-pushed the bnjbvr/remove-config-from-clientsend branch from 8260578 to c7b87f3 Compare December 19, 2024 16:23
crates/matrix-sdk/src/client/futures.rs Outdated Show resolved Hide resolved
@poljar poljar force-pushed the bnjbvr/remove-config-from-clientsend branch from c7b87f3 to 20af6ea Compare December 20, 2024 09:14
@poljar
Copy link
Contributor

poljar commented Dec 20, 2024

To prevent bitrot on this during the holidays, I took the freedom to implement the change myself, I also added a changelog entry and reworded the now obsolete commit message.

@poljar poljar force-pushed the bnjbvr/remove-config-from-clientsend branch from 20af6ea to f17bef9 Compare December 20, 2024 09:20
…ilder method

Instead of `Client::send(request, request_config)`, consumers can now do
`Client::send(request).with_request_config(request_config)`.
@poljar poljar merged commit 5f5e979 into main Dec 20, 2024
40 checks passed
@poljar poljar deleted the bnjbvr/remove-config-from-clientsend branch December 20, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants