| Crates.io | osrs-wiki-prices |
| lib.rs | osrs-wiki-prices |
| version | 0.2.0 |
| created_at | 2025-05-21 12:51:18.504446+00 |
| updated_at | 2025-05-23 01:46:35.397192+00 |
| description | Rust client for the OSRS Wiki Prices API |
| homepage | |
| repository | https://github.com/elertan/osrs-wiki-prices |
| max_upload_size | |
| id | 1683367 |
| size | 71,221 |
A Rust library for fetching and working with Old School RuneScape (OSRS) item price data from the OSRS Wiki. This crate provides async-friendly endpoints for retrieving the latest prices, historical timeseries, and mapping item IDs to names.
Add this to your Cargo.toml:
[dependencies]
osrs-wiki-prices = "0.1.0"
use osrs_wiki_prices::{Client, ApiEndpoint};
use std::borrow::Cow;
// Provide a descriptive user agent string here, as required by the OSRS Wiki API.
// This is important for identifying your application and ensuring compliance with their API usage policies.
let client = Client::try_new(Cow::Borrowed("my-user-agent"), ApiEndpoint::OldSchoolRuneScape).unwrap();
use osrs_wiki_prices::endpoints::latest::LatestEndpoint;
use osrs_wiki_prices::types::ItemId;
#[tokio::main]
async fn main() {
let client = /* create client as above */;
let latest = client.latest().await.unwrap();
if let Some(item) = latest.get(&ItemId::new(4151)) { // 4151 = Abyssal whip
println!("Abyssal whip high price: {:?}", item.high);
}
}
use osrs_wiki_prices::endpoints::timeseries::{TimeseriesEndpoint, Timestep};
use osrs_wiki_prices::types::ItemId;
#[tokio::main]
async fn main() {
let client = /* create client as above */;
let timeseries = client.timeseries(ItemId::new(4151), Timestep::FiveMinutes).await.unwrap();
for entry in timeseries {
println!("Timestamp: {}, Avg High Price: {:?}", entry.timestamp, entry.avg_high_price);
}
}
use osrs_wiki_prices::endpoints::mapping::MappingEndpoint;
#[tokio::main]
async fn main() {
let client = /* create client as above */;
let mapping = client.mapping().await.unwrap();
for item in mapping.iter().filter(|i| i.id.id() == 4151) {
println!("Item name: {}", item.name);
}
}
endpoints::latest — Latest prices for all itemsendpoints::prices::five_minutes — 5-minute interval price timeseriesendpoints::prices::one_hour — 1-hour interval price timeseriesendpoints::mapping — Item ID/name mappingendpoints::timeseries — Historical price timeseriesMIT