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: {
type: 'object',
optional: false, nullable: false,
ref: 'UserDetailed',
},
}, },
} as const; required: [
'id',
'createdAt',
'muteeId',
'mutee',
],
} 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',
},
}, },
}, },
} as const; required: [
'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: {
type: 'string', oneOf: [{
format: 'url', type: 'string',
nullable: true, optional: false, format: 'url',
}, {
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 = {
type: 'object', $id: 'https://misskey-hub.net/api/schemas/UserDetailedNotMeOnly',
properties: {
url: { oneOf: [{
type: 'string', $ref: '#/$defs/base',
format: 'url', }, {
nullable: true, optional: false, allOf: [{ $ref: '#/$defs/base', }, { $ref: '#/$defs/relations' }],
}, }],
uri: { $defs: {
type: 'string', base: {
format: 'uri', type: 'object',
nullable: true, optional: false, properties: {
}, url: {
movedToUri: { oneOf: [{
type: 'string',
format: 'uri',
nullable: true,
optional: false,
},
alsoKnownAs: {
type: 'array',
nullable: true,
optional: false,
items: {
type: 'string',
format: 'id',
nullable: false,
optional: false,
},
},
createdAt: {
type: 'string',
nullable: false, optional: false,
format: 'date-time',
},
updatedAt: {
type: 'string',
nullable: true, optional: false,
format: 'date-time',
},
lastFetchedAt: {
type: 'string',
nullable: true, optional: false,
format: 'date-time',
},
bannerUrl: {
type: 'string',
format: 'url',
nullable: true, optional: false,
},
bannerBlurhash: {
type: 'string',
nullable: true, optional: false,
},
isLocked: {
type: 'boolean',
nullable: false, optional: false,
},
isSilenced: {
type: 'boolean',
nullable: false, optional: false,
},
isSuspended: {
type: 'boolean',
nullable: false, optional: false,
example: false,
},
description: {
type: 'string',
nullable: true, optional: false,
example: 'Hi masters, I am Ai!',
},
location: {
type: 'string',
nullable: true, optional: false,
},
birthday: {
type: 'string',
nullable: true, optional: false,
example: '2018-03-12',
},
lang: {
type: 'string',
nullable: true, optional: false,
example: 'ja-JP',
},
fields: {
type: 'array',
nullable: false, optional: false,
items: {
type: 'object',
nullable: false, optional: false,
properties: {
name: {
type: 'string', type: 'string',
nullable: false, optional: false, format: 'url',
}, }, {
value: { type: 'null',
}],
},
uri: {
oneOf: [{
type: 'string', type: 'string',
nullable: false, optional: false, format: 'uri',
}, {
type: 'null',
}],
},
movedToUri: {
oneOf: [{
type: 'string',
format: 'uri',
}, {
type: 'null',
}],
},
alsoKnownAs: {
oneOf: [{
type: 'array',
items: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
}, {
type: 'null',
}],
},
createdAt: {
type: 'string',
format: 'date-time',
},
updatedAt: {
oneOf: [{
type: 'string',
format: 'date-time',
}, {
type: 'null',
}],
},
lastFetchedAt: {
oneOf: [{
type: 'string',
format: 'date-time',
}, {
type: 'null',
}],
},
bannerUrl: {
oneOf: [{
type: 'string',
format: 'url',
}, {
type: 'null',
}],
},
bannerBlurhash: {
type: ['string', 'null'],
},
isLocked: {
type: 'boolean',
},
isSilenced: {
type: 'boolean',
},
isSuspended: {
type: 'boolean',
examples: false,
},
description: {
type: ['string', 'null'],
examples: 'Hi masters, I am Ai!',
},
location: {
type: ['string', 'null'],
},
birthday: {
type: ['string', 'null'],
examples: '2018-03-12',
},
lang: {
type: ['string', 'null'],
examples: 'ja-JP',
},
fields: {
type: 'array',
maxLength: 4,
items: {
type: 'object',
properties: {
name: {
type: 'string',
},
value: {
type: 'string',
},
},
required: ['name', 'value'],
}, },
}, },
maxLength: 4, followersCount: {
type: 'number',
},
followingCount: {
type: 'number',
},
notesCount: {
type: 'number',
},
pinnedNoteIds: {
type: 'array',
items: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
},
pinnedNotes: {
type: 'array',
items: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
},
pinnedPageId: {
type: ['string', 'null'],
},
pinnedPage: {
oneOf: [{
$ref: 'https://misskey-hub.net/api/schemas/Page',
}, {
type: 'null',
}],
},
publicReactions: {
type: 'boolean',
},
twoFactorEnabled: {
type: 'boolean',
default: false,
},
usePasswordLessLogin: {
type: 'boolean',
default: false,
},
securityKeys: {
type: 'boolean',
default: false,
},
}, },
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',
],
}, },
followersCount: { relations: {
type: 'number',
nullable: false, optional: false,
},
followingCount: {
type: 'number',
nullable: false, optional: false,
},
notesCount: {
type: 'number',
nullable: false, optional: false,
},
pinnedNoteIds: {
type: 'array',
nullable: false, optional: false,
items: {
type: 'string',
nullable: false, optional: false,
format: 'id',
},
},
pinnedNotes: {
type: 'array',
nullable: false, optional: false,
items: {
type: 'object',
nullable: false, optional: false,
ref: 'Note',
},
},
pinnedPageId: {
type: 'string',
nullable: true, optional: false,
},
pinnedPage: {
type: 'object', type: 'object',
nullable: true, optional: false, properties: {
ref: 'Page', isFollowing: {
type: 'boolean',
},
isFollowed: {
type: 'boolean',
},
hasPendingFollowRequestFromYou: {
type: 'boolean',
},
hasPendingFollowRequestToYou: {
type: 'boolean',
},
isBlocking: {
type: 'boolean',
},
isBlocked: {
type: 'boolean',
},
isMuted: {
type: 'boolean',
},
isRenoteMuted: {
type: 'boolean',
},
memo: {
type: 'string',
},
},
required: [
'isFollowing',
'isFollowed',
'hasPendingFollowRequestFromYou',
'hasPendingFollowRequestToYou',
'isBlocking',
'isBlocked',
'isMuted',
'isRenoteMuted',
'memo',
],
}, },
publicReactions: {
type: 'boolean',
nullable: false, optional: false,
},
twoFactorEnabled: {
type: 'boolean',
nullable: false, optional: false,
default: false,
},
usePasswordLessLogin: {
type: 'boolean',
nullable: false, optional: false,
default: false,
},
securityKeys: {
type: 'boolean',
nullable: false, optional: false,
default: false,
},
//#region relations
isFollowing: {
type: 'boolean',
nullable: false, optional: true,
},
isFollowed: {
type: 'boolean',
nullable: false, optional: true,
},
hasPendingFollowRequestFromYou: {
type: 'boolean',
nullable: false, optional: true,
},
hasPendingFollowRequestToYou: {
type: 'boolean',
nullable: false, optional: true,
},
isBlocking: {
type: 'boolean',
nullable: false, optional: true,
},
isBlocked: {
type: 'boolean',
nullable: false, optional: true,
},
isMuted: {
type: 'boolean',
nullable: false, optional: true,
},
isRenoteMuted: {
type: 'boolean',
nullable: false, optional: true,
},
memo: {
type: 'string',
nullable: false, optional: true,
},
//#endregion
}, },
} as const; } as const satisfies JSONSchema7Definition;
export const packedMeDetailedOnlySchema = { export const packedMeDetailedOnlySchema = {
type: 'object', type: 'object',