Installation
Add this to your Cargo.toml:
[]
= "0.1.3"
= { = "1", = ["full"] }
= "0.4"
Usage
Setup the Client
Initialize the client with your Nightscout URL and optional API Secret.
use NightscoutClient;
use env;
async
Fetching Glucose Data (SGV)
Retrieve the latest Sensor Glucose Value (SGV) or a list of historical entries.
use SgvEntry;
// ... inside main ...
// Get the single latest entry
match client.entries.sgv.latest.await
// Fetch the last 10 entries
let history = client.entries.sgv.list.limit.await?;
for entry in history
Fetching System State (Properties)
Use the V2 Properties API to check system states like Insulin On Board (IOB), Carbs On Board (COB), or Pump Status.
use PropertyType;
// ... inside main ...
let stats = client.properties
.get
.only
.send
.await?;
if let Some = stats.iob
if let Some = stats.cob
Uploading Treatments
Upload insulin boluses, carb corrections, or other care events to Nightscout.
use Treatment;
use Utc;
// ... inside main ...
let correction = Treatment ;
match client.treatments.create.await
Disclaimer
NO MEDICAL ADVICE: This library is for educational and informational purposes only. It is not intended to be relied upon for medical decisions, insulin dosing, or treatment adjustments. Always consult with a qualified healthcare professional.
If you have any concerns regarding your health or diabetes management, please contact your healthcare provider immediately.
NO WARRANTY: This software is provided "as is", without warranty of any kind. The data retrieved may be inaccurate, delayed, or incomplete. The authors and contributors explicitly disclaim any liability for any direct or indirect damage or health consequences resulting from the use of this code.