PartialResponseRequest.Fields 1.1.0-beta

.NET Standard 2.0
This is a prerelease version of PartialResponseRequest.Fields.
There is a newer prerelease version of this package available.
See the version list below for details.
NuGet\Install-Package PartialResponseRequest.Fields -Version 1.1.0-beta
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.
dotnet add package PartialResponseRequest.Fields --version 1.1.0-beta
<PackageReference Include="PartialResponseRequest.Fields" Version="1.1.0-beta" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PartialResponseRequest.Fields --version 1.1.0-beta
#r "nuget: PartialResponseRequest.Fields, 1.1.0-beta"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install PartialResponseRequest.Fields as a Cake Addin
#addin nuget:?package=PartialResponseRequest.Fields&version=1.1.0-beta&prerelease

// Install PartialResponseRequest.Fields as a Cake Tool
#tool nuget:?package=PartialResponseRequest.Fields&version=1.1.0-beta&prerelease

Build Status Azure DevOps tests with custom labels Coverage Nuget Nuget Nuget

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

Nuget

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();
}

Read more

Fields Queries

Nuget

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
}

Read more

Filters Queries

Nuget

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());
    }
}

Read more

Documentation

View the documentation here

Cake build tasks

https://cakebuild.net/

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
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on PartialResponseRequest.Fields:

Package Downloads
PartialResponseRequest.AspNetCore.ResponsePruner

ASP.NET Web API JSON output formatter for partial response

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.2-beta 2,495 2/28/2021
1.1.0-beta 290 6/13/2020
1.0.0-rc2 251 3/8/2020
1.0.0-rc 424 3/7/2020