- Previously, the GetInviteAsync method would return null since it couldn't be parsed as a simple RestInvite object. The object should be a RestInviteMetadata instead.pull/1023/head
| @@ -50,7 +50,7 @@ namespace Discord.Rest | |||||
| return models.Select(x => RestConnection.Create(x)).ToImmutableArray(); | return models.Select(x => RestConnection.Create(x)).ToImmutableArray(); | ||||
| } | } | ||||
| public static async Task<RestInvite> GetInviteAsync(BaseDiscordClient client, | |||||
| public static async Task<RestInviteMetadata> GetInviteAsync(BaseDiscordClient client, | |||||
| string inviteId, bool withCount, RequestOptions options) | string inviteId, bool withCount, RequestOptions options) | ||||
| { | { | ||||
| var args = new GetInviteParams | var args = new GetInviteParams | ||||
| @@ -59,7 +59,7 @@ namespace Discord.Rest | |||||
| }; | }; | ||||
| var model = await client.ApiClient.GetInviteAsync(inviteId, args, options).ConfigureAwait(false); | var model = await client.ApiClient.GetInviteAsync(inviteId, args, options).ConfigureAwait(false); | ||||
| if (model != null) | if (model != null) | ||||
| return RestInvite.Create(client, null, null, model); | |||||
| return RestInviteMetadata.Create(client, null, null, model); | |||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -897,7 +897,7 @@ namespace Discord.API | |||||
| } | } | ||||
| //Guild Invites | //Guild Invites | ||||
| public async Task<Invite> GetInviteAsync(string inviteId, GetInviteParams args, RequestOptions options = null) | |||||
| public async Task<InviteMetadata> GetInviteAsync(string inviteId, GetInviteParams args, RequestOptions options = null) | |||||
| { | { | ||||
| Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); | Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); | ||||
| options = RequestOptions.CreateOrClone(options); | options = RequestOptions.CreateOrClone(options); | ||||
| @@ -912,7 +912,7 @@ namespace Discord.API | |||||
| try | try | ||||
| { | { | ||||
| return await SendJsonAsync<Invite>("GET", () => $"invites/{inviteId}", args, new BucketIds(), options: options).ConfigureAwait(false); | |||||
| return await SendJsonAsync<InviteMetadata>("GET", () => $"invites/{inviteId}", args, new BucketIds(), options: options).ConfigureAwait(false); | |||||
| } | } | ||||
| catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; } | catch (HttpException ex) when (ex.HttpCode == HttpStatusCode.NotFound) { return null; } | ||||
| } | } | ||||
| @@ -56,7 +56,7 @@ namespace Discord.Rest | |||||
| => ClientHelper.GetConnectionsAsync(this, options); | => ClientHelper.GetConnectionsAsync(this, options); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public Task<RestInvite> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null) | |||||
| public Task<RestInviteMetadata> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null) | |||||
| => ClientHelper.GetInviteAsync(this, inviteId, withCount, options); | => ClientHelper.GetInviteAsync(this, inviteId, withCount, options); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| @@ -55,8 +55,8 @@ namespace Discord.WebSocket | |||||
| public Task<IReadOnlyCollection<RestConnection>> GetConnectionsAsync(RequestOptions options = null) | public Task<IReadOnlyCollection<RestConnection>> GetConnectionsAsync(RequestOptions options = null) | ||||
| => ClientHelper.GetConnectionsAsync(this, options ?? RequestOptions.Default); | => ClientHelper.GetConnectionsAsync(this, options ?? RequestOptions.Default); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public Task<RestInvite> GetInviteAsync(string inviteId, RequestOptions options = null) | |||||
| => ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default); | |||||
| public Task<RestInviteMetadata> GetInviteAsync(string inviteId, bool withCount = false, RequestOptions options = null) | |||||
| => ClientHelper.GetInviteAsync(this, inviteId, withCount, options ?? RequestOptions.Default); | |||||
| // IDiscordClient | // IDiscordClient | ||||
| async Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options) | async Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options) | ||||
| @@ -70,8 +70,8 @@ namespace Discord.WebSocket | |||||
| async Task<IReadOnlyCollection<IConnection>> IDiscordClient.GetConnectionsAsync(RequestOptions options) | async Task<IReadOnlyCollection<IConnection>> IDiscordClient.GetConnectionsAsync(RequestOptions options) | ||||
| => await GetConnectionsAsync(options).ConfigureAwait(false); | => await GetConnectionsAsync(options).ConfigureAwait(false); | ||||
| async Task<IInvite> IDiscordClient.GetInviteAsync(string inviteId, RequestOptions options) | |||||
| => await GetInviteAsync(inviteId, options).ConfigureAwait(false); | |||||
| async Task<IInvite> IDiscordClient.GetInviteAsync(string inviteId, bool withCount, RequestOptions options) | |||||
| => await GetInviteAsync(inviteId, withCount, options).ConfigureAwait(false); | |||||
| Task<IGuild> IDiscordClient.GetGuildAsync(ulong id, CacheMode mode, RequestOptions options) | Task<IGuild> IDiscordClient.GetGuildAsync(ulong id, CacheMode mode, RequestOptions options) | ||||
| => Task.FromResult<IGuild>(GetGuild(id)); | => Task.FromResult<IGuild>(GetGuild(id)); | ||||