forked from mirror/Riven
rustfmt ignore templated generated files
parent
150566983e
commit
3d1188b5c9
|
@ -8,35 +8,43 @@
|
||||||
|
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod champion;
|
mod champion;
|
||||||
pub use champion::*;
|
pub use champion::*;
|
||||||
|
|
||||||
mod division;
|
mod division;
|
||||||
pub use division::*;
|
pub use division::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod game_mode;
|
mod game_mode;
|
||||||
pub use game_mode::*;
|
pub use game_mode::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod game_type;
|
mod game_type;
|
||||||
pub use game_type::*;
|
pub use game_type::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod map;
|
mod map;
|
||||||
pub use map::*;
|
pub use map::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod queue_type;
|
mod queue_type;
|
||||||
pub use queue_type::*;
|
pub use queue_type::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod queue;
|
mod queue;
|
||||||
pub use queue::*;
|
pub use queue::*;
|
||||||
|
|
||||||
pub mod ranks;
|
pub mod ranks;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod route;
|
mod route;
|
||||||
pub use route::*;
|
pub use route::*;
|
||||||
|
|
||||||
mod route_ext;
|
mod route_ext;
|
||||||
pub use route_ext::*;
|
pub use route_ext::*;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
mod season;
|
mod season;
|
||||||
pub use season::*;
|
pub use season::*;
|
||||||
|
|
||||||
|
|
|
@ -19,46 +19,46 @@
|
||||||
//! <!--<a href="https://travis-ci.com/MingweiSamuel/Riven"><img src="https://img.shields.io/travis/com/mingweisamuel/riven?style=flat-square" alt="Travis CI"></a>-->
|
//! <!--<a href="https://travis-ci.com/MingweiSamuel/Riven"><img src="https://img.shields.io/travis/com/mingweisamuel/riven?style=flat-square" alt="Travis CI"></a>-->
|
||||||
//! <a href="https://github.com/rust-secure-code/safety-dance/"><img src="https://img.shields.io/badge/unsafe-forbidden-green.svg?style=flat-square" alt="unsafe forbidden"></a>
|
//! <a href="https://github.com/rust-secure-code/safety-dance/"><img src="https://img.shields.io/badge/unsafe-forbidden-green.svg?style=flat-square" alt="unsafe forbidden"></a>
|
||||||
//! </p>
|
//! </p>
|
||||||
//!
|
//!
|
||||||
//! Rust Library for the [Riot Games API](https://developer.riotgames.com/).
|
//! Rust Library for the [Riot Games API](https://developer.riotgames.com/).
|
||||||
//!
|
//!
|
||||||
//! Riven's goals are _speed_, _reliability_, and _maintainability_. Riven handles rate limits and large requests with ease.
|
//! Riven's goals are _speed_, _reliability_, and _maintainability_. Riven handles rate limits and large requests with ease.
|
||||||
//! Data structs and endpoints are automatically generated from the
|
//! Data structs and endpoints are automatically generated from the
|
||||||
//! [Riot API Reference](https://developer.riotgames.com/api-methods/) ([Swagger](http://www.mingweisamuel.com/riotapi-schema/tool/)).
|
//! [Riot API Reference](https://developer.riotgames.com/api-methods/) ([Swagger](http://www.mingweisamuel.com/riotapi-schema/tool/)).
|
||||||
//!
|
//!
|
||||||
//! # Design
|
//! # Design
|
||||||
//!
|
//!
|
||||||
//! * Fast, asynchronous, thread-safe.
|
//! * Fast, asynchronous, thread-safe.
|
||||||
//! * Automatically retries failed requests.
|
//! * Automatically retries failed requests.
|
||||||
//! * Supports all endpoints, kept up-to-date using [riotapi-schema](https://github.com/MingweiSamuel/riotapi-schema).
|
//! * Supports all endpoints, kept up-to-date using [riotapi-schema](https://github.com/MingweiSamuel/riotapi-schema).
|
||||||
//!
|
//!
|
||||||
//! # Usage
|
//! # Usage
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use riven::RiotApi;
|
//! use riven::RiotApi;
|
||||||
//! use riven::consts::PlatformRoute;
|
//! use riven::consts::PlatformRoute;
|
||||||
//!
|
//!
|
||||||
//! // Enter tokio async runtime.
|
//! // Enter tokio async runtime.
|
||||||
//! let rt = tokio::runtime::Runtime::new().unwrap();
|
//! let rt = tokio::runtime::Runtime::new().unwrap();
|
||||||
//! rt.block_on(async {
|
//! rt.block_on(async {
|
||||||
//! // Create RiotApi instance from key string.
|
//! // Create RiotApi instance from key string.
|
||||||
//! let api_key = std::env!("RGAPI_KEY"); // "RGAPI-01234567-89ab-cdef-0123-456789abcdef";
|
//! let api_key = std::env!("RGAPI_KEY"); // "RGAPI-01234567-89ab-cdef-0123-456789abcdef";
|
||||||
//! let riot_api = RiotApi::new(api_key);
|
//! let riot_api = RiotApi::new(api_key);
|
||||||
//!
|
//!
|
||||||
//! // Get summoner data.
|
//! // Get summoner data.
|
||||||
//! let summoner = riot_api.summoner_v4()
|
//! let summoner = riot_api.summoner_v4()
|
||||||
//! .get_by_summoner_name(PlatformRoute::NA1, "잘 못").await
|
//! .get_by_summoner_name(PlatformRoute::NA1, "잘 못").await
|
||||||
//! .expect("Get summoner failed.")
|
//! .expect("Get summoner failed.")
|
||||||
//! .expect("There is no summoner with that name.");
|
//! .expect("There is no summoner with that name.");
|
||||||
//!
|
//!
|
||||||
//! // Print summoner name.
|
//! // Print summoner name.
|
||||||
//! println!("{} Champion Masteries:", summoner.name);
|
//! println!("{} Champion Masteries:", summoner.name);
|
||||||
//!
|
//!
|
||||||
//! // Get champion mastery data.
|
//! // Get champion mastery data.
|
||||||
//! let masteries = riot_api.champion_mastery_v4()
|
//! let masteries = riot_api.champion_mastery_v4()
|
||||||
//! .get_all_champion_masteries(PlatformRoute::NA1, &summoner.id).await
|
//! .get_all_champion_masteries(PlatformRoute::NA1, &summoner.id).await
|
||||||
//! .expect("Get champion masteries failed.");
|
//! .expect("Get champion masteries failed.");
|
||||||
//!
|
//!
|
||||||
//! // Print champion masteries.
|
//! // Print champion masteries.
|
||||||
//! for (i, mastery) in masteries.iter().take(10).enumerate() {
|
//! for (i, mastery) in masteries.iter().take(10).enumerate() {
|
||||||
//! println!("{: >2}) {: <9} {: >7} ({})", i + 1,
|
//! println!("{: >2}) {: <9} {: >7} ({})", i + 1,
|
||||||
|
@ -85,104 +85,104 @@
|
||||||
//! contains additional usage information. The [tests](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/tests)
|
//! contains additional usage information. The [tests](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/tests)
|
||||||
//! and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/example/proxy)
|
//! and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/example/proxy)
|
||||||
//! provide more example usage.
|
//! provide more example usage.
|
||||||
//!
|
//!
|
||||||
//! ## Feature Flags
|
//! ## Feature Flags
|
||||||
//!
|
//!
|
||||||
//! ### Nightly vs Stable
|
//! ### Nightly vs Stable
|
||||||
//!
|
//!
|
||||||
//! Enable the `nightly` feature to use nightly-only functionality. This enables
|
//! Enable the `nightly` feature to use nightly-only functionality. This enables
|
||||||
//! [nightly optimizations in the `parking_lot` crate](https://github.com/Amanieu/parking_lot#nightly-vs-stable).
|
//! [nightly optimizations in the `parking_lot` crate](https://github.com/Amanieu/parking_lot#nightly-vs-stable).
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! riven = { version = "...", features = [ "nightly" ] }
|
//! riven = { version = "...", features = [ "nightly" ] }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! ### rustls
|
//! ### rustls
|
||||||
//!
|
//!
|
||||||
//! Riven uses [reqwest](https://github.com/seanmonstar/reqwest) for making requests. By default, reqwest uses the native TLS library.
|
//! Riven uses [reqwest](https://github.com/seanmonstar/reqwest) for making requests. By default, reqwest uses the native TLS library.
|
||||||
//! If you prefer using [rustls](https://github.com/ctz/rustls) you can do so by turning off the Riven default features
|
//! If you prefer using [rustls](https://github.com/ctz/rustls) you can do so by turning off the Riven default features
|
||||||
//! and specifying the `rustls-tls` feature:
|
//! and specifying the `rustls-tls` feature:
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! riven = { version = "...", default-features = false, features = [ "rustls-tls" ] }
|
//! riven = { version = "...", default-features = false, features = [ "rustls-tls" ] }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Riven is additionally able to produce [tracing](https://docs.rs/tracing) spans for requests if the `tracing` feature is enabled. This feature is disabled by default.
|
//! Riven is additionally able to produce [tracing](https://docs.rs/tracing) spans for requests if the `tracing` feature is enabled. This feature is disabled by default.
|
||||||
//!
|
//!
|
||||||
//! ## Docs
|
//! ## Docs
|
||||||
//!
|
//!
|
||||||
//! [On docs.rs](https://docs.rs/riven/).
|
//! [On docs.rs](https://docs.rs/riven/).
|
||||||
//!
|
//!
|
||||||
//! ## Error Handling
|
//! ## Error Handling
|
||||||
//!
|
//!
|
||||||
//! Riven returns either `Result<T>` or `Result<Option<T>>` within futures.
|
//! Riven returns either `Result<T>` or `Result<Option<T>>` within futures.
|
||||||
//!
|
//!
|
||||||
//! If the `Result` is errored, this indicates that the API request failed to
|
//! If the `Result` is errored, this indicates that the API request failed to
|
||||||
//! complete successfully, which may be due to bad user input, Riot server errors,
|
//! complete successfully, which may be due to bad user input, Riot server errors,
|
||||||
//! incorrect API key, etc.
|
//! incorrect API key, etc.
|
||||||
//!
|
//!
|
||||||
//! If the `Option` is `None`, this indicates that the request completed
|
//! If the `Option` is `None`, this indicates that the request completed
|
||||||
//! successfully but no data was returned. This happens in several situations, such
|
//! successfully but no data was returned. This happens in several situations, such
|
||||||
//! as getting a summoner (by name) or match (by id) that doesn't exist, or getting
|
//! as getting a summoner (by name) or match (by id) that doesn't exist, or getting
|
||||||
//! spectator data for a summoner who is not in-game.
|
//! spectator data for a summoner who is not in-game.
|
||||||
//! Specifically, the API returned a 404 HTTP status code in this situation.
|
//! Specifically, the API returned a 404 HTTP status code in this situation.
|
||||||
//!
|
//!
|
||||||
//! The error type used by Riven is `riven::RiotApiError`. It provides some basic
|
//! The error type used by Riven is `riven::RiotApiError`. It provides some basic
|
||||||
//! diagnostic information, such as the source Reqwest error, the number of retries
|
//! diagnostic information, such as the source Reqwest error, the number of retries
|
||||||
//! attempted, and the Reqwest `Response` object.
|
//! attempted, and the Reqwest `Response` object.
|
||||||
//!
|
//!
|
||||||
//! You can configure the number of time Riven retries using
|
//! You can configure the number of time Riven retries using
|
||||||
//! `RiotApiConfig::set_retries(...)` and the `RiotApi::from_config(config)`
|
//! `RiotApiConfig::set_retries(...)` and the `RiotApi::from_config(config)`
|
||||||
//! constructor. By default, Riven retries up to 3 times (4 requests total).
|
//! constructor. By default, Riven retries up to 3 times (4 requests total).
|
||||||
//! Some errors, such as 400 client errors, are not retried as they would
|
//! Some errors, such as 400 client errors, are not retried as they would
|
||||||
//! inevitably fail again.
|
//! inevitably fail again.
|
||||||
//!
|
//!
|
||||||
//! ## Semantic Versioning
|
//! ## Semantic Versioning
|
||||||
//!
|
//!
|
||||||
//! This package follows semantic versioning to an extent. However, the Riot API
|
//! This package follows semantic versioning to an extent. However, the Riot API
|
||||||
//! itself changes often and does not follow semantic versioning, which makes
|
//! itself changes often and does not follow semantic versioning, which makes
|
||||||
//! things difficult. Out-of-date versions will slowly partially cease to work due
|
//! things difficult. Out-of-date versions will slowly partially cease to work due
|
||||||
//! to this.
|
//! to this.
|
||||||
//!
|
//!
|
||||||
//! When the API changes, this may result in breaking changes in the `models`
|
//! When the API changes, this may result in breaking changes in the `models`
|
||||||
//! module, `endpoints` module, and some of the `consts` module. "Handle accessor"
|
//! module, `endpoints` module, and some of the `consts` module. "Handle accessor"
|
||||||
//! methods may be removed from `RiotApi` if the corresponding endpoint is removed
|
//! methods may be removed from `RiotApi` if the corresponding endpoint is removed
|
||||||
//! from the Riot API. These breaking changes will increment the **MINOR** version,
|
//! from the Riot API. These breaking changes will increment the **MINOR** version,
|
||||||
//! not the major version.
|
//! not the major version.
|
||||||
//!
|
//!
|
||||||
//! Parts of Riven that do not depend on Riot API changes do follow semantic
|
//! Parts of Riven that do not depend on Riot API changes do follow semantic
|
||||||
//! versioning.
|
//! versioning.
|
||||||
//!
|
//!
|
||||||
//! ## Additional Help
|
//! ## Additional Help
|
||||||
//!
|
//!
|
||||||
//! Feel free to [make an issue](https://github.com/MingweiSamuel/Riven/issues/new)
|
//! Feel free to [make an issue](https://github.com/MingweiSamuel/Riven/issues/new)
|
||||||
//! if you are have any questions or trouble with Riven.
|
//! if you are have any questions or trouble with Riven.
|
||||||
//!
|
//!
|
||||||
//! # Development
|
//! # Development
|
||||||
//!
|
//!
|
||||||
//! NodeJS is used to generate code for Riven. The
|
//! NodeJS is used to generate code for Riven. The
|
||||||
//! [`riven/srcgen`](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/srcgen)
|
//! [`riven/srcgen`](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/srcgen)
|
||||||
//! folder contains the code and [doT.js](https://olado.github.io/doT/index.html)
|
//! folder contains the code and [doT.js](https://olado.github.io/doT/index.html)
|
||||||
//! templates. `index.js` lists the JSON files downloaded and used to generate the
|
//! templates. `index.js` lists the JSON files downloaded and used to generate the
|
||||||
//! code.
|
//! code.
|
||||||
//!
|
//!
|
||||||
//! To set up the srcgen, you will first need to install NodeJS. Then enter the
|
//! To set up the srcgen, you will first need to install NodeJS. Then enter the
|
||||||
//! `riven/srcgen` folder and run `npm ci` (or `npm install`) to install
|
//! `riven/srcgen` folder and run `npm ci` (or `npm install`) to install
|
||||||
//! dependencies.
|
//! dependencies.
|
||||||
//!
|
//!
|
||||||
//! To run the srcgen use `node riven/srcgen` from the repository root.
|
//! To run the srcgen use `node riven/srcgen` from the repository root.
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
|
|
||||||
// Re-exported reqwest types.
|
// Re-exported reqwest types.
|
||||||
pub use reqwest;
|
pub use reqwest;
|
||||||
|
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
pub use config::RiotApiConfig;
|
pub use config::RiotApiConfig;
|
||||||
|
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod endpoints;
|
pub mod endpoints;
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
|
@ -190,6 +190,7 @@ pub use error::*;
|
||||||
|
|
||||||
pub mod meta;
|
pub mod meta;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod models;
|
pub mod models;
|
||||||
mod models_impls;
|
mod models_impls;
|
||||||
|
|
||||||
|
|
|
@ -7,18 +7,18 @@
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
{{~ readme :line }}
|
{{~ readme :line }}
|
||||||
//! {{= line }}
|
//!{{= line ? (' ' + line) : '' }}
|
||||||
{{~}}
|
{{~}}
|
||||||
|
|
||||||
// Re-exported reqwest types.
|
// Re-exported reqwest types.
|
||||||
pub use reqwest;
|
pub use reqwest;
|
||||||
|
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
pub use config::RiotApiConfig;
|
pub use config::RiotApiConfig;
|
||||||
|
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod endpoints;
|
pub mod endpoints;
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
|
@ -26,6 +26,7 @@ pub use error::*;
|
||||||
|
|
||||||
pub mod meta;
|
pub mod meta;
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
pub mod models;
|
pub mod models;
|
||||||
mod models_impls;
|
mod models_impls;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue