Crates.io | wom_rs |
lib.rs | wom_rs |
version | 0.1.0 |
source | src |
created_at | 2024-02-01 20:40:19.540405 |
updated_at | 2024-02-01 20:40:19.540405 |
description | A rust api wrapper for the OSRS Wise Old Man API |
homepage | https://github.com/fatfingers23/wom_rs |
repository | https://github.com/fatfingers23/wom_rs |
max_upload_size | |
id | 1123584 |
size | 169,378 |
A asynchronous rust wrapper for interacting with Wise Old Man API.
The goal of wom_rs is to provide a 1:1 in rust to their API. This is still a work in progress and can find below in Endpoints Progress the current status of the endpoints. If you do find any issues or have any suggestions please feel free to open an issue.
add wom_rs
to your Cargo.toml
file:
[dependencies]
wom_rs = "0.1.0"
To get a client for interacting with the API, use the WomClient
struct:
use wom_rs::WomClient;
//Default client
let wom_client = WomClient::new();
//Client with an api key
let api_key = std::env::var("WOM_API_KEY").unwrap();
let wom_client = WomClient::new_with_key(api_key);
use wom_rs::WomClient;
let wom_client = WomClient::new();
let details = wom_client.player_client.get_details("IFat Fingers".to_string()).await;
println!("{:?}", details);
Some may have cross over completion. For example you can get player name changes by username, but cannot submit request for a name change.
Contains the clients for interacting with the API. Each of the above endpoints will have a client accessed from WomClient.
Various models used to represent the data returned from the API. You will find that many of the responses handled in models are very similar to each other. In the WOM API many responses are built off of each other. I did not find a good way to do this in rust. So I kept them separate for clarity.
Some of the models that may not be clear are:
Contains the mock responses for the tests. These are used to test the deserialization of the responses from the API. All examples are either from the real API or the examples provided in WOM fantastic API documentation.
None of this would be possible with out the wonderful team at Wise Old Man. Would not need a wrapper if it was not for their fantastic website. Not to mention their amazing documentation made creating this a breeze.