SimpleREST.NET 0.1
A simple and minimal api framework for .net base on Express.js
Loading...
Searching...
No Matches
SimpleRest.Api.SimpleRestRequest Class Reference

The main class for all incoming request data. This is a wrapper for the HttpListenerRequest class. Contains one static Factory function to create requests from httplistenercontexts. Cannot be instantiated More...

Inheritance diagram for SimpleRest.Api.SimpleRestRequest:
Collaboration diagram for SimpleRest.Api.SimpleRestRequest:

Static Public Member Functions

static SimpleRestRequest FromHttpListenerContext (HttpListenerContext listenerContext, JsonSerializerOptions jsonOptions, ISimpleRestEndpointFormatter? endpointFormatter=null)
 Factory function creating a Request object with all http request info stored on it.
 

Properties

string Endpoint = "" [get]
 
object?[] Path [get]
 
Dictionary< string, object?> Query = new Dictionary<string, object?>() [get]
 
Dictionary< string, object?> Params = new Dictionary<string, object?>() [get, set]
 
SimpleRestBody Body [get]
 
WebHeaderCollection Headers = new WebHeaderCollection() [get]
 
string? ContentType [get]
 
long ContentLength [get]
 
SimpleRestMethod Method [get]
 
string? UserAgent [get]
 
object? this[string key] [get]
 
Parameters
keyThe url parameter from the UriTemplate

 
- Properties inherited from SimpleRest.Api.ISimpleRestHttpObject

Detailed Description

The main class for all incoming request data. This is a wrapper for the HttpListenerRequest class. Contains one static Factory function to create requests from httplistenercontexts. Cannot be instantiated

Example: How the default SimpleRestApi creates the request
HttpListenerContext context = await listener.GetContextAsync();
The main class for all incoming request data. This is a wrapper for the HttpListenerRequest class....
static SimpleRestRequest FromHttpListenerContext(HttpListenerContext listenerContext, JsonSerializerOptions jsonOptions, ISimpleRestEndpointFormatter? endpointFormatter=null)
Factory function creating a Request object with all http request info stored on it.

Definition at line 25 of file SimpleRestRequest.cs.

Member Function Documentation

◆ FromHttpListenerContext()

static SimpleRestRequest SimpleRest.Api.SimpleRestRequest.FromHttpListenerContext ( HttpListenerContext listenerContext,
JsonSerializerOptions jsonOptions,
ISimpleRestEndpointFormatter? endpointFormatter = null )
static

Factory function creating a Request object with all http request info stored on it.

Parameters
listenerContextThe HttpListenerContext instance to generate the request from
endpointFormatterAn optional injectable Endpoint formatter class that can apply transformations to the url
Returns
The SimplerRestRequest generated from the listenerContext

Definition at line 55 of file SimpleRestRequest.cs.

Here is the caller graph for this function:

Property Documentation

◆ Body

SimpleRestBody SimpleRest.Api.SimpleRestRequest.Body
get

Implements SimpleRest.Api.ISimpleRestHttpObject.

Definition at line 32 of file SimpleRestRequest.cs.

◆ ContentLength

long SimpleRest.Api.SimpleRestRequest.ContentLength
get

Implements SimpleRest.Api.ISimpleRestHttpObject.

Definition at line 35 of file SimpleRestRequest.cs.

◆ ContentType

string? SimpleRest.Api.SimpleRestRequest.ContentType
get

Implements SimpleRest.Api.ISimpleRestHttpObject.

Definition at line 34 of file SimpleRestRequest.cs.

◆ Endpoint

string SimpleRest.Api.SimpleRestRequest.Endpoint = ""
get

Definition at line 27 of file SimpleRestRequest.cs.

◆ Headers

WebHeaderCollection SimpleRest.Api.SimpleRestRequest.Headers = new WebHeaderCollection()
get

Implements SimpleRest.Api.ISimpleRestHttpObject.

Definition at line 33 of file SimpleRestRequest.cs.

◆ Method

SimpleRestMethod SimpleRest.Api.SimpleRestRequest.Method
get

Definition at line 36 of file SimpleRestRequest.cs.

◆ Params

Dictionary<string, object?> SimpleRest.Api.SimpleRestRequest.Params = new Dictionary<string, object?>()
getset

Definition at line 30 of file SimpleRestRequest.cs.

◆ Path

object? [] SimpleRest.Api.SimpleRestRequest.Path
get

Definition at line 28 of file SimpleRestRequest.cs.

◆ Query

Dictionary<string, object?> SimpleRest.Api.SimpleRestRequest.Query = new Dictionary<string, object?>()
get

Definition at line 29 of file SimpleRestRequest.cs.

◆ this[string key]

object? SimpleRest.Api.SimpleRestRequest.this[string key]
get

Parameters
keyThe url parameter from the UriTemplate

Returns
The URI param from the request if it exists

Definition at line 44 of file SimpleRestRequest.cs.

◆ UserAgent

string? SimpleRest.Api.SimpleRestRequest.UserAgent
get

Implements SimpleRest.Api.ISimpleRestHttpObject.

Definition at line 37 of file SimpleRestRequest.cs.


The documentation for this class was generated from the following file: