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§

pub use uuid;

Modules§

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

Structs§

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

Enums§

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