Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix int in shared_users json serialization #375

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class UsersShared implements Serializable {
private final static long serialVersionUID = 0L;

private Integer request_id;
private Integer[] user_ids;
private Long[] user_ids;
private SharedUser[] users;

public Integer requestId() {
Expand All @@ -25,7 +25,7 @@ public SharedUser[] users() {
* @deprecated Use {@link UsersShared#users()} instead
*/
@Deprecated
public Integer[] userIds() {
public Long[] userIds() {
return user_ids;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public class SharedUser implements Serializable {

private final static long serialVersionUID = 0L;

private Integer user_id;
private Long user_id;
private String first_name;
private String last_name;
private String username;
private PhotoSize[] photo;

public Integer userId() {
public Long userId() {
return user_id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
public class BotUtilsTest {

final String updateStr = "{\"update_id\":874199391,\n" +
"\"message\":{\"message_id\":33111,\"from\":{\"id\":1231231231,\"is_bot\":false,\"first_name\":\"RRRR\",\"username\":\"RRRR54321\"},\"chat\":{\"id\":-23123123123123,\"title\":\"hhh iiiiii ccccc\",\"type\":\"supergroup\"},\"date\":1579958705,\"text\":\"block the news\"}}";
"\"message\":{\"message_id\":33111,\"from\":{\"id\":1231231231,\"is_bot\":false,\"first_name\":\"RRRR\",\"username\":\"RRRR54321\"},\"chat\":{\"id\":-23123123123123,\"title\":\"hhh iiiiii ccccc\",\"type\":\"supergroup\"},\"user_shared\":{\"user_id\":6111111111,\"request_id\":1},\"users_shared\":{\"user_ids\":[6111111111],\"users\":[{\"user_id\":6111111111,\"first_name\":\"FirstNameTest\",\"last_name\":\"LastNameTest\"}],\"request_id\":1},\"date\":1579958705,\"text\":\"block the news\"}}";

private void check(Update update) {
assertEquals(update.updateId(), Integer.valueOf(874199391));
assertEquals(update.message().messageId(), Integer.valueOf(33111));
assertEquals(update.message().usersShared().users()[0].userId(), Long.valueOf(6111111111L));
}

@Test
Expand All @@ -51,5 +52,4 @@ public void parseNull() {
assertNull(BotUtils.fromJson(null, SendResponse.class));
assertNull(BotUtils.fromJson("",SendResponse.class));
}

}
Loading