Show / Hide Table of Contents

# Class DiscordRestClient

Provides a client to send REST-based requests to Discord.

##### Inheritance

System.Object
BaseDiscordClient
DiscordRestClient
DiscordSocketRestClient

##### Implements

IDiscordClient
System.IDisposable

##### Inherited Members

BaseDiscordClient.Log
BaseDiscordClient.LoggedIn
BaseDiscordClient.LoggedOut
BaseDiscordClient.LoginState
BaseDiscordClient.TokenType
BaseDiscordClient.LoginAsync(TokenType, String, Boolean)
BaseDiscordClient.LogoutAsync()
BaseDiscordClient.Dispose()
BaseDiscordClient.GetRecommendedShardCountAsync(RequestOptions)
BaseDiscordClient.IDiscordClient.ConnectionState
BaseDiscordClient.IDiscordClient.CurrentUser
BaseDiscordClient.IDiscordClient.GetUserAsync(String, String, RequestOptions)
BaseDiscordClient.IDiscordClient.StartAsync()
BaseDiscordClient.IDiscordClient.StopAsync()
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Discord.Rest

###### Assembly: Discord.Net.Rest.dll

##### Syntax

    public class DiscordRestClient : BaseDiscordClient, IDiscordClient, IDisposable

### Constructors

| Improve this Doc View Source

#### DiscordRestClient()

##### Declaration

    public DiscordRestClient()

| Improve this Doc View Source

#### DiscordRestClient(DiscordRestConfig)

Initializes a new DiscordRestClient with the provided configuration.

##### Declaration

    public DiscordRestClient(DiscordRestConfig config)

##### Parameters

Type | Name | Description
--- | --- | ---
DiscordRestConfig | config | The configuration to be used with the client.

### Properties

| Improve this Doc View Source

#### CurrentUser

Gets the logged-in user.

##### Declaration

    public RestSelfUser CurrentUser { get; }

##### Property Value

Type | Description
--- | ---
RestSelfUser |

### Methods

| Improve this Doc View Source

#### CreateGuildAsync(String, IVoiceRegion, Stream, RequestOptions)

##### Declaration

    public Task<RestGuild> CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon = null, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |
IVoiceRegion | region |
System.IO.Stream | jpegIcon |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetApplicationInfoAsync(RequestOptions)

##### Declaration

    public Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetChannelAsync(UInt64, RequestOptions)

##### Declaration

    public Task<RestChannel> GetChannelAsync(ulong id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetConnectionsAsync(RequestOptions)

##### Declaration

    public Task<IReadOnlyCollection<RestConnection>> GetConnectionsAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<RestConnection>> |

| Improve this Doc View Source

#### GetDMChannelsAsync(RequestOptions)

##### Declaration

    public Task<IReadOnlyCollection<RestDMChannel>> GetDMChannelsAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<RestDMChannel>> |

| Improve this Doc View Source

#### GetGroupChannelsAsync(RequestOptions)

##### Declaration

    public Task<IReadOnlyCollection<RestGroupChannel>> GetGroupChannelsAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<RestGroupChannel>> |

| Improve this Doc View Source

#### GetGuildAsync(UInt64, RequestOptions)

##### Declaration

    public Task<RestGuild> GetGuildAsync(ulong id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetGuildEmbedAsync(UInt64, RequestOptions)

##### Declaration

    public Task<RestGuildEmbed?> GetGuildEmbedAsync(ulong id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Nullable<RestGuildEmbed>> |

| Improve this Doc View Source

#### GetGuildsAsync(RequestOptions)

##### Declaration

    public Task<IReadOnlyCollection<RestGuild>> GetGuildsAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<RestGuild>> |

| Improve this Doc View Source

#### GetGuildSummariesAsync(RequestOptions)

##### Declaration

    public IAsyncEnumerable<IReadOnlyCollection<RestUserGuild>> GetGuildSummariesAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestUserGuild>> |

| Improve this Doc View Source

#### GetGuildSummariesAsync(UInt64, Int32, RequestOptions)

##### Declaration

    public IAsyncEnumerable<IReadOnlyCollection<RestUserGuild>> GetGuildSummariesAsync(ulong fromGuildId, int limit, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | fromGuildId |
System.Int32 | limit |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<RestUserGuild>> |

| Improve this Doc View Source

#### GetGuildUserAsync(UInt64, UInt64, RequestOptions)

##### Declaration

    public Task<RestGuildUser> GetGuildUserAsync(ulong guildId, ulong id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | guildId |
System.UInt64 | id |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetInviteAsync(String, RequestOptions)

##### Declaration

    public Task<RestInviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | inviteId |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetPrivateChannelsAsync(RequestOptions)

##### Declaration

    public Task<IReadOnlyCollection<IRestPrivateChannel>> GetPrivateChannelsAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IRestPrivateChannel>> |

| Improve this Doc View Source

#### GetUserAsync(UInt64, RequestOptions)

##### Declaration

    public Task<RestUser> GetUserAsync(ulong id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetVoiceRegionAsync(String, RequestOptions)

##### Declaration

    public Task<RestVoiceRegion> GetVoiceRegionAsync(string id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | id |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### GetVoiceRegionsAsync(RequestOptions)

##### Declaration

    public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<RestVoiceRegion>> |

| Improve this Doc View Source

#### GetWebhookAsync(UInt64, RequestOptions)

##### Declaration

    public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
RequestOptions | options |

##### Returns

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

### Explicit Interface Implementations

| Improve this Doc View Source

#### IDiscordClient.CreateGuildAsync(String, IVoiceRegion, Stream, RequestOptions)

##### Declaration

    Task<IGuild> IDiscordClient.CreateGuildAsync(string name, IVoiceRegion region, Stream jpegIcon, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |
IVoiceRegion | region |
System.IO.Stream | jpegIcon |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### IDiscordClient.GetApplicationInfoAsync(RequestOptions)

##### Declaration

    Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### IDiscordClient.GetChannelAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IChannel> IDiscordClient.GetChannelAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### IDiscordClient.GetConnectionsAsync(RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IConnection>> IDiscordClient.GetConnectionsAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IConnection>> |

| Improve this Doc View Source

#### IDiscordClient.GetDMChannelsAsync(CacheMode, RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IDMChannel>> IDiscordClient.GetDMChannelsAsync(CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IDMChannel>> |

| Improve this Doc View Source

#### IDiscordClient.GetGroupChannelsAsync(CacheMode, RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IGroupChannel>> IDiscordClient.GetGroupChannelsAsync(CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IGroupChannel>> |

| Improve this Doc View Source

#### IDiscordClient.GetGuildAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IGuild> IDiscordClient.GetGuildAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### IDiscordClient.GetGuildsAsync(CacheMode, RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IGuild>> IDiscordClient.GetGuildsAsync(CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IGuild>> |

| Improve this Doc View Source

#### IDiscordClient.GetInviteAsync(String, RequestOptions)

##### Declaration

    Task<IInvite> IDiscordClient.GetInviteAsync(string inviteId, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | inviteId |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### IDiscordClient.GetPrivateChannelsAsync(CacheMode, RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IPrivateChannel>> IDiscordClient.GetPrivateChannelsAsync(CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IPrivateChannel>> |

| Improve this Doc View Source

#### IDiscordClient.GetUserAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IUser> IDiscordClient.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### IDiscordClient.GetVoiceRegionAsync(String, RequestOptions)

##### Declaration

    Task<IVoiceRegion> IDiscordClient.GetVoiceRegionAsync(string id, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | id |
RequestOptions | options |

##### Returns

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

| Improve this Doc View Source

#### IDiscordClient.GetVoiceRegionsAsync(RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IVoiceRegion>> IDiscordClient.GetVoiceRegionsAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IVoiceRegion>> |

| Improve this Doc View Source

#### IDiscordClient.GetWebhookAsync(UInt64, RequestOptions)

##### Declaration

    Task<IWebhook> IDiscordClient.GetWebhookAsync(ulong id, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
RequestOptions | options |

##### Returns

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

### Implements

IDiscordClient
System.IDisposable

### Extension Methods

ClientExtensions.AddGuildUserAsync(BaseDiscordClient, UInt64, UInt64, String, Action<AddGuildUserProperties>, RequestOptions)