Install-Package PartialResponseRequest.Fields
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
}
Allows you to parse fields query for processing/interpreting and reacting based on it, like building a custom optimized SQL query
Install-Package PartialResponseRequest.Filters
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());
}
}
Allows you to parse filters query for processing/interpreting and reacing based on it, like building custom SQL query where clauses
Install-Package PartialResponseRequest.AspNetCore.ResponsePruner
public void ConfigureServices(IServiceCollection services)
{
services.AddHttpContextAccessor();
services.AddPartialResponse();
}
That will search for ?fields=... query string that would be used to prune the response for the client. Internally it uses the PartialResponseRequest.Fields to parse the query