diff --git a/src/request.rs b/src/request.rs index e51bc3e..d08dbd0 100644 --- a/src/request.rs +++ b/src/request.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, process}; +use std::{collections::HashMap, process, string::String}; use base64::{engine::general_purpose::URL_SAFE, Engine as _}; use clap::ArgMatches; @@ -20,6 +20,7 @@ pub enum AuthenticationType { None, } +#[derive()] pub struct Request<'a> { pub client: Client, pub arg_value: &'a ArgMatches<'a>, @@ -69,22 +70,20 @@ impl<'a> Request<'a> { } } - pub fn auth_type(&self) { + pub fn auth_type(&self) -> String { + let key: &String = self.authentication.credentials.1.as_ref().unwrap(); match self.authentication.auth_type { - AuthenticationType::BasicAuth => { - URL_SAFE.encode(self.authentication.credentials.1.unwrap()) - } - AuthenticationType::ApiToken => self.authentication.credentials.1, + AuthenticationType::BasicAuth => URL_SAFE.encode(key), + AuthenticationType::ApiToken => key.to_string(), AuthenticationType::None => { + // TODO: make a custom error and error here instead of panicing // this shouldn't happen, ever panic!(); } } } - pub fn url_builder(&self) { - Ok() - } + pub fn url_builder(&self) -> String {} } impl Authentication {