package org.telegram.telegrambots.meta.api.methods.forum; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.Setter; import lombok.ToString; import lombok.experimental.Tolerate; import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; /** * @author Ruben Bermudez * @version 6.4 * Use this method to hide the 'General' topic in a forum supergroup chat. * The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. * The topic will be automatically closed if it was open. * * Returns True on success. */ @EqualsAndHashCode(callSuper = false) @Getter @Setter @ToString @NoArgsConstructor(force = true) @AllArgsConstructor @Builder public class HideGeneralForumTopic extends BotApiMethodBoolean { public static final String PATH = "hideGeneralForumTopic"; private static final String CHATID_FIELD = "chat_id"; /** * Unique identifier for the target chat or username * of the target supergroup (in the format @supergroupusername) */ @JsonProperty(CHATID_FIELD) @NonNull private String chatId; @Tolerate public void setChatId(@NonNull Long chatId) { this.chatId = chatId.toString(); } @Override public void validate() throws TelegramApiValidationException { if (chatId.isEmpty()) { throw new TelegramApiValidationException("ChatId can't be empty", this); } } @Override public String getMethod() { return PATH; } public static class HideGeneralForumTopicBuilder { @Tolerate public HideGeneralForumTopicBuilder chatId(@NonNull Long chatId) { this.chatId = chatId.toString(); return this; } } }