Skip to content

Commit

Permalink
Api version 7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Jun 22, 2024
1 parent 7d50276 commit 1337142
Show file tree
Hide file tree
Showing 32 changed files with 777 additions and 77 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<packaging>pom</packaging>
<version>7.4.2</version>
<version>7.5.0</version>

<modules>
<module>telegrambots-meta</module>
Expand Down
6 changes: 3 additions & 3 deletions telegrambots-abilities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</parent>

<artifactId>telegrambots-abilities</artifactId>
Expand Down Expand Up @@ -104,12 +104,12 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-webhook</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</parent>

<name>Telegram Bots Client</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ public CompletableFuture<Serializable> executeAsync(EditMessageMedia editMessage
builder.addPart(EditMessageMedia.CHAT_ID_FIELD, editMessageMedia.getChatId())
.addPart(EditMessageMedia.MESSAGE_ID_FIELD, editMessageMedia.getMessageId())
.addPart(EditMessageMedia.INLINE_MESSAGE_ID_FIELD, editMessageMedia.getInlineMessageId())
.addPart(EditMessageMedia.BUSINESS_CONNECTION_ID_FIELD, editMessageMedia.getBusinessConnectionId())
.addJsonPart(EditMessageMedia.REPLY_MARKUP_FIELD, editMessageMedia.getReplyMarkup());

addInputData(builder, EditMessageMedia.MEDIA_FIELD, editMessageMedia.getMedia(), true);
Expand Down
4 changes: 2 additions & 2 deletions telegrambots-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Just import add the library to your project with one of these options:
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-extensions</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</dependency>
```

2. Using Gradle:

```gradle
implementation 'org.telegram:telegrambots-extensions:7.4.2'
implementation 'org.telegram:telegrambots-extensions:7.5.0'
```
6 changes: 3 additions & 3 deletions telegrambots-extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</parent>

<artifactId>telegrambots-extensions</artifactId>
Expand Down Expand Up @@ -89,12 +89,12 @@
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-webhook</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-longpolling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</parent>

<artifactId>telegrambots-longpolling</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-meta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.telegram</groupId>
<artifactId>Bots</artifactId>
<version>7.4.2</version>
<version>7.5.0</version>
</parent>

<artifactId>telegrambots-meta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,40 @@
public class StopMessageLiveLocation extends BotApiMethodSerializable {
public static final String PATH = "stopMessageLiveLocation";

private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGEID_FIELD = "message_id";
private static final String CHAT_ID_FIELD = "chat_id";
private static final String MESSAGE_ID_FIELD = "message_id";
private static final String INLINE_MESSAGE_ID_FIELD = "inline_message_id";
private static final String REPLYMARKUP_FIELD = "reply_markup";
private static final String REPLY_MARKUP_FIELD = "reply_markup";
private static final String BUSINESS_CONNECTION_ID_FIELD = "business_connection_id";

/**
* Required if inline_message_id is not specified. Unique identifier for the chat to send the
* message to (Or username for channels)
*/
@JsonProperty(CHATID_FIELD)
@JsonProperty(CHAT_ID_FIELD)
private String chatId;
/**
* Required if inline_message_id is not specified. Unique identifier of the sent message
*/
@JsonProperty(MESSAGEID_FIELD)
@JsonProperty(MESSAGE_ID_FIELD)
private Integer messageId;
/**
* Required if chat_id and message_id are not specified. Identifier of the inline message
*/
@JsonProperty(INLINE_MESSAGE_ID_FIELD)
private String inlineMessageId;
@JsonProperty(REPLYMARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; ///< Optional. A JSON-serialized object for an inline keyboard.
/**
* Optional.
* A JSON-serialized object for an inline keyboard.
*/
@JsonProperty(REPLY_MARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup;
/**
* Optional
* Unique identifier of the business connection on behalf of which the message to be edited was sent
*/
@JsonProperty(BUSINESS_CONNECTION_ID_FIELD)
private String businessConnectionId;

@Tolerate
public void setChatId(Long chatId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package org.telegram.telegrambots.meta.api.methods.payments.star;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.payments.star.StarTransactions;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

/**
* @author Ruben Bermudez
* @version 7.5
*
* Returns the bot's Telegram Star transactions in chronological order.
* On success, returns a StarTransactions object.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetStarTransactions extends BotApiMethod<StarTransactions> {
public static final String PATH = "getStarTransactions";

private static final String OFFSET_FIELD = "offset";
private static final String LIMIT_FIELD = "limit";

/**
* Optional
* Number of transactions to skip in the response
*/
@JsonProperty(OFFSET_FIELD)
private Integer offset;
/**
* Optional
* The maximum number of transactions to be retrieved.
* Values between 1-100 are accepted.
* Defaults to 100.
*/
@JsonProperty(LIMIT_FIELD)
private Integer limit;

@Override
public StarTransactions deserializeResponse(String answer) throws TelegramApiRequestException {
return deserializeResponse(answer, StarTransactions.class);
}

@Override
public String getMethod() {
return PATH;
}

@Override
public void validate() throws TelegramApiValidationException {
if (limit != null && (limit > 100 || limit < 0)) {
throw new TelegramApiValidationException("Limit parameters must be between 0 and 100", this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,28 @@
public class StopPoll extends BotApiMethod<Poll> {
public static final String PATH = "stopPoll";

private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGEID_FIELD = "message_id";
private static final String CHAT_ID_FIELD = "chat_id";
private static final String MESSAGE_ID_FIELD = "message_id";
private static final String BUSINESS_CONNECTION_ID_FIELD = "business_connection_id";

@JsonProperty(CHATID_FIELD)
/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*/
@JsonProperty(CHAT_ID_FIELD)
@NonNull
private String chatId; ///< Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@JsonProperty(MESSAGEID_FIELD)
private String chatId;
/**
* Identifier of the original message with the poll
*/
@JsonProperty(MESSAGE_ID_FIELD)
@NonNull
private Integer messageId; ///< Identifier of the original message with the poll
private Integer messageId;
/**
* Optional
* Unique identifier of the business connection on behalf of which the message to be edited was sent
*/
@JsonProperty(BUSINESS_CONNECTION_ID_FIELD)
private String businessConnectionId;

@Tolerate
public void setChatId(@NonNull Long chatId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
* @author Ruben Bermudez
* @version 1.0
* Use this method to edit captions of messages.
* On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
* On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
* @apiNote Note that business messages that were not sent by the bot and do not contain an inline keyboard
* can only be edited within 48 hours from the time they were sent.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
Expand All @@ -35,46 +37,69 @@
public class EditMessageCaption extends BotApiMethodSerializable {
public static final String PATH = "editmessagecaption";

private static final String CHATID_FIELD = "chat_id";
private static final String MESSAGEID_FIELD = "message_id";
private static final String CHAT_ID_FIELD = "chat_id";
private static final String MESSAGE_ID_FIELD = "message_id";
private static final String INLINE_MESSAGE_ID_FIELD = "inline_message_id";
private static final String CAPTION_FIELD = "caption";
private static final String REPLYMARKUP_FIELD = "reply_markup";
private static final String PARSEMODE_FIELD = "parse_mode";
private static final String REPLY_MARKUP_FIELD = "reply_markup";
private static final String PARSE_MODE_FIELD = "parse_mode";
private static final String CAPTION_ENTITIES_FIELD = "caption_entities";
private static final String SHOW_CAPTION_ABOVE_MEDIA_FIELD = "show_caption_above_media";
private static final String BUSINESS_CONNECTION_ID_FIELD = "business_connection_id";

/**
* Required if inline_message_id is not specified. Unique identifier for the chat to send the
* message to (Or username for channels)
*/
@JsonProperty(CHATID_FIELD)
@JsonProperty(CHAT_ID_FIELD)
private String chatId;
/**
* Required if inline_message_id is not specified. Unique identifier of the sent message
*/
@JsonProperty(MESSAGEID_FIELD)
@JsonProperty(MESSAGE_ID_FIELD)
private Integer messageId;
/**
* Required if chat_id and message_id are not specified. Identifier of the inline message
*/
@JsonProperty(INLINE_MESSAGE_ID_FIELD)
private String inlineMessageId;
/**
* Optional.
* New caption of the message
*/
@JsonProperty(CAPTION_FIELD)
private String caption; ///< Optional. New caption of the message
@JsonProperty(REPLYMARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; ///< Optional. A JSON-serialized object for an inline keyboard.
@JsonProperty(PARSEMODE_FIELD)
private String parseMode; ///< Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
private String caption;
/**
* Optional.
* A JSON-serialized object for an inline keyboard.
*/
@JsonProperty(REPLY_MARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup;
/**
* Optional.
* Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption.
*/
@JsonProperty(PARSE_MODE_FIELD)
private String parseMode;
/**
* Optional.
* List of special entities that appear in the caption, which can be specified instead of parse_mode
*/
@JsonProperty(CAPTION_ENTITIES_FIELD)
@Singular
private List<MessageEntity> captionEntities; ///< Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
private List<MessageEntity> captionEntities;
/**
* Optional.
* Pass True, if the caption must be shown above the message media
*/
@JsonProperty(SHOW_CAPTION_ABOVE_MEDIA_FIELD)
private Boolean showCaptionAboveMedia;
/**
* Optional
* Unique identifier of the business connection on behalf of which the message to be edited was sent
*/
@JsonProperty(BUSINESS_CONNECTION_ID_FIELD)
private String businessConnectionId;

@Tolerate
public void setChatId(Long chatId) {
Expand Down
Loading

0 comments on commit 1337142

Please sign in to comment.