Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

A client for communicating with the Media Manager API

Implementations§

Source§

impl Client

Source

pub fn new(key: &str, secret: &str) -> MMCResult<Client>

Generates a new client for the production Media Manager API

Source

pub fn staging(key: &str, secret: &str) -> MMCResult<Client>

Generates a new client for the staging Media Manager API

Source

pub fn get( &self, endpoint: Endpoints, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Attempts to fetch a single object with the requested id from the requested Media Manager API endpoint

Source

pub fn list( &self, endpoint: Endpoints, params: Vec<(&'_ str, &'_ str)>, ) -> MMCResult<String>

Attempts to fetch a list of objects from the requested Media Manager API endpoint augmented by the requested parameters

Source

pub fn child_list( &self, endpoint: Endpoints, parent_id: &str, parent_endpoint: Endpoints, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Attempts to fetch a list of child objects of the requested Media Manager API type belonging to the requested parent object augmeted by the requested parameters

Source

pub fn create<T: Serialize>( &self, parent: Endpoints, id: &str, endpoint: Endpoints, body: &T, ) -> MMCResult<String>

Attempts to create a new object of the provided Endpoints for the provided parent Endpoints

Source

pub fn edit(&self, endpoint: Endpoints, id: &str) -> MMCResult<String>

Attempts to fetch the edit object specified by the Endpoints and id

Source

pub fn update<T: Serialize>( &self, endpoint: Endpoints, id: &str, body: &T, ) -> MMCResult<String>

Attempts to update the object specified by the Endpoints and id

Source

pub fn delete(&self, endpoint: Endpoints, id: &str) -> MMCResult<String>

Attempts to delete the object specified by the Endpoints and id

Source

pub fn change_parent( &self, parent_endpoint: Endpoints, parent_id: &str, child_endpoint: Endpoints, child_id: &str, ) -> MMCResult<String>

Attempts to change the parent of an object

Source

pub fn url(&self, url: &str) -> MMCResult<String>

Allows for calling any arbitrary url from the Media Manager API

Source

pub fn asset( &self, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a single asset

Source

pub fn assets( &self, parent_id: &str, parent_endpoint: Endpoints, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a list of assets

Source

pub fn changelog(&self, params: Vec<(&'_ str, &'_ str)>) -> MMCResult<String>

Shorthand for accessing a list of changes

Source

pub fn collection( &self, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a single collection

Source

pub fn collections(&self, params: Vec<(&'_ str, &'_ str)>) -> MMCResult<String>

Shorthand for accessing a list of collections

Source

pub fn episode( &self, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a single episode

Source

pub fn episodes( &self, season_id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a list of episodes

Source

pub fn franchise( &self, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a single franchise

Source

pub fn franchises(&self, params: Vec<(&'_ str, &'_ str)>) -> MMCResult<String>

Shorthand for accessing a list of franchises

Source

pub fn season( &self, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a single season

Source

pub fn seasons( &self, show_id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a list of seasons

Source

pub fn special( &self, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a single special

Source

pub fn specials( &self, show_id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a list of specials

Source

pub fn show( &self, id: &str, params: Option<Vec<(&'_ str, &'_ str)>>, ) -> MMCResult<String>

Shorthand for accessing a single show

Source

pub fn shows(&self, params: Vec<(&'_ str, &'_ str)>) -> MMCResult<String>

Shorthand for accessing a list of shows

Trait Implementations§

Source§

impl Debug for Client

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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 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, 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
Source§

impl<T> ErasedDestructor for T
where T: 'static,