* It was kinda stupid in the first place, might as well always get the count instead of having to ask the user whether they want the two fields filled or not.pull/1094/head
| @@ -1,7 +0,0 @@ | |||||
| namespace Discord.API.Rest | |||||
| { | |||||
| internal class GetInviteParams | |||||
| { | |||||
| public Optional<bool?> WithCounts { get; set; } | |||||
| } | |||||
| } | |||||
| @@ -51,13 +51,9 @@ namespace Discord.Rest | |||||
| } | } | ||||
| public static async Task<RestInviteMetadata> GetInviteAsync(BaseDiscordClient client, | public static async Task<RestInviteMetadata> GetInviteAsync(BaseDiscordClient client, | ||||
| string inviteId, bool withCount, RequestOptions options) | |||||
| string inviteId, RequestOptions options) | |||||
| { | { | ||||
| var args = new GetInviteParams | |||||
| { | |||||
| WithCounts = withCount | |||||
| }; | |||||
| var model = await client.ApiClient.GetInviteAsync(inviteId, args, options).ConfigureAwait(false); | |||||
| var model = await client.ApiClient.GetInviteAsync(inviteId, options).ConfigureAwait(false); | |||||
| if (model != null) | if (model != null) | ||||
| return RestInviteMetadata.Create(client, null, null, model); | return RestInviteMetadata.Create(client, null, null, model); | ||||
| return null; | return null; | ||||
| @@ -906,7 +906,7 @@ namespace Discord.API | |||||
| } | } | ||||
| //Guild Invites | //Guild Invites | ||||
| public async Task<InviteMetadata> GetInviteAsync(string inviteId, GetInviteParams args, RequestOptions options = null) | |||||
| public async Task<InviteMetadata> GetInviteAsync(string inviteId, RequestOptions options = null) | |||||
| { | { | ||||
| Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); | Preconditions.NotNullOrEmpty(inviteId, nameof(inviteId)); | ||||
| options = RequestOptions.CreateOrClone(options); | options = RequestOptions.CreateOrClone(options); | ||||
| @@ -919,11 +919,9 @@ namespace Discord.API | |||||
| if (index >= 0) | if (index >= 0) | ||||
| inviteId = inviteId.Substring(index + 1); | inviteId = inviteId.Substring(index + 1); | ||||
| var withCounts = args.WithCounts.GetValueOrDefault(false); | |||||
| try | try | ||||
| { | { | ||||
| return await SendAsync<InviteMetadata>("GET", () => $"invites/{inviteId}?with_counts={withCounts}", new BucketIds(), options: options).ConfigureAwait(false); | |||||
| return await SendAsync<InviteMetadata>("GET", () => $"invites/{inviteId}?with_counts=true", 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; } | ||||
| } | } | ||||
| @@ -57,7 +57,7 @@ namespace Discord.Rest | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public Task<RestInviteMetadata> 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, options); | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public Task<RestGuild> GetGuildAsync(ulong id, RequestOptions options = null) | public Task<RestGuild> GetGuildAsync(ulong id, RequestOptions options = null) | ||||
| @@ -45,10 +45,7 @@ namespace Discord.Rest | |||||
| public async Task UpdateAsync(RequestOptions options = null) | public async Task UpdateAsync(RequestOptions options = null) | ||||
| { | { | ||||
| var args = new GetInviteParams(); | |||||
| if (MemberCount != null || PresenceCount != null) | |||||
| args.WithCounts = true; | |||||
| var model = await Discord.ApiClient.GetInviteAsync(Code, args, options).ConfigureAwait(false); | |||||
| var model = await Discord.ApiClient.GetInviteAsync(Code, options).ConfigureAwait(false); | |||||
| Update(model); | Update(model); | ||||
| } | } | ||||
| public Task DeleteAsync(RequestOptions options = null) | public Task DeleteAsync(RequestOptions options = null) | ||||
| @@ -56,7 +56,7 @@ namespace Discord.WebSocket | |||||
| => ClientHelper.GetConnectionsAsync(this, options ?? RequestOptions.Default); | => ClientHelper.GetConnectionsAsync(this, options ?? RequestOptions.Default); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public Task<RestInviteMetadata> 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 ?? RequestOptions.Default); | |||||
| => ClientHelper.GetInviteAsync(this, inviteId, options ?? RequestOptions.Default); | |||||
| // IDiscordClient | // IDiscordClient | ||||
| async Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options) | async Task<IApplication> IDiscordClient.GetApplicationInfoAsync(RequestOptions options) | ||||