Interface IRestClient
Represents a generic REST-based client.
Assembly: Discord.Net.Core.dll​
View Source​
Declaration
public interface IRestClient : IDisposable
Methods​
SetHeader(String, String)​
Sets the HTTP header of this client for all requests.
View Source​
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. |
SetCancelToken(CancellationToken)​
Sets the cancellation token for this client.
View Source​
Declaration
void SetCancelToken(CancellationToken cancelToken)
Parameters​
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancelToken | The cancellation token. |
SendAsync(String, String, CancellationToken, Boolean, String)​
Sends a REST request.
View Source​
Declaration
Task<RestResponse> SendAsync(string method, string endpoint, CancellationToken cancelToken, bool headerOnly = false, string reason = null)
Returns​
System.Threading.Tasks.Task<Discord.Net.Rest.RestResponse>
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. |
SendAsync(String, String, String, CancellationToken, Boolean, String)​
View Source​
Declaration
Task<RestResponse> SendAsync(string method, string endpoint, string json, CancellationToken cancelToken, bool headerOnly = false, string reason = null)
Returns​
System.Threading.Tasks.Task<Discord.Net.Rest.RestResponse>
Parameters​
Type | Name |
---|---|
System.String | method |
System.String | endpoint |
System.String | json |
System.Threading.CancellationToken | cancelToken |
System.Boolean | headerOnly |
System.String | reason |
SendAsync(String, String, IReadOnlyDictionary<String, Object>, CancellationToken, Boolean, String)​
View Source​
Declaration
Task<RestResponse> SendAsync(string method, string endpoint, IReadOnlyDictionary<string, object> multipartParams, CancellationToken cancelToken, bool headerOnly = false, string reason = null)
Returns​
System.Threading.Tasks.Task<Discord.Net.Rest.RestResponse>
Parameters​
Type | Name |
---|---|
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 |