| @@ -20,7 +20,7 @@ namespace Discord | |||||
| /// <param name="maxAge"> The time (in seconds) until the invite expires. Set to null to never expire. </param> | /// <param name="maxAge"> The time (in seconds) until the invite expires. Set to null to never expire. </param> | ||||
| /// <param name="maxUses"> The max amount of times this invite may be used. Set to null to have unlimited uses. </param> | /// <param name="maxUses"> The max amount of times this invite may be used. Set to null to have unlimited uses. </param> | ||||
| /// <param name="isTemporary"> If true, a user accepting this invite will be kicked from the guild after closing their client. </param> | /// <param name="isTemporary"> If true, a user accepting this invite will be kicked from the guild after closing their client. </param> | ||||
| Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false, RequestOptions options = null); | |||||
| Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 1800, int? maxUses = default(int?), bool isTemporary = false, bool isUnique = false, RequestOptions options = null); | |||||
| /// <summary> Returns a collection of all invites to this channel. </summary> | /// <summary> Returns a collection of all invites to this channel. </summary> | ||||
| Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null); | Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null); | ||||
| @@ -12,5 +12,7 @@ namespace Discord.API.Rest | |||||
| public Optional<int> MaxUses { get; set; } | public Optional<int> MaxUses { get; set; } | ||||
| [JsonProperty("temporary")] | [JsonProperty("temporary")] | ||||
| public Optional<bool> IsTemporary { get; set; } | public Optional<bool> IsTemporary { get; set; } | ||||
| [JsonProperty("unique")] | |||||
| public Optional<bool> IsUnique { get; set; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -69,9 +69,9 @@ namespace Discord.Rest | |||||
| return models.Select(x => RestInviteMetadata.Create(client, null, channel, x)).ToImmutableArray(); | return models.Select(x => RestInviteMetadata.Create(client, null, channel, x)).ToImmutableArray(); | ||||
| } | } | ||||
| public static async Task<RestInviteMetadata> CreateInviteAsync(IGuildChannel channel, BaseDiscordClient client, | public static async Task<RestInviteMetadata> CreateInviteAsync(IGuildChannel channel, BaseDiscordClient client, | ||||
| int? maxAge, int? maxUses, bool isTemporary, RequestOptions options) | |||||
| int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | |||||
| { | { | ||||
| var args = new CreateChannelInviteParams { IsTemporary = isTemporary }; | |||||
| var args = new CreateChannelInviteParams { IsTemporary = isTemporary, IsUnique = isUnique }; | |||||
| if (maxAge.HasValue) | if (maxAge.HasValue) | ||||
| args.MaxAge = maxAge.Value; | args.MaxAge = maxAge.Value; | ||||
| else | else | ||||
| @@ -118,8 +118,8 @@ namespace Discord.Rest | |||||
| public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | ||||
| => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | ||||
| public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, RequestOptions options = null) | |||||
| => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false); | |||||
| public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | |||||
| => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||||
| public override string ToString() => Name; | public override string ToString() => Name; | ||||
| @@ -136,8 +136,8 @@ namespace Discord.Rest | |||||
| async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | ||||
| => await GetInvitesAsync(options).ConfigureAwait(false); | => await GetInvitesAsync(options).ConfigureAwait(false); | ||||
| async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, RequestOptions options) | |||||
| => await CreateInviteAsync(maxAge, maxUses, isTemporary, options).ConfigureAwait(false); | |||||
| async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | |||||
| => await CreateInviteAsync(maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||||
| OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role) | OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role) | ||||
| => GetPermissionOverwrite(role); | => GetPermissionOverwrite(role); | ||||
| @@ -51,8 +51,8 @@ namespace Discord.Rpc | |||||
| public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | ||||
| => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | ||||
| public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, RequestOptions options = null) | |||||
| => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false); | |||||
| public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | |||||
| => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||||
| public override string ToString() => Name; | public override string ToString() => Name; | ||||
| @@ -68,8 +68,8 @@ namespace Discord.Rpc | |||||
| async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | ||||
| => await GetInvitesAsync(options).ConfigureAwait(false); | => await GetInvitesAsync(options).ConfigureAwait(false); | ||||
| async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, RequestOptions options) | |||||
| => await CreateInviteAsync(maxAge, maxUses, isTemporary, options).ConfigureAwait(false); | |||||
| async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | |||||
| => await CreateInviteAsync(maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||||
| IReadOnlyCollection<Overwrite> IGuildChannel.PermissionOverwrites { get { throw new NotSupportedException(); } } | IReadOnlyCollection<Overwrite> IGuildChannel.PermissionOverwrites { get { throw new NotSupportedException(); } } | ||||
| OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IUser user) | OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IUser user) | ||||
| @@ -112,8 +112,8 @@ namespace Discord.WebSocket | |||||
| public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | public async Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null) | ||||
| => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | => await ChannelHelper.GetInvitesAsync(this, Discord, options).ConfigureAwait(false); | ||||
| public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, RequestOptions options = null) | |||||
| => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, options).ConfigureAwait(false); | |||||
| public async Task<RestInviteMetadata> CreateInviteAsync(int? maxAge = 3600, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null) | |||||
| => await ChannelHelper.CreateInviteAsync(this, Discord, maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||||
| public new abstract SocketGuildUser GetUser(ulong id); | public new abstract SocketGuildUser GetUser(ulong id); | ||||
| @@ -130,8 +130,8 @@ namespace Discord.WebSocket | |||||
| async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | async Task<IReadOnlyCollection<IInviteMetadata>> IGuildChannel.GetInvitesAsync(RequestOptions options) | ||||
| => await GetInvitesAsync(options).ConfigureAwait(false); | => await GetInvitesAsync(options).ConfigureAwait(false); | ||||
| async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, RequestOptions options) | |||||
| => await CreateInviteAsync(maxAge, maxUses, isTemporary, options).ConfigureAwait(false); | |||||
| async Task<IInviteMetadata> IGuildChannel.CreateInviteAsync(int? maxAge, int? maxUses, bool isTemporary, bool isUnique, RequestOptions options) | |||||
| => await CreateInviteAsync(maxAge, maxUses, isTemporary, isUnique, options).ConfigureAwait(false); | |||||
| OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role) | OverwritePermissions? IGuildChannel.GetPermissionOverwrite(IRole role) | ||||
| => GetPermissionOverwrite(role); | => GetPermissionOverwrite(role); | ||||