pl-api: status bite notification
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user