Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support new accounts field in PreviewCard of status introduced by Mastodon 4.3.0 #1229

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading