From a8bcb5849328699e8576262e3f9083f8e5a36677 Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Fri, 1 Sep 2023 12:12:07 +0200 Subject: [PATCH] Make auth functions take owned values, similar to the rest of the API --- src/api/auth/login.rs | 4 ++-- src/api/auth/register.rs | 4 ++-- tests/auth.rs | 2 +- tests/common/mod.rs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/auth/login.rs b/src/api/auth/login.rs index 1564bfb..78826b7 100644 --- a/src/api/auth/login.rs +++ b/src/api/auth/login.rs @@ -14,12 +14,12 @@ impl Instance { /// /// # Reference /// See - pub async fn login_account(&mut self, login_schema: &LoginSchema) -> ChorusResult { + pub async fn login_account(&mut self, login_schema: LoginSchema) -> ChorusResult { let endpoint_url = self.urls.api.clone() + "/auth/login"; let chorus_request = ChorusRequest { request: Client::new() .post(endpoint_url) - .body(to_string(login_schema).unwrap()) + .body(to_string(&login_schema).unwrap()) .header("Content-Type", "application/json"), limit_type: LimitType::AuthLogin, }; diff --git a/src/api/auth/register.rs b/src/api/auth/register.rs index d278a50..2f1bb28 100644 --- a/src/api/auth/register.rs +++ b/src/api/auth/register.rs @@ -20,13 +20,13 @@ impl Instance { /// See pub async fn register_account( &mut self, - register_schema: &RegisterSchema, + register_schema: RegisterSchema, ) -> ChorusResult { let endpoint_url = self.urls.api.clone() + "/auth/register"; let chorus_request = ChorusRequest { request: Client::new() .post(endpoint_url) - .body(to_string(register_schema).unwrap()) + .body(to_string(®ister_schema).unwrap()) .header("Content-Type", "application/json"), limit_type: LimitType::AuthRegister, }; diff --git a/tests/auth.rs b/tests/auth.rs index c26552f..f94f024 100644 --- a/tests/auth.rs +++ b/tests/auth.rs @@ -11,6 +11,6 @@ async fn test_registration() { consent: true, ..Default::default() }; - bundle.instance.register_account(®).await.unwrap(); + bundle.instance.register_account(reg).await.unwrap(); common::teardown(bundle).await; } diff --git a/tests/common/mod.rs b/tests/common/mod.rs index a7b9d5d..e17c354 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -31,7 +31,7 @@ impl TestBundle { ..Default::default() }; self.instance - .register_account(®ister_schema) + .register_account(register_schema) .await .unwrap() } @@ -91,7 +91,7 @@ pub(crate) async fn setup() -> TestBundle { default_thread_rate_limit_per_user: Some(0), video_quality_mode: None, }; - let mut user = instance.register_account(®).await.unwrap(); + let mut user = instance.register_account(reg).await.unwrap(); let guild = Guild::create(&mut user, guild_create_schema).await.unwrap(); let channel = Channel::create(&mut user, guild.id, None, channel_create_schema) .await