Skip to content

Commit

Permalink
Api Version 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Nov 19, 2024
1 parent c00e48a commit a6acbdd
Show file tree
Hide file tree
Showing 165 changed files with 589 additions and 873 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,4 @@ public OkHttpClient get() {
return okHttpClientBuilder.build();
}
}

/**
* @deprecated Use {@link HttpProxyOkHttpClientCreator} instead
*/
@Deprecated
public static class ProxyOkHttpClientCreator extends HttpProxyOkHttpClientCreator {
public ProxyOkHttpClientCreator(Supplier<Proxy> proxySupplier, Supplier<Authenticator> authenticatorSupplier) {
super(proxySupplier, authenticatorSupplier);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
@JacksonAnnotationsInside
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public @interface BotApiMethodJsonAnnotated {
public @interface BotApiJsonAnnotated {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.telegram.telegrambots.meta.api.interfaces;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.telegram.telegrambots.meta.annotations.BotApiJsonAnnotated;

import java.io.Serializable;

Expand All @@ -10,7 +9,6 @@
* @version 1.0
* An object from the Bots API received from Telegram Servers
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@BotApiJsonAnnotated
public interface BotApiObject extends Serializable {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -32,7 +31,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class AnswerCallbackQuery extends BotApiMethodBoolean {
public static final String PATH = "answercallbackquery";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -32,7 +31,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class AnswerInlineQuery extends BotApiMethodBoolean {
public static final String PATH = "answerInlineQuery";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -32,7 +31,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class AnswerPreCheckoutQuery extends BotApiMethodBoolean {
public static final String PATH = "answerPreCheckoutQuery";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -35,7 +34,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class AnswerShippingQuery extends BotApiMethodBoolean {
public static final String PATH = "answerShippingQuery";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -41,7 +40,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class CopyMessage extends BotApiMethod<MessageId> {
public static final String PATH = "copyMessage";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -43,7 +42,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class CopyMessages extends BotApiMethod<ArrayList<MessageId>> {
public static final String PATH = "copyMessages";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand All @@ -19,7 +18,6 @@
* @author Ruben Bermudez
* @version 1.0
* Use this method to forward messages of any kind.
*
* Service messages and messages with protected content can't be forwarded.
*
* On success, the Message sent is returned.
Expand All @@ -32,7 +30,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class ForwardMessage extends BotApiMethodMessage {
public static final String PATH = "forwardmessage";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -39,7 +38,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class ForwardMessages extends BotApiMethod<ArrayList<MessageId>> {
public static final String PATH = "forwardMessages";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down Expand Up @@ -32,7 +31,6 @@
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetFile extends BotApiMethod<File> {
public static final String PATH = "getFile";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -28,7 +27,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetUserProfilePhotos extends BotApiMethod<UserProfilePhotos> {
public static final String PATH = "getuserprofilephotos";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down Expand Up @@ -31,7 +30,6 @@
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class SetPassportDataErrors extends BotApiMethodBoolean {
public static final String PATH = "setPassportDataErrors";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package org.telegram.telegrambots.meta.api.methods;

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.extern.jackson.Jacksonized;
import org.telegram.telegrambots.meta.api.methods.botapimethods.BotApiMethodBoolean;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

/**
* @author Ruben Bermudez
* @version 8.0
* Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the
* Mini App method requestEmojiStatusAccess.
*
* Returns True on success.
*/
@SuppressWarnings("unused")
@EqualsAndHashCode(callSuper = false)
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Jacksonized
public class SetUserEmojiStatus extends BotApiMethodBoolean {
public static final String PATH = "setUserEmojiStatus";

private static final String USER_ID_FIELD = "user_id";
private static final String EMOJI_STATUS_CUSTOM_EMOJI_ID_FIELD = "emoji_status_custom_emoji_id";
private static final String EMOJI_STATUS_EXPIRATION_DATE_FIELD = "emoji_status_expiration_date";


/**
* Unique identifier of the target user
*/
@JsonProperty(USER_ID_FIELD)
@NonNull
private Integer userId;
/**
* Optional
* Custom emoji identifier of the emoji status to set.
* Pass an empty string to remove the status.
*/
@JsonProperty(EMOJI_STATUS_CUSTOM_EMOJI_ID_FIELD)
private String emojiStatusCustomEmojiId;
/**
* Optional
* Expiration date of the emoji status, if any
*/
@JsonProperty(EMOJI_STATUS_EXPIRATION_DATE_FIELD)
private Integer emojiStatusExpirationDate;

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

@Override
public void validate() throws TelegramApiValidationException {
if (userId == 0) {
throw new TelegramApiValidationException("UserId parameter can't be empty", this);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.botapimethods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
Expand All @@ -13,8 +11,6 @@
*
* A method of Telegram Bots Api that is fully supported in json format
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SuperBuilder
public abstract class BotApiMethodBoolean extends BotApiMethod<Boolean> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.botapimethods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
Expand All @@ -14,8 +12,6 @@
*
* A method of Telegram Bots Api that is fully supported in json format
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SuperBuilder
public abstract class BotApiMethodMessage extends BotApiMethod<Message> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.botapimethods;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
Expand All @@ -19,8 +17,6 @@
*
* A method of Telegram Bots Api that is fully supported in json format
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SuperBuilder
public abstract class BotApiMethodSerializable extends BotApiMethod<Serializable> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.telegram.telegrambots.meta.annotations.BotApiMethodJsonAnnotated;
import org.telegram.telegrambots.meta.annotations.BotApiJsonAnnotated;
import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
Expand All @@ -24,7 +24,7 @@
*/
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SuperBuilder
@BotApiMethodJsonAnnotated
@BotApiJsonAnnotated
public abstract class PartialBotApiMethod<T extends Serializable> implements Validable {
@JsonIgnore
protected static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
Expand Down Expand Up @@ -72,6 +72,7 @@ private T deserializeResponseInternal(String answer, JavaType type) throws Teleg
@JsonProperty(BotApiMethod.METHOD_FIELD)
public abstract String getMethod();

@BotApiJsonAnnotated
public static abstract class PartialBotApiMethodBuilder<T extends Serializable, C extends PartialBotApiMethod<T>, B extends PartialBotApiMethodBuilder<T, C, B>> {

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.commands;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -34,7 +33,6 @@
@AllArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class SetMyCommands extends BotApiMethodBoolean {
public static final String PATH = "setMyCommands";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.telegram.telegrambots.meta.api.methods.forum;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down Expand Up @@ -30,7 +29,6 @@
@RequiredArgsConstructor
@SuperBuilder
@Jacksonized
@JsonIgnoreProperties(ignoreUnknown = true)
public class CloseForumTopic extends BotApiMethodBoolean {
public static final String PATH = "closeForumTopic";

Expand Down
Loading

0 comments on commit a6acbdd

Please sign in to comment.