PartialResponseRequest.Core
1.1.0-beta
See the version list below for details.
dotnet add package PartialResponseRequest.Core --version 1.1.0-beta
NuGet\Install-Package PartialResponseRequest.Core -Version 1.1.0-beta
<PackageReference Include="PartialResponseRequest.Core" Version="1.1.0-beta" />
paket add PartialResponseRequest.Core --version 1.1.0-beta
#r "nuget: PartialResponseRequest.Core, 1.1.0-beta"
// Install PartialResponseRequest.Core as a Cake Addin #addin nuget:?package=PartialResponseRequest.Core&version=1.1.0-beta&prerelease // Install PartialResponseRequest.Core as a Cake Tool #tool nuget:?package=PartialResponseRequest.Core&version=1.1.0-beta&prerelease
Partial response
A simple set of libraries that enables you to parse, interpret, serialize and build simple queries for fields and filters that could be used in building flexible REST endpoints (but not limited to API):
https://my-app.com/animals?fields=id,photoUrl,guardian{name}&filters=id(gt:5)
Quick start
Response pruner
Add a dependency using the NuGet package manager (console):
Install-Package PartialResponseRequest.AspNetCore.ResponsePruner
Use services.AddPartialResponse()
to add a custom json output formatter, that will search for ?fields=...
query string that would be used to prune the response for the client.
public void ConfigureServices(IServiceCollection services)
{
services.AddHttpContextAccessor();
services.AddPartialResponse();
}
Fields Queries
Add a dependency using the NuGet package manager (console):
Install-Package PartialResponseRequest.Fields
Allows you to parse fields query for processing/interpreting and reacting based on it, like building a custom optimized SQL query:
var parser = new FieldsQueryParser();
IEnumerable<FieldToken> fields = parser.Parse("id,name,photoUrl");
var interpreter = new FieldsQueryInterpreter(fields);
// Use the interpreter to build queries
if (interpreter.Includes("id"))
{
// include id field
}
Filters Queries
Add a dependency using the NuGet package manager (console):
Install-Package PartialResponseRequest.Filters
Allows you to parse filters query for processing/interpreting and reacing based on it, like building custom SQL query where clauses:
var parser = new FilterQueryParser();
IEnumerable<FilterToken> filters = parser.Parse("created(gt:2020-01-01)");
var interpreter = new FiltersQueriesInterpreter<MyFilters>(filters.ToList());
if (interpreter.FiltersBy(x => x.Created, out IOperatorsInterpreter<CreatedFilters> createdFilter))
{
if (createdFilter.HasOperator(x => x.Gt, out OperatorValue value))
{
var parsedValue = DateTime.Parse(value.Value);
Console.WriteLine(parsedValue.ToString());
}
}
Documentation
View the documentation here
Cake build tasks
Build the project
build.ps1 --target=Build [--configuration=Release]
Run tests
build.ps1 --target=Test [--outputDirectory=./output]
Run a test coverage report
build.ps1 --target=Report [--testResultsDirectory=./test-results/]
Create nuget packages
build.ps1 --target=Pack [--outputDirectory=./output] [--configuration=Release] [--package-version=1.0.0.0]
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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. 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.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on PartialResponseRequest.Core:
Package | Downloads |
---|---|
PartialResponseRequest.Fields
Library for parsing and managing fields queries |
|
PartialResponseRequest.Filters
Library for parsing and managing filter queries |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.2-beta | 7,486 | 2/28/2021 |
1.1.0-beta | 382 | 6/13/2020 |
1.0.0-rc2 | 360 | 3/8/2020 |
1.0.0-rc | 525 | 3/7/2020 |