pl-api: update according to mastodon docs

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2026-01-04 13:29:54 +01:00
parent 858f866411
commit c7643d65c5
7 changed files with 26 additions and 1 deletions

View File

@ -58,6 +58,7 @@ const adminAccountSchema = v.pipe(
disabled: v.fallback(v.boolean(), false),
silenced: v.fallback(v.boolean(), false),
suspended: v.fallback(v.boolean(), false),
sensitized: v.fallback(v.boolean(), false),
account: v.fallback(v.nullable(accountSchema), null),
created_by_application_id: v.fallback(v.optional(v.string()), undefined),
invited_by_account_id: v.fallback(v.optional(v.string()), undefined),

View File

@ -9,7 +9,7 @@ const featuredTagSchema = v.object({
name: v.string(),
url: v.fallback(v.optional(v.string()), undefined),
statuses_count: v.number(),
last_status_at: v.number(),
last_status_at: v.fallback(v.nullable(v.number()), null),
});
/**

View File

@ -66,6 +66,8 @@ export * from './poll';
export * from './preview-card';
export * from './preview-card-author';
export * from './privacy-policy';
export * from './quote';
export * from './quote-approval';
export * from './relationship';
export * from './relationship-severance-event';
export * from './report';

View File

@ -0,0 +1,18 @@
import * as v from 'valibot';
/**
* @category Schemas
* @see {@link https://docs.joinmastodon.org/entities/QuoteApproval/}
*/
const quoteApprovalSchema = v.object({
automatic: v.array(v.picklist(['public', 'followers', 'following', 'unsupported_policy'])),
manual: v.array(v.picklist(['public', 'followers', 'following', 'unsupported_policy'])),
current_user: v.picklist(['automatic', 'manual', 'denied', 'unknown']),
});
/**
* @category Entity types
*/
type QuoteApproval = v.InferOutput<typeof quoteApprovalSchema>;
export { quoteApprovalSchema, type QuoteApproval };

View File

@ -18,6 +18,7 @@ const relationshipSchema = v.object({
notifying: v.fallback(v.boolean(), false),
requested: v.fallback(v.boolean(), false),
showing_reblogs: v.fallback(v.boolean(), false),
languages: v.fallback(v.nullable(v.array(v.string())), null),
});
/**

View File

@ -12,6 +12,7 @@ import { mentionSchema } from './mention';
import { pollSchema } from './poll';
import { previewCardSchema } from './preview-card';
import { type Quote, quoteSchema, type ShallowQuote, shallowQuoteSchema } from './quote';
import { quoteApprovalSchema } from './quote-approval';
import { rssFeedSchema } from './rss-feed';
import { tagSchema } from './tag';
import { translationSchema } from './translation';
@ -78,6 +79,7 @@ const baseStatusSchema = v.object({
approval_status: v.fallback(v.nullable(v.picklist(['pending', 'approval', 'rejected'])), null),
group: v.fallback(v.nullable(groupSchema), null),
scheduled_at: v.fallback(v.null(), null),
quote_approval: v.fallback(v.nullable(quoteApprovalSchema), null),
quote_id: v.fallback(v.nullable(v.string()), null),
local: v.fallback(v.optional(v.boolean()), undefined),

View File

@ -36,6 +36,7 @@ const translationSchema = v.pipe(
id: v.fallback(v.nullable(v.string()), null),
content: v.fallback(v.string(), ''),
spoiler_text: v.fallback(v.string(), ''),
language: v.fallback(v.string(), ''),
poll: v.fallback(v.optional(translationPollSchema), undefined),
media_attachments: filteredArray(translationMediaAttachment),
detected_source_language: v.string(),