Skip to content

Commit

Permalink
Merge #60 into 1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
quanticc committed Apr 10, 2021
2 parents aca0fd6 + 0ae1cd6 commit b2edd0f
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 16 deletions.
13 changes: 13 additions & 0 deletions src/main/java/discord4j/discordjson/json/InviteCreateRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,21 @@ static ImmutableInviteCreateRequest.Builder builder() {

@JsonProperty("max_age")
Possible<Integer> maxAge();

@JsonProperty("max_uses")
Possible<Integer> maxUses();

Possible<Boolean> temporary();

Possible<Boolean> unique();

@JsonProperty("target_type")
Possible<Integer> targetType();

@JsonProperty("target_user_id")
Possible<String> targetUserId();

@JsonProperty("target_application_id")
Possible<String> targetApplicationId();

}
24 changes: 21 additions & 3 deletions src/main/java/discord4j/discordjson/json/InviteData.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,41 @@ static ImmutableInviteData.Builder builder() {
}

String code();

Possible<PartialGuildData> guild();

ChannelData channel();

Possible<UserData> inviter();

@JsonProperty("target_type")
Possible<Integer> targetType();

@JsonProperty("target_user")
Possible<UserData> targetUser();
@JsonProperty("target_user_type")
Possible<Integer> targetUserType();

/* TODO
* @JsonProperty("target_application")
* Possible<?> targetApplication();
*/

@JsonProperty("approximate_presence_count")
Possible<Integer> approximatePresenceCount();

@JsonProperty("approximate_member_count")
Possible<Integer> approximateMemberCount();
Possible<UserData> inviter();

Possible<Integer> uses();

@JsonProperty("max_uses")
Possible<Integer> maxUses();

@JsonProperty("max_age")
Possible<Integer> maxAge();

Possible<Boolean> temporary();

@JsonProperty("created_at")
Possible<String> createdAt();

}
28 changes: 17 additions & 11 deletions src/main/java/discord4j/discordjson/json/gateway/InviteCreate.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ static ImmutableInviteCreate.Builder builder() {
return ImmutableInviteCreate.builder();
}

@JsonProperty("guild_id")
Id guildId();

@JsonProperty("channel_id")
Id channelId();

Expand All @@ -29,21 +26,30 @@ static ImmutableInviteCreate.Builder builder() {
@JsonProperty("created_at")
String createdAt();

int uses();
@JsonProperty("guild_id")
Id guildId();

@JsonProperty("max_uses")
int maxUses();
Possible<UserData> inviter();

@JsonProperty("max_age")
int maxAge();

boolean temporary();
@JsonProperty("max_uses")
int maxUses();

Possible<UserData> inviter();
@JsonProperty("target_type")
Possible<Integer> targetType();

@JsonProperty("target_user")
Possible<PartialUserData> targetUser();
Possible<UserData> targetUser();

/* TODO
* @JsonProperty("target_application")
* Possible<?> targetApplication();
*/

boolean temporary();

int uses();

@JsonProperty("target_user_type")
Possible<Integer> targetUserType();
}
23 changes: 22 additions & 1 deletion src/test/resources/gateway/InviteCreate.json
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
{"t":"INVITE_CREATE","s":347,"op":0,"d":{"uses":0,"temporary":true,"max_uses":0,"max_age":1,"inviter":{"username":"Test Bot","id":"123456789012345678","discriminator":"7519","bot":true,"avatar":null},"guild_id":"123456789012345678","created_at":"2020-03-02T02:59:57.827006+00:00","code":"abcdef","channel_id":"123456789012345678"}}
{
"t": "INVITE_CREATE",
"s": 347,
"op": 0,
"d": {
"uses": 0,
"temporary": true,
"max_uses": 0,
"max_age": 1,
"inviter": {
"username": "Test Bot",
"id": "123456789012345678",
"discriminator": "7519",
"bot": true,
"avatar": null
},
"guild_id": "123456789012345678",
"created_at": "2020-03-02T02:59:57.827006+00:00",
"code": "abcdef",
"channel_id": "123456789012345678"
}
}
9 changes: 8 additions & 1 deletion src/test/resources/rest/ChannelInvites.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@
"avatar": "131465a8db769b66e2b9837072be47a1",
"discriminator": "7924"
},
"target_user": {
"id": "165176875973476352",
"username": "bob",
"avatar": "deadbeef",
"discriminator": "1234"
},
"target_user_type": 1,
"uses": 6,
"max_uses": 0,
"max_age": 0,
"temporary": false,
"created_at": "2017-08-14T18:56:09.181000+00:00"
}
]
]

0 comments on commit b2edd0f

Please sign in to comment.