Mark guild optional in invite & general invite improvement (#1094)

* Mark guild as optional for invite

* Mark partial InviteMetadata members as Optional<T>

* Some of them aren't sent when requesting through the general GET invite endpoint

* Remove GetInviteParams

* 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.

* Add ChannelType property

* Add vanity invite support
This commit is contained in:
Still Hsu
2018-07-03 05:02:38 +08:00
committed by Christopher F
parent 4bc06a0a54
commit ffe994a9df
17 changed files with 84 additions and 52 deletions

View File

@@ -8,7 +8,7 @@ namespace Discord.API
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("guild")]
public InviteGuild Guild { get; set; }
public Optional<InviteGuild> Guild { get; set; }
[JsonProperty("channel")]
public InviteChannel Channel { get; set; }
[JsonProperty("approximate_presence_count")]

View File

@@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using Newtonsoft.Json;
namespace Discord.API
@@ -10,6 +10,6 @@ namespace Discord.API
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
public int Type { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
#pragma warning disable CS1591
#pragma warning disable CS1591
using Newtonsoft.Json;
using System;
@@ -9,15 +9,15 @@ namespace Discord.API
[JsonProperty("inviter")]
public User Inviter { get; set; }
[JsonProperty("uses")]
public int Uses { get; set; }
public Optional<int> Uses { get; set; }
[JsonProperty("max_uses")]
public int MaxUses { get; set; }
public Optional<int> MaxUses { get; set; }
[JsonProperty("max_age")]
public int MaxAge { get; set; }
public Optional<int> MaxAge { get; set; }
[JsonProperty("temporary")]
public bool Temporary { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
public Optional<DateTimeOffset> CreatedAt { get; set; }
[JsonProperty("revoked")]
public bool Revoked { get; set; }
}

View File

@@ -1,7 +0,0 @@
namespace Discord.API.Rest
{
internal class GetInviteParams
{
public Optional<bool?> WithCounts { get; set; }
}
}