Skip to content

Commit

Permalink
Api Version 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Jan 4, 2025
1 parent a45087a commit cceccfd
Show file tree
Hide file tree
Showing 19 changed files with 366 additions and 37 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>8.1.0</version>
<version>8.2.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>8.1.0</version>
<version>8.2.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>8.1.0</version>
<version>8.2.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>8.1.0</version>
<version>8.2.0</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion telegrambots-client-jetty-adapter/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>8.1.0</version>
<version>8.2.0</version>
</parent>

<name>Telegram Bots Client Jetty HttpClient adapter</name>
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>8.1.0</version>
<version>8.2.0</version>
</parent>

<name>Telegram Bots Client</name>
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>8.1.0</version>
<version>8.2.0</version>
</dependency>
```

2. Using Gradle:

```gradle
implementation 'org.telegram:telegrambots-extensions:8.1.0'
implementation 'org.telegram:telegrambots-extensions:8.2.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>8.1.0</version>
<version>8.2.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>8.1.0</version>
<version>8.2.0</version>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots-longpolling</artifactId>
<version>8.1.0</version>
<version>8.2.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>8.1.0</version>
<version>8.2.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>8.1.0</version>
<version>8.2.0</version>
</parent>

<artifactId>telegrambots-meta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class SendGift extends BotApiMethodBoolean {
private static final String TEXT_FIELD = "text";
private static final String TEXT_PARSE_MODE_FIELD = "text_parse_mode";
private static final String TEXT_ENTITIES_FIELD = "text_entities";
private static final String PAY_FOR_UPGRADE_FIELD = "pay_for_upgrade";

/**
* Unique identifier of the target user that will receive the gift
Expand Down Expand Up @@ -83,6 +84,12 @@ public class SendGift extends BotApiMethodBoolean {
@JsonProperty(TEXT_ENTITIES_FIELD)
@Singular
private List<MessageEntity> textEntities;
/**
* Optional
* Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
*/
@JsonProperty(PAY_FOR_UPGRADE_FIELD)
private Boolean payForUpgrade;

@Override
public void validate() throws TelegramApiValidationException {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package org.telegram.telegrambots.meta.api.methods.verification;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import lombok.experimental.Tolerate;
import lombok.extern.jackson.Jacksonized;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import org.telegram.telegrambots.meta.util.Validations;

/**
* @author Ruben Bermudez
* @version 8.2
*
* Removes verification from a chat that is currently verified on behalf of the organization represented by the bot.
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RemoveChatVerification extends BotApiMethodBoolean {
public static final String PATH = "removeChatVerification";

private static final String CHAT_ID_FIELD = "chat_id";

/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*/
@JsonProperty(CHAT_ID_FIELD)
@NonNull
private String chatId;

@Override
public void validate() throws TelegramApiValidationException {
Validations.requiredChatId(chatId, this);
}

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

@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}

public abstract static class RemoveChatVerificationBuilder<C extends RemoveChatVerification, B extends RemoveChatVerification.RemoveChatVerificationBuilder<C, B>> extends BotApiMethodBooleanBuilder<C, B> {
@Tolerate
public RemoveChatVerification.RemoveChatVerificationBuilder<C, B> chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.telegram.telegrambots.meta.api.methods.verification;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
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.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import org.telegram.telegrambots.meta.util.Validations;

/**
* @author Ruben Bermudez
* @version 8.2
*
* Removes verification from a user who is currently verified on behalf of the organization represented by the bot.
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RemoveUserVerification extends BotApiMethodBoolean {
public static final String PATH = "removeUserVerification";

private static final String USER_ID_FIELD = "user_id";

/**
* Unique identifier of the target user
*/
@JsonProperty(USER_ID_FIELD)
@NonNull
private Long userId;

@Override
public void validate() throws TelegramApiValidationException {
Validations.requiredUserId(userId, this);
}

@Override
public String getMethod() {
return PATH;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package org.telegram.telegrambots.meta.api.methods.verification;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import lombok.experimental.Tolerate;
import lombok.extern.jackson.Jacksonized;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import org.telegram.telegrambots.meta.util.Validations;

/**
* @author Ruben Bermudez
* @version 8.2
*
* Verifies a chat on behalf of the organization which is represented by the bot.
* Returns True on success.
*/
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@AllArgsConstructor
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class VerifyChat extends BotApiMethodBoolean {
public static final String PATH = "verifyChat";

private static final String CHAT_ID_FIELD = "chat_id";
private static final String CUSTOM_DESCRIPTION_FIELD = "custom_description";

/**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername)
*/
@JsonProperty(CHAT_ID_FIELD)
@NonNull
private String chatId;
/**
* Optional
* Custom description for the verification; 0-70 characters.
* Must be empty if the organization isn't allowed to provide a custom verification description.
*/
@JsonProperty(CUSTOM_DESCRIPTION_FIELD)
private String customDescription;

@Override
public void validate() throws TelegramApiValidationException {
Validations.requiredChatId(chatId, this);
if (customDescription != null && (customDescription.length() > 70 || customDescription.isEmpty())) {
throw new TelegramApiValidationException("Custom description must be between 0 and 70 characters long", this);
}
}

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

@Tolerate
public void setChatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
}

public abstract static class VerifyChatBuilder<C extends VerifyChat, B extends VerifyChat.VerifyChatBuilder<C, B>> extends BotApiMethodBoolean.BotApiMethodBooleanBuilder<C, B> {
@Tolerate
public VerifyChat.VerifyChatBuilder<C, B> chatId(@NonNull Long chatId) {
this.chatId = chatId.toString();
return this;
}
}
}
Loading

0 comments on commit cceccfd

Please sign in to comment.