[][src]Struct narwhalol::api::LeagueClient

pub struct LeagueClient { /* fields omitted */ }

Main type for calling League API Endpoints. Instances of LeagueClient can be created using new with a Region parameter

LeagueClient can have an embedded DDragonClient instance embedded in itself, reference to which can be obtained using ddragon. NOTE: this method will panic if you don't create the instance using with_ddragon.

Implementations

impl LeagueClient[src]

pub fn new(region: Region) -> Result<LeagueClient, ClientError>[src]

Constructor function for LeagueAPI struct, accepts type as a parameter

Panics

This will panic if you do not provide the RIOT_API_KEY environment variable with value being api token.

pub async fn with_ddragon(self, language: LanguageCode) -> Self[src]

Adds an embedded ddragon client instance to league api client that shares cache and client with parent.

pub fn ddragon(&mut self) -> &mut DDragonClient[src]

Gets mutable (because of cache) reference to ddragon client embedded in lapi client.

Panics

Do not call ddragon if with_ddragon is not called beforehand.

pub async fn get_summoner_by_name<'_, '_>(
    &'_ self,
    name: &'_ str
) -> Result<Summoner, ClientError>
[src]

Get summoner by plaintext name

Example

use narwhalol::{LeagueClient, Region, dto::api::Summoner, error::ClientError};

fn main() -> Result<(), ClientError> {
    smol::run(async {
         let mut lapi = LeagueClient::new(Region::RU).unwrap();
         let summoner = lapi.get_summoner_by_name("Vetro").await?;
         assert_eq!(summoner.name, "Vetro");
         Ok(())
    })
}

pub async fn get_champion_info<'_>(
    &'_ mut self
) -> Result<ChampionInfo, ClientError>
[src]

pub async fn get_champion_masteries<'_, '_>(
    &'_ mut self,
    summoner_id: &'_ str
) -> Result<Vec<ChampionMastery>, ClientError>
[src]

pub async fn get_champion_mastery_by_id<'_, '_>(
    &'_ mut self,
    summoner_id: &'_ str,
    champion_id: u64
) -> Result<ChampionMastery, ClientError>
[src]

pub async fn get_total_mastery_score<'_, '_>(
    &'_ mut self,
    summoner_id: &'_ str
) -> Result<i32, ClientError>
[src]

pub async fn get_league_exp_entries<'_>(
    &'_ mut self,
    queue: RankedQueue,
    tier: RankedTier,
    division: Division,
    pages: Option<i32>
) -> Result<Vec<LeagueInfo>, ClientError>
[src]

Trait Implementations

impl Debug for LeagueClient[src]

impl Default for LeagueClient[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.