SimpleGoogleFitApi 1.0.1

dotnet add package SimpleGoogleFitApi --version 1.0.1                
NuGet\Install-Package SimpleGoogleFitApi -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleGoogleFitApi" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SimpleGoogleFitApi --version 1.0.1                
#r "nuget: SimpleGoogleFitApi, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SimpleGoogleFitApi as a Cake Addin
#addin nuget:?package=SimpleGoogleFitApi&version=1.0.1

// Install SimpleGoogleFitApi as a Cake Tool
#tool nuget:?package=SimpleGoogleFitApi&version=1.0.1                

SimpleGoogleFitApi

SimpleGoogleFitApi is a c# simple opinionated library for reading from the Google Fit Api. The only supported way of using this libary is with Dependency Injection. See the sample under Usage for more details

It is based on the works of keestalkstech

Installation

Use the package manager NuGet to install SimpleGoogleFitApi.

dotnet add package SimpleGoogleFitApi --version 1.0.0

Usage

First of all, register for Google cloud and enable the Fit api. Remember to create an o-auth client and download the client_secrets.json! Then, use the following code as a quick start:

using Microsoft.Extensions.DependencyInjection;
using SimpleGoogleFitApi;
using SimpleGoogleFitApi.Queries;

/*
 This simple example will request the weight of the last 10 days.
 Make sure to place set the path to the client_secrets file right!
 */

var serviceProvider = new ServiceCollection()
    .AddGoogleFitApi(x => x.RequestBodyRead(), "client_secrets.json") // Here we request the BodyRead scope, which is needed to execute the query.
    .BuildServiceProvider();

var query = serviceProvider.GetRequiredService<WeightQuery>();

// Request the weight for the last 10 days
var weightsPerDay = query.QueryPerDay(DateTime.Now.AddDays(-10), DateTime.Now);

// Print the output.
Console.WriteLine($"date \t\t min \t max \t average");

foreach (var weight in weightsPerDay)
{
    Console.WriteLine($"{weight.Stamp.ToShortDateString()} \t {Math.Round(weight.Min, 2)} \t {Math.Round(weight.Max, 2)} \t {Math.Round(weight.Value, 2)}");
}

Supported endpoints

-ActiveMinutes -ActivitySegments -FatPercentage -BaseMetabolicRate -ExpendedCalories -Distance -HeartMinutes -HeartRate -Height -OxygenSaturation -Speed -Steps -Weight

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

None?

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 311 12/26/2022
1.0.0 257 12/26/2022

First version!