C# Class ModernApp4Me.Core.WebService.M4MBaseWebServiceCaller

A basis class for making web service calls easier which uses RestSharp.Portable. When invoking an HTTP method, the caller goes through the following workflow: The M4MBaseWebServiceCaller.ExecuteHttpRequest methods is invoked : if the response HttpStatusCode is OK, the body is returned ad a string. if the HttpStatusCode is not OK, the private method M4MBaseWebServiceCaller.OnHttpStatusCodeNotOk is invoked.
Mostrar archivo Open project: smartnsoft/ModernApp4Me

Protected Properties

Property Type Description
client RestClient

Public Methods

Method Description
ExecuteHttpRequest ( RestSharp.Portable.RestRequest restRequest, int attempsCount ) : double>>.Task

Executes a call to a web method without any persistence.

Protected Methods

Method Description
Debug ( string message ) : void
Error ( string message ) : void
M4MBaseWebServiceCaller ( string baseUrl ) : System.Net

Basis constructor.

OnHttpStatusCodeNotOk ( string resource, HttpStatusCode statusCode ) : void

Method Details

Debug() protected abstract method

protected abstract Debug ( string message ) : void
message string
return void

Error() protected abstract method

protected abstract Error ( string message ) : void
message string
return void

ExecuteHttpRequest() public method

Executes a call to a web method without any persistence.
public ExecuteHttpRequest ( RestSharp.Portable.RestRequest restRequest, int attempsCount ) : double>>.Task
restRequest RestSharp.Portable.RestRequest the
attempsCount int the current attemp number
return double>>.Task

M4MBaseWebServiceCaller() protected method

Basis constructor.
protected M4MBaseWebServiceCaller ( string baseUrl ) : System.Net
baseUrl string The base URL of the web service API
return System.Net

OnHttpStatusCodeNotOk() protected abstract method

protected abstract OnHttpStatusCodeNotOk ( string resource, HttpStatusCode statusCode ) : void
resource string
statusCode HttpStatusCode
return void

Property Details

client protected_oe property

protected RestClient client
return RestClient