Struct RarBgApi

Source
pub struct RarBgApi { /* private fields */ }

Implementations§

Source§

impl RarBgApi

Source

pub fn app_id(&self) -> &str

Return the name of your app.

§Example
use rarbg_api::RarBgApi;

#[tokio::main]
async fn main() {
    let api = RarBgApi::new("RustExample").await;
    let app_id = api.app_id();
}
Source

pub fn token(&self) -> &Token

Return the token associate to your app.

§Example
use rarbg_api::RarBgApi;
use rarbg_api::token::Token;

#[tokio::main]
async fn main() {
    let api = RarBgApi::new("RustExample").await;
    let token: &Token = api.token();
}
Source

pub async fn new(app_id: &str) -> Self

Create a new RARBG client.

§Arguments
  • app_id - A string slice that holds the name of your app.
§Example
use rarbg_api::RarBgApi;
use rarbg_api::token::Token;

#[tokio::main]
async fn main() {
    let api = RarBgApi::new("RustExample").await;
}
Source

pub async fn list( &mut self, parameters: Option<&ApiParameters>, ) -> Result<Torrents, Error>

List the torrents available depending on parameters given.

§Example
use rarbg_api::RarBgApi;
use rarbg_api::token::Token;

#[tokio::main]
async fn main() {
    let mut api = RarBgApi::new("RustExample").await;
    // It will get the 25 last ranked torrents
    let result = api.list(None).await;
}
Source

pub async fn search( &mut self, value: &str, parameters: Option<&ApiParameters>, ) -> Result<Torrents, Error>

Search torrents by its name with some or no parameters.

§Example
use rarbg_api::RarBgApi;
use rarbg_api::token::Token;

#[tokio::main]
async fn main() {
    let mut api = RarBgApi::new("RustExample").await;
    let result = api.search("Rick and Morty", None).await;
}
Source

pub async fn search_by_imdb( &mut self, value: &str, parameters: Option<&ApiParameters>, ) -> Result<Torrents, Error>

Search torrents by its IMDB id with some or no parameters.

§Example
use rarbg_api::RarBgApi;
use rarbg_api::token::Token;

#[tokio::main]
async fn main() {
    let mut api = RarBgApi::new("RustExample").await;
    // tt2861424 is Rick and Morty
    let result = api.search_by_imdb("tt2861424", None).await;
}
Source

pub async fn search_by_tvdb( &mut self, value: &str, parameters: Option<&ApiParameters>, ) -> Result<Torrents, Error>

Search torrents by its TVDB id with some or no parameters.

§Example
use rarbg_api::RarBgApi;
use rarbg_api::token::Token;

#[tokio::main]
async fn main() {
    let mut api = RarBgApi::new("RustExample").await;
    // 275274 is Rick and Morty
    let result = api.search_by_tvdb("275274", None).await;
}
Source

pub async fn search_by_tmdb( &mut self, value: &str, parameters: Option<&ApiParameters>, ) -> Result<Torrents, Error>

Search torrents by its TMDB id with some or no parameters.

§Example
use rarbg_api::RarBgApi;
use rarbg_api::token::Token;

#[tokio::main]
async fn main() {
    let mut api = RarBgApi::new("RustExample").await;
    // 60625 is Rick and Morty
    let result = api.search_by_tmdb("60625", None).await;
}

Trait Implementations§

Source§

impl Debug for RarBgApi

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