[][src]Struct riven::RiotApi

pub struct RiotApi { /* fields omitted */ }

For retrieving data from the Riot Games API.

Usage

Construct an instance using with_key(api_key) or with_config(config).

An instance provides access to "endpoint handles" which in turn provide access to individual API method calls. For example, getting a summoner by name:

This example is not tested
riot_api.summoner_v4().get_by_summoner_name(Region::NA, "LugnutsK")

Rate Limiting

The Riot Game API enforces dynamic rate limiting, meaning that rate limits are specified in response headers and (theoretically) could change at any time. Riven keeps track of changing rate limits seamlessly, preventing you from getting blacklisted.

Riven's rate limiting is highly efficient, meaning that it can reach the limits of your rate limit without going over.

To adjust rate limiting, see RiotApiConfig and use with_config(config) to construct an instance.

Implementations

impl RiotApi[src]

pub fn champion_mastery_v4(&self) -> ChampionMasteryV4[src]

Returns a handle for accessing ChampionMasteryV4 endpoints.

Riot Developer API Reference

champion-mastery-v4

Note: this method is automatically generated.

pub fn champion_v3(&self) -> ChampionV3[src]

Returns a handle for accessing ChampionV3 endpoints.

Riot Developer API Reference

champion-v3

Note: this method is automatically generated.

pub fn clash_v1(&self) -> ClashV1[src]

Returns a handle for accessing ClashV1 endpoints.

Riot Developer API Reference

clash-v1

Note: this method is automatically generated.

pub fn league_exp_v4(&self) -> LeagueExpV4[src]

Returns a handle for accessing LeagueExpV4 endpoints.

Riot Developer API Reference

league-exp-v4

Note: this method is automatically generated.

pub fn league_v4(&self) -> LeagueV4[src]

Returns a handle for accessing LeagueV4 endpoints.

Riot Developer API Reference

league-v4

Note: this method is automatically generated.

pub fn lol_status_v3(&self) -> LolStatusV3[src]

Returns a handle for accessing LolStatusV3 endpoints.

Riot Developer API Reference

lol-status-v3

Note: this method is automatically generated.

pub fn lor_ranked_v1(&self) -> LorRankedV1[src]

Returns a handle for accessing LorRankedV1 endpoints.

Riot Developer API Reference

lor-ranked-v1

Note: this method is automatically generated.

pub fn match_v4(&self) -> MatchV4[src]

Returns a handle for accessing MatchV4 endpoints.

Riot Developer API Reference

match-v4

Note: this method is automatically generated.

pub fn spectator_v4(&self) -> SpectatorV4[src]

Returns a handle for accessing SpectatorV4 endpoints.

Riot Developer API Reference

spectator-v4

Note: this method is automatically generated.

pub fn summoner_v4(&self) -> SummonerV4[src]

Returns a handle for accessing SummonerV4 endpoints.

Riot Developer API Reference

summoner-v4

Note: this method is automatically generated.

pub fn tft_league_v1(&self) -> TftLeagueV1[src]

Returns a handle for accessing TftLeagueV1 endpoints.

Riot Developer API Reference

tft-league-v1

Note: this method is automatically generated.

pub fn tft_match_v1(&self) -> TftMatchV1[src]

Returns a handle for accessing TftMatchV1 endpoints.

Riot Developer API Reference

tft-match-v1

Note: this method is automatically generated.

pub fn tft_summoner_v1(&self) -> TftSummonerV1[src]

Returns a handle for accessing TftSummonerV1 endpoints.

Riot Developer API Reference

tft-summoner-v1

Note: this method is automatically generated.

pub fn third_party_code_v4(&self) -> ThirdPartyCodeV4[src]

Returns a handle for accessing ThirdPartyCodeV4 endpoints.

Riot Developer API Reference

third-party-code-v4

Note: this method is automatically generated.

pub fn tournament_stub_v4(&self) -> TournamentStubV4[src]

Returns a handle for accessing TournamentStubV4 endpoints.

Riot Developer API Reference

tournament-stub-v4

Note: this method is automatically generated.

pub fn tournament_v4(&self) -> TournamentV4[src]

Returns a handle for accessing TournamentV4 endpoints.

Riot Developer API Reference

tournament-v4

Note: this method is automatically generated.

impl RiotApi[src]

pub fn with_config(config: RiotApiConfig) -> Self[src]

Constructs a new instance from the given RiotApiConfig, consuming it.

pub fn with_key<T: Into<String>>(api_key: T) -> Self[src]

Constructs a new instance from the given API key, using default configuration.

api_key should be a Riot Games API key from https://developer.riotgames.com/, and should look like "RGAPI-01234567-89ab-cdef-0123-456789abcdef".

pub async fn get_optional<'a, T: DeserializeOwned + 'a>(
    &'a self,
    method_id: &'static str,
    region_platform: &'static str,
    path: String,
    query: Option<String>
) -> Result<Option<T>>
[src]

This method is not meant to be used directly.

This sends a GET request based on the given parameters and returns an optional parsed result.

Parameters

  • method_id - A unique string id representing the endpoint method for per-method rate limiting.
  • region_platform - The stringified platform, prepended to .api.riotgames.com to create the hostname.
  • path - The path relative to the hostname.
  • query - An optional query string.

Returns

A future resolving to a Result containg either a Option<T> (success) or a RiotApiError (failure).

pub async fn get<'a, T: DeserializeOwned + 'a>(
    &'a self,
    method_id: &'static str,
    region_platform: &'static str,
    path: String,
    query: Option<String>
) -> Result<T>
[src]

This method is not meant to be used directly.

This sends a GET request based on the given parameters and returns a parsed result.

Parameters

  • method_id - A unique string id representing the endpoint method for per-method rate limiting.
  • region_platform - The stringified platform, prepended to .api.riotgames.com to create the hostname.
  • path - The path relative to the hostname.
  • query - An optional query string.

Returns

A future resolving to a Result containg either a T (success) or a RiotApiError (failure).

pub fn get_raw_response<'a>(
    &'a self,
    method_id: &'static str,
    region_platform: &'static str,
    path: String,
    query: Option<String>
) -> impl Future<Output = Result<ResponseInfo>> + 'a
[src]

This method is not meant to be used directly.

This sends a GET request based on the given parameters and returns a raw ResponseInfo.

This can be used to implement a Riot API proxy without needing to deserialize and reserialize JSON responses.

Parameters

  • method_id - A unique string id representing the endpoint method for per-method rate limiting.
  • region_platform - The stringified platform, prepended to .api.riotgames.com to create the hostname.
  • path - The path relative to the hostname.
  • query - An optional query string.

Returns

A future resolving to a Result containg either a ResponseInfo (success) or a RiotApiError (failure).

Auto Trait Implementations

impl !RefUnwindSafe for RiotApi

impl Send for RiotApi

impl Sync for RiotApi

impl Unpin for RiotApi

impl !UnwindSafe for RiotApi

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,