{"id":17006130,"url":"https://github.com/mingweisamuel/riven","last_synced_at":"2025-05-16T02:07:20.748Z","repository":{"id":43893165,"uuid":"214603378","full_name":"MingweiSamuel/Riven","owner":"MingweiSamuel","description":"Riot API Library for Rust","archived":false,"fork":false,"pushed_at":"2025-05-14T19:05:10.000Z","size":2853,"stargazers_count":109,"open_issues_count":12,"forks_count":15,"subscribers_count":3,"default_branch":"v/2.x.x","last_synced_at":"2025-05-16T02:06:57.427Z","etag":null,"topics":["riot-games-api","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/riven/latest/riven/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MingweiSamuel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-10-12T07:49:12.000Z","updated_at":"2025-05-14T19:05:13.000Z","dependencies_parsed_at":"2023-10-14T15:30:59.980Z","dependency_job_id":"e7b5e5ba-5a0d-4acf-a5d4-73f0732e3318","html_url":"https://github.com/MingweiSamuel/Riven","commit_stats":{"total_commits":498,"total_committers":13,"mean_commits":38.30769230769231,"dds":"0.032128514056224855","last_synced_commit":"a2e2b6ed6c96f9a6b93a7ebc37129ae7a6684f43"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MingweiSamuel%2FRiven","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MingweiSamuel%2FRiven/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MingweiSamuel%2FRiven/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MingweiSamuel%2FRiven/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MingweiSamuel","download_url":"https://codeload.github.com/MingweiSamuel/Riven/tar.gz/refs/heads/v/2.x.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254453652,"owners_count":22073617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["riot-games-api","rust"],"created_at":"2024-10-14T05:05:03.419Z","updated_at":"2025-05-16T02:07:20.727Z","avatar_url":"https://github.com/MingweiSamuel.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    Riven\u003cbr\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/MingweiSamuel/Riven/\"\u003e\u003cimg src=\"https://cdn.communitydragon.org/latest/champion/Riven/square\" width=\"20\" height=\"20\" alt=\"Riven Github\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/riven\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/riven?style=flat-square\u0026logo=rust\" alt=\"Crates.io\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/riven/\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs.rs-Riven-blue?style=flat-square\u0026logo=read-the-docs\u0026logoColor=white\" alt=\"Docs.rs\"\u003e\u003c/a\u003e\n    \u003c!--\u003ca href=\"https://travis-ci.com/MingweiSamuel/Riven\"\u003e\u003cimg src=\"https://img.shields.io/travis/com/mingweisamuel/riven?style=flat-square\" alt=\"Travis CI\"\u003e\u003c/a\u003e--\u003e\n    \u003ca href=\"https://github.com/rust-secure-code/safety-dance/\"\u003e\u003cimg src=\"https://img.shields.io/badge/unsafe-forbidden-green.svg?style=flat-square\" alt=\"unsafe forbidden\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nRust Library for the [Riot Games API](https://developer.riotgames.com/).\n\nRiven's goals are _speed_, _reliability_, and _maintainability_. Riven handles rate limits and large requests with ease.\nData structs and endpoints are automatically generated from the\n[Riot API Reference](https://developer.riotgames.com/api-methods/) ([Swagger](http://www.mingweisamuel.com/riotapi-schema/tool/)).\n\n# Design\n\n* Fast, asynchronous, thread-safe.\n* Automatically retries failed requests, configurable.\n* Supports all endpoints, kept up-to-date using [riotapi-schema](https://github.com/MingweiSamuel/riotapi-schema).\n* Can compile to Wasm for server-side or browser+proxy use.\n\n# Usage\n\n```rust\nuse riven::RiotApi;\nuse riven::consts::PlatformRoute;\n\n// Enter tokio async runtime.\nlet rt = tokio::runtime::Runtime::new().unwrap();\nrt.block_on(async {\n    // Create RiotApi instance from key string.\n    let api_key = std::env!(\"RGAPI_KEY\"); // \"RGAPI-01234567-89ab-cdef-0123-456789abcdef\";\n    let riot_api = RiotApi::new(api_key);\n\n    // The region.\n    let platform = PlatformRoute::NA1;\n\n    // Get account data.\n    let account = riot_api.account_v1()\n        .get_by_riot_id(platform.to_regional(), \"잘 못\", \"NA1\").await\n        .expect(\"Get summoner failed.\")\n        .expect(\"There is no summoner with that name.\");\n\n    // Print account name#tag.\n    println!(\n        \"{}#{} Champion Masteries:\",\n        account.game_name.unwrap_or_default(),\n        account.tag_line.unwrap_or_default(),\n    );\n\n    // Get champion mastery data.\n    let masteries = riot_api.champion_mastery_v4()\n        .get_all_champion_masteries_by_puuid(platform, \u0026account.puuid).await\n        .expect(\"Get champion masteries failed.\");\n\n    // Print champion masteries.\n    for (i, mastery) in masteries.iter().take(10).enumerate() {\n        println!(\"{: \u003e2}) {: \u003c9}    {: \u003e7} ({})\", i + 1,\n            mastery.champion_id.name().unwrap_or(\"UNKNOWN\"),\n            mastery.champion_points, mastery.champion_level);\n    }\n});\n```\nOutput:\n```text\n잘 못 Champion Masteries:\n 1) Riven        1236866 (7)\n 2) Fiora         230679 (5)\n 3) Katarina      175985 (5)\n 4) Lee Sin       156070 (7)\n 5) Jax           102662 (5)\n 6) Gnar           76373 (6)\n 7) Kai'Sa         64271 (5)\n 8) Caitlyn        46614 (5)\n 9) Irelia         46465 (5)\n10) Vladimir       37176 (5)\n```\nThe [`RiotApi` struct documentation](https://docs.rs/riven/latest/riven/struct.RiotApi.html)\ncontains additional usage information. The [tests](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/tests)\nand [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/examples/proxy)\nprovide more example usage.\n\n## Feature Flags\n\n### Nightly vs Stable\n\nEnable the `nightly` feature to use nightly-only functionality. This enables\n[nightly optimizations in the `parking_lot` crate](https://github.com/Amanieu/parking_lot#nightly-vs-stable).\n\n```toml\nriven = { version = \"...\", features = [ \"nightly\" ] }\n```\n\n### rustls\n\nRiven uses [reqwest](https://github.com/seanmonstar/reqwest) for making requests. By default, reqwest uses the native TLS library.\nIf you prefer using [rustls](https://github.com/ctz/rustls) you can do so by turning off the Riven default features\nand specifying the `rustls-tls` feature:\n\n```toml\nriven = { version = \"...\", default-features = false, features = [ \"rustls-tls\" ] }\n```\n\n### `tracing` (or `log`)\n\nBy default Riven logs some diagnostic information using [`log`](https://docs.rs/log).\nIf the `tracing` feature is enabled, Riven will use [tracing](https://docs.rs/tracing) which\nusefully aguments logs with per-request span information.\n\n### `metrics`\n\nThe `metrics` feature enables some rudiementary metrics collecting via the [`metrics`](https://docs.rs/metrics)\ncrate. See [#76](https://github.com/MingweiSamuel/Riven/pull/76) for details. More metrics may be\nadded in the future.\n\n## Docs\n\n[On docs.rs](https://docs.rs/riven/).\n\n## Error Handling\n\nRiven returns either `Result\u003cT\u003e` or `Result\u003cOption\u003cT\u003e\u003e` within futures.\n\nIf the `Result` is errored, this indicates that the API request failed to\ncomplete successfully, which may be due to bad user input, Riot server errors,\nincorrect API key, etc.\n\nIf the `Option` is `None`, this indicates that the request completed\nsuccessfully but no data was returned. This happens in several situations, such\nas getting an account (by `name#tag`) or match (by id) that doesn't exist, or getting\nspectator data for a summoner who is not in-game.\nSpecifically, the API returned an HTTP 404 (or 204) status code.\n\nThe error type returned by Riven is [`RiotApiError`](https://docs.rs/riven/latest/riven/struct.RiotApiError.html).\nIt provides some basic diagnostic information, such as the source reqwest\nerror, the number of retries attempted, and the reqwest `Response` object.\n\nBy default, Riven retries up to 3 times (4 requests total). Some errors, such\nas 400 client errors, are not retried as they would inevitably fail again.\n\nYou can configure Riven by creating a [`RiotApiConfig`](https://docs.rs/riven/latest/riven/struct.RiotApiConfig.html)\ninstance, setting the desired config values, and passing that to [`RiotApi::new`](https://docs.rs/riven/latest/riven/struct.RiotApi.html#method.new)\n(instead of just the API key). For example, you can configure the number of\ntimes Riven retries using [`RiotApiConfig::set_retries(...)`](https://docs.rs/riven/latest/riven/struct.RiotApiConfig.html#method.set_retries).\n\n\n## Semantic Versioning\n\nThis package follows semantic versioning to an extent. However, the Riot API\nitself changes often and does not follow semantic versioning, which makes\nthings difficult. Keep Riven up-to-date as out-of-date versions will slowly\ncease to work.\n\nWhen the API changes, this may result in breaking changes in the [`models`](https://docs.rs/riven/latest/riven/models/index.html)\nmodule, [`endpoints`](https://docs.rs/riven/latest/riven/endpoints/index.html)\nmodule, and some of the [`consts`](https://docs.rs/riven/latest/riven/consts/index.html)\nmodule. Models may receive new fields (and, less frequently, have fields\nremoved), endpoints may be added or removed, and new enum variants may be added.\nThese breaking changes will increment the **MINOR** version, not the major\nversion. (`major.minor.patch`)\n\nParts of Riven that do not depend on Riot API changes do follow semantic\nversioning.\n\n## Additional Help\n\nFeel free to [make an issue](https://github.com/MingweiSamuel/Riven/issues/new)\nif you are have any questions or trouble with Riven.\n\n# Development\n\nNodeJS is used to generate code for Riven. The\n[`riven/srcgen`](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/srcgen)\nfolder contains the code and [doT.js](https://olado.github.io/doT/index.html)\ntemplates. `index.js` lists the JSON files downloaded and used to generate the\ncode.\n\nTo set up the srcgen, you will first need to install NodeJS. Then enter the\n`riven/srcgen` folder and run `npm ci` (or `npm install`) to install\ndependencies.\n\nTo run the srcgen use `node riven/srcgen` from the repository root.\n\n## Testing\n\nTo run tests put your API key into either the `RGAPI_KEY` environment variable or the `apikey.txt`\nfile.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingweisamuel%2Friven","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmingweisamuel%2Friven","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingweisamuel%2Friven/lists"}