Skip to main content

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​
TypeNameDescription
System.StringkeyThe field name of the header.
System.StringvalueThe value of the header.

SetCancelToken(CancellationToken)​

Sets the cancellation token for this client.

View Source​
Declaration
void SetCancelToken(CancellationToken cancelToken)
Parameters​
TypeNameDescription
System.Threading.CancellationTokencancelTokenThe 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​
TypeNameDescription
System.StringmethodThe method used to send this request (i.e. HTTP verb such as GET, POST).
System.StringendpointThe endpoint to send this request to.
System.Threading.CancellationTokencancelTokenThe cancellation token used to cancel the task.
System.BooleanheaderOnlyIndicates whether to send the header only.
System.StringreasonThe 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​
TypeName
System.Stringmethod
System.Stringendpoint
System.Stringjson
System.Threading.CancellationTokencancelToken
System.BooleanheaderOnly
System.Stringreason

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​
TypeName
System.Stringmethod
System.Stringendpoint
System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>multipartParams
System.Threading.CancellationTokencancelToken
System.BooleanheaderOnly
System.Stringreason