#lol #riot-games #native #api #base64 #cargo #irelia

irelia_encoder

A Rust wrapper around the native LoL APIs

5 releases

0.1.4 Feb 6, 2024
0.1.3 Oct 6, 2023
0.1.2 Jul 15, 2023
0.1.1 Jun 23, 2023
0.1.0 Jun 5, 2023

#4 in #riot-games

30 downloads per month
Used in 2 crates

MIT license

29KB
483 lines

Irelia

Crates.io Total Downloads GitHub Repo stars Crates.io Version docs.rs

Irelia is a wrapper for the local https APIs provided by riot games for LoL


[dependencies]
irelia = "0.7"

Cargo Features


This crate is designed with modularity in mind, and as such API support has been split into different cargo features.

By default, everything but the replay feature is enabled

  • ["full"] - enables support for all APIs
  • ["ws"] - enables support for the LCU websocket
  • ["in_game"] - enables support for the native in game API
  • ["batched"] - enabled the batched request system
  • ["replay"] - enables the replay API interface

Making a request to the LCU


Making a request to the LCU with irelia is simple

use irelia::{Error, RequestClient, rest::LcuClient};
use serde_json::Value;

#[tokio::main]
async fn main() {
    let request_client = RequestClient::new();
    let lcu_client = LcuClient::new(false).unwrap();
    
    let json: Result<Option<Value>, Error> = lcu_client.get("/endpoint", &request_client).await;
}

Examples


Up-to-date examples can always be found here


lib.rs:

This decoder is largely taking from this article. https://dev.to/tiemen/implementing-base64-from-scratch-in-rust-kb1 It goes into detail about the entire thing, and why it works the way it does, and I hightly reccomend reading it Very big thanks to Tiemen for writing it!

The usage of u64s as byte arrays is taken from the base64 crate, which is under the MIT licsense

No runtime deps