-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a45087a
commit cceccfd
Showing
19 changed files
with
366 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
.../java/org/telegram/telegrambots/meta/api/methods/verification/RemoveChatVerification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
.../java/org/telegram/telegrambots/meta/api/methods/verification/RemoveUserVerification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
...eta/src/main/java/org/telegram/telegrambots/meta/api/methods/verification/VerifyChat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
Oops, something went wrong.