zTools 0.3.8

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

zTools

NuGet License: MIT

Overview

zTools is a unified library that combines the Anti-Corruption Layer (ACL) clients and Data Transfer Objects (DTOs) for zTools API services. It provides strongly-typed HTTP clients for consuming zTools API endpoints, along with all required models, settings, and request/response objects.

This package was previously distributed as two separate packages (zTools.ACL and zTools.DTO), now unified into a single package for simpler dependency management.

zTools Ecosystem

Project Type Description Links
zTools.API REST API Main API with controllers, business logic, and services GitHub
zTools (this) NuGet Package ACL clients + DTOs for consuming the API NuGet

Features

Anti-Corruption Layer (ACL) Clients

Strongly-typed HTTP clients for consuming zTools API endpoints:

  • ChatGPTClient - ChatGPT/OpenAI integration (messages, conversations, custom requests, DALL-E)
  • MailClient - Email validation and sending (MailerSend)
  • FileClient - File upload and URL retrieval (S3-compatible storage)
  • DocumentClient - CPF/CNPJ validation
  • StringClient - String manipulation utilities (slug, unique IDs, number extraction)

Data Transfer Objects (DTOs)

ChatGPT Integration
  • ChatGPTRequest / ChatGPTResponse - Request/response models for ChatGPT API
  • ChatGPTMessageRequest - Simple message request wrapper
  • ChatGPTErrorResponse / ChatGPTError - Error handling models
  • ChatMessage / Choice / Usage - Conversation and usage models
  • DallERequest / DallEResponse / DallEImageData - DALL-E image generation models
Email Service (MailerSend)
  • MailerInfo - Email composition and sending
  • MailerRecipientInfo - Recipient information
  • MailerErrorInfo - Email service error handling
Configuration Settings
  • ChatGPTSetting - OpenAI API configuration (ApiUrl, ApiKey, Model)
  • MailerSendSetting - Email service configuration
  • S3Setting - S3-compatible storage configuration
  • zToolsetting - General API settings

Installation

dotnet add package zTools

Configuration

appsettings.json

{
  "NTool": {
    "ApiUrl": "https://your-zTools-api.com"
  }
}

Startup.cs / Program.cs

services.Configure<zToolsetting>(Configuration.GetSection("NTool"));
services.AddHttpClient<IChatGPTClient, ChatGPTClient>();
services.AddHttpClient<IMailClient, MailClient>();
services.AddHttpClient<IFileClient, FileClient>();
services.AddHttpClient<IDocumentClient, DocumentClient>();
services.AddHttpClient<IStringClient, StringClient>();

Usage Examples

ChatGPT Client

using zTools.ACL;
using zTools.ACL.Interfaces;

public class MyService
{
    private readonly IChatGPTClient _chatGPTClient;

    public MyService(IChatGPTClient chatGPTClient)
    {
        _chatGPTClient = chatGPTClient;
    }

    public async Task<string> AskQuestion(string question)
    {
        return await _chatGPTClient.SendMessageAsync(question);
    }
}

ChatGPT DTOs

using zTools.DTO.ChatGPT;

var request = new ChatGPTRequest
{
    Model = "gpt-4o",
    Messages = new List<ChatMessage>
    {
        new ChatMessage { Role = "user", Content = "Hello" },
        new ChatMessage { Role = "assistant", Content = "Hi!" }
    },
    Temperature = 0.7,
    MaxCompletionTokens = 1000
};

Configuration Models

using zTools.DTO.Settings;

var chatGPTSettings = new ChatGPTSetting
{
    ApiUrl = "https://api.openai.com/v1/chat/completions",
    ApiKey = "your-api-key",
    Model = "gpt-4o"
};

var s3Settings = new S3Setting
{
    AccessKey = "your-access-key",
    SecretKey = "your-secret-key",
    Endpoint = "https://your-bucket.s3.amazonaws.com"
};

Email Models

using zTools.DTO.MailerSend;

var email = new MailerInfo
{
    From = new MailerRecipientInfo
    {
        Email = "sender@example.com",
        Name = "Sender Name"
    },
    To = new List<MailerRecipientInfo>
    {
        new MailerRecipientInfo
        {
            Email = "recipient@example.com",
            Name = "Recipient Name"
        }
    },
    Subject = "Test Email",
    Html = "<h1>Hello World</h1>",
    Text = "Hello World"
};

Key Benefits

  • Strongly Typed - Type-safe API calls with IntelliSense support
  • Dependency Injection - Full DI support with IHttpClientFactory
  • Logging - Integrated logging with ILogger
  • Configuration - Uses IOptions pattern for settings
  • Error Handling - Automatic HTTP error handling and dedicated error models
  • JSON Serialization - Built-in JSON handling with Newtonsoft.Json
  • OpenAI Compatible - ChatGPT DTOs match OpenAI API specifications

Dependencies

  • Newtonsoft.Json (13.0.3) - JSON serialization/deserialization
  • Microsoft.AspNetCore.Authentication (2.3.0) - Authentication support

Compatible With

  • .NET 8.0
  • ASP.NET Core
  • OpenAI API
  • MailerSend API
  • AWS S3 / DigitalOcean Spaces

Repository

License

MIT License - Copyright (c) Rodrigo Landim / Emagine

Author

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on zTools:

Package Downloads
NAuth

Unified NAuth library containing DTOs, ACL clients, authentication handlers, and HTTP client implementations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.8 120 3/18/2026
0.3.7 155 3/11/2026
0.3.6 605 3/10/2026
0.3.5 91 3/10/2026
0.3.4 89 3/10/2026
0.3.3 85 3/10/2026
0.3.2 107 3/9/2026
0.3.1 157 2/19/2026
0.3.0 87 2/19/2026
0.2.11 91 2/19/2026
0.2.10 87 2/19/2026
0.2.9 91 2/19/2026