Share via


CardFactory class

Factory class for creating various types of cards.

Properties

contentTypes

The content types supported by the card factory.

Methods

actions(undefined | (string | CardAction)[])

Converts an array of action URLs or objects to an array of CardAction objects.

adaptiveCard(any)

Creates an adaptive card attachment.

animationCard(string, (string | MediaUrl)[], (string | CardAction)[], Partial<AnimationCard>)

Creates an animation card attachment.

audioCard(string, (string | MediaUrl)[], (string | CardAction)[], Partial<AudioCard>)

Creates an audio card attachment.

heroCard(string, any, any, any, Partial<HeroCard>)

Creates a hero card attachment.

images(undefined | (string | CardImage)[])

Converts an array of image URLs or objects to an array of CardImage objects.

media(undefined | (string | MediaUrl)[])

Converts an array of media URLs or objects to an array of MediaUrl objects.

o365ConnectorCard(O365ConnectorCard)

Creates an O365 connector card attachment.

oauthCard(string, string, string, SignInResource)

Creates an OAuth card attachment.

receiptCard(ReceiptCard)

Creates a receipt card attachment.

signinCard(string, string, string)

Creates a sign-in card attachment.

thumbnailCard(string, any, any, any, Partial<ThumbnailCard>)

Creates a thumbnail card attachment.

videoCard(string, (string | MediaUrl)[], (string | CardAction)[], Partial<VideoCard>)

Creates a video card attachment.

Property Details

contentTypes

The content types supported by the card factory.

static contentTypes: any

Property Value

any

Method Details

actions(undefined | (string | CardAction)[])

Converts an array of action URLs or objects to an array of CardAction objects.

static function actions(actions: undefined | (string | CardAction)[]): CardAction[]

Parameters

actions

undefined | (string | CardAction)[]

The action URLs or objects.

Returns

The array of CardAction objects.

adaptiveCard(any)

Creates an adaptive card attachment.

static function adaptiveCard(card: any): Attachment

Parameters

card

any

The adaptive card content.

Returns

The adaptive card attachment.

animationCard(string, (string | MediaUrl)[], (string | CardAction)[], Partial<AnimationCard>)

Creates an animation card attachment.

static function animationCard(title: string, media: (string | MediaUrl)[], buttons?: (string | CardAction)[], other?: Partial<AnimationCard>): Attachment

Parameters

title

string

The title of the card.

media

(string | MediaUrl)[]

The media URLs or objects.

buttons

(string | CardAction)[]

The optional buttons for the card.

other

Partial<AnimationCard>

Additional properties for the card.

Returns

The animation card attachment.

audioCard(string, (string | MediaUrl)[], (string | CardAction)[], Partial<AudioCard>)

Creates an audio card attachment.

static function audioCard(title: string, media: (string | MediaUrl)[], buttons?: (string | CardAction)[], other?: Partial<AudioCard>): Attachment

Parameters

title

string

The title of the card.

media

(string | MediaUrl)[]

The media URLs or objects.

buttons

(string | CardAction)[]

The optional buttons for the card.

other

Partial<AudioCard>

Additional properties for the card.

Returns

The audio card attachment.

heroCard(string, any, any, any, Partial<HeroCard>)

Creates a hero card attachment.

static function heroCard(title: string, text?: any, images?: any, buttons?: any, other?: Partial<HeroCard>): Attachment

Parameters

title

string

The title of the card.

text

any

The optional text for the card.

images

any

The optional images for the card.

buttons

any

The optional buttons for the card.

other

Partial<HeroCard>

Additional properties for the card.

Returns

The hero card attachment.

images(undefined | (string | CardImage)[])

Converts an array of image URLs or objects to an array of CardImage objects.

static function images(images: undefined | (string | CardImage)[]): CardImage[]

Parameters

images

undefined | (string | CardImage)[]

The image URLs or objects.

Returns

The array of CardImage objects.

media(undefined | (string | MediaUrl)[])

Converts an array of media URLs or objects to an array of MediaUrl objects.

static function media(links: undefined | (string | MediaUrl)[]): MediaUrl[]

Parameters

links

undefined | (string | MediaUrl)[]

The media URLs or objects.

Returns

The array of MediaUrl objects.

o365ConnectorCard(O365ConnectorCard)

Creates an O365 connector card attachment.

static function o365ConnectorCard(card: O365ConnectorCard): Attachment

Parameters

card
O365ConnectorCard

The O365 connector card content.

Returns

The O365 connector card attachment.

oauthCard(string, string, string, SignInResource)

Creates an OAuth card attachment.

static function oauthCard(connectionName: string, title: string, text: string, signingResource: SignInResource): Attachment

Parameters

connectionName

string

The connection name.

title

string

The title of the card.

text

string

The optional text for the card.

signingResource
SignInResource

The signing resource.

Returns

The OAuth card attachment.

receiptCard(ReceiptCard)

Creates a receipt card attachment.

static function receiptCard(card: ReceiptCard): Attachment

Parameters

card
ReceiptCard

The receipt card content.

Returns

The receipt card attachment.

signinCard(string, string, string)

Creates a sign-in card attachment.

static function signinCard(title: string, url: string, text?: string): Attachment

Parameters

title

string

The title of the card.

url

string

The URL for the sign-in button.

text

string

The optional text for the card.

Returns

The sign-in card attachment.

thumbnailCard(string, any, any, any, Partial<ThumbnailCard>)

Creates a thumbnail card attachment.

static function thumbnailCard(title: string, text?: any, images?: any, buttons?: any, other?: Partial<ThumbnailCard>): Attachment

Parameters

title

string

The title of the card.

text

any

The optional text for the card.

images

any

The optional images for the card.

buttons

any

The optional buttons for the card.

other

Partial<ThumbnailCard>

Additional properties for the card.

Returns

The thumbnail card attachment.

videoCard(string, (string | MediaUrl)[], (string | CardAction)[], Partial<VideoCard>)

Creates a video card attachment.

static function videoCard(title: string, media: (string | MediaUrl)[], buttons?: (string | CardAction)[], other?: Partial<VideoCard>): Attachment

Parameters

title

string

The title of the card.

media

(string | MediaUrl)[]

The media URLs or objects.

buttons

(string | CardAction)[]

The optional buttons for the card.

other

Partial<VideoCard>

Additional properties for the card.

Returns

The video card attachment.