Struct plex_api::HttpClient

source ·
pub struct HttpClient {
Show 14 fields pub api_url: Uri, pub http_client: IsahcHttpClient, pub x_plex_provides: String, pub x_plex_platform: String, pub x_plex_platform_version: String, pub x_plex_product: String, pub x_plex_version: String, pub x_plex_device: String, pub x_plex_device_name: String, pub x_plex_client_identifier: String, pub x_plex_sync_version: String, pub x_plex_model: String, pub x_plex_features: String, pub x_plex_target_client_identifier: String, /* private fields */
}

Fields§

§api_url: Uri§http_client: IsahcHttpClient§x_plex_provides: String

X-Plex-Provides header value. Comma-separated list.

Should be one or more of controller, server, sync-target, player.

§x_plex_platform: String

X-Plex-Platform header value.

Platform name, e.g. iOS, macOS, etc.

§x_plex_platform_version: String

X-Plex-Platform-Version header value.

OS version, e.g. 4.3.1

§x_plex_product: String

X-Plex-Product header value.

Application name, e.g. Laika, Plex Media Server, Media Link.

§x_plex_version: String

X-Plex-Version header value.

Application version, e.g. 10.6.7.

§x_plex_device: String

X-Plex-Device header value.

Device name and model number, e.g. iPhone3,2, Motorola XOOM™, LG5200TV.

§x_plex_device_name: String

X-Plex-Device-Name header value.

Primary name for the device, e.g. “Plex Web (Chrome)”.

§x_plex_client_identifier: String

X-Plex-Client-Identifier header value.

UUID, serial number, or other number unique per device.

N.B. Should be unique for each of your devices.

§x_plex_sync_version: String

X-Plex-Sync-Version header value.

Not sure what are the valid values, but at the time of writing Plex Web sends 2 here.

§x_plex_model: String

X-Plex-Model header value.

Plex Web sends hosted

§x_plex_features: String

X-Plex-Features header value.

Looks like it’s a replacement for X-Plex-Provides

§x_plex_target_client_identifier: String

X-Plex-Target-Client-Identifier header value.

Used when proxying a client request via a server.

Implementations§

source§

impl HttpClient

source

pub fn is_authenticated(&self) -> bool

Verifies that this client has an authentication token.

source

pub fn post<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Begins building a request using the HTTP POST method.

source

pub fn postm<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Does the same as HttpClient::post(), but appends only bare minimum headers: X-Plex-Client-Identifier and X-Plex-Token.

source

pub fn get<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Begins building a request using the HTTP GET method.

source

pub fn getm<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Does the same as HttpClient::get(), but appends only bare minimum headers: X-Plex-Client-Identifier and X-Plex-Token.

source

pub fn put<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Begins building a request using the HTTP PUT method.

source

pub fn putm<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Does the same as HttpClient::put(), but appends only bare minimum headers: X-Plex-Client-Identifier and X-Plex-Token.

source

pub fn delete<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Begins building a request using the HTTP DELETE method.

source

pub fn deletem<T>(&self, path: T) -> RequestBuilder<'_, T>where PathAndQuery: TryFrom<T>, <PathAndQuery as TryFrom<T>>::Error: Into<Error>,

Does the same as HttpClient::delete(), but appends only bare minimum headers: X-Plex-Client-Identifier and X-Plex-Token.

source

pub fn set_x_plex_token<T>(self, x_plex_token: T) -> Selfwhere T: Into<SecretString>,

Set the client’s authentication token.

source

pub fn x_plex_token(&self) -> &str

Get a reference to the client’s authentication token.

Trait Implementations§

source§

impl Clone for HttpClient

source§

fn clone(&self) -> HttpClient

Returns a copy 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 HttpClient

source§

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

Formats the value using the given formatter. Read more
source§

impl From<&HttpClient> for HttpClient

source§

fn from(value: &HttpClient) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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> 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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