pub struct MacroFactorClient {
pub auth: FirebaseAuth,
pub firestore: FirestoreClient,
/* private fields */
}Fields§
§auth: FirebaseAuth§firestore: FirestoreClientImplementations§
Source§impl MacroFactorClient
impl MacroFactorClient
pub fn new(refresh_token: String) -> Self
Sourcepub async fn login(email: &str, password: &str) -> Result<Self>
pub async fn login(email: &str, password: &str) -> Result<Self>
Sign in with email and password.
pub async fn get_user_id(&mut self) -> Result<String>
Sourcepub async fn get_profile(&mut self) -> Result<Value>
pub async fn get_profile(&mut self) -> Result<Value>
Get the user profile document.
Sourcepub async fn list_subcollections(
&self,
document_path: &str,
) -> Result<Vec<String>>
pub async fn list_subcollections( &self, document_path: &str, ) -> Result<Vec<String>>
List sub-collections under the user document.
Sourcepub async fn sample_collection(
&self,
collection_path: &str,
limit: u32,
) -> Result<Vec<Value>>
pub async fn sample_collection( &self, collection_path: &str, limit: u32, ) -> Result<Vec<Value>>
Get a few documents from a collection for schema discovery.
Sourcepub async fn get_raw_document(&self, path: &str) -> Result<Value>
pub async fn get_raw_document(&self, path: &str) -> Result<Value>
Get a raw document by path and return parsed fields.
Sourcepub async fn get_weight_entries(
&mut self,
start: NaiveDate,
end: NaiveDate,
) -> Result<Vec<ScaleEntry>>
pub async fn get_weight_entries( &mut self, start: NaiveDate, end: NaiveDate, ) -> Result<Vec<ScaleEntry>>
Get scale/weight entries for a date range.
Data is stored in scale/{year} docs with MMDD keys.
Sourcepub async fn get_nutrition(
&mut self,
start: NaiveDate,
end: NaiveDate,
) -> Result<Vec<NutritionSummary>>
pub async fn get_nutrition( &mut self, start: NaiveDate, end: NaiveDate, ) -> Result<Vec<NutritionSummary>>
Get nutrition summaries for a date range.
Data is stored in nutrition/{year} docs with MMDD keys.
Sourcepub async fn get_food_log(&mut self, date: NaiveDate) -> Result<Vec<FoodEntry>>
pub async fn get_food_log(&mut self, date: NaiveDate) -> Result<Vec<FoodEntry>>
Get food log entries for a specific date.
Data is stored in food/{YYYY-MM-DD} docs.
Sourcepub async fn get_steps(
&mut self,
start: NaiveDate,
end: NaiveDate,
) -> Result<Vec<StepEntry>>
pub async fn get_steps( &mut self, start: NaiveDate, end: NaiveDate, ) -> Result<Vec<StepEntry>>
Get step counts for a date range.
Data is stored in steps/{year} docs with MMDD keys.
Sourcepub async fn get_goals(&mut self) -> Result<Goals>
pub async fn get_goals(&mut self) -> Result<Goals>
Get the current macro/calorie goals from the user’s planner.
Sourcepub async fn log_food(
&mut self,
date: NaiveDate,
name: &str,
calories: f64,
protein: f64,
carbs: f64,
fat: f64,
) -> Result<()>
pub async fn log_food( &mut self, date: NaiveDate, name: &str, calories: f64, protein: f64, carbs: f64, fat: f64, ) -> Result<()>
Log a food entry for a given date.
Fields like calories, protein, carbs, fat are required.
The entry will be created with a timestamp-based ID.
Trait Implementations§
Source§impl Clone for MacroFactorClient
impl Clone for MacroFactorClient
Source§fn clone(&self) -> MacroFactorClient
fn clone(&self) -> MacroFactorClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more