pub struct UtilsApi {
pub version: String,
pub language: String,
}
Fields§
§version: String
§language: String
Implementations§
Source§impl UtilsApi
impl UtilsApi
Sourcepub fn latest(language: &str) -> Option<UtilsApi>
pub fn latest(language: &str) -> Option<UtilsApi>
Creates a new UtilsApi using the latest available version and custom language.
§Examples
Basic usage: (current latest version is 12.12.1 (07/05/2022))
use samira::utils_api::*;
let api = UtilsApi::latest("en_US").unwrap_or_default();
assert_eq!(api, UtilsApi{version: "12.12.1".to_owned(), language: "en_US".to_owned()});
Sourcepub fn new(version: &str, language: &str) -> Option<UtilsApi>
pub fn new(version: &str, language: &str) -> Option<UtilsApi>
Creates a new UtilsApi using a custom version and custom language.
§Examples
Basic usage:
use samira::utils_api::*;
let api = UtilsApi::new("12.12.1", "fr_FR").unwrap_or_default();
assert_eq!(api, UtilsApi{version: "12.12.1".to_owned(), language: "fr_FR".to_owned()});
Sourcepub fn get_all_champions(&self) -> Vec<Champion>
pub fn get_all_champions(&self) -> Vec<Champion>
Retrieve all current champions.
§Examples
Basic usage:
use samira::{models::champion_model::*, utils_api::*};
let api = UtilsApi::new("12.12.1", "fr_FR").unwrap_or_default();
let champions = api.get_all_champions();
assert_eq!(champions.iter().find(|&c| c.name == "Samira").is_some(), true);
assert_eq!(champions.iter().find(|&c| c.name == "Akali").is_some(), true);
assert_eq!(champions.iter().find(|&c| c.name == "RqndomChampion").is_some(), false);
Sourcepub fn get_champion_by_key(&self, key: String) -> Option<Champion>
pub fn get_champion_by_key(&self, key: String) -> Option<Champion>
Retrieve a champion from its id.
§Examples
Basic usage:
use samira::{models::champion_model::*, utils_api::*};
let api = UtilsApi::latest("en_US").unwrap_or_default();
assert_eq!("360", api.get_champion_by_key("360".to_owned()).unwrap().key);
Sourcepub fn get_champion_by_name(&self, name: String) -> Option<Champion>
pub fn get_champion_by_name(&self, name: String) -> Option<Champion>
Retrieve a champion from its name.
§Examples
Basic usage:
use samira::{models::champion_model::*, utils_api::*};
let api = UtilsApi::latest("en_US").unwrap_or_default();
assert_eq!("Samira", api.get_champion_by_name("Samira".to_owned()).unwrap().name);
Sourcepub fn get_rune(&self, name: String) -> Option<Rune>
pub fn get_rune(&self, name: String) -> Option<Rune>
Retrieve a rune by its name
§Examples
Basic usage:
use samira::{models::rune_model::*, utils_api::*};
let api = UtilsApi::latest("en_US").unwrap_or_default();
assert_eq!("Domination", api.get_rune("Domination".to_owned()).unwrap().name);
assert_eq!("Inspiration", api.get_rune("Inspiration".to_owned()).unwrap().name);
Sourcepub fn get_all_runes(&self) -> Vec<Rune>
pub fn get_all_runes(&self) -> Vec<Rune>
Retrieve all current runes
§Examples
Basic usage:
use samira::{models::rune_model::*, utils_api::*};
let api = UtilsApi::new("12.12.1", "fr_FR").unwrap_or_default();
let runes = api.get_all_runes();
assert_eq!(runes.iter().find(|&c| c.name == "Domination").is_some(), true);
assert_eq!(runes.iter().find(|&c| c.name == "Inspiration").is_some(), true);
assert_eq!(runes.iter().find(|&c| c.id == 8400).is_some(), true);
assert_eq!(runes.iter().find(|&c| c.name == "RqndomRune").is_some(), false);
Trait Implementations§
impl StructuralPartialEq for UtilsApi
Auto Trait Implementations§
impl Freeze for UtilsApi
impl RefUnwindSafe for UtilsApi
impl Send for UtilsApi
impl Sync for UtilsApi
impl Unpin for UtilsApi
impl UnwindSafe for UtilsApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more