Skip to content

Commit 031fa74

Browse files
Bernhard Breytenbachdenizkilic
Bernhard Breytenbach
authored andcommitted
Bugfix: #87 Webhook URL and Token not set correctly
1 parent d91e403 commit 031fa74

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

api/src/main/java/com/messagebird/objects/voicecalls/VoiceCall.java

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.messagebird.objects.voicecalls;
22

3+
import com.fasterxml.jackson.annotation.JsonIgnore;
34
import com.messagebird.objects.MessageBase;
45

56
import java.io.Serializable;
@@ -12,9 +13,7 @@ public class VoiceCall implements MessageBase, Serializable {
1213
private String source;
1314
private String destination;
1415
private VoiceCallFlow callFlow;
15-
16-
private String webhookUrl;
17-
private String webhookToken;
16+
private Webhook webhook = new Webhook();
1817

1918
@Override
2019
public String getBody() {
@@ -60,20 +59,41 @@ public void setCallFlow(VoiceCallFlow callFlow) {
6059
this.callFlow = callFlow;
6160
}
6261

62+
public Webhook getWebhook() {
63+
return webhook;
64+
}
65+
66+
public void setWebhook(String url) {
67+
this.setWebhook(url, null);
68+
}
69+
70+
public void setWebhook(String url, String token) {
71+
this.webhook.setUrl(url);
72+
this.webhook.setToken(token);
73+
}
74+
75+
@JsonIgnore
76+
@Deprecated
6377
public String getWebhookUrl() {
64-
return webhookUrl;
78+
return webhook.getUrl();
6579
}
6680

81+
@JsonIgnore
82+
@Deprecated
6783
public void setWebhookUrl(String webhookUrl) {
68-
this.webhookUrl = webhookUrl;
84+
this.webhook.setUrl(webhookUrl);
6985
}
7086

87+
@JsonIgnore
88+
@Deprecated
7189
public String getWebhookToken() {
72-
return webhookToken;
90+
return webhook.getToken();
7391
}
7492

93+
@JsonIgnore
94+
@Deprecated
7595
public void setWebhookToken(String webhookToken) {
76-
this.webhookToken = webhookToken;
96+
this.webhook.setToken(webhookToken);
7797
}
7898

7999
@Override
@@ -82,8 +102,7 @@ public String toString() {
82102
"source='" + source + '\'' +
83103
", destination='" + destination + '\'' +
84104
", callFlow=" + callFlow +
85-
", webhookUrl='" + webhookUrl + '\'' +
86-
", webhookToken='" + webhookToken + '\'' +
105+
", webhook=" + webhook +
87106
'}';
88107
}
89108
}

0 commit comments

Comments
 (0)