Skip to content

Commit 96a84f2

Browse files
committed
feat: Support new accounts field in PreviewCard of status introduced by Mastodon 4.3.0
Here's Mastodon documentation page for new `authors` field: https://docs.joinmastodon.org/entities/PreviewCard/#authors
1 parent 7110ad0 commit 96a84f2

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/mastodon/entities/v1/preview-card.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
import { type TagHistory } from "./tag";
2+
import { Account } from "./account";
23

34
export type PreviewCardType = "link" | "photo" | "video" | "rich";
45

6+
/**
7+
* Represents an author in a rich preview card.
8+
* @see https://docs.joinmastodon.org/entities/PreviewCardAuthor/
9+
*/
10+
export interface PreviewCardAuthor {
11+
/** The original resource author’s name. Replaces the deprecated author_name attribute of the preview card. */
12+
name: string;
13+
/** A link to the author of the original resource. Replaces the deprecated author_url attribute of the preview card. */
14+
url: string;
15+
/** The fediverse account of the author. */
16+
account: Account | null;
17+
}
18+
519
/**
620
* Represents a rich preview card that is generated using OpenGraph tags from a URL.
721
* @see https://docs.joinmastodon.org/entities/PreviewCard
@@ -17,10 +31,17 @@ export interface PreviewCard {
1731
type: PreviewCardType;
1832
/** Blurhash */
1933
blurhash: string;
20-
21-
/** The author of the original resource. */
34+
/** Fediverse account of the authors of the original resource. */
35+
authors: PreviewCardAuthor[];
36+
/**
37+
* The author of the original resource.
38+
* @deprecated Use `authors` instead
39+
*/
2240
authorName?: string | null;
23-
/** A link to the author of the original resource. */
41+
/**
42+
* A link to the author of the original resource.
43+
* @deprecated Use `authors` instead
44+
*/
2445
authorUrl?: string | null;
2546
/** The provider of the original resource. */
2647
providerName?: string | null;

0 commit comments

Comments
 (0)