Skip to content

Commit 08152bd

Browse files
committed
refactor(sdk)!: rename PrepareEncryptedFile et al. to UploadEncryptedFile
Changelog: Renamed `PrepareEncryptedFile` and `Client::prepare_encrypted_file` to `UploadEncryptedFile` and `Client::upload_encrypted_file`.
1 parent 89183a3 commit 08152bd

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

crates/matrix-sdk/src/encryption/futures.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ use ruma::events::room::{EncryptedFile, EncryptedFileInit};
2727

2828
use crate::{Client, Result, TransmissionProgress};
2929

30-
/// Future returned by [`Client::prepare_encrypted_file`].
30+
/// Future returned by [`Client::upload_encrypted_file`].
3131
#[allow(missing_debug_implementations)]
32-
pub struct PrepareEncryptedFile<'a, R: ?Sized> {
32+
pub struct UploadEncryptedFile<'a, R: ?Sized> {
3333
client: &'a Client,
3434
content_type: &'a mime::Mime,
3535
reader: &'a mut R,
3636
send_progress: SharedObservable<TransmissionProgress>,
3737
}
3838

39-
impl<'a, R: ?Sized> PrepareEncryptedFile<'a, R> {
39+
impl<'a, R: ?Sized> UploadEncryptedFile<'a, R> {
4040
pub(crate) fn new(client: &'a Client, content_type: &'a mime::Mime, reader: &'a mut R) -> Self {
4141
Self { client, content_type, reader, send_progress: Default::default() }
4242
}
@@ -63,7 +63,7 @@ impl<'a, R: ?Sized> PrepareEncryptedFile<'a, R> {
6363
}
6464
}
6565

66-
impl<'a, R> IntoFuture for PrepareEncryptedFile<'a, R>
66+
impl<'a, R> IntoFuture for UploadEncryptedFile<'a, R>
6767
where
6868
R: Read + Send + ?Sized + 'a,
6969
{

crates/matrix-sdk/src/encryption/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use vodozemac::Curve25519PublicKey;
5858

5959
use self::{
6060
backups::{types::BackupClientState, Backups},
61-
futures::PrepareEncryptedFile,
61+
futures::UploadEncryptedFile,
6262
identities::{Device, DeviceUpdates, IdentityUpdates, UserDevices, UserIdentity},
6363
recovery::{Recovery, RecoveryState},
6464
secret_storage::SecretStorage,
@@ -438,17 +438,17 @@ impl Client {
438438
/// # let client = Client::new(homeserver).await?;
439439
/// # let room = client.get_room(&room_id!("!test:example.com")).unwrap();
440440
/// let mut reader = std::io::Cursor::new(b"Hello, world!");
441-
/// let encrypted_file = client.prepare_encrypted_file(&mime::TEXT_PLAIN, &mut reader).await?;
441+
/// let encrypted_file = client.upload_encrypted_file(&mime::TEXT_PLAIN, &mut reader).await?;
442442
///
443443
/// room.send(CustomEventContent { encrypted_file }).await?;
444444
/// # anyhow::Ok(()) };
445445
/// ```
446-
pub fn prepare_encrypted_file<'a, R: Read + ?Sized + 'a>(
446+
pub fn upload_encrypted_file<'a, R: Read + ?Sized + 'a>(
447447
&'a self,
448448
content_type: &'a mime::Mime,
449449
reader: &'a mut R,
450-
) -> PrepareEncryptedFile<'a, R> {
451-
PrepareEncryptedFile::new(self, content_type, reader)
450+
) -> UploadEncryptedFile<'a, R> {
451+
UploadEncryptedFile::new(self, content_type, reader)
452452
}
453453

454454
/// Encrypt and upload the file and thumbnails, and return the source
@@ -465,7 +465,7 @@ impl Client {
465465

466466
let upload_attachment = async {
467467
let mut cursor = Cursor::new(data);
468-
self.prepare_encrypted_file(content_type, &mut cursor)
468+
self.upload_encrypted_file(content_type, &mut cursor)
469469
.with_send_progress_observable(send_progress)
470470
.await
471471
};
@@ -491,7 +491,7 @@ impl Client {
491491
let mut cursor = Cursor::new(thumbnail.data);
492492

493493
let file = self
494-
.prepare_encrypted_file(content_type, &mut cursor)
494+
.upload_encrypted_file(content_type, &mut cursor)
495495
.with_send_progress_observable(send_progress)
496496
.await?;
497497

0 commit comments

Comments
 (0)