macro-factor-rs
Unofficial Rust client library for reading MacroFactor data via the Firestore REST API.
Authentication
Email/Password (recommended)
Add a password to your MacroFactor account, then sign in directly:
let mut client = login.await?;
Refresh Token
If you already have a Firebase refresh token:
let mut client = new;
Usage
use MacroFactorClient;
use NaiveDate;
async
API Methods
| Method | Description |
|---|---|
login(email, password) |
Sign in with email/password |
new(refresh_token) |
Create client with a refresh token |
get_profile() |
User profile (name, height, weight units, goals, etc.) |
get_goals() |
Current calorie/macro targets and TDEE |
get_weight_entries(start, end) |
Scale entries with weight in kg |
get_nutrition(start, end) |
Daily summaries (calories, protein, carbs, fat, sugar, fiber) |
get_food_log(date) |
Individual food entries for a day |
get_steps(start, end) |
Daily step counts |
log_food(date, name, cal, protein, carbs, fat) |
Log a food entry |
log_weight(date, weight_kg, body_fat) |
Log a weight entry |
log_nutrition(date, cal, protein, carbs, fat) |
Log a nutrition summary |
get_raw_document(path) |
Fetch any Firestore document by path |
Firestore Schema
Data lives under users/{uid}/:
scale/{year}— weight entries keyed byMMDDnutrition/{year}— daily macro summaries keyed byMMDDfood/{YYYY-MM-DD}— food log entries per daysteps/{year}— step counts keyed byMMDDbody/{year}— body measurements keyed byMMDDcustomFoods/{id}— user-created foods and recipes