Skip to content

Commit 811119a

Browse files
authored
Add voice message support to incoming message DTO (#20606)
1 parent 07e913e commit 811119a

File tree

2 files changed

+115
-0
lines changed

2 files changed

+115
-0
lines changed

components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.camel.component.telegram.model;
1819

1920
import java.io.Serializable;
@@ -71,6 +72,8 @@ public class IncomingMessage implements Serializable {
7172

7273
private IncomingGame game;
7374

75+
private IncomingVoice voice;
76+
7477
public IncomingMessage() {
7578
}
7679

@@ -202,6 +205,14 @@ public void setGame(IncomingGame game) {
202205
this.game = game;
203206
}
204207

208+
public IncomingVoice getVoice() {
209+
return voice;
210+
}
211+
212+
public void setVoice(IncomingVoice voice) {
213+
this.voice = voice;
214+
}
215+
205216
@Override
206217
public String toString() {
207218
final StringBuilder sb = new StringBuilder("IncomingMessage{");
@@ -221,6 +232,7 @@ public String toString() {
221232
sb.append(", captionEntities=").append(captionEntities);
222233
sb.append(", replyMarkup=").append(replyMarkup);
223234
sb.append(", game=").append(game);
235+
sb.append(", voice=").append(voice);
224236
sb.append('}');
225237
return sb.toString();
226238
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.camel.component.telegram.model;
19+
20+
import java.io.Serializable;
21+
22+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
23+
import com.fasterxml.jackson.annotation.JsonProperty;
24+
25+
/**
26+
* Message is a voice message, information about the file.
27+
*
28+
* @see <a href="https://core.telegram.org/bots/api#voice">https://core.telegram.org/bots/api#voice</a>
29+
*/
30+
@JsonIgnoreProperties(ignoreUnknown = true)
31+
public class IncomingVoice implements Serializable {
32+
33+
private static final long serialVersionUID = 8346607899859789612L;
34+
35+
@JsonProperty("file_id")
36+
private String fileId;
37+
38+
@JsonProperty("file_unique_id")
39+
private String fileUniqueId;
40+
41+
private Integer duration;
42+
43+
@JsonProperty("mime_type")
44+
private String mimeType;
45+
46+
@JsonProperty("file_size")
47+
private Long fileSize;
48+
49+
public IncomingVoice() {
50+
}
51+
52+
public String getFileId() {
53+
return fileId;
54+
}
55+
56+
public void setFileId(String fileId) {
57+
this.fileId = fileId;
58+
}
59+
60+
public String getFileUniqueId() {
61+
return fileUniqueId;
62+
}
63+
64+
public void setFileUniqueId(String fileUniqueId) {
65+
this.fileUniqueId = fileUniqueId;
66+
}
67+
68+
public Integer getDuration() {
69+
return duration;
70+
}
71+
72+
public void setDuration(Integer duration) {
73+
this.duration = duration;
74+
}
75+
76+
public String getMimeType() {
77+
return mimeType;
78+
}
79+
80+
public void setMimeType(String mimeType) {
81+
this.mimeType = mimeType;
82+
}
83+
84+
public Long getFileSize() {
85+
return fileSize;
86+
}
87+
88+
public void setFileSize(Long fileSize) {
89+
this.fileSize = fileSize;
90+
}
91+
92+
@Override
93+
public String toString() {
94+
final StringBuilder sb = new StringBuilder("IncomingVoice{");
95+
sb.append("fileId='").append(fileId).append('\'');
96+
sb.append(", fileUniqueId=").append(fileUniqueId);
97+
sb.append(", duration=").append(duration);
98+
sb.append(", mimeType=").append(mimeType);
99+
sb.append(", fileSize=").append(fileSize);
100+
sb.append('}');
101+
return sb.toString();
102+
}
103+
}

0 commit comments

Comments
 (0)