Table of Contents

Class CardAttachment

Namespace
Vonage.Messages.Rcs
Assembly
Vonage.dll

Represents a card attachment

public record CardAttachment : IEquatable<CardAttachment>
Inheritance
CardAttachment
Implements
Inherited Members

Constructors

CardAttachment(string, string, Uri)

Represents a card attachment

public CardAttachment(string Title, string Text, Uri MediaUrl)

Parameters

Title string

The title of the card.

Text string

The text to display on the card.

MediaUrl Uri

The publicly accessible URL of the media attachment for the card. Supported media include images, videos, and PDFs.

Properties

MediaDescription

A short description of the media for accessibility purposes.

public string MediaDescription { get; init; }

Property Value

string

MediaForceRefresh

By default, media URLs are cached on the RCS platform for up to 60 days. Set this property to true to force the platform to fetch a fresh copy of the media from the provided URL.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool MediaForceRefresh { get; init; }

Property Value

bool

MediaHeight

The height of the media element. If not specified, defaults to SHORT.

[JsonConverter(typeof(EnumDescriptionJsonConverter<CardAttachment.Height>))]
public CardAttachment.Height? MediaHeight { get; init; }

Property Value

CardAttachment.Height?

MediaUrl

The publicly accessible URL of the media attachment for the card. Supported media include images, videos, and PDFs.

public Uri MediaUrl { get; init; }

Property Value

Uri

Suggestions

An array of suggestion objects to include with the card. You can include up to 4 suggestions per card.

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public SuggestionBase[] Suggestions { get; init; }

Property Value

SuggestionBase[]

Text

The text to display on the card.

public string Text { get; init; }

Property Value

string

ThumbnailUrl

The publicly accessible URL of the thumbnail image for the card.

public Uri ThumbnailUrl { get; init; }

Property Value

Uri

Title

The title of the card.

public string Title { get; init; }

Property Value

string

Methods

AppendSuggestion(SuggestionBase)

Returns a card attachment with a new suggestion.

public CardAttachment AppendSuggestion(SuggestionBase suggestion)

Parameters

suggestion SuggestionBase

The suggestion

Returns

CardAttachment

The card attachment

ForceMediaRefresh()

Returns a card attachment with a forced media refresh.

public CardAttachment ForceMediaRefresh()

Returns

CardAttachment

The card attachment

GetErrors()

Returns any validation errors for this card attachment.

public IEnumerable<string> GetErrors()

Returns

IEnumerable<string>

WithMediaDescription(string)

Returns a card attachment with a media description.

public CardAttachment WithMediaDescription(string value)

Parameters

value string

The media description

Returns

CardAttachment

The card attachment

WithMediaHeight(Height)

Returns a card attachment with a media height.

public CardAttachment WithMediaHeight(CardAttachment.Height value)

Parameters

value CardAttachment.Height

The media height

Returns

CardAttachment

The card attachment

WithThumbnailUrl(Uri)

Returns a card attachment with a thumbnail url.

public CardAttachment WithThumbnailUrl(Uri value)

Parameters

value Uri

The thumbnail url.

Returns

CardAttachment

The card attachment