1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! Processed glucose and read-response types ([`read`](crate::LibreLinkUpClient::read), [`read_raw`](crate::LibreLinkUpClient::read_raw)).
use crate;
use ;
use ;
/// Trend direction for glucose readings (matches API trend arrow).
/// Processed glucose data for consumption
///
/// # Examples
///
/// ```
/// use libre_link_up_api_client::{LibreCgmData, TrendType};
/// use chrono::Utc;
///
/// let data = LibreCgmData {
/// value: 120.0,
/// is_high: false,
/// is_low: false,
/// trend: TrendType::Flat,
/// timestamp: Utc::now(),
/// };
/// assert_eq!(data.value, 120.0);
/// ```
/// Response from the read() method containing current and historical glucose data
///
/// # Examples
///
/// ```no_run
/// use libre_link_up_api_client::LibreLinkUpClient;
///
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
/// let client = LibreLinkUpClient::simple(
/// "email@example.com".to_string(),
/// "password".to_string(),
/// None,
/// )?;
///
/// let response = client.read().await?;
/// println!("Current: {:.1} mg/dL", response.current.value);
/// println!("History: {} readings", response.history.len());
/// # Ok(())
/// # }
/// ```
/// Response from the read_raw() method with unparsed API data
///
/// Access to raw API responses for advanced use cases
///
/// # Examples
///
/// ```no_run
/// use libre_link_up_api_client::LibreLinkUpClient;
///
/// # async fn example() -> Result<(), Box<dyn std::error::Error>> {
/// let client = LibreLinkUpClient::simple(
/// "email@example.com".to_string(),
/// "password".to_string(),
/// None,
/// )?;
///
/// let raw = client.read_raw().await?;
/// println!("Connection ID: {}", raw.connection.patient_id);
/// # Ok(())
/// # }
/// ```