Skip to content

Commit

Permalink
Merge pull request #1229 from shuuji3/feat/support-preview-card-autho…
Browse files Browse the repository at this point in the history
…rs-field

feat: Support new `accounts` field in `PreviewCard` of status introduced by Mastodon 4.3.0
  • Loading branch information
neet authored Oct 21, 2024
2 parents 7110ad0 + 12b4695 commit 6219c18
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/mastodon/entities/v1/preview-card.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { type Account } from "./account";
import { type TagHistory } from "./tag";

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

/**
* Represents an author in a rich preview card.
* @see https://docs.joinmastodon.org/entities/PreviewCardAuthor/
*/
export interface PreviewCardAuthor {
/** The original resource author’s name. Replaces the deprecated author_name attribute of the preview card. */
name: string;
/** A link to the author of the original resource. Replaces the deprecated author_url attribute of the preview card. */
url: string;
/** The fediverse account of the author. */
account: Account | null;
}

/**
* Represents a rich preview card that is generated using OpenGraph tags from a URL.
* @see https://docs.joinmastodon.org/entities/PreviewCard
Expand All @@ -17,10 +31,17 @@ export interface PreviewCard {
type: PreviewCardType;
/** Blurhash */
blurhash: string;

/** The author of the original resource. */
/** Fediverse account of the authors of the original resource. */
authors: PreviewCardAuthor[];
/**
* The author of the original resource.
* @deprecated Use `authors` instead
*/
authorName?: string | null;
/** A link to the author of the original resource. */
/**
* A link to the author of the original resource.
* @deprecated Use `authors` instead
*/
authorUrl?: string | null;
/** The provider of the original resource. */
providerName?: string | null;
Expand Down

0 comments on commit 6219c18

Please sign in to comment.