Skip to content

Commit fd2ad69

Browse files
authored
fix(model): add VanityUrl uses (#2257)
The VanityUrl model used for the response from [/guilds/{guild.id}/vanity-url](https://discord.com/developers/docs/resources/guild#get-guild-vanity-url) is missing the `uses` field. Despite what the aforementioned docs say, the code will not be null if the vanity url is not set, instead, you get a `403` response, so I did not make any additional changes beyond adding the uses field.
1 parent 5868426 commit fd2ad69

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

twilight-model/src/guild/vanity_url.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ pub struct VanityUrl {
88
/// For example, in an invite of `discord.gg/applejack`, the code is
99
/// `applejack`.
1010
pub code: String,
11+
/// Number of times the vanity URL has been used.
12+
pub uses: u64,
1113
}
1214

1315
#[cfg(test)]
@@ -19,16 +21,19 @@ mod tests {
1921
fn vanity_url() {
2022
let url = VanityUrl {
2123
code: "a".to_owned(),
24+
uses: 12,
2225
};
2326
serde_test::assert_tokens(
2427
&url,
2528
&[
2629
Token::Struct {
2730
name: "VanityUrl",
28-
len: 1,
31+
len: 2,
2932
},
3033
Token::String("code"),
3134
Token::String("a"),
35+
Token::String("uses"),
36+
Token::U64(12),
3237
Token::StructEnd,
3338
],
3439
);

0 commit comments

Comments
 (0)