This commit is contained in:
tamaina 2023-05-10 16:22:21 +00:00
parent 0e08c56bc7
commit ad6c5275ec
4 changed files with 292 additions and 260 deletions

View File

@ -1,25 +1,31 @@
import type { JSONSchema7Definition } from 'schema-type';
export const packedQueueCountSchema = { export const packedQueueCountSchema = {
$id: 'https://misskey-hub.net/api/schemas/QueueCount',
type: 'object', type: 'object',
properties: { properties: {
waiting: { waiting: {
type: 'number', type: 'number',
optional: false, nullable: false,
}, },
active: { active: {
type: 'number', type: 'number',
optional: false, nullable: false,
}, },
completed: { completed: {
type: 'number', type: 'number',
optional: false, nullable: false,
}, },
failed: { failed: {
type: 'number', type: 'number',
optional: false, nullable: false,
}, },
delayed: { delayed: {
type: 'number', type: 'number',
optional: false, nullable: false,
}, },
}, },
} as const; required: [
'waiting',
'active',
'completed',
'failed',
'delayed',
],
} as const satisfies JSONSchema7Definition;

View File

@ -1,26 +1,22 @@
import type { JSONSchema7Definition } from 'schema-type';
export const packedRenoteMutingSchema = { export const packedRenoteMutingSchema = {
$id: 'https://misskey-hub.net/api/schemas/RenoteMuting',
type: 'object', type: 'object',
properties: { properties: {
id: { id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
type: 'string',
optional: false, nullable: false,
format: 'id',
example: 'xxxxxxxxxx',
},
createdAt: { createdAt: {
type: 'string', type: 'string',
optional: false, nullable: false,
format: 'date-time', format: 'date-time',
}, },
muteeId: { muteeId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
type: 'string', mutee: { $ref: 'https://misskey-hub.net/api/schemas/UserDetailed' },
optional: false, nullable: false,
format: 'id',
}, },
mutee: { required: [
type: 'object', 'id',
optional: false, nullable: false, 'createdAt',
ref: 'UserDetailed', 'muteeId',
}, 'mutee',
}, ],
} as const; } as const satisfies JSONSchema7Definition;

View File

@ -1,29 +1,26 @@
import type { JSONSchema7Definition } from 'schema-type';
export const packedUserListSchema = { export const packedUserListSchema = {
$id: 'https://misskey-hub.net/api/schemas/UserList',
type: 'object', type: 'object',
properties: { properties: {
id: { id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
type: 'string',
optional: false, nullable: false,
format: 'id',
example: 'xxxxxxxxxx',
},
createdAt: { createdAt: {
type: 'string', type: 'string',
optional: false, nullable: false,
format: 'date-time', format: 'date-time',
}, },
name: { name: {
type: 'string', type: 'string',
optional: false, nullable: false,
}, },
userIds: { userIds: {
type: 'array', type: 'array',
nullable: false, optional: true, items: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
items: {
type: 'string',
nullable: false, optional: false,
format: 'id',
}, },
}, },
}, required: [
} as const; 'id',
'createdAt',
'name',
],
} as const satisfies JSONSchema7Definition;

View File

@ -1,267 +1,300 @@
import type { JSONSchema7Definition } from 'schema-type';
export const packedUserLiteSchema = { export const packedUserLiteSchema = {
$id: 'https://misskey-hub.net/api/schemas/UserLite',
type: 'object', type: 'object',
properties: { properties: {
id: { id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
type: 'string',
nullable: false, optional: false,
format: 'id',
example: 'xxxxxxxxxx',
},
name: { name: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false, examples: '藍',
example: '藍',
}, },
username: { username: {
type: 'string', type: 'string',
nullable: false, optional: false, examples: 'ai',
example: 'ai',
}, },
host: { host: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false, examples: 'misskey.example.com',
example: 'misskey.example.com',
description: 'The local host is represented with `null`.', description: 'The local host is represented with `null`.',
}, },
avatarUrl: { avatarUrl: {
oneOf: [{
type: 'string', type: 'string',
format: 'url', format: 'url',
nullable: true, optional: false, }, {
type: 'null',
}],
}, },
avatarBlurhash: { avatarBlurhash: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false,
}, },
isAdmin: { isAdmin: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
default: false, default: false,
}, },
isModerator: { isModerator: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
default: false, default: false,
}, },
isBot: { isBot: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
isCat: { isCat: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
onlineStatus: { onlineStatus: {
type: 'string', type: ['string', 'null'],
format: 'url', enum: ['unknown', 'online', 'active', 'offline', null],
nullable: true, optional: false,
enum: ['unknown', 'online', 'active', 'offline'],
}, },
}, },
} as const; required: [
'id',
'name',
'username',
'host',
'avatarUrl',
'avatarBlurhash',
'onlineStatus',
],
} as const satisfies JSONSchema7Definition;
export const packedUserDetailedNotMeOnlySchema = { export const packedUserDetailedNotMeOnlySchema = {
$id: 'https://misskey-hub.net/api/schemas/UserDetailedNotMeOnly',
oneOf: [{
$ref: '#/$defs/base',
}, {
allOf: [{ $ref: '#/$defs/base', }, { $ref: '#/$defs/relations' }],
}],
$defs: {
base: {
type: 'object', type: 'object',
properties: { properties: {
url: { url: {
oneOf: [{
type: 'string', type: 'string',
format: 'url', format: 'url',
nullable: true, optional: false, }, {
type: 'null',
}],
}, },
uri: { uri: {
oneOf: [{
type: 'string', type: 'string',
format: 'uri', format: 'uri',
nullable: true, optional: false, }, {
type: 'null',
}],
}, },
movedToUri: { movedToUri: {
oneOf: [{
type: 'string', type: 'string',
format: 'uri', format: 'uri',
nullable: true, }, {
optional: false, type: 'null',
}],
}, },
alsoKnownAs: { alsoKnownAs: {
oneOf: [{
type: 'array', type: 'array',
nullable: true, items: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
optional: false, }, {
items: { type: 'null',
type: 'string', }],
format: 'id',
nullable: false,
optional: false,
},
}, },
createdAt: { createdAt: {
type: 'string', type: 'string',
nullable: false, optional: false,
format: 'date-time', format: 'date-time',
}, },
updatedAt: { updatedAt: {
oneOf: [{
type: 'string', type: 'string',
nullable: true, optional: false,
format: 'date-time', format: 'date-time',
}, {
type: 'null',
}],
}, },
lastFetchedAt: { lastFetchedAt: {
oneOf: [{
type: 'string', type: 'string',
nullable: true, optional: false,
format: 'date-time', format: 'date-time',
}, {
type: 'null',
}],
}, },
bannerUrl: { bannerUrl: {
oneOf: [{
type: 'string', type: 'string',
format: 'url', format: 'url',
nullable: true, optional: false, }, {
type: 'null',
}],
}, },
bannerBlurhash: { bannerBlurhash: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false,
}, },
isLocked: { isLocked: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false,
}, },
isSilenced: { isSilenced: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false,
}, },
isSuspended: { isSuspended: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false, examples: false,
example: false,
}, },
description: { description: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false, examples: 'Hi masters, I am Ai!',
example: 'Hi masters, I am Ai!',
}, },
location: { location: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false,
}, },
birthday: { birthday: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false, examples: '2018-03-12',
example: '2018-03-12',
}, },
lang: { lang: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false, examples: 'ja-JP',
example: 'ja-JP',
}, },
fields: { fields: {
type: 'array', type: 'array',
nullable: false, optional: false, maxLength: 4,
items: { items: {
type: 'object', type: 'object',
nullable: false, optional: false,
properties: { properties: {
name: { name: {
type: 'string', type: 'string',
nullable: false, optional: false,
}, },
value: { value: {
type: 'string', type: 'string',
nullable: false, optional: false,
}, },
}, },
maxLength: 4, required: ['name', 'value'],
}, },
}, },
followersCount: { followersCount: {
type: 'number', type: 'number',
nullable: false, optional: false,
}, },
followingCount: { followingCount: {
type: 'number', type: 'number',
nullable: false, optional: false,
}, },
notesCount: { notesCount: {
type: 'number', type: 'number',
nullable: false, optional: false,
}, },
pinnedNoteIds: { pinnedNoteIds: {
type: 'array', type: 'array',
nullable: false, optional: false, items: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
items: {
type: 'string',
nullable: false, optional: false,
format: 'id',
},
}, },
pinnedNotes: { pinnedNotes: {
type: 'array', type: 'array',
nullable: false, optional: false, items: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
items: {
type: 'object',
nullable: false, optional: false,
ref: 'Note',
},
}, },
pinnedPageId: { pinnedPageId: {
type: 'string', type: ['string', 'null'],
nullable: true, optional: false,
}, },
pinnedPage: { pinnedPage: {
type: 'object', oneOf: [{
nullable: true, optional: false, $ref: 'https://misskey-hub.net/api/schemas/Page',
ref: 'Page', }, {
type: 'null',
}],
}, },
publicReactions: { publicReactions: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false,
}, },
twoFactorEnabled: { twoFactorEnabled: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false,
default: false, default: false,
}, },
usePasswordLessLogin: { usePasswordLessLogin: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false,
default: false, default: false,
}, },
securityKeys: { securityKeys: {
type: 'boolean', type: 'boolean',
nullable: false, optional: false,
default: false, default: false,
}, },
//#region relations },
required: [
'url',
'uri',
'movedToUri',
'alsoKnownAs',
'createdAt',
'updatedAt',
'lastFetchedAt',
'bannerUrl',
'bannerBlurhash',
'isLocked',
'isSilenced',
'isSuspended',
'description',
'location',
'birthday',
'lang',
'fields',
'followersCount',
'followingCount',
'notesCount',
'pinnedNoteIds',
'pinnedNotes',
'pinnedPageId',
'pinnedPage',
'publicReactions',
'twoFactorEnabled',
'usePasswordLessLogin',
'securityKeys',
],
},
relations: {
type: 'object',
properties: {
isFollowing: { isFollowing: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
isFollowed: { isFollowed: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
hasPendingFollowRequestFromYou: { hasPendingFollowRequestFromYou: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
hasPendingFollowRequestToYou: { hasPendingFollowRequestToYou: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
isBlocking: { isBlocking: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
isBlocked: { isBlocked: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
isMuted: { isMuted: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
isRenoteMuted: { isRenoteMuted: {
type: 'boolean', type: 'boolean',
nullable: false, optional: true,
}, },
memo: { memo: {
type: 'string', type: 'string',
nullable: false, optional: true,
}, },
//#endregion
}, },
} as const; required: [
'isFollowing',
'isFollowed',
'hasPendingFollowRequestFromYou',
'hasPendingFollowRequestToYou',
'isBlocking',
'isBlocked',
'isMuted',
'isRenoteMuted',
'memo',
],
},
},
} as const satisfies JSONSchema7Definition;
export const packedMeDetailedOnlySchema = { export const packedMeDetailedOnlySchema = {
type: 'object', type: 'object',