Skip to content

Commit 9febea5

Browse files
authored
Merge pull request #242 from mircoianese/api_5.2
Update to BOT API 5.2
2 parents 82a949b + e295f5c commit 9febea5

25 files changed

+239
-36
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
.idea
2+
.vs
3+
.settings
4+
library/bin/*
5+
26
*.iml
7+
*.class
38
.gradle
49
build
510
out
@@ -8,3 +13,6 @@ target
813
.DS_Store
914
local.properties
1015
private.key
16+
.project
17+
library/.classpath
18+
sample/.classpath

library/src/main/java/com/pengrad/telegrambot/model/Contact.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class Contact implements Serializable {
1212
private String phone_number;
1313
private String first_name;
1414
private String last_name;
15-
private Integer user_id;
15+
private Long user_id;
1616
private String vcard;
1717

1818
public String phoneNumber() {
@@ -27,7 +27,7 @@ public String lastName() {
2727
return last_name;
2828
}
2929

30-
public Integer userId() {
30+
public Long userId() {
3131
return user_id;
3232
}
3333

library/src/main/java/com/pengrad/telegrambot/model/InlineQuery.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class InlineQuery implements Serializable {
1414
private Location location;
1515
private String query;
1616
private String offset;
17+
private String chat_type;
1718

1819
public String id() {
1920
return id;
@@ -35,6 +36,10 @@ public String offset() {
3536
return offset;
3637
}
3738

39+
public String chatType() {
40+
return chat_type;
41+
}
42+
3843
@Override
3944
public boolean equals(Object o) {
4045
if (this == o) return true;
@@ -46,8 +51,9 @@ public boolean equals(Object o) {
4651
if (from != null ? !from.equals(that.from) : that.from != null) return false;
4752
if (location != null ? !location.equals(that.location) : that.location != null) return false;
4853
if (query != null ? !query.equals(that.query) : that.query != null) return false;
49-
return offset != null ? offset.equals(that.offset) : that.offset == null;
54+
if (chat_type != null ? !chat_type.equals(that.chat_type) : that.chat_type != null) return false;
5055

56+
return offset != null ? offset.equals(that.offset) : that.offset == null;
5157
}
5258

5359
@Override
@@ -63,6 +69,7 @@ public String toString() {
6369
", location=" + location +
6470
", query='" + query + '\'' +
6571
", offset='" + offset + '\'' +
72+
", chat_type='" + chat_type + '\'' +
6673
'}';
6774
}
6875
}

library/src/main/java/com/pengrad/telegrambot/model/Message.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class Message implements Serializable {
6868
private VoiceChatStarted voice_chat_started;
6969
private VoiceChatEnded voice_chat_ended;
7070
private VoiceChatParticipantsInvited voice_chat_participants_invited;
71+
private VoiceChatScheduled voice_chat_scheduled;
7172
private InlineKeyboardMarkup reply_markup;
7273

7374
public Integer messageId() {
@@ -286,6 +287,10 @@ public VoiceChatParticipantsInvited voiceChatParticipantsInvited() {
286287
return voice_chat_participants_invited;
287288
}
288289

290+
public VoiceChatScheduled voiceChatScheduled() {
291+
return voice_chat_scheduled;
292+
}
293+
289294
public InlineKeyboardMarkup replyMarkup() {
290295
return reply_markup;
291296
}
@@ -349,6 +354,7 @@ public boolean equals(Object o) {
349354
Objects.equals(voice_chat_started, message.voice_chat_started) &&
350355
Objects.equals(voice_chat_ended, message.voice_chat_ended) &&
351356
Objects.equals(voice_chat_participants_invited, message.voice_chat_participants_invited) &&
357+
Objects.equals(voice_chat_scheduled, message.voice_chat_scheduled) &&
352358
Objects.equals(reply_markup, message.reply_markup);
353359
}
354360

@@ -414,6 +420,7 @@ public String toString() {
414420
", voice_chat_started=" + voice_chat_started +
415421
", voice_chat_ended=" + voice_chat_ended +
416422
", voice_chat_participants_invited=" + voice_chat_participants_invited +
423+
", voice_chat_scheduled=" + voice_chat_scheduled +
417424
", reply_markup=" + reply_markup +
418425
'}';
419426
}

library/src/main/java/com/pengrad/telegrambot/model/User.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public class User implements Serializable {
1010
private final static long serialVersionUID = 0L;
1111

12-
private Integer id;
12+
private Long id;
1313
private Boolean is_bot;
1414
private String first_name;
1515
private String last_name;
@@ -22,11 +22,11 @@ public class User implements Serializable {
2222
private User() {
2323
}
2424

25-
public User(Integer id) {
25+
public User(Long id) {
2626
this.id = id;
2727
}
2828

29-
public Integer id() {
29+
public Long id() {
3030
return id;
3131
}
3232

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.pengrad.telegrambot.model;
2+
3+
import java.io.Serializable;
4+
5+
public class VoiceChatScheduled implements Serializable {
6+
7+
private final static long serialVersionUID = 0L;
8+
9+
private Integer start_date;
10+
11+
public Integer startDate() {
12+
return start_date;
13+
}
14+
15+
@Override
16+
public boolean equals(Object o) {
17+
if (this == o) return true;
18+
19+
return o != null && getClass() == o.getClass();
20+
}
21+
22+
@Override
23+
public int hashCode() {
24+
return 1;
25+
}
26+
27+
@Override
28+
public String toString() {
29+
return "VoiceChatScheduled{" +
30+
"start_date=" + start_date +
31+
'}';
32+
}
33+
34+
}

library/src/main/java/com/pengrad/telegrambot/model/request/ChatAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
* 10/21/15.
66
*/
77
public enum ChatAction {
8-
typing, upload_photo, record_video, upload_video, record_audio, upload_audio, upload_document, find_location,
8+
typing, upload_photo, record_video, upload_video, record_voice, upload_voice, upload_document, find_location,
99
record_video_note, upload_video_note
1010
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
package com.pengrad.telegrambot.model.request;
2+
3+
import java.io.Serializable;
4+
5+
public class InputInvoiceMessageContent extends InputMessageContent implements Serializable {
6+
7+
private final static long serialVersionUID = 0L;
8+
9+
private String title;
10+
private String description;
11+
12+
private String payload;
13+
private String provider_token;
14+
15+
private String currency;
16+
private LabeledPrice[] prices;
17+
18+
private Integer max_tip_amount;
19+
private Integer[] suggested_tip_amount;
20+
21+
private String provider_data;
22+
23+
private String photo_url;
24+
private Integer photo_size;
25+
private Integer photo_width;
26+
private Integer photo_height;
27+
28+
private boolean need_name;
29+
private boolean need_phone_number;
30+
private boolean need_email;
31+
private boolean need_shipping_address;
32+
private boolean send_phone_number_to_provider;
33+
private boolean send_email_to_provider;
34+
35+
private boolean is_flexible;
36+
37+
38+
public InputInvoiceMessageContent(String title, String description, String payload, String providerToken, String currency, LabeledPrice[] prices) {
39+
this.title = title;
40+
this.description = description;
41+
this.payload = payload;
42+
this.provider_token = providerToken;
43+
this.currency = currency;
44+
this.prices = prices;
45+
}
46+
47+
public InputInvoiceMessageContent maxTipAmount(Integer maxTipAmount) {
48+
this.max_tip_amount = maxTipAmount;
49+
return this;
50+
}
51+
52+
public InputInvoiceMessageContent suggestedTipAmount(Integer[] suggestedTipAmount) {
53+
this.suggested_tip_amount = suggestedTipAmount;
54+
return this;
55+
}
56+
57+
public InputInvoiceMessageContent providerData(String providerData) {
58+
this.provider_data = providerData;
59+
return this;
60+
}
61+
62+
public InputInvoiceMessageContent photoUrl(String photoUrl) {
63+
this.photo_url = photoUrl;
64+
return this;
65+
}
66+
67+
public InputInvoiceMessageContent photoSize(Integer photoSize) {
68+
this.photo_size = photoSize;
69+
return this;
70+
}
71+
72+
public InputInvoiceMessageContent photoWidth(Integer photoWidth) {
73+
this.photo_width = photoWidth;
74+
return this;
75+
}
76+
77+
public InputInvoiceMessageContent photoHeight(Integer photoHeight) {
78+
this.photo_height = photoHeight;
79+
return this;
80+
}
81+
82+
public InputInvoiceMessageContent needName(boolean needName) {
83+
this.need_name = needName;
84+
return this;
85+
}
86+
87+
public InputInvoiceMessageContent needPhoneNumber(boolean needPhoneNumber) {
88+
this.need_phone_number = needPhoneNumber;
89+
return this;
90+
}
91+
92+
public InputInvoiceMessageContent needEmail(boolean needEmail) {
93+
this.need_email = needEmail;
94+
return this;
95+
}
96+
97+
public InputInvoiceMessageContent needShippingAddress(boolean needShippingAddress) {
98+
this.need_shipping_address = needShippingAddress;
99+
return this;
100+
}
101+
102+
public InputInvoiceMessageContent sendPhoneNumberToProvider(boolean sendPhoneNumberToProvider) {
103+
this.send_phone_number_to_provider = sendPhoneNumberToProvider;
104+
return this;
105+
}
106+
107+
public InputInvoiceMessageContent sendEmailToProvider(boolean sendEmailToProvider) {
108+
this.send_email_to_provider = sendEmailToProvider;
109+
return this;
110+
}
111+
112+
public InputInvoiceMessageContent isFlexible(boolean isFlexible) {
113+
this.is_flexible = isFlexible;
114+
return this;
115+
}
116+
117+
}

library/src/main/java/com/pengrad/telegrambot/passport/SetPassportDataErrors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
public class SetPassportDataErrors extends BaseRequest<SetPassportDataErrors, BaseResponse> {
1111

12-
public SetPassportDataErrors(int userId, PassportElementError... errors) {
12+
public SetPassportDataErrors(long userId, PassportElementError... errors) {
1313
super(BaseResponse.class);
1414
add("user_id", userId).add("errors", errors);
1515
}

library/src/main/java/com/pengrad/telegrambot/request/AddStickerToSet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
*/
1010
public class AddStickerToSet extends AbstractUploadRequest<AddStickerToSet, BaseResponse> {
1111

12-
public static AddStickerToSet tgsSticker(Integer userId, String name, String emojis, Object tgsSticker) {
12+
public static AddStickerToSet tgsSticker(Long userId, String name, String emojis, Object tgsSticker) {
1313
return new AddStickerToSet(userId, name, emojis, "tgs_sticker", tgsSticker);
1414
}
1515

16-
public AddStickerToSet(Integer userId, String name, Object pngSticker, String emojis) {
16+
public AddStickerToSet(Long userId, String name, Object pngSticker, String emojis) {
1717
this(userId, name, emojis, "png_sticker", pngSticker);
1818
}
1919

20-
private AddStickerToSet(Integer userId, String name, String emojis, String stickerParam, Object sticker) {
20+
private AddStickerToSet(Long userId, String name, String emojis, String stickerParam, Object sticker) {
2121
super(BaseResponse.class, stickerParam, sticker);
2222
add("user_id", userId);
2323
add("name", name);

0 commit comments

Comments
 (0)