Skip to main content

XtreamClient

Struct XtreamClient 

Source
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

Source

pub fn new(creds: XtreamCredentials) -> Result<Self, XtreamError>

Create a new client with the given credentials and default configuration.

Source

pub fn with_config( creds: XtreamCredentials, config: XtreamClientConfig, ) -> Result<Self, XtreamError>

Create a new client with explicit configuration.

Source

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).

Source

pub fn base_url(&self) -> &str

The base URL of the Xtream server.

Source

pub fn username(&self) -> &str

The username used for authentication.

Source

pub fn preferred_format(&self) -> StreamFormat

The configured preferred stream format.

Source

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.

Source

pub async fn get_user_profile(&self) -> Result<XtreamUserProfile, XtreamError>

Get the cached user profile, authenticating first if needed.

Source

pub async fn get_live_categories( &self, ) -> Result<Vec<XtreamCategory>, XtreamError>

Fetch live channel categories.

Source

pub async fn get_vod_categories( &self, ) -> Result<Vec<XtreamCategory>, XtreamError>

Fetch VOD (movie) categories.

Source

pub async fn get_series_categories( &self, ) -> Result<Vec<XtreamCategory>, XtreamError>

Fetch series categories.

Source

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.

Source

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.

Source

pub async fn get_vod_info( &self, vod_id: i64, ) -> Result<XtreamMovie, XtreamError>

Fetch detailed information about a specific movie.

Source

pub async fn get_series( &self, category_id: Option<&str>, ) -> Result<Vec<XtreamShowListing>, XtreamError>

Fetch series listings, optionally filtered by category.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn xmltv_url(&self) -> String

Build the XMLTV EPG URL.

Source

pub fn timeshift_url( &self, stream_id: i64, duration_minutes: u32, start: &str, ) -> String

Build a timeshift/catchup URL.

Trait Implementations§

Source§

impl Clone for XtreamClient

Source§

fn clone(&self) -> XtreamClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for XtreamClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more