Statbook
A Rust library for accessing sports statistics and data.
Currently supports NFL player data via MySportsFeeds.com with plans to expand to other sports and data sources.
Setup
1. Get MySportsFeeds Credentials
Sign up for a free account at MySportsFeeds.com to get your API credentials.
2. Add to Cargo.toml
[]
= "0.1.0"
= { = "1.0", = ["full"] }
3. Set Environment Variables
Quick Start
use ;
async
Configuration Options
Environment Variables (Recommended)
use StatbookClient;
let client = from_env?;
Builder Pattern
use ;
let config = builder
.api_key
.password
.build?;
let client = new;
Direct Configuration
use ;
let config = new;
let client = new;
API Reference
Players
use get_player_by_name;
// Get player summary
let player = get_player_by_name.await?;
Types
use PlayerSummary;
// PlayerSummary contains:
// - first_name: String
// - last_name: String
// - primary_position: String
// - jersey_number: u32
// - current_team: String
// - injury: String
// - rookie: bool
// - games_played: u64
Error Handling
use ;
match from_env
Future Plans
- Finish NFL player and team statistics
- More comprehensive NFL data (forecasting, games, seasons)
- Additional sports (NHL, NBA, etc.)
- Additional data providers beyond MySportsFeeds
License
Licensed under either of
- Apache License, Version 2.0
- MIT license
at your option.