From e61090cc75586f7bdcb78b78b849ce642922363c Mon Sep 17 00:00:00 2001 From: philippeitis <33013301+philippeitis@users.noreply.github.com> Date: Sun, 25 Sep 2022 01:48:03 +0000 Subject: [PATCH] Replace () with documented NoToken for clarity --- src/rust/api/client.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rust/api/client.rs b/src/rust/api/client.rs index b558c376a0..25b2459830 100644 --- a/src/rust/api/client.rs +++ b/src/rust/api/client.rs @@ -795,7 +795,7 @@ pub async fn get_body_as_string(res_body: &mut hyper::Body) -> String { type TokenResult = std::result::Result, oauth2::Error>; pub trait GetToken: GetTokenClone { - /// Called whenever there is the need for your applications API key after + /// Called whenever there is the need for an oauth token after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail fn get_token<'a>(&'a self, _scopes: &'a [&str]) -> Pin + 'a>> { @@ -828,7 +828,12 @@ impl GetToken for String { } } -impl GetToken for () {} +/// In the event that the API endpoint does not require an oauth2 token, `NoToken` should be provided to the hub to avoid specifying an +/// authenticator. +#[derive(Default, Clone)] +pub struct NoToken; + +impl GetToken for NoToken {} // TODO: Make this optional // #[cfg(feature = "yup-oauth2")]