A Rust library for using the [Screeps] HTTP API.
Screeps is a true programming MMO where users uploading JavaScript code to power their online empires.
rust-screeps-api
can connect to the official server, and any private server instances run by
users.
rust-screeps-api
uses [hyper] to run http requests and [serde] to parse json results.
```rust extern crate screeps_api;
use screeps_api::SyncApi;
let mut api = SyncApi::new().unwrap();
api.login("username", "password").unwrap();
let myinfo = api.myinfo().unwrap();
println!("Logged in with user ID {}!", myinfo.userid); ```
Documentation is located at https://docs.rs/screeps-api/.
Unofficial documentation for HTTP endpoints can be found at https://github.com/screepers/python-screeps/blob/master/docs/Endpoints.md.
rust-screeps-api
has both unit tests for parsing sample results from each endpoint, and integration tests which make calls to the official server.
Environmental variables used when testing:
- SCREEPSAPIUSERNAME: the username to log in with for doing authenticated tests
- SCREEPSAPIPASSWORD: the password to login with for doing authenticated tests
- All variables can also be placed into a .env
file (parsed using the dotenv
crate)
Use:
- cargo test
to perform all tests, including calls to https://screeps.com with provided login details.
- cargo test parse
to only perform parsing unit tests. This can be performed offline.
- cargo test -- --skip auth
to test both parsing and all unauthenticated calls to the official server.