Skip to content

Commit be42256

Browse files
authored
feat: Add quote entities and attach to statuses (#1324)
* add quote entities and attach to statuses * Fix linting
1 parent 2728952 commit be42256

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

src/mastodon/entities/v1/quote.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { type Status } from "./status.js";
2+
3+
export interface QuoteStateRegistry {
4+
pending: never;
5+
accepted: never;
6+
rejected: never;
7+
revoked: never;
8+
deleted: never;
9+
unauthorized: never;
10+
}
11+
12+
export type QuoteState = keyof QuoteStateRegistry;
13+
14+
/**
15+
* Represents a quote or a quote placeholder, with the current authorization status.
16+
* @see https://docs.joinmastodon.org/entities/Quote
17+
*/
18+
export interface Quote {
19+
/* The state of the quote */
20+
state: QuoteState;
21+
/* The status being quoted, if the quote has been accepted. This will be null, unless the state attribute is accepted. */
22+
quotedStatus: Status | null;
23+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { type QuoteState } from "./quote.js";
2+
3+
/**
4+
* Represents a quote or a quote placeholder, with the current authorization status.
5+
* @see https://docs.joinmastodon.org/entities/ShallowQuote/
6+
*/
7+
export interface ShallowQuote {
8+
/* The state of the quote. */
9+
state: QuoteState;
10+
/* The identifier of the status being quoted, if the quote has been accepted. This will be null, unless the state attribute is accepted. */
11+
quotedStatusId: string | null;
12+
}

src/mastodon/entities/v1/status-edit.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ export type StatusEdit = Pick<
99
| "account"
1010
| "mediaAttachments"
1111
| "emojis"
12-
>;
12+
> & {
13+
quote?: Status["quote"];
14+
};

src/mastodon/entities/v1/status.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { type FilterResult } from "./filter-result.js";
55
import { type MediaAttachment } from "./media-attachment.js";
66
import { type Poll } from "./poll.js";
77
import { type PreviewCard } from "./preview-card.js";
8+
import { type Quote } from "./quote.js";
9+
import { type ShallowQuote } from "./shallow-quote.js";
810
import { type Tag } from "./tag.js";
911

1012
/**
@@ -77,6 +79,8 @@ export interface Status {
7779
filtered?: FilterResult[];
7880
/** How many replies this status has received. */
7981
repliesCount: number;
82+
/** Information about the status being quoted, if any */
83+
quote: Quote | ShallowQuote | null;
8084

8185
/** A link to the status's HTML representation. */
8286
url?: string | null;

0 commit comments

Comments
 (0)