Unofficial SpaceTraders API for Bevy

SpaceTraders API implemented for Bevy the game engine.

Consult official Docs for APIs explanations.

Learm more about Bevy here and about SpaceTraders here.

Issues / Pull requests / criticism / requests welcome.

Features

Simple Example

```rust use bevy::{log::LogPlugin, prelude::}; use bevy_mod_pies_spacetraders_api::prelude::;

fn main() { App::new() .addplugins(MinimalPlugins) .addplugin(LogPlugin::default()) // we will need this, it sets up stuff .addplugin(ClientPlugin) .addsystem(addtoken.inschedule(CoreSchedule::Startup)) .addsystem(setstatus.runif(runonce())) .addsystem(getstatus.runif(/* custom run condition is provided: */responsereceived::())) .run(); }

fn addtoken(mut config: ResMut) { // bearer token, almost every API needs it config.bearertoken = Some("Bearer XXXX".tostring()); } // there's no need to specify 'markers::' but it makes it easy to know available apis fn setstatus(mut status: ResMut) { // setting rates is optional (defaults: RateLimit::Normal, RateStrategy::Queued, RatePriority::Normal) // will be reset after sending request status.addrates(Rates { // we will use Burst limiter - up to 10 requests per second over 10 seconds limit: RateLimit::Burst, // request will be queued untill wa can send it strategy: RateStrategy::Queued, ..default() }); // we can send request with this method, each API has it's own impl and will require different args status.setrequest(); }

// each API is it's own Resource (on surface, interior mutability goes BRRRRR) fn getstatus(mut status: ResMut) { for status in status.writeunwrap().drain(..) { match status { Ok(status) => info!("{:?}", status), Err(error) => warn!("{:?}", error), } } } ```

Version Compatibility Table

|SpaceTraders|Bevy|Crate| |-|-|-| |June 24, 2023|0.11.0|0.2.0| |June 24, 2023|0.10.1|0.1.0, 0.1.1|

License

Repo is dual licensed under MIT or Apache-2.0 unless stated othervise.