@microsoft/teams.cards
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta
114 lines (113 loc) • 2.87 kB
JavaScript
class Card {
type;
/**
* The Adaptive Card schema.
*/
$schema;
/**
* Schema version that this card requires. If a client is lower than this version, the fallbackText will be rendered. NOTE: Version is not required for cards within an Action.ShowCard. However, it is required for the top-level card.
*/
version;
/**
* Defines how the card can be refreshed by making a request to the target Bot.
*/
refresh;
/**
* Defines authentication information to enable on-behalf-of single sign on or just-in-time OAuth.
*/
authentication;
/**
* The card elements to show in the primary card region.
*/
body;
/**
* The Actions to show in the card’s action bar.
*/
actions;
/**
* An Action that will be invoked when the card is tapped or selected. Action.ShowCard is not supported.
*/
selectAction;
/**
* Text shown when the client doesn’t support the version specified (may contain markdown).
*/
fallbackText;
/**
* Specifies the background image of the card.
*/
backgroundImage;
/**
* Specifies the minimum height of the card.
*/
minHeight;
/**
* When true content in this Adaptive Card should be presented right to left. When ‘false’ content in this Adaptive Card should be presented left to right. If unset, the default platform behavior will apply.
*/
rtl;
/**
* Specifies what should be spoken for this entire card. This is simple text or SSML fragment.
*/
speak;
/**
* The 2-letter ISO-639-1 language used in the card. Used to localize any date/time functions.
*/
lang;
/**
* Defines how the content should be aligned vertically within the container. Only relevant for fixed-height cards, or cards with a minHeight specified.
*/
verticalContentAlignment;
/**
* Extra Teams data for the card.
*/
msteams;
constructor(...body) {
this.type = "AdaptiveCard";
this.body = body;
this.version = "1.6";
}
withOptions(value) {
Object.assign(this, value);
return this;
}
withSchema(value) {
this.$schema = value;
return this;
}
withVersion(value) {
this.version = value;
return this;
}
withRefresh(value) {
this.refresh = value;
return this;
}
withAuth(value) {
this.authentication = value;
return this;
}
withSelectedAction(value) {
this.selectAction = value;
return this;
}
withBody(...value) {
this.body = value;
return this;
}
addCards(...value) {
this.body.push(...value);
return this;
}
addActions(...value) {
if (!this.actions) {
this.actions = [];
}
this.actions.push(...value);
return this;
}
}
function isCard(value) {
return typeof value === "object" && value.type === "AdaptiveCard";
}
export { Card, isCard };
//# sourceMappingURL=card.mjs.map
//# sourceMappingURL=card.mjs.map