Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 6eeeb16

Browse files
Sample 06.using-cards (#933)
* Sample 06.using-cards * Corrected package name in 06.using-cards Co-authored-by: Lee Parrish <30470292+LeeParrishMSFT@users.noreply.github.com>
1 parent 47e3e5c commit 6eeeb16

File tree

33 files changed

+2159
-6
lines changed

33 files changed

+2159
-6
lines changed

libraries/bot-dialogs/src/main/java/com/microsoft/bot/dialogs/choices/Choice.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import com.fasterxml.jackson.annotation.JsonProperty;
77
import com.microsoft.bot.schema.CardAction;
8+
import java.util.Arrays;
89
import java.util.List;
910

1011
/**
@@ -35,6 +36,26 @@ public Choice(String withValue) {
3536
value = withValue;
3637
}
3738

39+
/**
40+
* Creates a Choice.
41+
* @param withValue The value.
42+
* @param withSynonyms The list of synonyms to recognize in addition to the value.
43+
*/
44+
public Choice(String withValue, List<String> withSynonyms) {
45+
value = withValue;
46+
synonyms = withSynonyms;
47+
}
48+
49+
/**
50+
* Creates a Choice.
51+
* @param withValue The value.
52+
* @param withSynonyms The list of synonyms to recognize in addition to the value.
53+
*/
54+
public Choice(String withValue, String... withSynonyms) {
55+
value = withValue;
56+
synonyms = Arrays.asList(withSynonyms);
57+
}
58+
3859
/**
3960
* Gets the value to return when selected.
4061
* @return The value.

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/AnimationCard.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.annotation.JsonInclude;
88
import com.fasterxml.jackson.annotation.JsonProperty;
99

10+
import java.util.Arrays;
1011
import java.util.List;
1112

1213
/**
@@ -193,6 +194,15 @@ public void setMedia(List<MediaUrl> withMedia) {
193194
this.media = withMedia;
194195
}
195196

197+
/**
198+
* Set the media value.
199+
*
200+
* @param withMedia the media value to set
201+
*/
202+
public void setMedia(MediaUrl... withMedia) {
203+
this.media = Arrays.asList(withMedia);
204+
}
205+
196206
/**
197207
* Get the buttons value.
198208
*
@@ -211,6 +221,15 @@ public void setButtons(List<CardAction> withButtons) {
211221
this.buttons = withButtons;
212222
}
213223

224+
/**
225+
* Set the buttons value.
226+
*
227+
* @param withButtons the buttons value to set
228+
*/
229+
public void setButtons(CardAction... withButtons) {
230+
this.buttons = Arrays.asList(withButtons);
231+
}
232+
214233
/**
215234
* Get the shareable value.
216235
*

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/AudioCard.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.annotation.JsonInclude;
88
import com.fasterxml.jackson.annotation.JsonProperty;
99

10+
import java.util.Arrays;
1011
import java.util.List;
1112

1213
/**
@@ -194,6 +195,15 @@ public void setMedia(List<MediaUrl> withMedia) {
194195
this.media = withMedia;
195196
}
196197

198+
/**
199+
* Set the media value.
200+
*
201+
* @param withMedia the media value to set
202+
*/
203+
public void setMedia(MediaUrl... withMedia) {
204+
this.media = Arrays.asList(withMedia);
205+
}
206+
197207
/**
198208
* Get the buttons value.
199209
*
@@ -212,6 +222,15 @@ public void setButtons(List<CardAction> withButtons) {
212222
this.buttons = withButtons;
213223
}
214224

225+
/**
226+
* Set the buttons value.
227+
*
228+
* @param withButtons the buttons value to set
229+
*/
230+
public void setButtons(CardAction... withButtons) {
231+
this.buttons = Arrays.asList(withButtons);
232+
}
233+
215234
/**
216235
* Get the shareable value.
217236
*

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/CardAction.java

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,37 @@ public CardAction() {
102102
}
103103

104104
/**
105-
* Simplify creation of CardActions with string values.
105+
* Creation of CardAction with string values.
106106
*
107-
* @param input The value for both Title and Value.
107+
* @param withInput The value for both Title and Value.
108108
*/
109-
public CardAction(String input) {
110-
setTitle(input);
111-
setValue(input);
109+
public CardAction(String withInput) {
110+
setTitle(withInput);
111+
setValue(withInput);
112+
}
113+
114+
/**
115+
* Creation of CardAction with type and title.
116+
*
117+
* @param withType the type value to set.
118+
* @param withTitle the title value to set.
119+
*/
120+
public CardAction(ActionTypes withType, String withTitle) {
121+
setType(withType);
122+
setTitle(withTitle);
123+
}
124+
125+
/**
126+
* Creation of CardAction with type and title.
127+
*
128+
* @param withType the type value to set.
129+
* @param withTitle the title value to set.
130+
* @param withValue The value for both Title and Value.
131+
*/
132+
public CardAction(ActionTypes withType, String withTitle, String withValue) {
133+
setType(withType);
134+
setTitle(withTitle);
135+
setValue(withValue);
112136
}
113137

114138
/**

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/Fact.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ public class Fact {
2727
@JsonInclude(JsonInclude.Include.NON_EMPTY)
2828
private String value;
2929

30+
/**
31+
* Creates a new fact.
32+
*/
33+
public Fact() {
34+
}
35+
36+
/**
37+
* Creates a new fact.
38+
* @param withKey The key value.
39+
* @param withValue The value
40+
*/
41+
public Fact(String withKey, String withValue) {
42+
key = withKey;
43+
value = withValue;
44+
}
45+
3046
/**
3147
* Get the key value.
3248
*

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/HeroCard.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.annotation.JsonInclude;
88
import com.fasterxml.jackson.annotation.JsonProperty;
99

10+
import java.util.Arrays;
1011
import java.util.List;
1112

1213
/**
@@ -130,6 +131,15 @@ public void setImages(List<CardImage> withImages) {
130131
this.images = withImages;
131132
}
132133

134+
/**
135+
* Set the images value.
136+
*
137+
* @param withImages the images value to set
138+
*/
139+
public void setImages(CardImage... withImages) {
140+
this.images = Arrays.asList(withImages);
141+
}
142+
133143
/**
134144
* Get the buttons value.
135145
*
@@ -148,6 +158,15 @@ public void setButtons(List<CardAction> withButtons) {
148158
this.buttons = withButtons;
149159
}
150160

161+
/**
162+
* Set the buttons value.
163+
*
164+
* @param withButtons the buttons value to set
165+
*/
166+
public void setButtons(CardAction... withButtons) {
167+
this.buttons = Arrays.asList(withButtons);
168+
}
169+
151170
/**
152171
* Get the tap value.
153172
*

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/MediaUrl.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ public class MediaUrl {
2525
@JsonInclude(JsonInclude.Include.NON_EMPTY)
2626
private String profile;
2727

28+
/**
29+
* Creates a new MediaUrl.
30+
*/
31+
public MediaUrl() {
32+
}
33+
34+
/**
35+
* Creates a new MediaUrl.
36+
*
37+
* @param withUrl The url value.
38+
*/
39+
public MediaUrl(String withUrl) {
40+
url = withUrl;
41+
42+
}
43+
2844
/**
2945
* Get the url value.
3046
*

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/OAuthCard.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.annotation.JsonInclude;
88
import com.fasterxml.jackson.annotation.JsonProperty;
99

10+
import java.util.Arrays;
1011
import java.util.List;
1112

1213
/**
@@ -91,6 +92,15 @@ public void setButtons(List<CardAction> withButtons) {
9192
this.buttons = withButtons;
9293
}
9394

95+
/**
96+
* Set the buttons value.
97+
*
98+
* @param withButtons the buttons value to set
99+
*/
100+
public void setButtons(CardAction... withButtons) {
101+
this.buttons = Arrays.asList(withButtons);
102+
}
103+
94104
/**
95105
* Creates an @{link Attachment} for this card.
96106
*

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/ReceiptCard.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.annotation.JsonInclude;
88
import com.fasterxml.jackson.annotation.JsonProperty;
99

10+
import java.util.Arrays;
1011
import java.util.List;
1112

1213
/**
@@ -108,6 +109,15 @@ public void setFacts(List<Fact> withFacts) {
108109
this.facts = withFacts;
109110
}
110111

112+
/**
113+
* Set the facts value.
114+
*
115+
* @param withFacts the facts value to set
116+
*/
117+
public void setFacts(Fact... withFacts) {
118+
this.facts = Arrays.asList(withFacts);
119+
}
120+
111121
/**
112122
* Get the items value.
113123
*
@@ -126,6 +136,15 @@ public void setItems(List<ReceiptItem> withItems) {
126136
this.items = withItems;
127137
}
128138

139+
/**
140+
* Set the items value.
141+
*
142+
* @param withItems the items value to set
143+
*/
144+
public void setItems(ReceiptItem... withItems) {
145+
this.items = Arrays.asList(withItems);
146+
}
147+
129148
/**
130149
* Get the tap value.
131150
*
@@ -216,6 +235,15 @@ public void setButtons(List<CardAction> withButtons) {
216235
this.buttons = withButtons;
217236
}
218237

238+
/**
239+
* Set the buttons value.
240+
*
241+
* @param withButtons the buttons value to set
242+
*/
243+
public void setButtons(CardAction... withButtons) {
244+
this.buttons = Arrays.asList(withButtons);
245+
}
246+
219247
/**
220248
* Creates an @{link Attachment} for this card.
221249
*

libraries/bot-schema/src/main/java/com/microsoft/bot/schema/SigninCard.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.annotation.JsonInclude;
88
import com.fasterxml.jackson.annotation.JsonProperty;
99

10+
import java.util.Arrays;
1011
import java.util.List;
1112

1213
/**
@@ -66,6 +67,15 @@ public void setButtons(List<CardAction> withButtons) {
6667
this.buttons = withButtons;
6768
}
6869

70+
/**
71+
* Set the buttons value.
72+
*
73+
* @param withButtons the buttons value to set
74+
*/
75+
public void setButtons(CardAction... withButtons) {
76+
this.buttons = Arrays.asList(withButtons);
77+
}
78+
6979
/**
7080
* Creates an @{link Attachment} for this card.
7181
*

0 commit comments

Comments
 (0)