From 16a3af275ba0fb5bfafc27f22a8e17f3a95799f8 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Mon, 24 Apr 2023 03:03:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../godfather/quarkus/domain/BoxAnswer.java | 13 ++++++++ .../domain/content/send/SendAttachment.java | 9 ++++++ .../quarkus/domain/content/send/SendFile.java | 30 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendAttachment.java create mode 100644 bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendFile.java diff --git a/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/BoxAnswer.java b/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/BoxAnswer.java index d0ab002..ea813fc 100644 --- a/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/BoxAnswer.java +++ b/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/BoxAnswer.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import dev.struchkov.godfather.main.domain.jackson.TelegramPayloadDeserializer; import dev.struchkov.godfather.main.domain.jackson.TelegramPayloadSerializer; import dev.struchkov.godfather.main.domain.keyboard.KeyBoard; +import dev.struchkov.godfather.quarkus.domain.content.send.SendAttachment; import dev.struchkov.haiti.utils.container.ContextKey; import io.smallrye.mutiny.Uni; import lombok.Getter; @@ -60,6 +61,8 @@ public class BoxAnswer { @JsonDeserialize(using = TelegramPayloadDeserializer.class) protected Map payload = new HashMap<>(); + private SendAttachment attachment; + private BoxAnswer(Builder builder) { message = builder.message; keyBoard = builder.keyBoard; @@ -67,6 +70,7 @@ public class BoxAnswer { replaceMessageId = builder.replaceMessageId; recipientPersonId = builder.recipientPersonId; payload = builder.payload; + attachment = builder.attachment; } public static BoxAnswer boxAnswer(boolean replace, String message) { @@ -149,6 +153,7 @@ public class BoxAnswer { private String replaceMessageId; private String recipientPersonId; private Map payload = new HashMap<>(); + private SendAttachment attachment; private Builder() { } @@ -192,6 +197,14 @@ public class BoxAnswer { return this; } + public Builder attachment(SendAttachment attachment) { + if (checkNotNull(attachment)) { + this.attachment = attachment; + } + return this; + } + + public BoxAnswer build() { return new BoxAnswer(this); } diff --git a/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendAttachment.java b/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendAttachment.java new file mode 100644 index 0000000..95e3bbc --- /dev/null +++ b/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendAttachment.java @@ -0,0 +1,9 @@ +package dev.struchkov.godfather.quarkus.domain.content.send; + +public interface SendAttachment { + + String getType(); + + SendFile getSendFile(); + +} diff --git a/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendFile.java b/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendFile.java new file mode 100644 index 0000000..3851d83 --- /dev/null +++ b/bot-domain/bot-domain-quarkus/src/main/java/dev/struchkov/godfather/quarkus/domain/content/send/SendFile.java @@ -0,0 +1,30 @@ +package dev.struchkov.godfather.quarkus.domain.content.send; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.io.File; +import java.io.InputStream; + +@Getter +@Setter +@Builder +@NoArgsConstructor +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class SendFile { + + private String fileId; + + private String url; + + private String fileName; + + private File data; + + private InputStream fileStream; + +}