GTM.Common
0.0.3
dotnet add package GTM.Common --version 0.0.3
NuGet\Install-Package GTM.Common -Version 0.0.3
<PackageReference Include="GTM.Common" Version="0.0.3" />
<PackageVersion Include="GTM.Common" Version="0.0.3" />
<PackageReference Include="GTM.Common" />
paket add GTM.Common --version 0.0.3
#r "nuget: GTM.Common, 0.0.3"
#:package GTM.Common@0.0.3
#addin nuget:?package=GTM.Common&version=0.0.3
#tool nuget:?package=GTM.Common&version=0.0.3
Common Library
Reusable library for building clean, decoupled, and resilient APIs.
This package provides components to facilitate the development of modern APIs and microservices, including:
Result modeling (
Result,SuccessResult,FailureResult)Error wrappers (
BusinessRuleException,ErrorList)Interfaces for clean architecture (
IInteractor,IPresenter,IResponse, etc.)Centralized HTTP API client (
HttpApiClient)Logging extensions for Serilog + Seq
📦 Installation
Install the package from nuget.org:
dotnet add package Common
Or add it to your .csproj:
<PackageReference Include="Common" Version="x.y.z" />
Replace x.y.z with the latest available version.
⚙️ Requirements
Compatible with ASP.NET Core, domain libraries, and microservices.
🚀 Basic Usage
Standard responses with Result:
using Common;
Result<string> result = Result.OK("All good");
// For errors
Result<string> error = Result.Fail<string>("Something went wrong");
Clean Architecture example:
public class GetUserInteractor : IResultInteractor<GetUserRequest, UserDto>
{
public Task<Result<UserDto>> Handle(GetUserRequest request, CancellationToken cancellationToken)
{
if (request.Id <= 0)
return Task.FromResult(Result.Fail<UserDto>("Invalid ID"));
var user = new UserDto { Id = request.Id, Name = "Example" };
return Task.FromResult(Result.OK(user));
}
}
Centralized HTTP Client (HttpApiClient):
var client = new HttpApiClient("https://api.example.com/");
var response = await client.GetAsync<MyResponse>("endpoint");
🧩 Logging with Serilog + Seq
Add the following to your appsettings.json:
"CustomLogging": {
"Project": "MyApiProject",
"SeqUri": "http://localhost:5341",
"LogEventLevel": "Information"
}
Then register the services:
builder.Services.AddLoggingServices(configuration);
🤝 Contributions
This package is designed for internal use, but feel free to open issues or pull requests for improvements or suggestions.
📝 License
Distributed under the MIT License. See the LICENSE file for more details.
Built with ❤️ by the development team.
¿Quieres que lo suba a un README.md limpio o lo formateamos de alguna forma especial para NuGet?
| Product | Versions 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. |
-
net8.0
- MediatR (>= 12.5.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.4)
- Microsoft.Extensions.Logging (>= 9.0.4)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.4)
- Newtonsoft.Json (>= 13.0.3)
- Serilog (>= 4.2.0)
- Serilog.Extensions.Logging (>= 9.0.1)
- Serilog.Sinks.Seq (>= 9.0.0)
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 |
|---|