forked from mirrors/misskey
wip
This commit is contained in:
@@ -1,25 +1,24 @@
|
||||
import type { JSONSchema7Definition } from 'schema-type';
|
||||
|
||||
export const packedNoteReactionSchema = {
|
||||
$id: 'https://misskey-hub.net/api/schemas/NoteReaction',
|
||||
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'id',
|
||||
example: 'xxxxxxxxxx',
|
||||
},
|
||||
id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
createdAt: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'date-time',
|
||||
},
|
||||
user: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'UserLite',
|
||||
},
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
type: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
required: [
|
||||
'id',
|
||||
'createdAt',
|
||||
'user',
|
||||
'type',
|
||||
],
|
||||
} as const satisfies JSONSchema7Definition;
|
||||
|
||||
@@ -1,62 +1,117 @@
|
||||
import { notificationTypes } from '../consts';
|
||||
import type { JSONSchema7Definition } from 'schema-type';
|
||||
import { ACHIEVEMENT_TYPES } from '../consts';
|
||||
|
||||
export const packedNotificationSchema = {
|
||||
$id: 'https://misskey-hub.net/api/schemas/Notification',
|
||||
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'id',
|
||||
example: 'xxxxxxxxxx',
|
||||
allOf: [{
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
createdAt: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
},
|
||||
},
|
||||
createdAt: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'date-time',
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
enum: [...notificationTypes],
|
||||
},
|
||||
user: {
|
||||
required: ['id', 'createdAt'],
|
||||
}, {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'object',
|
||||
ref: 'UserLite',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
format: 'id',
|
||||
},
|
||||
note: {
|
||||
properties: {
|
||||
type: { const: 'follow' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
},
|
||||
required: ['type', 'userId', 'user'],
|
||||
}, {
|
||||
type: 'object',
|
||||
ref: 'Note',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
reaction: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
choice: {
|
||||
type: 'number',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
invitation: {
|
||||
properties: {
|
||||
type: { const: 'mention' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
note: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
|
||||
},
|
||||
required: ['type', 'userId', 'user', 'note'],
|
||||
}, {
|
||||
type: 'object',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
body: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
header: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
icon: {
|
||||
type: 'string',
|
||||
optional: true, nullable: true,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
properties: {
|
||||
type: { const: 'reply' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
note: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
|
||||
},
|
||||
required: ['type', 'userId', 'user', 'note'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'renote' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
note: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
|
||||
},
|
||||
required: ['type', 'userId', 'user', 'note'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'quote' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
note: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
|
||||
},
|
||||
required: ['type', 'userId', 'user', 'note'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'reaction' },
|
||||
reaction: { type: 'string' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
note: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
|
||||
},
|
||||
required: ['type', 'reaction', 'userId', 'user', 'note'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'pollEnded' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
note: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
|
||||
},
|
||||
required: ['type', 'userId', 'user', 'note'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'receiveFollowRequest' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
},
|
||||
required: ['type', 'userId', 'user'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'followRequestAccepted' },
|
||||
userId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
|
||||
user: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
|
||||
},
|
||||
required: ['type', 'userId', 'user'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'achievementEarned' },
|
||||
achievement: { enum: [...ACHIEVEMENT_TYPES] },
|
||||
},
|
||||
required: ['type', 'achievement'],
|
||||
}, {
|
||||
type: 'object',
|
||||
properties: {
|
||||
type: { const: 'app' },
|
||||
header: { type: ['string', 'null'] },
|
||||
body: { type: 'string' },
|
||||
icon: { type: ['string', 'null'] },
|
||||
},
|
||||
required: ['type'],
|
||||
}],
|
||||
}],
|
||||
} as const satisfies JSONSchema7Definition;
|
||||
|
||||
Reference in New Issue
Block a user