Browse Source

keep obsolete properties and return types for compatibility

pull/1639/head
Fyers 4 years ago
parent
commit
7316ef07da
3 changed files with 16 additions and 8 deletions
  1. +8
    -4
      src/Discord.Net.Core/Entities/Invites/IInviteMetadata.cs
  2. +2
    -0
      src/Discord.Net.Rest/API/Common/InviteMetadata.cs
  3. +6
    -4
      src/Discord.Net.Rest/Entities/Invites/RestInviteMetadata.cs

+ 8
- 4
src/Discord.Net.Core/Entities/Invites/IInviteMetadata.cs View File

@@ -15,6 +15,10 @@ namespace Discord
/// <c>false</c>.
/// </returns>
bool IsTemporary { get; }

[Obsolete("This will always return false. If an invite is revoked, it will not be found and the invite will be null.")]
bool IsRevoked { get; }

/// <summary>
/// Gets the time (in seconds) until the invite expires.
/// </summary>
@@ -22,7 +26,7 @@ namespace Discord
/// An <see cref="int"/> representing the time in seconds until this invite expires; <c>null</c> if this
/// invite never expires.
/// </returns>
int MaxAge { get; }
int? MaxAge { get; }
/// <summary>
/// Gets the max number of uses this invite may have.
/// </summary>
@@ -30,20 +34,20 @@ namespace Discord
/// An <see cref="int"/> representing the number of uses this invite may be accepted until it is removed
/// from the guild; <c>null</c> if none is set.
/// </returns>
int MaxUses { get; }
int? MaxUses { get; }
/// <summary>
/// Gets the number of times this invite has been used.
/// </summary>
/// <returns>
/// An <see cref="int"/> representing the number of times this invite has been used.
/// </returns>
int Uses { get; }
int? Uses { get; }
/// <summary>
/// Gets when this invite was created.
/// </summary>
/// <returns>
/// A <see cref="DateTimeOffset"/> representing the time of which the invite was first created.
/// </returns>
DateTimeOffset CreatedAt { get; }
DateTimeOffset? CreatedAt { get; }
}
}

+ 2
- 0
src/Discord.Net.Rest/API/Common/InviteMetadata.cs View File

@@ -16,5 +16,7 @@ namespace Discord.API
public bool Temporary { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[Obsolete("This will always return false. If an invite is revoked, it will not be found and the invite will be null.")]
public bool Revoked { get; set; }
}
}

+ 6
- 4
src/Discord.Net.Rest/Entities/Invites/RestInviteMetadata.cs View File

@@ -8,17 +8,19 @@ namespace Discord.Rest
{
private long _createdAtTicks;

[Obsolete("This will always return false. If an invite is revoked, it will not be found and the invite will be null.")]
public bool IsRevoked { get; private set; }
/// <inheritdoc />
public bool IsTemporary { get; private set; }
/// <inheritdoc />
public int MaxAge { get; private set; }
public int? MaxAge { get; private set; }
/// <inheritdoc />
public int MaxUses { get; private set; }
public int? MaxUses { get; private set; }
/// <inheritdoc />
public int Uses { get; private set; }
public int? Uses { get; private set; }

/// <inheritdoc />
public DateTimeOffset CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks);
public DateTimeOffset? CreatedAt => DateTimeUtils.FromTicks(_createdAtTicks);

internal RestInviteMetadata(BaseDiscordClient discord, IGuild guild, IChannel channel, string id)
: base(discord, guild, channel, id)


Loading…
Cancel
Save