Отправка файлов
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-04-24 03:03:02 +03:00
parent a616bd7787
commit 16a3af275b
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
3 changed files with 52 additions and 0 deletions

View File

@ -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<ContextKey, Object> 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<ContextKey, Object> 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);
}

View File

@ -0,0 +1,9 @@
package dev.struchkov.godfather.quarkus.domain.content.send;
public interface SendAttachment {
String getType();
SendFile getSendFile();
}

View File

@ -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;
}