Crate splits_io_api

source ·
Expand description

splits-io-api is a library that provides bindings for the splits.io API for Rust.

// Create a splits.io API client.
let client = Client::new();

// Search for a runner.
let runner = Runner::search(&client, "cryze")
    .await?
    .into_iter()
    .next()
    .context("There is no runner with that name")?;

assert_eq!(&*runner.name, "cryze92");

// Get the PBs for the runner.
let first_pb = runner.pbs(&client)
    .await?
    .into_iter()
    .next()
    .context("This runner doesn't have any PBs")?;

// Get the game for the PB.
let game = first_pb.game.context("There is no game for the PB")?;

assert_eq!(&*game.name, "The Legend of Zelda: The Wind Waker");

// Get the categories for the game.
let categories = game.categories(&client).await?;

// Get the runs for the Any% category.
let runs = categories
    .iter()
    .find(|category| &*category.name == "Any%")
    .context("Couldn't find category")?
    .runs(&client)
    .await?;

assert!(!runs.is_empty());

Re-exports

Modules

  • The category module handles retrieving Categories. A Category is a ruleset for a Game and may contain Runs.
  • The game module handles retrieving Games. A Game is a collection of information about a game and may contain Categories.
  • The race module handles retrieving Races. A Race is a competition between multiple Runners.
  • The run module handles retrieving Runs. A Run maps directly to an uploaded splits file.
  • The runner module handles retrieving Runners. A Runner is a user with at least one Run tied to their splits.io account.

Structs

  • A file that is attached to a Race.
  • A Category is a ruleset for a Game (Any%, 100%, MST, etc.) and an optional container for Runs.
  • A Chat Message is a shortform message sent by a user to a Race
  • A client that can access the splits.io API. This includes an access token that is used for authentication to all API endpoints.
  • An Entry represents a Runner’s participation in a Race or a ghost of a past Run.
  • A Game is a collection of information about a game, and a container for Categories.
  • A Race is a live competition between multiple Runners who share a start time for their run.
  • A Run maps 1:1 to an uploaded splits file.
  • Information about a past attempt associated with a Run.
  • A Runner is a user who has at least one run tied to their account.
  • A Segment maps to a single piece of a run, also called a split.
  • Information about a past attempt of a segment.

Enums

  • An error when making an API request.
  • The permission set for a Race.