LinkPreview

Card action that displays a link preview card and smart chip in the host app. For more
information, refer to [Preview links
with smart chips](https://developers.google.com/apps-script/add-ons/editors/gsao/preview-links).

```javascript
const decoratedText =
    CardService.newDecoratedText().setTopLabel('Hello').setText('Hi!');

const cardSection = CardService.newCardSection().addWidget(decoratedText);

const card = CardService.newCardBuilder().addSection(cardSection).build();

const linkPreview =
    AddOnsResponseService.newLinkPreview().setPreviewCard(card).setTitle(
        'Smart chip title');
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#printJson()` | `String` | Prints the JSON representation of this object. |
| `https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#setLinkPreviewTitle(String)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#` | Sets the title that displays in the link preview above the preview card. |
| `https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#setPreviewCard(Card)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#` | Sets the card that displays information about a link from a third-party or non-Google service. |
| `https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#setTitle(String)` | `https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#` | Sets the title that displays in the smart chip for the link preview. |

## Detailed documentation

### `printJson()`

Prints the JSON representation of this object. This is for debugging only.

#### Return


`String`

*** ** * ** ***

### `setLinkPreviewTitle(title)`

Sets the title that displays in the link preview above the preview card. If unset, the link
preview displays the header of the `PreviewCard`.

```javascript
const linkPreview = AddOnsResponseService.newLinkPreview().setLinkPreviewTitle(
    'Link preview title',
);
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `title` | `String` | The title of the link preview. |

#### Return


`https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#` --- This object, for chaining.

*** ** * ** ***

### `setPreviewCard(previewCard)`

Sets the card that displays information about a link from a third-party or non-Google service.

```javascript
const decoratedText =
    CardService.newDecoratedText().setTopLabel('Hello').setText('Hi!');

const cardSection = CardService.newCardSection().addWidget(decoratedText);

const card = CardService.newCardBuilder().addSection(cardSection).build();

const linkPreview =
    AddOnsResponseService.newLinkPreview().setPreviewCard(card).setTitle(
        'Smart chip title');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `previewCard` | `https://developers.google.com/apps-script/reference/card-service/card.html` | The preview card. |

#### Return


`https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#` --- This object, for chaining.

*** ** * ** ***

### `setTitle(title)`

Sets the title that displays in the smart chip for the link preview. If unset, the smart chip
displays the header of the `PreviewCard`.

```javascript
const linkPreview =
    AddOnsResponseService.newLinkPreview().setTitle('Smart chip title');
```

#### Parameters

| Name | Type | Description |
|---|---|---|
| `title` | `String` | The title of the smart chip. |

#### Return


`https://developers.google.com/apps-script/reference/add-ons-response-service/link-preview#` --- This object, for chaining.