MxIO.ApiClient.Abstractions
2.0.150.1
dotnet add package MxIO.ApiClient.Abstractions --version 2.0.150.1
NuGet\Install-Package MxIO.ApiClient.Abstractions -Version 2.0.150.1
<PackageReference Include="MxIO.ApiClient.Abstractions" Version="2.0.150.1" />
<PackageVersion Include="MxIO.ApiClient.Abstractions" Version="2.0.150.1" />
<PackageReference Include="MxIO.ApiClient.Abstractions" />
paket add MxIO.ApiClient.Abstractions --version 2.0.150.1
#r "nuget: MxIO.ApiClient.Abstractions, 2.0.150.1"
#:package MxIO.ApiClient.Abstractions@2.0.150.1
#addin nuget:?package=MxIO.ApiClient.Abstractions&version=2.0.150.1
#tool nuget:?package=MxIO.ApiClient.Abstractions&version=2.0.150.1
MxIO.ApiClient.Abstractions
This library provides common models and interfaces for standardized API response handling, including pagination, filtering, and error management.
Installation
dotnet add package MxIO.ApiClient.Abstractions
Features
- Standardized API response models
- Common collection models for result sets
- Consistent error model structure
- Pagination support with metadata
- OData-like filtering options
Core Models
ApiResponse<T>
The ApiResponse<T> class is a wrapper for API responses that includes:
public class ApiResponse<T>
{
public HttpStatusCode StatusCode { get; set; }
public T? Data { get; set; }
public ApiError[]? Errors { get; set; }
public ApiPagination? Pagination { get; set; }
public Dictionary<string, string>? Metadata { get; set; }
// Helper properties
public bool IsSuccess => (int)StatusCode >= 200 && (int)StatusCode < 300;
public bool IsNotFound => StatusCode == HttpStatusCode.NotFound;
public bool IsConflict => StatusCode == HttpStatusCode.Conflict;
public bool IsBadRequest => StatusCode == HttpStatusCode.BadRequest;
}
ApiError
The ApiError class provides a standardized format for API errors:
public class ApiError
{
public string Code { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public string? Target { get; set; }
public ApiError[]? Details { get; set; }
}
ApiPagination
The ApiPagination class provides standardized pagination information:
public class ApiPagination
{
public int TotalCount { get; set; }
public int FilteredCount { get; set; }
public int Skip { get; set; }
public int Top { get; set; }
public bool HasMore { get; set; }
}
CollectionModel<T>
The CollectionModel<T> class provides a standardized container for collections of resources:
public class CollectionModel<T>
{
public List<T> Items { get; set; } = new List<T>();
}
FilterOptions
The FilterOptions class provides standardized options for filtering API responses:
public class FilterOptions
{
public string? FilterExpression { get; set; }
public string[]? Select { get; set; }
public string[]? Expand { get; set; }
public string? OrderBy { get; set; }
public int Skip { get; set; }
public int Top { get; set; }
public bool Count { get; set; }
}
HttpResponseWrapper<T>
The HttpResponseWrapper<T> class wraps API responses with HTTP-specific information:
public class HttpResponseWrapper<T>
{
public ApiResponse<T>? Result { get; set; }
public HttpStatusCode StatusCode { get; set; }
public string? Content { get; set; }
// Helper properties
public bool IsSuccess { get; }
public bool IsNotFound { get; }
public bool IsConflict { get; }
public bool IsBadRequest { get; }
}
Usage Examples
Creating API Responses
// Success response with data
var successResponse = new ApiResponse<User>
{
StatusCode = HttpStatusCode.OK,
Data = user
};
// Error response
var errorResponse = new ApiResponse<User>
{
StatusCode = HttpStatusCode.BadRequest,
Errors = new[]
{
new ApiError
{
Code = "InvalidUsername",
Message = "Username is invalid",
Target = "username"
}
}
};
// Collection response with pagination
var collectionResponse = new ApiResponse<CollectionModel<User>>
{
StatusCode = HttpStatusCode.OK,
Data = new CollectionModel<User>
{
Items = users
},
Pagination = new ApiPagination
{
TotalCount = 100,
FilteredCount = 10,
Skip = 0,
Top = 10,
HasMore = true
}
};
Working with Filter Options
// Create filter options for an API request
var filter = new FilterOptions
{
FilterExpression = "username eq 'john' and active eq true",
OrderBy = "created desc",
Skip = 0,
Top = 20,
Select = new[] { "username", "email", "firstName", "lastName" },
Expand = new[] { "roles", "permissions" }
};
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on MxIO.ApiClient.Abstractions:
| Package | Downloads |
|---|---|
|
MX.GeoLocation.GeoLocationApi.Client
This package provides a web service client to query the geolocation service. |
|
|
XtremeIdiots.Portal.RepositoryApi.Abstractions
Abstractions for the XtremeIdiots Portal Repository API. |
|
|
XtremeIdiots.Portal.RepositoryApiClient
Client for the XtremeIdiots Portal Repository API. |
|
|
XtremeIdiots.Portal.ServersApi.Abstractions
Abstractions for the XtremeIdiots Portal Servers API. |
|
|
MxIO.ApiClient
An abstractions library containing common API client functionality for .NET 7. Contains common interfaces, extensions and models for API clients. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.150.1 | 835 | 6/30/2025 |
| 2.0.149.1 | 241 | 6/25/2025 |
| 1.1.147.1 | 3,836 | 6/23/2025 |
| 1.1.146.1 | 1,410 | 6/16/2025 |
| 1.1.145.1 | 428 | 6/9/2025 |
| 1.1.144.1 | 289 | 6/2/2025 |
| 1.1.143.1 | 225 | 5/26/2025 |
| 1.1.142.1 | 237 | 5/19/2025 |
| 1.1.141.1 | 307 | 5/12/2025 |
| 1.1.140.1 | 528 | 5/5/2025 |
| 1.1.139.1 | 883 | 4/28/2025 |
| 1.1.138.1 | 631 | 4/26/2025 |
| 1.1.137.1 | 256 | 4/25/2025 |
| 1.1.136.1 | 996 | 4/23/2025 |
| 1.1.135.1 | 402 | 4/21/2025 |
| 1.1.134.1 | 246 | 4/19/2025 |
| 1.1.133.1 | 160 | 4/19/2025 |
| 1.1.132.1 | 156 | 4/19/2025 |
| 1.1.131.1 | 185 | 4/19/2025 |
| 1.1.130.1 | 558 | 4/14/2025 |
| 1.1.129.1 | 739 | 4/7/2025 |
| 1.1.128.1 | 1,148 | 3/31/2025 |
| 1.1.127.1 | 1,682 | 3/24/2025 |
| 1.1.126.1 | 1,074 | 3/17/2025 |
| 1.1.125.1 | 1,244 | 3/16/2025 |
| 1.1.124.1 | 642 | 3/10/2025 |
| 1.1.123.1 | 780 | 3/3/2025 |
| 1.1.122.1 | 1,235 | 2/24/2025 |
| 1.1.115.1 | 2,740 | 1/6/2025 |
| 1.1.114.1 | 882 | 12/31/2024 |
| 1.1.113.1 | 973 | 12/30/2024 |
| 1.1.112.1 | 1,015 | 12/23/2024 |
| 1.1.111.1 | 1,019 | 12/16/2024 |
| 1.1.110.1 | 587 | 12/9/2024 |
| 1.1.109.1 | 465 | 12/2/2024 |
| 1.1.108.1 | 787 | 11/25/2024 |
| 1.1.107.1 | 1,075 | 11/18/2024 |
| 1.1.106.1 | 932 | 11/15/2024 |
| 1.1.105.1 | 1,191 | 11/11/2024 |
| 1.1.104.1 | 1,068 | 11/4/2024 |
| 1.1.103.1 | 987 | 10/28/2024 |
| 1.1.102.1 | 486 | 10/21/2024 |
| 1.1.101.1 | 1,344 | 10/14/2024 |
| 1.1.100.1 | 1,618 | 10/7/2024 |
| 1.1.99.1 | 1,292 | 9/30/2024 |
| 1.1.98.1 | 1,008 | 9/23/2024 |
| 1.1.97.1 | 1,379 | 9/17/2024 |
| 1.1.92.1 | 1,375 | 8/19/2024 |
| 1.1.91.1 | 1,139 | 8/12/2024 |
| 1.1.90.1 | 1,011 | 8/5/2024 |
| 1.1.89.1 | 847 | 7/29/2024 |
| 1.1.88.1 | 779 | 7/23/2024 |
| 1.1.87.1 | 947 | 7/22/2024 |
| 1.1.86.1 | 595 | 7/15/2024 |
| 1.1.85.1 | 993 | 7/8/2024 |
| 1.1.84.1 | 1,417 | 7/1/2024 |
| 1.1.83.1 | 2,451 | 6/24/2024 |
| 1.1.82.1 | 950 | 6/17/2024 |
| 1.1.81.1 | 1,723 | 6/10/2024 |
| 1.1.80.1 | 1,253 | 6/3/2024 |
| 1.1.79.1 | 1,187 | 5/27/2024 |
| 1.1.78.1 | 1,133 | 5/20/2024 |
| 1.1.77.1 | 1,093 | 5/13/2024 |
| 1.1.76.1 | 1,253 | 5/6/2024 |
| 1.1.75.1 | 2,315 | 4/29/2024 |
| 1.1.74.1 | 371 | 4/22/2024 |
| 1.1.73.1 | 395 | 4/15/2024 |
| 1.1.72.1 | 1,033 | 4/8/2024 |
| 1.1.71.1 | 458 | 4/1/2024 |
| 1.1.70.1 | 1,428 | 3/25/2024 |
| 1.1.69.1 | 314 | 3/18/2024 |
| 1.1.68.1 | 300 | 3/11/2024 |
| 1.1.67.1 | 999 | 3/4/2024 |
| 1.1.66.1 | 326 | 2/26/2024 |
| 1.1.65.1 | 344 | 2/19/2024 |
| 1.1.64.1 | 399 | 2/12/2024 |
| 1.1.63.1 | 396 | 2/7/2024 |
| 1.1.62.1 | 1,377 | 2/7/2024 |
| 1.1.61.1 | 1,132 | 2/6/2024 |
| 1.1.60.1 | 352 | 2/6/2024 |
| 1.1.59.1 | 537 | 2/5/2024 |
| 1.1.58.1 | 457 | 1/29/2024 |
| 1.1.57.1 | 471 | 1/22/2024 |
| 1.1.56.1 | 448 | 1/15/2024 |
| 1.1.55.1 | 514 | 1/8/2024 |
| 1.1.54.1 | 2,377 | 1/1/2024 |
| 1.1.53.1 | 754 | 12/25/2023 |
| 1.1.52.1 | 1,550 | 12/18/2023 |
| 1.1.51.1 | 537 | 12/11/2023 |
| 1.1.50.1 | 3,636 | 12/4/2023 |
| 1.1.49.1 | 2,394 | 11/27/2023 |
| 1.1.48.1 | 969 | 11/20/2023 |
| 1.1.47.1 | 2,909 | 11/13/2023 |
| 1.1.46.1 | 620 | 11/11/2023 |
| 1.1.45.1 | 1,303 | 11/11/2023 |
| 1.1.44.1 | 461 | 11/11/2023 |
| 1.1.43.1 | 409 | 11/11/2023 |
| 1.1.42.1 | 442 | 11/11/2023 |
| 1.1.41.1 | 437 | 11/11/2023 |
| 1.1.40.1 | 445 | 11/11/2023 |
| 1.1.39.1 | 1,095 | 11/9/2023 |
| 1.1.38.1 | 453 | 11/9/2023 |
| 1.1.37.1 | 457 | 11/9/2023 |
| 1.1.36.1 | 463 | 11/9/2023 |
| 1.1.35.1 | 1,486 | 11/6/2023 |
| 1.1.34.1 | 1,999 | 10/30/2023 |
| 1.1.33.1 | 921 | 10/27/2023 |
| 1.1.32.1 | 1,410 | 10/23/2023 |
| 1.1.31.1 | 1,334 | 10/21/2023 |
| 1.1.30.1 | 579 | 10/21/2023 |
| 1.1.29.1 | 445 | 10/21/2023 |
| 1.1.28.1 | 483 | 10/21/2023 |
| 1.1.27.1 | 485 | 10/20/2023 |
| 1.1.26.1 | 516 | 10/20/2023 |
| 1.1.25.1 | 554 | 10/20/2023 |
| 1.1.24.1 | 486 | 10/20/2023 |
| 1.0.23.1 | 487 | 10/20/2023 |