pl-api: status bite notification

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2025-06-02 21:38:15 +02:00
parent 4ec032ab47
commit 08822a32d8
7 changed files with 35 additions and 12 deletions

View File

@@ -481,7 +481,7 @@ class PlApiClient {
return accounts;
}, {})),
statuses: Object.values(items.reduce<Record<string, Status>>((statuses, notification) => {
if ('status' in notification) statuses[notification.status.id] = notification.status;
if ('status' in notification && notification.status) statuses[notification.status.id] = notification.status;
return statuses;
}, {})),
notification_groups: notificationGroups,

View File

@@ -22,7 +22,7 @@ const baseNotificationSchema = v.object({
const accountNotificationSchema = v.object({
...baseNotificationSchema.entries,
type: v.picklist(['follow', 'follow_request', 'admin.sign_up', 'bite']),
type: v.picklist(['follow', 'follow_request', 'admin.sign_up']),
});
const mentionNotificationSchema = v.object({
@@ -83,6 +83,12 @@ const eventParticipationRequestNotificationSchema = v.object({
participation_message: v.fallback(v.nullable(v.string()), null),
});
const biteNotificationSchema = v.object({
...baseNotificationSchema.entries,
type: v.literal('bite'),
status: v.fallback(v.nullable(statusSchema), null),
});
/**
* @category Schemas
* @see {@link https://docs.joinmastodon.org/entities/Notification/}
@@ -108,6 +114,7 @@ const notificationSchema: v.BaseSchema<any, Notification, v.BaseIssue<unknown>>
emojiReactionNotificationSchema,
chatMentionNotificationSchema,
eventParticipationRequestNotificationSchema,
biteNotificationSchema,
])) as any;
/**
@@ -124,6 +131,7 @@ type Notification = v.InferOutput<
| typeof emojiReactionNotificationSchema
| typeof chatMentionNotificationSchema
| typeof eventParticipationRequestNotificationSchema
| typeof biteNotificationSchema
>;
export { notificationSchema, type Notification };

View File

@@ -1,6 +1,6 @@
{
"name": "pl-api",
"version": "1.0.0-rc.75",
"version": "1.0.0-rc.76",
"type": "module",
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
"repository": {