Skip to main content

ServiceClientBase

Assembly: ServiceStack.Client.dll
View Source
Declaration
public abstract class ServiceClientBase : IServiceClient, IRestServiceClient, IServiceClientAsync, IServiceGatewayAsync, IServiceClientSync, IHasSessionId, IHasBearerToken, IHasVersion, IHttpRestClientAsync, IRestClientAsync, IReplyClient, IServiceGateway, IOneWayClient, IRestClient, IRestClientSync, IServiceClientCommon, IMessageProducer, IDisposable, IHasCookieContainer, IServiceClientMeta

Properties

GlobalRequestFilter

The request filter is called before any request. This request filter is executed globally.

View Source
Declaration
public static Action<HttpWebRequest> GlobalRequestFilter { get; set; }

GlobalResponseFilter

The response action is called once the server response is available. It will allow you to access raw response information. This response action is executed globally. Note that you should NOT consume the response stream as this is handled by ServiceStack

View Source
Declaration
public static Action<HttpWebResponse> GlobalResponseFilter { get; set; }

Headers

Gets the collection of headers to be added to outgoing requests.

View Source
Declaration
public NameValueCollection Headers { get; }

BasePath

Relative BasePath to use for predefined routes. Set with UseBasePath or WithBasePath() Always contains '/' prefix + '/' suffix, e.g. /api/

View Source
Declaration
public string BasePath { get; protected set; }

UseBasePath

Replace the Base reply/oneway paths to use a different prefix

View Source
Declaration
public string UseBasePath { set; }

DisableAutoCompression

Whether to Accept Gzip,Deflate Content-Encoding and to auto decompress responses

View Source
Declaration
public bool DisableAutoCompression { get; set; }

RequestCompressionType

View Source
Declaration
public string RequestCompressionType { get; set; }

UserName

The user name for basic authentication

View Source
Declaration
public string UserName { get; set; }

Password

The password for basic authentication

View Source
Declaration
public string Password { get; set; }

BearerToken

The Authorization Bearer Token to send with this request

View Source
Declaration
public string BearerToken { get; set; }

BaseUri

View Source
Declaration
public string BaseUri { get; set; }

Format

View Source
Declaration
public abstract string Format { get; }

SyncReplyBaseUri

View Source
Declaration
public string SyncReplyBaseUri { get; set; }

AsyncOneWayBaseUri

View Source
Declaration
public string AsyncOneWayBaseUri { get; set; }

Version

View Source
Declaration
public int Version { get; set; }

SessionId

View Source
Declaration
public string SessionId { get; set; }

UserAgent

View Source
Declaration
public string UserAgent { get; set; }

Timeout

View Source
Declaration
public TimeSpan? Timeout { get; set; }

ReadWriteTimeout

View Source
Declaration
public TimeSpan? ReadWriteTimeout { get; set; }

Accept

View Source
Declaration
public virtual string Accept { get; }

ContentType

View Source
Declaration
public abstract string ContentType { get; }

HttpMethod

View Source
Declaration
public string HttpMethod { get; set; }

EmulateHttpViaPost

View Source
Declaration
public bool EmulateHttpViaPost { get; set; }

OnDownloadProgress

View Source
Declaration
public ProgressDelegate OnDownloadProgress { get; set; }

OnUploadProgress

View Source
Declaration
public ProgressDelegate OnUploadProgress { get; set; }

ShareCookiesWithBrowser

View Source
Declaration
public bool ShareCookiesWithBrowser { get; set; }

Proxy

View Source
Declaration
public IWebProxy Proxy { get; set; }

Credentials

Gets or sets authentication information for the request. Warning: It's recommend to use ServiceStack.ServiceClientBase.UserName and ServiceStack.ServiceClientBase.Password for basic auth. This property is only used for IIS level authentication.

View Source
Declaration
public ICredentials Credentials { get; set; }

AlwaysSendBasicAuthHeader

Determines if the basic auth header should be sent with every request. By default, the basic auth header is only sent when "401 Unauthorized" is returned.

View Source
Declaration
public bool AlwaysSendBasicAuthHeader { get; set; }

StoreCookies

Specifies if cookies should be stored

View Source
Declaration
public bool StoreCookies { get; set; }

CookieContainer

View Source
Declaration
public CookieContainer CookieContainer { get; set; }

AllowAutoRedirect

View Source
Declaration
public bool AllowAutoRedirect { get; set; }

OnAuthenticationRequired

Called before request resend, when the initial request required authentication

View Source
Declaration
public Action OnAuthenticationRequired { get; set; }

RefreshToken

If a request fails with a 401 Unauthorized and a BearerToken is present the client will automatically fetch a new AccessToken using this RefreshToken and retry the request

View Source
Declaration
public string RefreshToken { get; set; }

RefreshTokenUri

Send the Request to get the AccessToken with the RefreshToken at a non-default location

View Source
Declaration
public string RefreshTokenUri { get; set; }

EnableAutoRefreshToken

Whether to enable auto refreshing token of JWT Tokens from Refresh Tokens

View Source
Declaration
public bool EnableAutoRefreshToken { get; set; }

RequestFilter

The request filter is called before any request. This request filter only works with the instance where it was set (not global).

View Source
Declaration
public Action<HttpWebRequest> RequestFilter { get; set; }

ResultsFilter

The ResultsFilter is called before the Request is sent allowing you to return a cached response.

View Source
Declaration
public ResultsFilterDelegate ResultsFilter { get; set; }

ResultsFilterResponse

The ResultsFilterResponse is called before returning the response allowing responses to be cached.

View Source
Declaration
public ResultsFilterResponseDelegate ResultsFilterResponse { get; set; }

ExceptionFilter

Called with requestUri, ResponseType when server returns 304 NotModified

View Source
Declaration
public ExceptionFilterDelegate ExceptionFilter { get; set; }

ResponseFilter

The response action is called once the server response is available. It will allow you to access raw response information. Note that you should NOT consume the response stream as this is handled by ServiceStack

View Source
Declaration
public Action<HttpWebResponse> ResponseFilter { get; set; }

HttpLog

View Source
Declaration
public StringBuilder HttpLog { get; set; }

HttpLogFilter

View Source
Declaration
public Action<StringBuilder> HttpLogFilter { get; set; }

UrlResolver

View Source
Declaration
public UrlResolverDelegate UrlResolver { get; set; }

TypedUrlResolver

View Source
Declaration
public TypedUrlResolverDelegate TypedUrlResolver { get; set; }

StreamDeserializer

View Source
Declaration
public abstract StreamDeserializerDelegate StreamDeserializer { get; }

Fields

DefaultHttpMethod

View Source
Declaration
public const string DefaultHttpMethod = "POST"

DefaultUserAgent

View Source
Declaration
public static string DefaultUserAgent

Methods

SetBaseUri(String)

Sets all baseUri properties, using the Format property for the SyncReplyBaseUri and AsyncOneWayBaseUri

View Source
Declaration
public void SetBaseUri(string baseUri)
Parameters
TypeNameDescription
System.StringbaseUriBase URI of the service

|

SetCredentials(String, String)

Sets the username and the password for basic authentication.

View Source
Declaration
public void SetCredentials(string userName, string password)
Parameters
TypeName
System.StringuserName
System.Stringpassword

CaptureHttp(Boolean, Boolean, Boolean)

View Source
Declaration
public void CaptureHttp(bool print = false, bool log = false, bool clear = true)
Parameters
TypeName
System.Booleanprint
System.Booleanlog
System.Booleanclear

CaptureHttp(Action<StringBuilder>)

View Source
Declaration
public void CaptureHttp(Action<StringBuilder> httpFilter)
Parameters
TypeName
System.Action<System.Text.StringBuilder>httpFilter

ToAbsoluteUrl(String)

View Source
Declaration
public virtual string ToAbsoluteUrl(string relativeOrAbsoluteUrl)
Returns

System.String

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl

ResolveUrl(String, String)

View Source
Declaration
public virtual string ResolveUrl(string httpMethod, string relativeOrAbsoluteUrl)
Returns

System.String

Parameters
TypeName
System.StringhttpMethod
System.StringrelativeOrAbsoluteUrl

ResolveTypedUrl(String, Object)

View Source
Declaration
public virtual string ResolveTypedUrl(string httpMethod, object requestDto)
Returns

System.String

Parameters
TypeName
System.StringhttpMethod
System.ObjectrequestDto

SerializeToStream(IRequest, Object, Stream)

View Source
Declaration
public abstract void SerializeToStream(IRequest req, object request, Stream stream)
Parameters
TypeName
ServiceStack.Web.IRequestreq
System.Objectrequest
System.IO.Streamstream

DeserializeFromStream<T>(Stream)

View Source
Declaration
public abstract T DeserializeFromStream<T>(Stream stream)
Returns

<T>

Parameters
TypeName
System.IO.Streamstream
Type Parameters
  • T

Deserialize<T>(String)

View Source
Declaration
protected T Deserialize<T>(string text)
Returns

<T>

Parameters
TypeName
System.Stringtext
Type Parameters
  • T

SendAll<TResponse>(IEnumerable<Object>)

View Source
Declaration
public virtual List<TResponse> SendAll<TResponse>(IEnumerable<object> requests)
Returns

System.Collections.Generic.List<<TResponse>>

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests
Type Parameters
  • TResponse

Send<TResponse>(Object)

View Source
Declaration
public virtual TResponse Send<TResponse>(object request)
Returns

<TResponse>

Parameters
TypeName
System.Objectrequest
Type Parameters
  • TResponse

HandleResponseException<TResponse>(Exception, Object, String, Func<WebRequest>, Func<WebRequest, WebResponse>, out TResponse)

Called by Send method if an exception occurs, for instance a System.Net.WebException because the server returned an HTTP error code. Override if you want to handle specific exceptions or always want to parse the response to a custom ErrorResponse DTO type instead of ServiceStack's ErrorResponse class. In case ex is a System.Net.WebException, do not use createWebRequest/getResponse/HandleResponse&lt;TResponse&gt; to parse the response because that will result in the same exception again. Use ThrowWebServiceException&lt;YourErrorResponseType&gt; to parse the response and to throw a WebServiceException containing the parsed DTO. Then override Send to handle that exception.

View Source
Declaration
protected virtual bool HandleResponseException<TResponse>(Exception ex, object request, string requestUri, Func<WebRequest> createWebRequest, Func<WebRequest, WebResponse> getResponse, out TResponse response)
Returns

System.Boolean

Parameters
TypeName
System.Exceptionex
System.Objectrequest
System.StringrequestUri
System.Func<System.Net.WebRequest>createWebRequest
System.Func<System.Net.WebRequest,System.Net.WebResponse>getResponse
<TResponse>response
Type Parameters
  • TResponse

ThrowResponseTypeException<TResponse>(Object, Exception, String)

View Source
Declaration
protected void ThrowResponseTypeException<TResponse>(object request, Exception ex, string requestUri)
Parameters
TypeName
System.Objectrequest
System.Exceptionex
System.StringrequestUri
Type Parameters
  • TResponse

ToWebServiceException(WebException, Func<Stream, Object>, String)

View Source
Declaration
public static WebServiceException ToWebServiceException(WebException webEx, Func<Stream, object> parseDtoFn, string contentType)
Returns

ServiceStack.WebServiceException

Parameters
TypeName
System.Net.WebExceptionwebEx
System.Func<System.IO.Stream,System.Object>parseDtoFn
System.StringcontentType

ThrowWebServiceException<TResponse>(Exception, String)

View Source
Declaration
public void ThrowWebServiceException<TResponse>(Exception ex, string requestUri)
Parameters
TypeName
System.Exceptionex
System.StringrequestUri
Type Parameters
  • TResponse

SendRequest(String, String, Object)

View Source
Declaration
protected virtual WebRequest SendRequest(string httpMethod, string requestUri, object request)
Returns

System.Net.WebRequest

Parameters
TypeName
System.StringhttpMethod
System.StringrequestUri
System.Objectrequest

SerializeRequestToStream(Object, Stream, Boolean)

View Source
Declaration
protected virtual void SerializeRequestToStream(object request, Stream requestStream, bool keepOpen = false)
Parameters
TypeName
System.Objectrequest
System.IO.StreamrequestStream
System.BooleankeepOpen

PrepareWebRequest(String, String, Object, Action<HttpWebRequest>)

View Source
Declaration
protected WebRequest PrepareWebRequest(string httpMethod, string requestUri, object request, Action<HttpWebRequest> sendRequestAction)
Returns

System.Net.WebRequest

Parameters
TypeName
System.StringhttpMethod
System.StringrequestUri
System.Objectrequest
System.Action<System.Net.HttpWebRequest>sendRequestAction

DownloadBytes(String, String, Object)

View Source
Declaration
public byte[] DownloadBytes(string httpMethod, string requestUri, object request)
Returns

System.Byte[]

Parameters
TypeName
System.StringhttpMethod
System.StringrequestUri
System.Objectrequest

DownloadBytesAsync(String, String, Object)

View Source
Declaration
public async Task<byte[]> DownloadBytesAsync(string httpMethod, string requestUri, object request)
Returns

System.Threading.Tasks.Task<System.Byte[]>

Parameters
TypeName
System.StringhttpMethod
System.StringrequestUri
System.Objectrequest

Publish(Object)

View Source
Declaration
public virtual void Publish(object requestDto)
Parameters
TypeName
System.ObjectrequestDto

PublishAll(IEnumerable<Object>)

View Source
Declaration
public void PublishAll(IEnumerable<object> requests)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests

Publish<T>(T)

View Source
Declaration
public void Publish<T>(T requestDto)
Parameters
TypeName
<T>requestDto
Type Parameters
  • T

Publish<T>(IMessage<T>)

View Source
Declaration
public void Publish<T>(IMessage<T> message)
Parameters
TypeName
ServiceStack.Messaging.IMessage<T>message
Type Parameters
  • T

SendOneWay(Object)

View Source
Declaration
public virtual void SendOneWay(object request)
Parameters
TypeName
System.Objectrequest

SendOneWay(String, Object)

View Source
Declaration
public virtual void SendOneWay(string relativeOrAbsoluteUrl, object request)
Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest

SendAllOneWay(IEnumerable<Object>)

View Source
Declaration
public virtual void SendAllOneWay(IEnumerable<object> requests)
Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests

SendOneWay(String, String, Object)

View Source
Declaration
public virtual void SendOneWay(string httpMethod, string relativeOrAbsoluteUrl, object requestDto)
Parameters
TypeName
System.StringhttpMethod
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto

SendAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public virtual async Task<TResponse> SendAsync<TResponse>(object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

SendAllAsync<TResponse>(IEnumerable<Object>, CancellationToken)

View Source
Declaration
public Task<List<TResponse>> SendAllAsync<TResponse>(IEnumerable<object> requests, CancellationToken token)
Returns

System.Threading.Tasks.Task<System.Collections.Generic.List<<TResponse>>>

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PublishAsync(Object, CancellationToken)

View Source
Declaration
public Task PublishAsync(object request, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Objectrequest
System.Threading.CancellationTokentoken

PublishAllAsync(IEnumerable<Object>, CancellationToken)

View Source
Declaration
public Task PublishAllAsync(IEnumerable<object> requests, CancellationToken token)
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.Collections.Generic.IEnumerable<System.Object>requests
System.Threading.CancellationTokentoken

SendAsync<TResponse>(String, String, Object, CancellationToken)

View Source
Declaration
public Task<TResponse> SendAsync<TResponse>(string httpMethod, string absoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpMethod
System.StringabsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

GetAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> GetAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

GetAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> GetAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

GetAsync<TResponse>(String, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> GetAsync<TResponse>(string relativeOrAbsoluteUrl, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

GetAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public virtual Task GetAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

DeleteAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> DeleteAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

DeleteAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> DeleteAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

DeleteAsync<TResponse>(String, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> DeleteAsync<TResponse>(string relativeOrAbsoluteUrl, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

DeleteAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public virtual Task DeleteAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

PostAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PostAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PostAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PostAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PostAsync<TResponse>(String, Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PostAsync<TResponse>(string relativeOrAbsoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PostAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public virtual Task PostAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

PutAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PutAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PutAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PutAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PutAsync<TResponse>(String, Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PutAsync<TResponse>(string relativeOrAbsoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PutAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public virtual Task PutAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

PatchAsync<TResponse>(IReturn<TResponse>, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PatchAsync<TResponse>(IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PatchAsync<TResponse>(Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PatchAsync<TResponse>(object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PatchAsync<TResponse>(String, Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> PatchAsync<TResponse>(string relativeOrAbsoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

PatchAsync(IReturnVoid, CancellationToken)

View Source
Declaration
public virtual Task PatchAsync(IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

CustomMethodAsync<TResponse>(String, IReturn<TResponse>, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, IReturn<TResponse> requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturn<T>requestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

CustomMethodAsync<TResponse>(String, Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, object requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpVerb
System.ObjectrequestDto
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

CustomMethodAsync<TResponse>(String, String, Object, CancellationToken)

View Source
Declaration
public virtual Task<TResponse> CustomMethodAsync<TResponse>(string httpVerb, string relativeOrAbsoluteUrl, object request, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<<TResponse>>

Parameters
TypeName
System.StringhttpVerb
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Threading.CancellationTokentoken
Type Parameters
  • TResponse

CustomMethodAsync(String, IReturnVoid, CancellationToken)

View Source
Declaration
public virtual Task CustomMethodAsync(string httpVerb, IReturnVoid requestDto, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturnVoidrequestDto
System.Threading.CancellationTokentoken

Send<TResponse>(String, String, Object)

View Source
Declaration
public virtual TResponse Send<TResponse>(string httpMethod, string relativeOrAbsoluteUrl, object request)
Returns

<TResponse>

Parameters
TypeName
System.StringhttpMethod
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
Type Parameters
  • TResponse

AddHeader(String, String)

View Source
Declaration
public void AddHeader(string name, string value)
Parameters
TypeName
System.Stringname
System.Stringvalue

ClearCookies()

View Source
Declaration
public void ClearCookies()

GetCookieValues()

View Source
Declaration
public Dictionary<string, string> GetCookieValues()
Returns

System.Collections.Generic.Dictionary<System.String,System.String>

SetCookie(String, String, Nullable<TimeSpan>)

View Source
Declaration
public void SetCookie(string name, string value, TimeSpan? expiresIn = null)
Parameters
TypeName
System.Stringname
System.Stringvalue
System.Nullable<System.TimeSpan>expiresIn

Get(IReturnVoid)

View Source
Declaration
public virtual void Get(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Get(Object)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Get(url)) { ... }

View Source
Declaration
[Obsolete("Use: using var res = client.Get<HttpWebResponse>(requestDto)")]
public virtual HttpWebResponse Get(object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.ObjectrequestDto

Get(String)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Get(url)) { ... }

View Source
Declaration
[Obsolete("Use: using var res = client.Get<HttpWebResponse>(relativeOrAbsoluteUrl)")]
public virtual HttpWebResponse Get(string relativeOrAbsoluteUrl)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl

Get<TResponse>(IReturn<TResponse>)

View Source
Declaration
public virtual TResponse Get<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Get<TResponse>(Object)

View Source
Declaration
public virtual TResponse Get<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Get<TResponse>(String)

View Source
Declaration
public virtual TResponse Get<TResponse>(string relativeOrAbsoluteUrl)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
Type Parameters
  • TResponse

GetLazy<TResponse>(IReturn<QueryResponse<TResponse>>)

View Source
Declaration
public virtual IEnumerable<TResponse> GetLazy<TResponse>(IReturn<QueryResponse<TResponse>> queryDto)
Returns

System.Collections.Generic.IEnumerable<<TResponse>>

Parameters
TypeName
ServiceStack.IReturn<T>queryDto
Type Parameters
  • TResponse

Delete(IReturnVoid)

View Source
Declaration
public virtual void Delete(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Delete(Object)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Delete(url)) { ... }

View Source
Declaration
[Obsolete("Use: using (client.Delete<HttpWebResponse>(requestDto) { }")]
public virtual HttpWebResponse Delete(object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.ObjectrequestDto

Delete(String)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Delete(url)) { ... }

View Source
Declaration
[Obsolete("Use: using (client.Delete<HttpWebResponse>(relativeOrAbsoluteUrl) { }")]
public virtual HttpWebResponse Delete(string relativeOrAbsoluteUrl)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl

Delete<TResponse>(IReturn<TResponse>)

View Source
Declaration
public virtual TResponse Delete<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Delete<TResponse>(Object)

View Source
Declaration
public virtual TResponse Delete<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Delete<TResponse>(String)

View Source
Declaration
public virtual TResponse Delete<TResponse>(string relativeOrAbsoluteUrl)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
Type Parameters
  • TResponse

Post(IReturnVoid)

View Source
Declaration
public virtual void Post(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Post(Object)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Post(url)) { ... }

View Source
Declaration
[Obsolete("Use: using (client.Post<HttpWebResponse>(requestDto) { }")]
public virtual HttpWebResponse Post(object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.ObjectrequestDto

Post<TResponse>(IReturn<TResponse>)

View Source
Declaration
public virtual TResponse Post<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Post<TResponse>(Object)

View Source
Declaration
public virtual TResponse Post<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Post<TResponse>(String, Object)

View Source
Declaration
public virtual TResponse Post<TResponse>(string relativeOrAbsoluteUrl, object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto
Type Parameters
  • TResponse

Put(IReturnVoid)

View Source
Declaration
public virtual void Put(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Put(Object)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Put(url)) { ... }

View Source
Declaration
[Obsolete("Use: using (client.Put<HttpWebResponse>(requestDto) { }")]
public virtual HttpWebResponse Put(object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.ObjectrequestDto

Put<TResponse>(IReturn<TResponse>)

View Source
Declaration
public virtual TResponse Put<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Put<TResponse>(Object)

View Source
Declaration
public virtual TResponse Put<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Put<TResponse>(String, Object)

View Source
Declaration
public virtual TResponse Put<TResponse>(string relativeOrAbsoluteUrl, object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto
Type Parameters
  • TResponse

Patch(IReturnVoid)

View Source
Declaration
public virtual void Patch(IReturnVoid requestDto)
Parameters
TypeName
ServiceStack.IReturnVoidrequestDto

Patch(Object)

View Source
Declaration
[Obsolete("Use: using (client.Patch<HttpWebResponse>(requestDto) { }")]
public virtual HttpWebResponse Patch(object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.ObjectrequestDto

Patch<TResponse>(IReturn<TResponse>)

View Source
Declaration
public virtual TResponse Patch<TResponse>(IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

Patch<TResponse>(Object)

View Source
Declaration
public virtual TResponse Patch<TResponse>(object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.ObjectrequestDto
Type Parameters
  • TResponse

Patch<TResponse>(String, Object)

View Source
Declaration
public virtual TResponse Patch<TResponse>(string relativeOrAbsoluteUrl, object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto
Type Parameters
  • TResponse

CustomMethod(String, IReturnVoid)

View Source
Declaration
public virtual void CustomMethod(string httpVerb, IReturnVoid requestDto)
Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturnVoidrequestDto

CustomMethod(String, Object)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.CustomMethod(method,dto)) { ... }

View Source
Declaration
public virtual HttpWebResponse CustomMethod(string httpVerb, object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.StringhttpVerb
System.ObjectrequestDto

CustomMethod(String, String, Object)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.CustomMethod(method,dto)) { ... }

View Source
Declaration
public virtual HttpWebResponse CustomMethod(string httpVerb, string relativeOrAbsoluteUrl, object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.StringhttpVerb
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto

CustomMethod<TResponse>(String, IReturn<TResponse>)

View Source
Declaration
public virtual TResponse CustomMethod<TResponse>(string httpVerb, IReturn<TResponse> requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringhttpVerb
ServiceStack.IReturn<T>requestDto
Type Parameters
  • TResponse

CustomMethod<TResponse>(String, Object)

View Source
Declaration
public virtual TResponse CustomMethod<TResponse>(string httpVerb, object requestDto)
Returns

<TResponse>

Parameters
TypeName
System.StringhttpVerb
System.ObjectrequestDto
Type Parameters
  • TResponse

CustomMethod<TResponse>(String, String, Object)

View Source
Declaration
public virtual TResponse CustomMethod<TResponse>(string httpVerb, string relativeOrAbsoluteUrl, object requestDto = null)
Returns

<TResponse>

Parameters
TypeName
System.StringhttpVerb
System.StringrelativeOrAbsoluteUrl
System.ObjectrequestDto
Type Parameters
  • TResponse

GetHttpMethod(Object)

View Source
Declaration
public string GetHttpMethod(object request)
Returns

System.String

Parameters
TypeName
System.Objectrequest

Head(IReturn)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Head(request)) { ... }

View Source
Declaration
public virtual HttpWebResponse Head(IReturn requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
ServiceStack.IReturnrequestDto

Head(Object)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Head(request)) { ... }

View Source
Declaration
public virtual HttpWebResponse Head(object requestDto)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.ObjectrequestDto

Head(String)

APIs returning HttpWebResponse must be explicitly Disposed, e.g using (var res = client.Head(request)) { ... }

View Source
Declaration
public virtual HttpWebResponse Head(string relativeOrAbsoluteUrl)
Returns

System.Net.HttpWebResponse

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl

SendStringToUrl(HttpWebRequest, String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>)

View Source
Declaration
public static string SendStringToUrl(HttpWebRequest webReq, string method, string requestBody, string contentType, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null)
Returns

System.String

Parameters
TypeName
System.Net.HttpWebRequestwebReq
System.Stringmethod
System.StringrequestBody
System.StringcontentType
System.Stringaccept
System.Action<System.Net.HttpWebRequest>requestFilter
System.Action<System.Net.HttpWebResponse>responseFilter

SendStringToUrlAsync(HttpWebRequest, String, String, String, String, Action<HttpWebRequest>, Action<HttpWebResponse>, CancellationToken)

View Source
Declaration
public static async Task<string> SendStringToUrlAsync(HttpWebRequest webReq, string method, string requestBody, string contentType, string accept = "*/*", Action<HttpWebRequest> requestFilter = null, Action<HttpWebResponse> responseFilter = null, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task<System.String>

Parameters
TypeName
System.Net.HttpWebRequestwebReq
System.Stringmethod
System.StringrequestBody
System.StringcontentType
System.Stringaccept
System.Action<System.Net.HttpWebRequest>requestFilter
System.Action<System.Net.HttpWebResponse>responseFilter
System.Threading.CancellationTokentoken

PostFilesWithRequest<TResponse>(Object, IEnumerable<UploadFile>)

View Source
Declaration
public virtual TResponse PostFilesWithRequest<TResponse>(object request, IEnumerable<UploadFile> files)
Returns

<TResponse>

Parameters
TypeName
System.Objectrequest
System.Collections.Generic.IEnumerable<ServiceStack.UploadFile>files
Type Parameters
  • TResponse

PostFilesWithRequest<TResponse>(String, Object, IEnumerable<UploadFile>)

View Source
Declaration
public virtual TResponse PostFilesWithRequest<TResponse>(string relativeOrAbsoluteUrl, object request, IEnumerable<UploadFile> files)
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.Objectrequest
System.Collections.Generic.IEnumerable<ServiceStack.UploadFile>files
Type Parameters
  • TResponse

PostFileWithRequest<TResponse>(Stream, String, Object, String)

View Source
Declaration
public virtual TResponse PostFileWithRequest<TResponse>(Stream fileToUpload, string fileName, object request, string fieldName = "file")
Returns

<TResponse>

Parameters
TypeName
System.IO.StreamfileToUpload
System.StringfileName
System.Objectrequest
System.StringfieldName
Type Parameters
  • TResponse

PostFileWithRequest<TResponse>(String, Stream, String, Object, String)

View Source
Declaration
public virtual TResponse PostFileWithRequest<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, object request, string fieldName = "file")
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.IO.StreamfileToUpload
System.StringfileName
System.Objectrequest
System.StringfieldName
Type Parameters
  • TResponse

UploadFile(WebRequest, Stream, String, String, String, Action<HttpWebRequest>, String, String)

View Source
Declaration
public static void UploadFile(WebRequest webRequest, Stream fileStream, string fileName, string mimeType, string accept = null, Action<HttpWebRequest> requestFilter = null, string method = "POST", string fieldName = "file")
Parameters
TypeName
System.Net.WebRequestwebRequest
System.IO.StreamfileStream
System.StringfileName
System.StringmimeType
System.Stringaccept
System.Action<System.Net.HttpWebRequest>requestFilter
System.Stringmethod
System.StringfieldName

PostFile<TResponse>(String, Stream, String, String, String)

View Source
Declaration
public virtual TResponse PostFile<TResponse>(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, string mimeType, string fieldName = "file")
Returns

<TResponse>

Parameters
TypeName
System.StringrelativeOrAbsoluteUrl
System.IO.StreamfileToUpload
System.StringfileName
System.StringmimeType
System.StringfieldName
Type Parameters
  • TResponse

GetResponse<TResponse>(WebResponse)

View Source
Declaration
protected TResponse GetResponse<TResponse>(WebResponse webRes)
Returns

<TResponse>

Parameters
TypeName
System.Net.WebResponsewebRes
Type Parameters
  • TResponse

Dispose()

View Source
Declaration
public void Dispose()

Implements