diff --git a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs index 738c5e9cc..b4625abbf 100644 --- a/src/Discord.Net.Core/Entities/Guilds/IGuild.cs +++ b/src/Discord.Net.Core/Entities/Guilds/IGuild.cs @@ -729,16 +729,14 @@ namespace Discord Task> GetIntegrationsAsync(RequestOptions options = null); /// - /// Creates a new integration. + /// Deletes an integration. /// /// The id for the integration. - /// The type of integration. /// The options to be used when sending the request. /// - /// A task that represents the asynchronous creation operation. The task result contains the newly created - /// integration. + /// A task that represents the asynchronous removal operation. /// - Task CreateIntegrationAsync(ulong id, string type, RequestOptions options = null); + Task DeleteIntegrationAsync(ulong id, RequestOptions options = null); /// /// Gets a collection of all invites in this guild. diff --git a/src/Discord.Net.Core/Entities/Users/IConnection.cs b/src/Discord.Net.Core/Entities/Users/IConnection.cs index 0f38931f9..94b23a4b5 100644 --- a/src/Discord.Net.Core/Entities/Users/IConnection.cs +++ b/src/Discord.Net.Core/Entities/Users/IConnection.cs @@ -4,27 +4,53 @@ namespace Discord { public interface IConnection { - /// Gets the ID of the connection account. - /// A representing the unique identifier value of this connection. + /// + /// Gets the ID of the connection account. + /// + /// + /// A representing the unique identifier value of this connection. + /// string Id { get; } - /// Gets the username of the connection account. - /// A string containing the name of this connection. + /// + /// Gets the username of the connection account. + /// + /// + /// A string containing the name of this connection. + /// string Name { get; } - /// Gets the service of the connection (twitch, youtube). - /// A string containing the name of this type of connection. + /// + /// Gets the service of the connection (twitch, youtube). + /// + /// + /// A string containing the name of this type of connection. + /// string Type { get; } - /// Gets whether the connection is revoked. - /// A value which if true indicates that this connection has been revoked, otherwise false. + /// + /// Gets whether the connection is revoked. + /// + /// + /// A value which if true indicates that this connection has been revoked, otherwise false. + /// bool? IsRevoked { get; } - /// Gets a of integration parials. + /// + /// Gets a of integration parials. + /// IReadOnlyCollection Integrations { get; } - /// Gets whether the connection is verified. + /// + /// Gets whether the connection is verified. + /// bool Verified { get; } - /// Gets whether friend sync is enabled for this connection. + /// + /// Gets whether friend sync is enabled for this connection. + /// bool FriendSync { get; } - /// Gets whether activities related to this connection will be shown in presence updates. + /// + /// Gets whether activities related to this connection will be shown in presence updates. + /// bool ShowActivity { get; } - /// Visibility of this connection. + /// + /// Visibility of this connection. + /// ConnectionVisibility Visibility { get; } } } diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index f6d579d79..645e6711c 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -1626,7 +1626,7 @@ namespace Discord.API #region Guild Integrations /// must not be equal to zero. - public async Task> GetGuildIntegrationsAsync(ulong guildId, RequestOptions options = null) + public async Task> GetIntegrationsAsync(ulong guildId, RequestOptions options = null) { Preconditions.NotEqual(guildId, 0, nameof(guildId)); options = RequestOptions.CreateOrClone(options); @@ -1634,47 +1634,14 @@ namespace Discord.API var ids = new BucketIds(guildId: guildId); return await SendAsync>("GET", () => $"guilds/{guildId}/integrations", ids, options: options).ConfigureAwait(false); } - /// and must not be equal to zero. - /// must not be . - public async Task CreateGuildIntegrationAsync(ulong guildId, CreateGuildIntegrationParams args, RequestOptions options = null) - { - Preconditions.NotEqual(guildId, 0, nameof(guildId)); - Preconditions.NotNull(args, nameof(args)); - Preconditions.NotEqual(args.Id, 0, nameof(args.Id)); - options = RequestOptions.CreateOrClone(options); - - var ids = new BucketIds(guildId: guildId); - return await SendAsync("POST", () => $"guilds/{guildId}/integrations", ids, options: options).ConfigureAwait(false); - } - public async Task DeleteGuildIntegrationAsync(ulong guildId, ulong integrationId, RequestOptions options = null) - { - Preconditions.NotEqual(guildId, 0, nameof(guildId)); - Preconditions.NotEqual(integrationId, 0, nameof(integrationId)); - options = RequestOptions.CreateOrClone(options); - - var ids = new BucketIds(guildId: guildId); - return await SendAsync("DELETE", () => $"guilds/{guildId}/integrations/{integrationId}", ids, options: options).ConfigureAwait(false); - } - public async Task ModifyGuildIntegrationAsync(ulong guildId, ulong integrationId, Rest.ModifyGuildIntegrationParams args, RequestOptions options = null) - { - Preconditions.NotEqual(guildId, 0, nameof(guildId)); - Preconditions.NotEqual(integrationId, 0, nameof(integrationId)); - Preconditions.NotNull(args, nameof(args)); - Preconditions.AtLeast(args.ExpireBehavior, 0, nameof(args.ExpireBehavior)); - Preconditions.AtLeast(args.ExpireGracePeriod, 0, nameof(args.ExpireGracePeriod)); - options = RequestOptions.CreateOrClone(options); - - var ids = new BucketIds(guildId: guildId); - return await SendJsonAsync("PATCH", () => $"guilds/{guildId}/integrations/{integrationId}", args, ids, options: options).ConfigureAwait(false); - } - public async Task SyncGuildIntegrationAsync(ulong guildId, ulong integrationId, RequestOptions options = null) + public async Task DeleteIntegrationAsync(ulong guildId, ulong integrationId, RequestOptions options = null) { Preconditions.NotEqual(guildId, 0, nameof(guildId)); Preconditions.NotEqual(integrationId, 0, nameof(integrationId)); options = RequestOptions.CreateOrClone(options); var ids = new BucketIds(guildId: guildId); - return await SendAsync("POST", () => $"guilds/{guildId}/integrations/{integrationId}/sync", ids, options: options).ConfigureAwait(false); + await SendAsync("DELETE", () => $"guilds/{guildId}/integrations/{integrationId}", ids, options: options).ConfigureAwait(false); } #endregion diff --git a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs index 061d2b5f8..7dbe20881 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/GuildHelper.cs @@ -308,16 +308,12 @@ namespace Discord.Rest public static async Task> GetIntegrationsAsync(IGuild guild, BaseDiscordClient client, RequestOptions options) { - var models = await client.ApiClient.GetGuildIntegrationsAsync(guild.Id, options).ConfigureAwait(false); + var models = await client.ApiClient.GetIntegrationsAsync(guild.Id, options).ConfigureAwait(false); return models.Select(x => RestIntegration.Create(client, guild, x)).ToImmutableArray(); } - public static async Task CreateIntegrationAsync(IGuild guild, BaseDiscordClient client, - ulong id, string type, RequestOptions options) - { - var args = new CreateGuildIntegrationParams(id, type); - var model = await client.ApiClient.CreateGuildIntegrationAsync(guild.Id, args, options).ConfigureAwait(false); - return RestIntegration.Create(client, guild, model); - } + public static async Task DeleteIntegrationAsync(IGuild guild, BaseDiscordClient client, ulong id, + RequestOptions options) => + await client.ApiClient.DeleteIntegrationAsync(guild.Id, id, options).ConfigureAwait(false); #endregion #region Interactions diff --git a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs index fd62bc1db..8d50f873f 100644 --- a/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs +++ b/src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs @@ -722,8 +722,8 @@ namespace Discord.Rest #region Integrations public Task> GetIntegrationsAsync(RequestOptions options = null) => GuildHelper.GetIntegrationsAsync(this, Discord, options); - public Task CreateIntegrationAsync(ulong id, string type, RequestOptions options = null) - => GuildHelper.CreateIntegrationAsync(this, Discord, id, type, options); + public Task DeleteIntegrationAsync(ulong id, RequestOptions options = null) + => GuildHelper.DeleteIntegrationAsync(this, Discord, id, options); #endregion #region Invites @@ -1378,8 +1378,8 @@ namespace Discord.Rest async Task> IGuild.GetIntegrationsAsync(RequestOptions options) => await GetIntegrationsAsync(options).ConfigureAwait(false); /// - async Task IGuild.CreateIntegrationAsync(ulong id, string type, RequestOptions options) - => await CreateIntegrationAsync(id, type, options).ConfigureAwait(false); + async Task IGuild.DeleteIntegrationAsync(ulong id, RequestOptions options) + => await DeleteIntegrationAsync(id, options).ConfigureAwait(false); /// async Task> IGuild.GetInvitesAsync(RequestOptions options) diff --git a/src/Discord.Net.Rest/Entities/Integrations/RestIntegration.cs b/src/Discord.Net.Rest/Entities/Integrations/RestIntegration.cs index 7748dbca3..55b46beac 100644 --- a/src/Discord.Net.Rest/Entities/Integrations/RestIntegration.cs +++ b/src/Discord.Net.Rest/Entities/Integrations/RestIntegration.cs @@ -76,12 +76,7 @@ namespace Discord.Rest public async Task DeleteAsync() { - await Discord.ApiClient.DeleteGuildIntegrationAsync(GuildId, Id).ConfigureAwait(false); - } - - public async Task SyncAsync() - { - await Discord.ApiClient.SyncGuildIntegrationAsync(GuildId, Id).ConfigureAwait(false); + await Discord.ApiClient.DeleteIntegrationAsync(GuildId, Id).ConfigureAwait(false); } public override string ToString() => Name; diff --git a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs index 56a1671f6..9497c80a7 100644 --- a/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs +++ b/src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs @@ -849,8 +849,8 @@ namespace Discord.WebSocket #region Integrations public Task> GetIntegrationsAsync(RequestOptions options = null) => GuildHelper.GetIntegrationsAsync(this, Discord, options); - public Task CreateIntegrationAsync(ulong id, string type, RequestOptions options = null) - => GuildHelper.CreateIntegrationAsync(this, Discord, id, type, options); + public Task DeleteIntegrationAsync(ulong id, RequestOptions options = null) + => GuildHelper.DeleteIntegrationAsync(this, Discord, id, options); #endregion #region Interactions @@ -1895,8 +1895,8 @@ namespace Discord.WebSocket async Task> IGuild.GetIntegrationsAsync(RequestOptions options) => await GetIntegrationsAsync(options).ConfigureAwait(false); /// - async Task IGuild.CreateIntegrationAsync(ulong id, string type, RequestOptions options) - => await CreateIntegrationAsync(id, type, options).ConfigureAwait(false); + async Task IGuild.DeleteIntegrationAsync(ulong id, RequestOptions options) + => await DeleteIntegrationAsync(id, options).ConfigureAwait(false); /// async Task> IGuild.GetInvitesAsync(RequestOptions options)