docs: update README.md

v/2.x.x
Mingwei Samuel 2024-04-22 12:55:06 -07:00
parent 9bcb8ed5bf
commit 1d46327479
1 changed files with 22 additions and 18 deletions

View File

@ -123,32 +123,37 @@ 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 an account (by `name#tag`) 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 an HTTP 404 (or 204) status code.
The error type used by Riven is `riven::RiotApiError`. It provides some basic The error type returned by Riven is [`RiotApiError`](https://docs.rs/riven/latest/riven/struct.RiotApiError.html).
diagnostic information, such as the source Reqwest error, the number of retries It provides some basic diagnostic information, such as the source reqwest
attempted, and the Reqwest `Response` object. error, the number of retries attempted, and the reqwest `Response` object.
By default, Riven retries up to 3 times (4 requests total). Some errors, such
as 400 client errors, are not retried as they would inevitably fail again.
You can configure Riven by creating a [`RiotApiConfig`](https://docs.rs/riven/latest/riven/struct.RiotApiConfig.html)
instance, setting the desired config values, and passing that to [`RiotApi::new`](https://docs.rs/riven/latest/riven/struct.RiotApi.html#method.new)
(instead of just the API key). For example, you can configure the number of
times Riven retries using [`RiotApiConfig::set_retries(...)`](https://docs.rs/riven/latest/riven/struct.RiotApiConfig.html#method.set_retries).
You can configure the number of time Riven retries using
`RiotApiConfig::set_retries(...)` and the `RiotApi::from_config(config)`
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
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. Keep Riven up-to-date as out-of-date versions will slowly
to this. cease to work.
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`](https://docs.rs/riven/latest/riven/models/index.html)
module, `endpoints` module, and some of the `consts` module. "Handle accessor" module, [`endpoints`](https://docs.rs/riven/latest/riven/endpoints/index.html)
methods may be removed from `RiotApi` if the corresponding endpoint is removed module, and some of the [`consts`](https://docs.rs/riven/latest/riven/consts/index.html)
from the Riot API. These breaking changes will increment the **MINOR** version, module. Models may receive new fields (and, less frequently, have fields
not the major version. removed), endpoints may be added or removed, and new enum variants may be added.
These breaking changes will increment the **MINOR** version, not the major
version. (`major.minor.patch`)
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.
@ -171,4 +176,3 @@ To set up the srcgen, you will first need to install NodeJS. Then enter the
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.