pub struct RiotApi { /* private fields */ }
Expand description
For retrieving data from the Riot Games API.
§Usage
Construct an instance using RiotApi::new(api_key or config)
.
The parameter may be a Riot API key string or a RiotApiConfig
. Riot API
keys are obtained from the Riot Developer Portal
and look like "RGAPI-01234567-89ab-cdef-0123-456789abcdef"
.
An instance provides access to “endpoint handles” which in turn provide
access to individual API method calls. For example, to get a summoner by
name we first access the summoner_v4()
endpoints
then call the get_by_summoner_name()
method:
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 can change at any time. Riven keeps track of changing rate limits seamlessly, preventing you from getting blacklisted.
Riven’s rate limiting is highly efficient; it can use the full throughput of your rate limit without triggering 429 errors.
To adjust rate limiting, see RiotApiConfig and use
RiotApi::new(config)
to construct an instance.
Implementations§
Source§impl RiotApi
impl RiotApi
Sourcepub fn account_v1(&self) -> AccountV1<'_>
pub fn account_v1(&self) -> AccountV1<'_>
Sourcepub fn champion_mastery_v4(&self) -> ChampionMasteryV4<'_>
pub fn champion_mastery_v4(&self) -> ChampionMasteryV4<'_>
Returns a handle for accessing ChampionMasteryV4 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn champion_v3(&self) -> ChampionV3<'_>
pub fn champion_v3(&self) -> ChampionV3<'_>
Returns a handle for accessing ChampionV3 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn league_exp_v4(&self) -> LeagueExpV4<'_>
pub fn league_exp_v4(&self) -> LeagueExpV4<'_>
Returns a handle for accessing LeagueExpV4 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn lol_challenges_v1(&self) -> LolChallengesV1<'_>
pub fn lol_challenges_v1(&self) -> LolChallengesV1<'_>
Returns a handle for accessing LolChallengesV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn lol_rso_match_v1(&self) -> LolRsoMatchV1<'_>
pub fn lol_rso_match_v1(&self) -> LolRsoMatchV1<'_>
Returns a handle for accessing LolRsoMatchV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn lol_status_v4(&self) -> LolStatusV4<'_>
pub fn lol_status_v4(&self) -> LolStatusV4<'_>
Returns a handle for accessing LolStatusV4 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn lor_deck_v1(&self) -> LorDeckV1<'_>
pub fn lor_deck_v1(&self) -> LorDeckV1<'_>
Sourcepub fn lor_inventory_v1(&self) -> LorInventoryV1<'_>
pub fn lor_inventory_v1(&self) -> LorInventoryV1<'_>
Returns a handle for accessing LorInventoryV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn lor_match_v1(&self) -> LorMatchV1<'_>
pub fn lor_match_v1(&self) -> LorMatchV1<'_>
Returns a handle for accessing LorMatchV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn lor_ranked_v1(&self) -> LorRankedV1<'_>
pub fn lor_ranked_v1(&self) -> LorRankedV1<'_>
Returns a handle for accessing LorRankedV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn lor_status_v1(&self) -> LorStatusV1<'_>
pub fn lor_status_v1(&self) -> LorStatusV1<'_>
Returns a handle for accessing LorStatusV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn spectator_tft_v5(&self) -> SpectatorTftV5<'_>
pub fn spectator_tft_v5(&self) -> SpectatorTftV5<'_>
Returns a handle for accessing SpectatorTftV5 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn spectator_v5(&self) -> SpectatorV5<'_>
pub fn spectator_v5(&self) -> SpectatorV5<'_>
Returns a handle for accessing SpectatorV5 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn summoner_v4(&self) -> SummonerV4<'_>
pub fn summoner_v4(&self) -> SummonerV4<'_>
Returns a handle for accessing SummonerV4 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn tft_league_v1(&self) -> TftLeagueV1<'_>
pub fn tft_league_v1(&self) -> TftLeagueV1<'_>
Returns a handle for accessing TftLeagueV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn tft_match_v1(&self) -> TftMatchV1<'_>
pub fn tft_match_v1(&self) -> TftMatchV1<'_>
Returns a handle for accessing TftMatchV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn tft_status_v1(&self) -> TftStatusV1<'_>
pub fn tft_status_v1(&self) -> TftStatusV1<'_>
Returns a handle for accessing TftStatusV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn tft_summoner_v1(&self) -> TftSummonerV1<'_>
pub fn tft_summoner_v1(&self) -> TftSummonerV1<'_>
Returns a handle for accessing TftSummonerV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn tournament_stub_v5(&self) -> TournamentStubV5<'_>
pub fn tournament_stub_v5(&self) -> TournamentStubV5<'_>
Returns a handle for accessing TournamentStubV5 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn tournament_v5(&self) -> TournamentV5<'_>
pub fn tournament_v5(&self) -> TournamentV5<'_>
Returns a handle for accessing TournamentV5 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn val_console_match_v1(&self) -> ValConsoleMatchV1<'_>
pub fn val_console_match_v1(&self) -> ValConsoleMatchV1<'_>
Returns a handle for accessing ValConsoleMatchV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn val_console_ranked_v1(&self) -> ValConsoleRankedV1<'_>
pub fn val_console_ranked_v1(&self) -> ValConsoleRankedV1<'_>
Returns a handle for accessing ValConsoleRankedV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn val_content_v1(&self) -> ValContentV1<'_>
pub fn val_content_v1(&self) -> ValContentV1<'_>
Returns a handle for accessing ValContentV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn val_match_v1(&self) -> ValMatchV1<'_>
pub fn val_match_v1(&self) -> ValMatchV1<'_>
Returns a handle for accessing ValMatchV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn val_ranked_v1(&self) -> ValRankedV1<'_>
pub fn val_ranked_v1(&self) -> ValRankedV1<'_>
Returns a handle for accessing ValRankedV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Sourcepub fn val_status_v1(&self) -> ValStatusV1<'_>
pub fn val_status_v1(&self) -> ValStatusV1<'_>
Returns a handle for accessing ValStatusV1 endpoints.
§Riot Developer API Reference
Note: this method is automatically generated.
Source§impl RiotApi
impl RiotApi
Sourcepub fn new(config: impl Into<RiotApiConfig>) -> Self
pub fn new(config: impl Into<RiotApiConfig>) -> Self
Constructs a new instance from an API key (e.g. "RGAPI-01234567-89ab-cdef-0123-456789abcdef"
) or a RiotApiConfig.
Sourcepub fn request(
&self,
method: Method,
region_platform: &str,
path: &str,
) -> RequestBuilder
pub fn request( &self, method: Method, region_platform: &str, path: &str, ) -> RequestBuilder
This method should generally not be used directly. Consider using endpoint wrappers instead.
Creates a RequestBuilder
instance with the given parameters, for use with the execute*()
methods.
§Parameters
method
- The HTTP method for this request.region_platform
- The stringified platform, used to create the base URL.path
- The URL path, appended to the base URL.
Sourcepub async fn execute_val<'a, T: for<'de> Deserialize<'de> + 'a>(
&'a self,
method_id: &'static str,
region_platform: &'static str,
request: RequestBuilder,
) -> Result<T>
pub async fn execute_val<'a, T: for<'de> Deserialize<'de> + 'a>( &'a self, method_id: &'static str, region_platform: &'static str, request: RequestBuilder, ) -> Result<T>
This method should generally not be used directly. Consider using endpoint wrappers instead.
This sends a 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, used in rate limiting.request
- The request information. Userequest()
to obtain aRequestBuilder
instance.
§Returns
A future resolving to a Result
containg either a T
(success) or a RiotApiError
(failure).
Sourcepub async fn execute_opt<'a, T: for<'de> Deserialize<'de> + 'a>(
&'a self,
method_id: &'static str,
region_platform: &'static str,
request: RequestBuilder,
) -> Result<Option<T>>
pub async fn execute_opt<'a, T: for<'de> Deserialize<'de> + 'a>( &'a self, method_id: &'static str, region_platform: &'static str, request: RequestBuilder, ) -> Result<Option<T>>
This method should generally not be used directly. Consider using endpoint wrappers instead.
This sends a 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, used in rate limiting.request
- The request information. Userequest()
to obtain aRequestBuilder
instance.
§Returns
A future resolving to a Result
containg either an Option<T>
(success) or a RiotApiError
(failure).
Sourcepub async fn execute(
&self,
method_id: &'static str,
region_platform: &'static str,
request: RequestBuilder,
) -> Result<()>
pub async fn execute( &self, method_id: &'static str, region_platform: &'static str, request: RequestBuilder, ) -> Result<()>
This method should generally not be used directly. Consider using endpoint wrappers instead.
This sends a request based on the given parameters but does not deserialize any response body.
§Parameters
method_id
- A unique string id representing the endpoint method for per-method rate limiting.region_platform
- The stringified platform, used in rate limiting.request
- The request information. Userequest()
to obtain aRequestBuilder
instance.
§Returns
A future resolving to a Result
containg either ()
(success) or a RiotApiError
(failure).
Sourcepub fn execute_raw(
&self,
method_id: &'static str,
region_platform: &'static str,
request: RequestBuilder,
) -> impl Future<Output = Result<ResponseInfo>> + '_
pub fn execute_raw( &self, method_id: &'static str, region_platform: &'static str, request: RequestBuilder, ) -> impl Future<Output = Result<ResponseInfo>> + '_
This method should generally not be used directly. Consider using endpoint wrappers instead.
This sends a 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, used in rate limiting.request
- The request information. Userequest()
to obtain aRequestBuilder
instance.
§Returns
A future resolving to a Result
containg either a ResponseInfo
(success) or a RiotApiError
(failure).