Trait twitch_api::client::ClientDefault
source · [−]pub trait ClientDefault<'a>: Clone + Sized {
type Error: Error + Send + Sync + 'static;
fn default_client_with_name(
product: Option<HeaderValue>
) -> Result<Self, Self::Error>;
fn default_client() -> Self { ... }
}
Available on crate feature
client
only.Expand description
A specific client default for setting some sane defaults for API calls and oauth2 usage
Required Associated Types
Required Methods
sourcefn default_client_with_name(
product: Option<HeaderValue>
) -> Result<Self, Self::Error>
fn default_client_with_name(
product: Option<HeaderValue>
) -> Result<Self, Self::Error>
Constructs Self
with sane defaults for API calls and oauth2 and setting user-agent to include another product
Specifically, one should
- Set User-Agent to
{product} twitch_api/{version_of_twitch_api}
(According to RFC7231) SeeTWITCH_API_USER_AGENT
for the product of this crate - Disallow redirects
Notes
When the product name is none, this function should never fail. This should be ensured with tests.
Provided Methods
sourcefn default_client() -> Self
fn default_client() -> Self
Construct Self
with sane defaults for API calls and oauth2.
Examples found in repository?
More examples
Implementations on Foreign Types
sourceimpl ClientDefault<'static> for SurfClientwhere
Self: Default,
Available on crate feature surf
only.
impl ClientDefault<'static> for SurfClientwhere
Self: Default,
Available on crate feature
surf
only.type Error = SurfClientDefaultError
fn default_client_with_name(
product: Option<HeaderValue>
) -> Result<Self, Self::Error>
sourceimpl ClientDefault<'static> for ReqwestClient
Available on crate feature reqwest
only.
impl ClientDefault<'static> for ReqwestClient
Available on crate feature
reqwest
only.