Browse Source

1. New api changes

master
Rubenlagu 11 years ago
committed by Rubenlagus
parent
commit
8ee772a875
  1. 4
      src/main/java/org/telegram/api/Contact.java
  2. 4
      src/main/java/org/telegram/api/Sticker.java
  3. 16
      src/main/java/org/telegram/api/Video.java
  4. 4
      src/main/java/org/telegram/methods/SendVideo.java

4
src/main/java/org/telegram/api/Contact.java

@ -22,7 +22,7 @@ public class Contact {
private String lastName; ///< Optional. Contact's last name
public static final String USERID_FIELD = "user_id";
@JsonProperty(USERID_FIELD)
private String userID; ///< Optional. Contact's user identifier in Telegram
private Integer userID; ///< Optional. Contact's user identifier in Telegram
public Contact() {
super();
@ -33,6 +33,6 @@ public class Contact {
this.phoneNumber = jsonObject.getString(PHONENUMBER_FIELD);
this.firstName = jsonObject.getString(FIRSTNAME_FIELD);
this.lastName = jsonObject.optString(LASTNAME_FIELD, "");
this.userID = jsonObject.optString(USERID_FIELD, "");
this.userID = jsonObject.optInt(USERID_FIELD, 0);
}
}

4
src/main/java/org/telegram/api/Sticker.java

@ -36,7 +36,11 @@ public class Sticker {
this.fileId = jsonObject.getString(FILEID_FIELD);
this.width = jsonObject.getInt(WIDTH_FIELD);
this.height = jsonObject.getInt(HEIGHT_FIELD);
if (jsonObject.has(THUMB_FIELD)) {
this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD));
} else {
this.thumb = null;
}
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);
}
}

16
src/main/java/org/telegram/api/Video.java

@ -32,9 +32,6 @@ public class Video {
public static final String FILESIZE_FIELD = "file_size";
@JsonProperty(FILESIZE_FIELD)
private Integer fileSize; ///< Optional. File size
public static final String CAPTION_FIELD = "caption";
@JsonProperty(CAPTION_FIELD)
private String caption; ///< Optional. Text description of the video (usually empty)
public Video() {
super();
@ -45,10 +42,13 @@ public class Video {
this.width = jsonObject.getInt(WIDTH_FIELD);
this.height = jsonObject.getInt(HEIGHT_FIELD);
this.duration = jsonObject.getInt(DURATION_FIELD);
if (jsonObject.has(THUMB_FIELD)) {
this.thumb = new PhotoSize(jsonObject.getJSONObject(THUMB_FIELD));
} else {
this.thumb = null;
}
this.mimeType = jsonObject.optString(MIMETYPE_FIELD, "");
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0);
this.caption = jsonObject.optString(CAPTION_FIELD, "");
}
public Integer getWidth() {
@ -106,12 +106,4 @@ public class Video {
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
}

4
src/main/java/org/telegram/methods/SendVideo.java

@ -17,6 +17,10 @@ public class SendVideo {
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
public static final String VIDEO_FIELD = "video";
private String video; ///< Video to send. file_id as String to resend a video that is already on the Telegram servers
public static final String DURATION_FIELD = "duration";
private String duration; ///< Optional. Duration of sent video in seconds
public static final String CAPTION_FIELD = "caption";
private String caption; ///< OptionaL. Video caption (may also be used when resending videos by file_id).
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
public static final String REPLYMARKUP_FIELD = "reply_markup";

Loading…
Cancel
Save