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

Sample 06.using-cards #933

Merged
merged 4 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.bot.schema.CardAction;
import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -35,6 +36,26 @@ public Choice(String withValue) {
value = withValue;
}

/**
* Creates a Choice.
* @param withValue The value.
* @param withSynonyms The list of synonyms to recognize in addition to the value.
*/
public Choice(String withValue, List<String> withSynonyms) {
value = withValue;
synonyms = withSynonyms;
}

/**
* Creates a Choice.
* @param withValue The value.
* @param withSynonyms The list of synonyms to recognize in addition to the value.
*/
public Choice(String withValue, String... withSynonyms) {
value = withValue;
synonyms = Arrays.asList(withSynonyms);
}

/**
* Gets the value to return when selected.
* @return The value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -193,6 +194,15 @@ public void setMedia(List<MediaUrl> withMedia) {
this.media = withMedia;
}

/**
* Set the media value.
*
* @param withMedia the media value to set
*/
public void setMedia(MediaUrl... withMedia) {
this.media = Arrays.asList(withMedia);
}

/**
* Get the buttons value.
*
Expand All @@ -211,6 +221,15 @@ public void setButtons(List<CardAction> withButtons) {
this.buttons = withButtons;
}

/**
* Set the buttons value.
*
* @param withButtons the buttons value to set
*/
public void setButtons(CardAction... withButtons) {
this.buttons = Arrays.asList(withButtons);
}

/**
* Get the shareable value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -194,6 +195,15 @@ public void setMedia(List<MediaUrl> withMedia) {
this.media = withMedia;
}

/**
* Set the media value.
*
* @param withMedia the media value to set
*/
public void setMedia(MediaUrl... withMedia) {
this.media = Arrays.asList(withMedia);
}

/**
* Get the buttons value.
*
Expand All @@ -212,6 +222,15 @@ public void setButtons(List<CardAction> withButtons) {
this.buttons = withButtons;
}

/**
* Set the buttons value.
*
* @param withButtons the buttons value to set
*/
public void setButtons(CardAction... withButtons) {
this.buttons = Arrays.asList(withButtons);
}

/**
* Get the shareable value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,37 @@ public CardAction() {
}

/**
* Simplify creation of CardActions with string values.
* Creation of CardAction with string values.
*
* @param input The value for both Title and Value.
* @param withInput The value for both Title and Value.
*/
public CardAction(String input) {
setTitle(input);
setValue(input);
public CardAction(String withInput) {
setTitle(withInput);
setValue(withInput);
}

/**
* Creation of CardAction with type and title.
*
* @param withType the type value to set.
* @param withTitle the title value to set.
*/
public CardAction(ActionTypes withType, String withTitle) {
setType(withType);
setTitle(withTitle);
}

/**
* Creation of CardAction with type and title.
*
* @param withType the type value to set.
* @param withTitle the title value to set.
* @param withValue The value for both Title and Value.
*/
public CardAction(ActionTypes withType, String withTitle, String withValue) {
setType(withType);
setTitle(withTitle);
setValue(withValue);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ public class Fact {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String value;

/**
* Creates a new fact.
*/
public Fact() {
}

/**
* Creates a new fact.
* @param withKey The key value.
* @param withValue The value
*/
public Fact(String withKey, String withValue) {
key = withKey;
value = withValue;
}

/**
* Get the key value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -130,6 +131,15 @@ public void setImages(List<CardImage> withImages) {
this.images = withImages;
}

/**
* Set the images value.
*
* @param withImages the images value to set
*/
public void setImages(CardImage... withImages) {
this.images = Arrays.asList(withImages);
}

/**
* Get the buttons value.
*
Expand All @@ -148,6 +158,15 @@ public void setButtons(List<CardAction> withButtons) {
this.buttons = withButtons;
}

/**
* Set the buttons value.
*
* @param withButtons the buttons value to set
*/
public void setButtons(CardAction... withButtons) {
this.buttons = Arrays.asList(withButtons);
}

/**
* Get the tap value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ public class MediaUrl {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String profile;

/**
* Creates a new MediaUrl.
*/
public MediaUrl() {
}

/**
* Creates a new MediaUrl.
*
* @param withUrl The url value.
*/
public MediaUrl(String withUrl) {
url = withUrl;

}

/**
* Get the url value.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -91,6 +92,15 @@ public void setButtons(List<CardAction> withButtons) {
this.buttons = withButtons;
}

/**
* Set the buttons value.
*
* @param withButtons the buttons value to set
*/
public void setButtons(CardAction... withButtons) {
this.buttons = Arrays.asList(withButtons);
}

/**
* Creates an @{link Attachment} for this card.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -108,6 +109,15 @@ public void setFacts(List<Fact> withFacts) {
this.facts = withFacts;
}

/**
* Set the facts value.
*
* @param withFacts the facts value to set
*/
public void setFacts(Fact... withFacts) {
this.facts = Arrays.asList(withFacts);
}

/**
* Get the items value.
*
Expand All @@ -126,6 +136,15 @@ public void setItems(List<ReceiptItem> withItems) {
this.items = withItems;
}

/**
* Set the items value.
*
* @param withItems the items value to set
*/
public void setItems(ReceiptItem... withItems) {
this.items = Arrays.asList(withItems);
}

/**
* Get the tap value.
*
Expand Down Expand Up @@ -216,6 +235,15 @@ public void setButtons(List<CardAction> withButtons) {
this.buttons = withButtons;
}

/**
* Set the buttons value.
*
* @param withButtons the buttons value to set
*/
public void setButtons(CardAction... withButtons) {
this.buttons = Arrays.asList(withButtons);
}

/**
* Creates an @{link Attachment} for this card.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -66,6 +67,15 @@ public void setButtons(List<CardAction> withButtons) {
this.buttons = withButtons;
}

/**
* Set the buttons value.
*
* @param withButtons the buttons value to set
*/
public void setButtons(CardAction... withButtons) {
this.buttons = Arrays.asList(withButtons);
}

/**
* Creates an @{link Attachment} for this card.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

Expand Down Expand Up @@ -113,6 +114,15 @@ public void setImages(List<CardImage> withImages) {
this.images = withImages;
}

/**
* Set the images value.
*
* @param withImages the images value to set
*/
public void setImages(CardImage... withImages) {
this.images = Arrays.asList(withImages);
}

/**
* Sets the images list with a single image.
* @param image The image to set as the list.
Expand All @@ -139,6 +149,15 @@ public void setButtons(List<CardAction> withButtons) {
this.buttons = withButtons;
}

/**
* Set the buttons value.
*
* @param withButtons the buttons value to set
*/
public void setButtons(CardAction... withButtons) {
this.buttons = Arrays.asList(withButtons);
}

/**
* Get the tap value.
*
Expand Down
Loading