pub struct XtreamClient { /* private fields */ }Expand description
Async client for the Xtream Codes API.
Wraps a reqwest::Client (connection pooled) and caches the user profile
after the first authentication call.
Implementations§
Source§impl XtreamClient
impl XtreamClient
Sourcepub fn new(creds: XtreamCredentials) -> Result<Self, XtreamError>
pub fn new(creds: XtreamCredentials) -> Result<Self, XtreamError>
Create a new client with the given credentials and default configuration.
Sourcepub fn with_config(
creds: XtreamCredentials,
config: XtreamClientConfig,
) -> Result<Self, XtreamError>
pub fn with_config( creds: XtreamCredentials, config: XtreamClientConfig, ) -> Result<Self, XtreamError>
Create a new client with explicit configuration.
Sourcepub fn with_http_client(
http: Client,
creds: XtreamCredentials,
config: XtreamClientConfig,
) -> Self
pub fn with_http_client( http: Client, creds: XtreamCredentials, config: XtreamClientConfig, ) -> Self
Create a client from an existing reqwest::Client (useful for sharing
a connection pool across multiple crates).
Sourcepub fn preferred_format(&self) -> StreamFormat
pub fn preferred_format(&self) -> StreamFormat
The configured preferred stream format.
Sourcepub async fn authenticate(&self) -> Result<XtreamProfile, XtreamError>
pub async fn authenticate(&self) -> Result<XtreamProfile, XtreamError>
Authenticate with the server and cache the profile.
This is called implicitly by methods that need the user profile (channel/VOD listings), but you can call it explicitly to verify credentials early.
Sourcepub async fn get_user_profile(&self) -> Result<XtreamUserProfile, XtreamError>
pub async fn get_user_profile(&self) -> Result<XtreamUserProfile, XtreamError>
Get the cached user profile, authenticating first if needed.
Sourcepub async fn get_live_categories(
&self,
) -> Result<Vec<XtreamCategory>, XtreamError>
pub async fn get_live_categories( &self, ) -> Result<Vec<XtreamCategory>, XtreamError>
Fetch live channel categories.
Sourcepub async fn get_vod_categories(
&self,
) -> Result<Vec<XtreamCategory>, XtreamError>
pub async fn get_vod_categories( &self, ) -> Result<Vec<XtreamCategory>, XtreamError>
Fetch VOD (movie) categories.
Sourcepub async fn get_series_categories(
&self,
) -> Result<Vec<XtreamCategory>, XtreamError>
pub async fn get_series_categories( &self, ) -> Result<Vec<XtreamCategory>, XtreamError>
Fetch series categories.
Sourcepub async fn get_live_streams(
&self,
category_id: Option<&str>,
) -> Result<Vec<XtreamChannel>, XtreamError>
pub async fn get_live_streams( &self, category_id: Option<&str>, ) -> Result<Vec<XtreamChannel>, XtreamError>
Fetch live channels, optionally filtered by category.
Stream URLs are automatically generated and attached to each channel.
Sourcepub async fn get_vod_streams(
&self,
category_id: Option<&str>,
) -> Result<Vec<XtreamMovieListing>, XtreamError>
pub async fn get_vod_streams( &self, category_id: Option<&str>, ) -> Result<Vec<XtreamMovieListing>, XtreamError>
Fetch VOD (movie) listings, optionally filtered by category.
Stream URLs are automatically generated and attached.
Sourcepub async fn get_vod_info(
&self,
vod_id: i64,
) -> Result<XtreamMovie, XtreamError>
pub async fn get_vod_info( &self, vod_id: i64, ) -> Result<XtreamMovie, XtreamError>
Fetch detailed information about a specific movie.
Sourcepub async fn get_series(
&self,
category_id: Option<&str>,
) -> Result<Vec<XtreamShowListing>, XtreamError>
pub async fn get_series( &self, category_id: Option<&str>, ) -> Result<Vec<XtreamShowListing>, XtreamError>
Fetch series listings, optionally filtered by category.
Sourcepub async fn get_series_info(
&self,
series_id: i64,
) -> Result<XtreamShow, XtreamError>
pub async fn get_series_info( &self, series_id: i64, ) -> Result<XtreamShow, XtreamError>
Fetch detailed information about a specific series, including seasons and episodes. Episode stream URLs are automatically attached.
Sourcepub async fn get_short_epg(
&self,
stream_id: i64,
limit: Option<u32>,
) -> Result<XtreamShortEpg, XtreamError>
pub async fn get_short_epg( &self, stream_id: i64, limit: Option<u32>, ) -> Result<XtreamShortEpg, XtreamError>
Fetch short EPG for a channel, with an optional entry limit.
Base64-encoded titles and descriptions are decoded transparently.
Sourcepub async fn get_full_epg(
&self,
stream_id: i64,
) -> Result<XtreamFullEpg, XtreamError>
pub async fn get_full_epg( &self, stream_id: i64, ) -> Result<XtreamFullEpg, XtreamError>
Fetch full EPG for a channel.
Base64-encoded titles and descriptions are decoded transparently.
Sourcepub fn stream_url(
&self,
stream_type: StreamType,
stream_id: i64,
extension: &str,
) -> String
pub fn stream_url( &self, stream_type: StreamType, stream_id: i64, extension: &str, ) -> String
Build a stream URL for a given content type and ID.
Trait Implementations§
Source§impl Clone for XtreamClient
impl Clone for XtreamClient
Source§fn clone(&self) -> XtreamClient
fn clone(&self) -> XtreamClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more