Posseth.Toyota.Client 1.4.0

dotnet add package Posseth.Toyota.Client --version 1.4.0
                    
NuGet\Install-Package Posseth.Toyota.Client -Version 1.4.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="Posseth.Toyota.Client" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Posseth.Toyota.Client" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Posseth.Toyota.Client" />
                    
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 Posseth.Toyota.Client --version 1.4.0
                    
#r "nuget: Posseth.Toyota.Client, 1.4.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 Posseth.Toyota.Client@1.4.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=Posseth.Toyota.Client&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Posseth.Toyota.Client&version=1.4.0
                    
Install as a Cake Tool

<div align="center"> <img src="assets/ToyoCL.png" alt="Posseth Toyota Client logo" width="120" height="120" />

Posseth.Toyota.Client

NuGet License .NET C#

A modern .NET 10 client library for interacting with Toyota's MyToyota Connected Services API. This project provides a fluent, async-first interface to access comprehensive vehicle data including location, status, climate control, remote commands, and more.

</div>

๐Ÿ“‹ Table of Contents

โœจ Features

  • Async-First: All operations are fully asynchronous with cancellation token support
  • Fluent Configuration: Easy, chainable builder pattern for client setup
  • Dependency Injection: First-class IServiceCollection integration via AddToyotaClient()
  • Type-Safe: Strong typing for all API contracts and responses
  • Comprehensive API: Access to vehicles, location, climate control, remote commands, trip history, and more
  • Token Caching: Automatic token caching to minimize login overhead
  • Error Handling: Precise exceptions for different failure scenarios
  • Performance: Built with .NET 10 and C# 14 for optimal performance

๐Ÿ“ฆ Installation

Install the NuGet package:

dotnet add package Posseth.Toyota.Client

Or via Package Manager:

Install-Package Posseth.Toyota.Client

๐Ÿš€ Quick Start

using Posseth.Toyota.Client;

// Create and configure the client
var client = new MyToyotaClient()
    .UseCredentials("your-username", "your-password")
    .UseTimeout(30)
    .UseTokenCaching(true);

// Authenticate
var loginSuccess = await client.LoginAsync();
if (!loginSuccess)
    throw new InvalidOperationException("Login failed");

// Get your vehicles
var vehicles = await client.GetVehiclesAsync();
foreach (var vehicle in vehicles?.Data ?? [])
{
    Console.WriteLine($"VIN: {vehicle.Vin}, Name: {vehicle.Nickname}");
}

// Get vehicle status
var location = await client.GetLocationAsync("JTHJP5C27D5012345");
Console.WriteLine($"Location: {location?.Data?.Latitude}, {location?.Data?.Longitude}");

// Control your vehicle
var result = await client.StartClimateControlAsync("JTHJP5C27D5012345");
if (result?.IsSuccess == true)
    Console.WriteLine("Climate control started");

๐Ÿ’‰ Dependency Injection

Posseth.Toyota.Client ships with built-in support for the .NET Options pattern and Microsoft.Extensions.DependencyInjection.

// Program.cs
using Posseth.Toyota.Client.Extensions;

builder.Services.AddToyotaClient(options =>
{
    options.Username       = builder.Configuration["Toyota:Username"]!;
    options.Password       = builder.Configuration["Toyota:Password"]!;
    options.TimeoutSeconds = 30;
    options.Logger         = msg => Console.WriteLine(msg); // optional
});

Option B โ€” Bind from appsettings.json

Add a section to your appsettings.json:

{
  "ToyotaClient": {
    "Username": "your@email.com",
    "Password": "your-password",
    "TimeoutSeconds": 30,
    "UseTokenCaching": true
  }
}

Then register:

// Program.cs
using Posseth.Toyota.Client;
using Posseth.Toyota.Client.Extensions;

builder.Services.AddToyotaClient(
    builder.Configuration.GetSection(ToyotaClientOptions.SectionName));

Consuming IMyToyotaClient

Once registered, inject IMyToyotaClient anywhere in your application:

public class VehicleService(IMyToyotaClient client)
{
    public async Task<string?> GetFirstVinAsync(CancellationToken ct = default)
    {
        await client.LoginAsync(ct);
        var vehicles = await client.GetVehiclesAsync(ct);
        return vehicles?.Data?.FirstOrDefault()?.Vin;
    }
}

Security tip: Never store credentials in appsettings.json for production.
Use Secret Manager in development
and Azure Key Vault or environment variables in production.

For a full walkthrough see docs/GETTING_STARTED.md.

๐Ÿ“š Documentation

๐Ÿ“ Project Structure

Posseth.Toyota.Client/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ Posseth.Toyota.Client/          # Main client library
โ”‚       โ”œโ”€โ”€ Extensions/                 # DI extension methods
โ”‚       โ”œโ”€โ”€ Interfaces/                 # Public API contracts
โ”‚       โ”œโ”€โ”€ Models/                     # API response/request models
โ”‚       โ”œโ”€โ”€ Services/                   # Core business logic
โ”‚       โ”œโ”€โ”€ Exceptions/                 # Custom exception types
โ”‚       โ””โ”€โ”€ ToyotaClientOptions.cs      # DI / Options-pattern configuration
โ”œโ”€โ”€ samples/
โ”‚   โ””โ”€โ”€ Posseth.Toyota.Demo.ConsoleApp/ # Example usage
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ Posseth.Toyota.Client.Tests/    # Unit and integration tests
โ”œโ”€โ”€ assets/
โ”‚   โ””โ”€โ”€ logo.svg                        # Project logo
โ””โ”€โ”€ docs/                               # Documentation

๐Ÿ› ๏ธ Requirements

  • .NET 10+ or later
  • C# 14 (or later)
  • Toyota Connected Services Account

๐Ÿงช Testing

To run the test suite:

# Unit tests
dotnet test

# With coverage (requires dotnet-coverage)
dotnet-coverage collect -f cobertura -o coverage.cobertura.xml dotnet test

Environment Variables for Tests

Integration tests require valid Toyota credentials:

export TOYOTA_USERNAME=your-username
export TOYOTA_PASSWORD=your-password
dotnet test

๐ŸŽฏ Supported Features

Vehicle Information

  • Get all associated vehicles
  • Get vehicle association details

Electric/EV Status

  • Battery level and charging status
  • Real-time EV status data

Climate Control

  • Get climate settings and status
  • Start/stop climate control
  • Refresh climate status

Remote Commands

  • Lock/unlock vehicle
  • Start/stop engine
  • Control lights
  • Open trunk
  • Hazard lights

Vehicle Telemetry

  • Current location
  • Lock status (doors, trunk, windows)
  • Health diagnostics
  • Telemetry data
  • Service history
  • Driving statistics and eco-scores

Trip Management

  • Trip history with optional route data
  • Trip summaries
  • Trip statistics

Notifications

  • Recent vehicle notifications

๐Ÿ”’ Security

  • Never hardcode credentials - Use environment variables or configuration files
  • Token caching is enabled by default but can be disabled if needed
  • Secure storage - Consider using Azure Key Vault or similar for sensitive data in production
  • See SECURITY.md for more details

๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright ยฉ 2026 Michel Posseth (MPCoreDeveloper)

Attribution

This project is based on Abraham.MyToyotaClient, which is licensed under the Apache License 2.0. We acknowledge and thank the original author for their work.

โš ๏ธ Disclaimer

This is an unofficial client library and is not affiliated with, endorsed by, or associated with Toyota Motor Corporation or any of its subsidiaries.

Use at your own risk. The authors assume no responsibility for any misuse, damage, or issues arising from the use of this library. Ensure you comply with Toyota's Terms of Service and respect their API usage policies.

๐Ÿ“ž Support

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
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.4.0 44 3/29/2026