Skip to content

Commit 4a88b21

Browse files
authored
feat: support new attributes of status - quotesCount and quoteApproval introduced by Mastodon v4.5.0 (#1377)
1 parent 6a29fac commit 4a88b21

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
export interface QuoteApprovalPolicyRegistry {
2+
public: never;
3+
followers: never;
4+
following: never;
5+
unsupported_policy: never;
6+
}
7+
8+
export type QuoteApprovalPolicy = keyof QuoteApprovalPolicyRegistry;
9+
10+
export interface QuoteApprovalCurrentUserPolicyRegistry {
11+
automatic: never;
12+
manual: never;
13+
denied: never;
14+
unknown: never;
15+
}
16+
17+
export type QuoteApprovalCurrentUserPolicy =
18+
keyof QuoteApprovalCurrentUserPolicyRegistry;
19+
20+
/**
21+
* Represents a summary of a status' quote approval policy and how it applies to the requesting user.
22+
* @see https://docs.joinmastodon.org/entities/QuoteApproval
23+
*/
24+
export interface QuoteApproval {
25+
/**
26+
* Describes who is expected to be able to quote that status and have the quote automatically authorized.
27+
* An empty list means that nobody is expected to be able to quote this post. Other values may be added in the future,
28+
* so unknown values should be treated as `unsupported_policy`.
29+
* @see https://docs.joinmastodon.org/entities/QuoteApproval/#automatic
30+
*/
31+
automatic: QuoteApprovalPolicy[];
32+
/**
33+
* Describes who is expected to have their quotes of this status be manually reviewed by the author before being accepted.
34+
* An empty list means that nobody is expected to be able to quote this post. Other values may be added in the future,
35+
* so unknown values should be treated as `unsupported_policy`.
36+
* @see https://docs.joinmastodon.org/entities/QuoteApproval/#manual
37+
*/
38+
manual: QuoteApprovalPolicy[];
39+
/**
40+
* Describes how this status’ quote policy applies to the current user.
41+
* @see https://docs.joinmastodon.org/entities/QuoteApproval/#current_user
42+
*/
43+
currentUser: QuoteApprovalCurrentUserPolicy;
44+
}

src/mastodon/entities/v1/status.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { type MediaAttachment } from "./media-attachment.js";
66
import { type Poll } from "./poll.js";
77
import { type PreviewCard } from "./preview-card.js";
88
import { type Quote } from "./quote.js";
9+
import { type QuoteApproval } from "./quote-approval.js";
910
import { type ShallowQuote } from "./shallow-quote.js";
1011
import { type Tag } from "./tag.js";
1112

@@ -81,6 +82,13 @@ export interface Status {
8182
repliesCount: number;
8283
/** Information about the status being quoted, if any */
8384
quote?: Quote | ShallowQuote | null;
85+
/** How many replies this status has received. */
86+
quotesCount: number;
87+
/**
88+
* Summary of the post quote’s approval policy and how it applies to the user making the request,
89+
* that is, whether the user can be expected to be allowed to quote that post.
90+
**/
91+
quoteApproval: QuoteApproval;
8492

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

0 commit comments

Comments
 (0)