diff --git a/api/src/lib.rs b/api/src/lib.rs index 6761b5b..bce8498 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -505,15 +505,13 @@ impl Client { pub fn put_comments( &self, source_name: &SourceFullName, - comments: &[NewComment], + comments: Vec, no_charge: bool, ) -> Result { self.request( Method::PUT, self.endpoints.put_comments(source_name)?, - Some(PutCommentsRequest { - comments: comments.to_vec(), - }), + Some(PutCommentsRequest { comments }), Some(NoChargeQuery { no_charge }), Retry::No, ) @@ -580,15 +578,13 @@ impl Client { pub fn sync_comments( &self, source_name: &SourceFullName, - comments: &[NewComment], + comments: Vec, no_charge: bool, ) -> Result { self.request( Method::POST, self.endpoints.sync_comments(source_name)?, - Some(SyncCommentsRequest { - comments: comments.to_vec(), - }), + Some(SyncCommentsRequest { comments }), Some(NoChargeQuery { no_charge }), Retry::Yes, ) @@ -597,15 +593,13 @@ impl Client { pub fn sync_comments_split_on_failure( &self, source_name: &SourceFullName, - comments: &[NewComment], + comments: Vec, no_charge: bool, ) -> Result> { self.splitable_request( Method::POST, self.endpoints.sync_comments(source_name)?, - SyncCommentsRequest { - comments: comments.to_vec(), - }, + SyncCommentsRequest { comments }, Some(NoChargeQuery { no_charge }), Retry::Yes, ) @@ -635,15 +629,13 @@ impl Client { pub fn put_emails_split_on_failure( &self, bucket_name: &BucketFullName, - emails: &[NewEmail], + emails: Vec, no_charge: bool, ) -> Result> { self.splitable_request( Method::PUT, self.endpoints.put_emails(bucket_name)?, - PutEmailsRequest { - emails: emails.to_vec(), - }, + PutEmailsRequest { emails }, Some(NoChargeQuery { no_charge }), Retry::Yes, ) @@ -652,15 +644,13 @@ impl Client { pub fn put_emails( &self, bucket_name: &BucketFullName, - emails: &[NewEmail], + emails: Vec, no_charge: bool, ) -> Result { self.request( Method::PUT, self.endpoints.put_emails(bucket_name)?, - Some(PutEmailsRequest { - emails: emails.to_vec(), - }), + Some(PutEmailsRequest { emails }), Some(NoChargeQuery { no_charge }), Retry::Yes, ) diff --git a/cli/src/commands/create/comments.rs b/cli/src/commands/create/comments.rs index 002af7b..ea9b9c5 100644 --- a/cli/src/commands/create/comments.rs +++ b/cli/src/commands/create/comments.rs @@ -294,7 +294,7 @@ fn upload_batch_of_comments( failed += result.num_failed; } else { client - .put_comments(&source.full_name(), comments_to_put, no_charge) + .put_comments(&source.full_name(), comments_to_put.to_vec(), no_charge) .context("Could not put batch of comments")?; } uploaded += comments_to_put.len() - failed; @@ -303,13 +303,17 @@ fn upload_batch_of_comments( if !comments_to_sync.is_empty() { let result = if resume_on_error { let result = client - .sync_comments_split_on_failure(&source.full_name(), comments_to_sync, no_charge) + .sync_comments_split_on_failure( + &source.full_name(), + comments_to_sync.to_vec(), + no_charge, + ) .context("Could not sync batch of comments")?; failed += result.num_failed; result.response } else { client - .sync_comments(&source.full_name(), comments_to_sync, no_charge) + .sync_comments(&source.full_name(), comments_to_sync.to_vec(), no_charge) .context("Could not sync batch of comments")? }; diff --git a/cli/src/commands/create/emails.rs b/cli/src/commands/create/emails.rs index f052a4b..8ccfaf0 100644 --- a/cli/src/commands/create/emails.rs +++ b/cli/src/commands/create/emails.rs @@ -160,7 +160,7 @@ fn upload_emails_from_reader( if resume_on_error { let result = client - .put_emails_split_on_failure(&bucket.full_name(), &batch, no_charge) + .put_emails_split_on_failure(&bucket.full_name(), batch.to_vec(), no_charge) .context("Could not upload batch of emails")?; statistics.add_emails(StatisticsUpdate { uploaded: batch.len() - result.num_failed, @@ -169,7 +169,7 @@ fn upload_emails_from_reader( batch.clear(); } else { client - .put_emails(&bucket.full_name(), &batch, no_charge) + .put_emails(&bucket.full_name(), batch.to_vec(), no_charge) .context("Could not upload batch of emails")?; statistics.add_emails(StatisticsUpdate { uploaded: batch.len(), diff --git a/cli/src/commands/parse/mod.rs b/cli/src/commands/parse/mod.rs index f3b073d..5f0fe8a 100644 --- a/cli/src/commands/parse/mod.rs +++ b/cli/src/commands/parse/mod.rs @@ -114,7 +114,7 @@ fn upload_batch_of_new_emails( no_charge: bool, statistics: &Arc, ) -> Result<()> { - client.put_emails(bucket, emails, no_charge)?; + client.put_emails(bucket, emails.to_vec(), no_charge)?; statistics.add_uploaded(emails.len()); Ok(()) }