Skip to content

CSharpTeoMan911/QueryParser

Repository files navigation

QueryParser

QueryParser it is a .NET package that allows users to convert objects into HTTP query parameters to be used within an HTTP request. This package is designed to be used with ASP.Net controllers and enable C# classes to be sent to API controllers as query parameters. By passing objects using the Query section of an HTTP payload, the quantity of information to be sent using the other HTTP sections is minimised, thus allowing the app to transmit data with more flexibility. This package is using the Newtonsoft.json package.

// [FromQuery] => The controller extracts the required payload from the url query parameters
// [FromBody] => The controller extracts the required payload from the HTTP payload Body section
// [FromHeader] => The controller extracts the required payload from the HTTP payload Header section

public async Task<string?> Get([FromQuery] AuthenticationModel? value)
{
  // Controller content
}

Example usage

Client

Code snippet

Controller

GetAPI Example

Example usage result

Generated URL

QueryParser Result

Controller received payload

Controller Result

Usage

// string query_parameters = QueryParser.QueryParsing.QueryParser<TypeOfTheObjectToBeParsed>(object_to_be_parsed);

string query_parameters = QueryParser.QueryParsing.QueryParser<AuthenticationModel>(authentication);

Download

.NET CLI

dotnet add package QueryParser --version 1.0.4

Package Manager Console

NuGet\Install-Package QueryParser -Version 1.0.4

Links

NuGet: https://www.nuget.org/packages/QueryParser
GitHub: https://github.com/CSharpTeoMan911/QueryParser

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages