v2 #2
1 changed files with 4 additions and 4 deletions
move flexible Client input types
commit
9de30e2308
|
|
@ -7,7 +7,7 @@ use isahc::{
|
||||||
config::Configurable,
|
config::Configurable,
|
||||||
http::{Method, StatusCode, header},
|
http::{Method, StatusCode, header},
|
||||||
};
|
};
|
||||||
use secrecy::{ExposeSecret, SecretString};
|
use secrecy::SecretString;
|
||||||
|
|
||||||
pub fn paths_parser(input: OsString) -> Result<Vec<PathBuf>, FromUtf8Error> {
|
pub fn paths_parser(input: OsString) -> Result<Vec<PathBuf>, FromUtf8Error> {
|
||||||
let input = String::from_utf8(input.into_encoded_bytes())?;
|
let input = String::from_utf8(input.into_encoded_bytes())?;
|
||||||
|
|
@ -72,15 +72,15 @@ pub struct Client {
|
||||||
pub struct CacheId(u64);
|
pub struct CacheId(u64);
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
pub fn new(actions_token: SecretString, base_url: String) -> Result<Self> {
|
pub fn new(actions_token: impl AsRef<str>, base_url: impl Into<String>) -> Result<Self> {
|
||||||
let http_client = HttpClientBuilder::new()
|
let http_client = HttpClientBuilder::new()
|
||||||
.authentication(Authentication::basic())
|
.authentication(Authentication::basic())
|
||||||
.credentials(Credentials::new("Bearer", actions_token.expose_secret()))
|
.credentials(Credentials::new("Bearer", actions_token.as_ref()))
|
||||||
.build()
|
.build()
|
||||||
.context("initializing the client")?;
|
.context("initializing the client")?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
http_client,
|
http_client,
|
||||||
base_url,
|
base_url: base_url.into(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue