C# 클래스 PortableRest.RestRequest

Specifies the parameters for the HTTP request that will be executed against a given resource.
파일 보기 프로젝트 열기: advancedrei/PortableRest 1 사용 예제들

Private Properties

프로퍼티 타입 설명
CombineUriParts string
GetContentType string
GetRequestBody string
Transform void

공개 메소드들

메소드 설명
AddFileParameter ( string key, System.Stream fileStream, string filename ) : void

AddHeader ( string key, object value ) : void

Adds an Header to only this specific request.

Use this if you have an authentication token that times out on a regular basis.

AddParameter ( object value ) : void

Adds an unnamed parameter to the body of the request.

Use this method if you're not using UrlFormEncoded requests.

AddParameter ( string key, object value, ParameterEncoding encoding = ParameterEncoding.UriEncoded ) : void

Adds a parameter to the body of the request, to be encoded with the specified format.

Note: If the ContentType is anything other than UrlFormEncoded, only the first Parameter will be serialzed to the request body.

AddQueryString ( string key, object value ) : void

Appends a key/value pair to the end of the existing QueryString in a URI.

AddQueryString ( string key, string value ) : void

Appends a key/value pair to the end of the existing QueryString in a URI.

AddUrlSegment ( string key, string value ) : void

Replaces tokenized segments of the URL with a desired value.

GetResourceUri ( string baseUrl ) : Uri

RestRequest ( ) : System

Creates a new RestRequest instance, assuming the request will be an HTTP GET.

RestRequest ( string resource ) : System

Creates a new RestRequest instance for a given Resource.

RestRequest ( string resource, ContentTypes contentType ) : System

Creates a new RestRequest instance for a given Resource and Method, specifying whether or not to ignore the root object in the response.

RestRequest ( string resource, HttpMethod method ) : System

Creates a new RestRequest instance for a given Resource and Method.

RestRequest ( string resource, HttpMethod method, ContentTypes contentType ) : System

Creates a new RestRequest instance for a given Resource and Method, specifying whether or not to ignore the root object in the response.

RestRequest ( string resource, HttpMethod method, bool ignoreRoot ) : System

Creates a new RestRequest instance for a given Resource and Method, specifying whether or not to ignore the root object in the response.

비공개 메소드들

메소드 설명
CombineUriParts ( ) : string

Combines URI parts, taking care of trailing and starting slashes. See http://stackoverflow.com/a/6704287

GetContentType ( ) : string

GetRequestBody ( ) : string

Transform ( XNode node, Type type ) : void

Technique from http://blogs.msdn.com/b/ericwhite/archive/2009/07/20/a-tutorial-in-the-recursive-approach-to-pure-functional-transformations-of-xml.aspx

메소드 상세

AddFileParameter() 공개 메소드

public AddFileParameter ( string key, System.Stream fileStream, string filename ) : void
key string
fileStream System.Stream
filename string
리턴 void

AddHeader() 공개 메소드

Adds an Header to only this specific request.
Use this if you have an authentication token that times out on a regular basis.
public AddHeader ( string key, object value ) : void
key string
value object
리턴 void

AddParameter() 공개 메소드

Adds an unnamed parameter to the body of the request.
Use this method if you're not using UrlFormEncoded requests.
public AddParameter ( object value ) : void
value object
리턴 void

AddParameter() 공개 메소드

Adds a parameter to the body of the request, to be encoded with the specified format.
Note: If the ContentType is anything other than UrlFormEncoded, only the first Parameter will be serialzed to the request body.
public AddParameter ( string key, object value, ParameterEncoding encoding = ParameterEncoding.UriEncoded ) : void
key string
value object /// For ByteArrays or Base64, this needs to be a Stream, or an exception will be thrown when the request is executed. ///
encoding ParameterEncoding
리턴 void

AddQueryString() 공개 메소드

Appends a key/value pair to the end of the existing QueryString in a URI.
public AddQueryString ( string key, object value ) : void
key string The string key to append to the QueryString.
value object The value to append to the QueryString (we will call .ToString() for you).
리턴 void

AddQueryString() 공개 메소드

Appends a key/value pair to the end of the existing QueryString in a URI.
public AddQueryString ( string key, string value ) : void
key string The string key to append to the QueryString.
value string The string value to append to the QueryString.
리턴 void

AddUrlSegment() 공개 메소드

Replaces tokenized segments of the URL with a desired value.
public AddUrlSegment ( string key, string value ) : void
key string
value string
리턴 void

GetResourceUri() 공개 메소드

public GetResourceUri ( string baseUrl ) : Uri
baseUrl string
리턴 System.Uri

RestRequest() 공개 메소드

Creates a new RestRequest instance, assuming the request will be an HTTP GET.
public RestRequest ( ) : System
리턴 System

RestRequest() 공개 메소드

Creates a new RestRequest instance for a given Resource.
public RestRequest ( string resource ) : System
resource string The specific resource to access.
리턴 System

RestRequest() 공개 메소드

Creates a new RestRequest instance for a given Resource and Method, specifying whether or not to ignore the root object in the response.
public RestRequest ( string resource, ContentTypes contentType ) : System
resource string The URL format string of the resource to request.
contentType ContentTypes The Content Type for the request.
리턴 System

RestRequest() 공개 메소드

Creates a new RestRequest instance for a given Resource and Method.
public RestRequest ( string resource, HttpMethod method ) : System
resource string The specific resource to access.
method HttpMethod The HTTP method to use for the request.
리턴 System

RestRequest() 공개 메소드

Creates a new RestRequest instance for a given Resource and Method, specifying whether or not to ignore the root object in the response.
public RestRequest ( string resource, HttpMethod method, ContentTypes contentType ) : System
resource string The URL format string of the resource to request.
method HttpMethod The for the request.
contentType ContentTypes The Content Type for the request.
리턴 System

RestRequest() 공개 메소드

Creates a new RestRequest instance for a given Resource and Method, specifying whether or not to ignore the root object in the response.
public RestRequest ( string resource, HttpMethod method, bool ignoreRoot ) : System
resource string The URL format string of the resource to request.
method HttpMethod The for the request.
ignoreRoot bool Whether or not the root object from the response should be ignored.
리턴 System