Show / Hide Table of Contents

# Interface IRestClient

Represents a generic REST-based client.

##### Inherited Members

System.IDisposable.Dispose()

###### Namespace: Discord.Net.Rest

###### Assembly: Discord.Net.Core.dll

##### Syntax

    public interface IRestClient : IDisposable

### Methods

| Improve this Doc View Source

#### SendAsync(String, String, IReadOnlyDictionary<String, Object>, CancellationToken, Boolean, String)

##### Declaration

    Task<RestResponse> SendAsync(string method, string endpoint, IReadOnlyDictionary<string, object> multipartParams, CancellationToken cancelToken, bool headerOnly = false, string reason = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | method |
System.String | endpoint |
System.Collections.Generic.IReadOnlyDictionary<System.String, System.Object> | multipartParams |
System.Threading.CancellationToken | cancelToken |
System.Boolean | headerOnly |
System.String | reason |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<RestResponse> |

| Improve this Doc View Source

#### SendAsync(String, String, String, CancellationToken, Boolean, String)

##### Declaration

    Task<RestResponse> SendAsync(string method, string endpoint, string json, CancellationToken cancelToken, bool headerOnly = false, string reason = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | method |
System.String | endpoint |
System.String | json |
System.Threading.CancellationToken | cancelToken |
System.Boolean | headerOnly |
System.String | reason |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<RestResponse> |

| Improve this Doc View Source

#### SendAsync(String, String, CancellationToken, Boolean, String)

Sends a REST request.

##### Declaration

    Task<RestResponse> SendAsync(string method, string endpoint, CancellationToken cancelToken, bool headerOnly = false, string reason = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | method | The method used to send this request (i.e. HTTP verb such as `GET`, `POST`).
System.String | endpoint | The endpoint to send this request to.
System.Threading.CancellationToken | cancelToken | The cancellation token used to cancel the task.
System.Boolean | headerOnly | Indicates whether to send the header only.
System.String | reason | The audit log reason.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<RestResponse> |

| Improve this Doc View Source

#### SetCancelToken(CancellationToken)

Sets the cancellation token for this client.

##### Declaration

    void SetCancelToken(CancellationToken cancelToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Threading.CancellationToken | cancelToken | The cancellation token.

| Improve this Doc View Source

#### SetHeader(String, String)

Sets the HTTP header of this client for all requests.

##### Declaration

    void SetHeader(string key, string value)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | key | The field name of the header.
System.String | value | The value of the header.