Table of Contents

Class RestClientSyncExtensions

Namespace
RestSharp
Assembly
RestSharp.dll
public static class RestClientSyncExtensions
Inheritance
RestClientSyncExtensions
Inherited Members

Methods

Delete(RestClient, RestRequest)

public static RestResponse Delete(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Returns

RestResponse

Delete<T>(RestClient, RestRequest)

Execute the request using DELETE HTTP method. Exception will be thrown if the request does not succeed. The response data is deserialized to the Data property of the returned response object.

public static T? Delete<T>(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

The request

Returns

T

Type Parameters

T

Expected result type

DownloadData(RestClient, RestRequest)

A specialized method to download files.

public static byte[]? DownloadData(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

Pre-configured request instance.

Returns

byte[]

The downloaded file.

Execute(RestClient, RestRequest, Method)

Executes the request synchronously, authenticating if needed

public static RestResponse Execute(this RestClient client, RestRequest request, Method httpMethod)

Parameters

client RestClient
request RestRequest

Request to be executed

httpMethod Method

Override the request method

Returns

RestResponse

ExecuteGet(RestClient, RestRequest)

Executes a GET-style synchronously, authenticating if needed

public static RestResponse ExecuteGet(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Request to be executed

Returns

RestResponse

ExecuteGet<T>(RestClient, RestRequest)

Executes a GET-style request synchronously, authenticating if needed. The response content then gets deserialized to T.

public static RestResponse<T> ExecuteGet<T>(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Request to be executed

Returns

RestResponse<T>

Deserialized response content

Type Parameters

T

Target deserialization type

ExecutePost(RestClient, RestRequest)

Executes a POST-style synchronously, authenticating if needed

public static RestResponse ExecutePost(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Request to be executed

Returns

RestResponse

ExecutePost<T>(RestClient, RestRequest)

Executes a POST-style request synchronously, authenticating if needed. The response content then gets deserialized to T.

public static RestResponse<T> ExecutePost<T>(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Request to be executed

Returns

RestResponse<T>

Deserialized response content

Type Parameters

T

Target deserialization type

ExecutePut(RestClient, RestRequest)

Executes a PUP-style synchronously, authenticating if needed

public static RestResponse ExecutePut(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Request to be executed

Returns

RestResponse

ExecutePut<T>(RestClient, RestRequest)

Executes a PUT-style request synchronously, authenticating if needed. The response content then gets deserialized to T.

public static RestResponse<T> ExecutePut<T>(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Request to be executed

Returns

RestResponse<T>

Deserialized response content

Type Parameters

T

Target deserialization type

Execute<T>(RestClient, RestRequest)

Executes the request synchronously, authenticating if needed

public static RestResponse<T> Execute<T>(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Request to be executed

Returns

RestResponse<T>

Type Parameters

T

Target deserialization type

Execute<T>(RestClient, RestRequest, Method)

Executes the request synchronously, authenticating if needed

public static RestResponse<T> Execute<T>(this RestClient client, RestRequest request, Method httpMethod)

Parameters

client RestClient
request RestRequest

Request to be executed

httpMethod Method

Override the request method

Returns

RestResponse<T>

Type Parameters

T

Target deserialization type

Get(RestClient, RestRequest)

public static RestResponse Get(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Returns

RestResponse

Get<T>(RestClient, RestRequest)

Execute the request using GET HTTP method. Exception will be thrown if the request does not succeed. The response data is deserialized to the Data property of the returned response object.

public static T? Get<T>(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

The request

Returns

T

Type Parameters

T

Expected result type

Head(RestClient, RestRequest)

public static RestResponse Head(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Returns

RestResponse

Head<T>(RestClient, RestRequest)

Execute the request using HEAD HTTP method. Exception will be thrown if the request does not succeed. The response data is deserialized to the Data property of the returned response object.

public static T? Head<T>(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

The request

Returns

T

Type Parameters

T

Expected result type

Options(RestClient, RestRequest)

public static RestResponse Options(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Returns

RestResponse

Options<T>(RestClient, RestRequest)

Execute the request using OPTIONS HTTP method. Exception will be thrown if the request does not succeed. The response data is deserialized to the Data property of the returned response object.

public static T? Options<T>(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

The request

Returns

T

Type Parameters

T

Expected result type

Patch(RestClient, RestRequest)

public static RestResponse Patch(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Returns

RestResponse

Patch<T>(RestClient, RestRequest)

Execute the request using PATCH HTTP method. Exception will be thrown if the request does not succeed. The response data is deserialized to the Data property of the returned response object.

public static T? Patch<T>(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

The request

Returns

T

Type Parameters

T

Expected result type

Post<T>(RestClient, RestRequest)

Execute the request using POST HTTP method. Exception will be thrown if the request does not succeed. The response data is deserialized to the Data property of the returned response object.

public static T? Post<T>(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

The request

Returns

T

Type Parameters

T

Expected result type

Put(RestClient, RestRequest)

public static RestResponse Put(this RestClient client, RestRequest request)

Parameters

client RestClient
request RestRequest

Returns

RestResponse

Put<T>(RestClient, RestRequest)

Execute the request using PUT HTTP method. Exception will be thrown if the request does not succeed. The response data is deserialized to the Data property of the returned response object.

public static T? Put<T>(this RestClient client, RestRequest request)

Parameters

client RestClient

RestClient instance

request RestRequest

The request

Returns

T

Type Parameters

T

Expected result type