C# Class RusticiSoftware.TinCanAPILibrary.Helper.HttpMethods

Exibir arquivo Open project: RusticiSoftware/TinCanAPILibraryCSharp

Public Methods

Method Description
DeleteRequest ( NameValueCollection deleteData, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string

Sends a DELETE request

GetRequest ( NameValueCollection getData, string endpoint, IAuthenticationConfiguration authentification, WebHeaderCollection &whc, string x_experience_api_version ) : string

Sends a GET request

GetRequest ( NameValueCollection getData, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string

Sends a GET request

PostRequest ( string postData, string endpoint, IAuthenticationConfiguration authentification, TCAPI callback, string x_experience_api_version ) : string

Sends a POST request.

Providing null for the callback means this is intended to be synchronous. Any exceptions will be thrown and must be handled in the main thread.

PostRequest ( string postData, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string

Sends a POST request

PutRequest ( string putData, NameValueCollection queryParameters, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string

Sends a PUT request with the default content-type of "application/json"

PutRequest ( string putData, NameValueCollection queryParameters, string endpoint, IAuthenticationConfiguration authentification, string contentType, string x_experience_api_version ) : string

Sends a PUT request

PutRequest ( string putData, NameValueCollection queryParameters, string endpoint, IAuthenticationConfiguration authentification, string contentType, string eTag, string x_experience_api_version ) : string

Sends a PUT request

ThrowHttpException ( WebException e ) : void

Handles interpreting WebClient exceptions

Private Methods

Method Description
AddAuthHeader ( WebHeaderCollection nvc, IAuthenticationConfiguration auth ) : void
AddExperienceVersionHeader ( WebHeaderCollection whc, string x_experience_api_version ) : void
SendRequest ( WebRequest request ) : string
SendRequest ( WebRequest request, byte data ) : string
SendRequest ( WebRequest request, byte data, WebHeaderCollection &whc ) : string
ToQueryString ( NameValueCollection nvc ) : string

Method Details

DeleteRequest() public static method

Sends a DELETE request
public static DeleteRequest ( NameValueCollection deleteData, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string
deleteData System.Collections.Specialized.NameValueCollection A name-value pair collection of query parameters
endpoint string
authentification IAuthenticationConfiguration
x_experience_api_version string
return string

GetRequest() public static method

Sends a GET request
public static GetRequest ( NameValueCollection getData, string endpoint, IAuthenticationConfiguration authentification, WebHeaderCollection &whc, string x_experience_api_version ) : string
getData System.Collections.Specialized.NameValueCollection A name-value pair collection of query parameters
endpoint string
authentification IAuthenticationConfiguration
whc System.Net.WebHeaderCollection Allows for retrieval of the webheaders if they are needed.
x_experience_api_version string
return string

GetRequest() public static method

Sends a GET request
public static GetRequest ( NameValueCollection getData, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string
getData System.Collections.Specialized.NameValueCollection A name-value pair collection of query parameters
endpoint string
authentification IAuthenticationConfiguration
x_experience_api_version string
return string

PostRequest() public static method

Sends a POST request.
Providing null for the callback means this is intended to be synchronous. Any exceptions will be thrown and must be handled in the main thread.
public static PostRequest ( string postData, string endpoint, IAuthenticationConfiguration authentification, TCAPI callback, string x_experience_api_version ) : string
postData string A string of data to post
endpoint string The endpoint to send the statement to
authentification IAuthenticationConfiguration An IAuthentificationConfiguration. Only Basic is currently supported.
callback RusticiSoftware.TinCanAPILibrary.TCAPI The asynchronous callback
x_experience_api_version string
return string

PostRequest() public static method

Sends a POST request
public static PostRequest ( string postData, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string
postData string A string of data to post
endpoint string The endpoint to send the statement to
authentification IAuthenticationConfiguration An IAuthentificationConfiguration. Only Basic is currently supported.
x_experience_api_version string
return string

PutRequest() public static method

Sends a PUT request with the default content-type of "application/json"
public static PutRequest ( string putData, NameValueCollection queryParameters, string endpoint, IAuthenticationConfiguration authentification, string x_experience_api_version ) : string
putData string The data to PUT to the server
queryParameters System.Collections.Specialized.NameValueCollection A name-value pair collection of query parameters
endpoint string
authentification IAuthenticationConfiguration
x_experience_api_version string
return string

PutRequest() public static method

Sends a PUT request
public static PutRequest ( string putData, NameValueCollection queryParameters, string endpoint, IAuthenticationConfiguration authentification, string contentType, string x_experience_api_version ) : string
putData string The data to PUT to the server
queryParameters System.Collections.Specialized.NameValueCollection A name-value pair collection of query parameters
endpoint string
authentification IAuthenticationConfiguration
contentType string
x_experience_api_version string
return string

PutRequest() public static method

Sends a PUT request
public static PutRequest ( string putData, NameValueCollection queryParameters, string endpoint, IAuthenticationConfiguration authentification, string contentType, string eTag, string x_experience_api_version ) : string
putData string The data to PUT to the server
queryParameters System.Collections.Specialized.NameValueCollection A name-value pair collection of query parameters
endpoint string
authentification IAuthenticationConfiguration
contentType string
eTag string
x_experience_api_version string
return string

ThrowHttpException() public static method

Handles interpreting WebClient exceptions
public static ThrowHttpException ( WebException e ) : void
e System.Net.WebException The original exception thrown
return void