BioLogreen.Sdk 0.1.0

dotnet add package BioLogreen.Sdk --version 0.1.0
                    
NuGet\Install-Package BioLogreen.Sdk -Version 0.1.0
                    
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="BioLogreen.Sdk" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BioLogreen.Sdk" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="BioLogreen.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BioLogreen.Sdk --version 0.1.0
                    
#r "nuget: BioLogreen.Sdk, 0.1.0"
                    
#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.
#:package BioLogreen.Sdk@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BioLogreen.Sdk&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=BioLogreen.Sdk&version=0.1.0
                    
Install as a Cake Tool

BioLogreen C# (.NET) SDK

The official C#/.NET SDK for the BioLogreen Facial Authentication API.

This SDK is a .NET Standard 2.0 class library, ensuring maximum compatibility with a wide range of .NET platforms, including .NET Framework, .NET Core/5/6/7/8+, MAUI, and Unity.

Features

  • Cross-Platform: Built on .NET Standard 2.0 for broad compatibility.
  • Modern & Asynchronous: Uses async/await with Task for non-blocking, efficient network operations.
  • Robust & Type-Safe: Built with modern C# features and includes XML documentation.
  • Resource-Safe: Implements IDisposable for proper management of network connections.
  • No Heavy Dependencies: Uses the built-in HttpClient and System.Text.Json for high performance.

Installation

This SDK is intended to be published to the NuGet package manager. To install it, you can use the .NET CLI:

dotnet add package BioLogreen.Sdk --version 0.1.0 #or the latest version



Or, you can add it to your .csproj file directly:

XML

<ItemGroup>
  <PackageReference Include="BioLogreen.Sdk" Version="0.1.0" />
</ItemGroup>
Usage
The BioLogreenClient is designed to be instantiated once and reused throughout your application's lifecycle. It is thread-safe.

Here is a basic example for a console application.

C#

using BioLogreen.Sdk;
using BioLogreen.Sdk.Exceptions;
using BioLogreen.Sdk.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;

public class Program
{
    // C# supports async Main methods, which is perfect for our SDK.
    public static async Task Main(string[] args)
    {
        // It is recommended to load your API key from environment variables or a secure config.
        var apiKey = "YOUR_SECRET_API_KEY";
        
        // Use a using statement to ensure the HttpClient is properly disposed.
        using var client = new BioLogreenClient(apiKey, "http://localhost:8000/v1"); // Use local URL for testing

        try
        {
            // --- Example: Signing up a new user ---
            Console.WriteLine("Attempting to sign up a new user...");
            var signupImageBytes = await File.ReadAllBytesAsync("path/to/user_signup_image.jpg");
            var customData = new Dictionary<string, object>
            {
                { "plan", "premium" },
                { "userId", "user-123" }
            };

            FaceAuthResponse signupResponse = await client.SignupWithFaceAsync(signupImageBytes, customData);

            Console.WriteLine("Signup Successful!");
            Console.WriteLine($"New User ID: {signupResponse.UserId}");
            Console.WriteLine($"Is New User: {signupResponse.IsNewUser}");
            Console.WriteLine($"Custom Fields Count: {signupResponse.CustomFields?.Count}");

            // --- Example: Logging in an existing user ---
            Console.WriteLine("\nAttempting to log in the user...");
            var loginImageBytes = await File.ReadAllBytesAsync("path/to/user_login_image.jpg");

            FaceAuthResponse loginResponse = await client.LoginWithFaceAsync(loginImageBytes);

            Console.WriteLine("Login Successful!");
            Console.WriteLine($"User ID: {loginResponse.UserId}");
        }
        catch (BioLogreenApiException ex)
        {
            Console.WriteLine($"API Error: {ex.Message} (Status Code: {ex.StatusCode})");
        }
        catch (HttpRequestException ex)
        {
            // This catches network-level errors (e.g., server is down)
            Console.WriteLine($"Network Error: {ex.Message}");
        }
        catch (IOException ex)
        {
            // This catches file-level errors (e.g., image not found)
            Console.WriteLine($"File Error: {ex.Message}");
        }
    }
}
Contributing
Suggestions and contributions are welcome. Please open an issue or a pull request on the GitHub repository to suggest changes.

License
This SDK is licensed under the MIT License with The Commons Clause. See the LICENSE file for more details.
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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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
0.1.0 212 9/20/2025