Expand description
A NationStates API wrapper that takes full advantage of Rust’s type system.
Works with the current API (v12) as of 4 October 2023.
Using the library usually takes three steps:
- Creating a request
(e.g.
PublicNationRequest) with the relevant shards. - Sending the request as a URL through a
Client. - Parsing the response using a parser in
parsers.
Currently, the following requests can be formed and sent:
- Nation (public shards only):
PublicNationRequest::new, fromPublicNationShards; also,StandardPublicNationRequest - Region:
RegionRequest::new, fromRegionShards; also,StandardRegionRequest - World (except for
regionsfromtag):WorldRequest::new, fromWorldShards - WA (World Assembly):
WAShard, fromWAShards
The following requests can be parsed:
Nation(some fields still being finalized)
The following functionality is planned, but is not implemented:
- parsers for Region, World, and WA request responses
- private shards
- lighter-weight client using
hyper - breaking crate into features
§Examples
For a list of examples, see the examples folder on GitHub.
Modules§
- client
- Additional tools for making requests.
- models
- Models that are useful for both sending and receiving information.
- parsers
- Contains the modules that parse responses from the NationStates API.
- shards
- A shard is a tiny request, composed of two parts: the query and the extra parameters. You add multiple shards together to get the most efficient response. Remember: 50 requests per 30 seconds is both a lot and very little at the same time!
Macros§
Functions§
- pretty_
name - Takes a lowercase, web-safe name and replaces it with a name that should match the real name on NationStates.
- safe_
name - Takes a nation name with capital letters and spaces and turns it into a safe-to-send, lowercase name.