ATK.Command.Communication.Models
0.0.3
dotnet add package ATK.Command.Communication.Models --version 0.0.3
NuGet\Install-Package ATK.Command.Communication.Models -Version 0.0.3
<PackageReference Include="ATK.Command.Communication.Models" Version="0.0.3" />
<PackageVersion Include="ATK.Command.Communication.Models" Version="0.0.3" />
<PackageReference Include="ATK.Command.Communication.Models" />
paket add ATK.Command.Communication.Models --version 0.0.3
#r "nuget: ATK.Command.Communication.Models, 0.0.3"
#:package ATK.Command.Communication.Models@0.0.3
#addin nuget:?package=ATK.Command.Communication.Models&version=0.0.3
#tool nuget:?package=ATK.Command.Communication.Models&version=0.0.3
ATK.Command.Communication.Models
A lightweight .NET Standard 2.1 class library providing reusable data models for web API communication. This library offers essential models for building standardized API responses, handling pagination, managing notifications, and transferring file data.
Features
- ApiResponse<T> - Generic API response wrapper with status, data, message, and notifications support
- Paging - Configurable pagination request model with filter, skip, and take parameters
- PaginationResponse<T> - Generic pagination response model for paginated data
- Notification - Notification model with severity levels and factory methods (Success, Info, Warning, Error)
- FileModel - File transfer model with support for both binary and Base64-encoded content
Installation
Install the NuGet package:
dotnet add package ATK.Command.Communication.Models
Or using the NuGet Package Manager:
Install-Package ATK.Command.Communication.Models
Quick Start
ApiResponse
The ApiResponse<T> class provides a standardized API response format with status tracking and notification support:
using ATK.Command.Communication.Models;
// Create a successful response
var response = new ApiResponse<User>
{
Status = "success",
Data = user,
Message = "User retrieved successfully"
};
// Check response status
if (response.IsSuccess)
{
// Handle success
}
// Add notifications
response.Notifications.Add(Notification.Info("Data loaded from cache"));
Pagination
Use the Paging model for pagination requests and PaginationResponse<T> for responses:
// Create a paging request
var paging = new Paging
{
Filter = "active",
Skip = 0,
Take = 20
};
// Create a paginated response
var response = new PaginationResponse<User>
{
Total = 150,
Items = users
};
Notifications
The Notification class provides factory methods for creating different severity levels:
// Create notifications using factory methods
var success = Notification.Success("Operation completed", "Success", new { userId = 123 });
var info = Notification.Info("This is informational", "Info");
var warning = Notification.Warning("Please review this", "Warning");
var error = Notification.Error("An error occurred", "Error");
// Add to response
response.Notifications.AddRange(new[] { success, info });
File Transfer
The FileModel class supports both binary and Base64-encoded file content:
var fileModel = new FileModel
{
Name = "document.pdf",
ContentType = "application/pdf",
Content = fileBytes
};
// Convert to Base64 for transmission
fileModel.ToBase64();
// Convert back from Base64
fileModel.FromBase64();
Models Overview
ApiResponse<T>
Generic API response wrapper for standardized communication.
Properties:
Status- Response status (success, fail, error, forbidden)Data- The response payload of type TMessage- Additional response messageNotifications- List of notification objects
Methods:
IsSuccess- Check if status is "success"IsFail- Check if status is "fail"IsForbidden- Check if status is "forbidden"
Paging
Request model for paginating data retrieval.
Properties:
Filter- Search/filter term (default: empty string)Skip- Number of records to skip (default: 0)Take- Number of records to retrieve (default: 10)
PaginationResponse<T>
Generic response model for paginated data.
Properties:
Total- Total number of items availableItems- Collection of paginated items
Notification
Notification object with severity levels.
Properties:
Severity- Severity level (success, info, warning, error)Message- Notification messageTitle- Notification titleVariables- Additional data/context
Factory Methods:
Success(message, title, variables)Info(message, title, variables)Warning(message, title, variables)Error(message, title, variables)
FileModel
File transfer model supporting binary and Base64 encoding.
Properties:
Content- Binary file content (byte array)Base64EncodedContent- Base64-encoded file contentName- File nameContentType- MIME type
Methods:
ToBase64()- Convert binary content to Base64FromBase64()- Convert Base64 content to binary
Requirements
- .NET Standard 2.1 or higher
- .NET Framework 4.7.2+
- .NET Core 3.0+
- .NET 5.0+
License
This project is licensed under the MIT License - see the LICENSE file for details.
Repository
GitHub: a-t-k/WebCommunicationModels
Version History
0.0.3 - Current stable release
| Product | Versions 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 | 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. |
-
.NETStandard 2.1
- No dependencies.
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.0.3 | 148 | 4/20/2026 |