pub struct Client { /* private fields */ }Expand description
Basic HTTP client using TLS wrapping a reqwest::Client,
with the minimum required features to call YouTube Music queries.
Clone is low cost, internals of reqwest::Client are wrapped in an Arc.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Utilises reqwest’s default tls choice for the enabled set of options.
Sourcepub fn new_rustls_tls() -> Result<Self>
Available on crate feature rustls-tls only.
pub fn new_rustls_tls() -> Result<Self>
rustls-tls only.Force the use of rustls-tls
Sourcepub fn new_native_tls() -> Result<Self>
Available on crate feature native-tls only.
pub fn new_native_tls() -> Result<Self>
native-tls only.Force the use of native-tls
Sourcepub fn new_from_reqwest_client(client: Client) -> Self
Available on crate feature reqwest only.
pub fn new_from_reqwest_client(client: Client) -> Self
reqwest only.Re-use a pre-existing reqwest::Client.
Sourcepub async fn post_query<'a, I>(
&self,
url: impl AsRef<str>,
headers: impl IntoIterator<IntoIter = I>,
body: Body,
params: &(impl Serialize + ?Sized),
) -> Result<QueryResponse>
pub async fn post_query<'a, I>( &self, url: impl AsRef<str>, headers: impl IntoIterator<IntoIter = I>, body: Body, params: &(impl Serialize + ?Sized), ) -> Result<QueryResponse>
Run a POST query, with url, body, key/kalue params and headers.
Sourcepub async fn post_json_query<'a, I>(
&self,
url: impl AsRef<str>,
headers: impl IntoIterator<IntoIter = I>,
body_json: &(impl Serialize + ?Sized),
params: &(impl Serialize + ?Sized),
) -> Result<QueryResponse>
pub async fn post_json_query<'a, I>( &self, url: impl AsRef<str>, headers: impl IntoIterator<IntoIter = I>, body_json: &(impl Serialize + ?Sized), params: &(impl Serialize + ?Sized), ) -> Result<QueryResponse>
Run a POST query, with url, body serialisable to json, key/kalue params and headers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more