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 = {
$id: 'https://misskey-hub.net/api/schemas/QueueCount',
type: 'object',
properties: {
waiting: {
type: 'number',
optional: false, nullable: false,
},
active: {
type: 'number',
optional: false, nullable: false,
},
completed: {
type: 'number',
optional: false, nullable: false,
},
failed: {
type: 'number',
optional: false, nullable: false,
},
delayed: {
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 = {
$id: 'https://misskey-hub.net/api/schemas/RenoteMuting',
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',
},
muteeId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
muteeId: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
mutee: { $ref: 'https://misskey-hub.net/api/schemas/UserDetailed' },
},
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 = {
$id: 'https://misskey-hub.net/api/schemas/UserList',
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',
},
name: {
type: 'string',
optional: false, nullable: false,
},
userIds: {
type: 'array',
nullable: false, optional: true,
items: {
type: 'string',
nullable: false, optional: false,
format: 'id',
items: { $ref: 'https://misskey-hub.net/api/schemas/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 = {
$id: 'https://misskey-hub.net/api/schemas/UserLite',
type: 'object',
properties: {
id: {
type: 'string',
nullable: false, optional: false,
format: 'id',
example: 'xxxxxxxxxx',
},
id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
name: {
type: 'string',
nullable: true, optional: false,
example: '藍',
type: ['string', 'null'],
examples: '藍',
},
username: {
type: 'string',
nullable: false, optional: false,
example: 'ai',
examples: 'ai',
},
host: {
type: 'string',
nullable: true, optional: false,
example: 'misskey.example.com',
type: ['string', 'null'],
examples: 'misskey.example.com',
description: 'The local host is represented with `null`.',
},
avatarUrl: {
oneOf: [{
type: 'string',
format: 'url',
nullable: true, optional: false,
}, {
type: 'null',
}],
},
avatarBlurhash: {
type: 'string',
nullable: true, optional: false,
type: ['string', 'null'],
},
isAdmin: {
type: 'boolean',
nullable: false, optional: true,
default: false,
},
isModerator: {
type: 'boolean',
nullable: false, optional: true,
default: false,
},
isBot: {
type: 'boolean',
nullable: false, optional: true,
},
isCat: {
type: 'boolean',
nullable: false, optional: true,
},
onlineStatus: {
type: 'string',
format: 'url',
nullable: true, optional: false,
enum: ['unknown', 'online', 'active', 'offline'],
type: ['string', 'null'],
enum: ['unknown', 'online', 'active', 'offline', null],
},
},
} as const;
required: [
'id',
'name',
'username',
'host',
'avatarUrl',
'avatarBlurhash',
'onlineStatus',
],
} as const satisfies JSONSchema7Definition;
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',
properties: {
url: {
oneOf: [{
type: 'string',
format: 'url',
nullable: true, optional: false,
}, {
type: 'null',
}],
},
uri: {
oneOf: [{
type: 'string',
format: 'uri',
nullable: true, optional: false,
}, {
type: 'null',
}],
},
movedToUri: {
oneOf: [{
type: 'string',
format: 'uri',
nullable: true,
optional: false,
}, {
type: 'null',
}],
},
alsoKnownAs: {
oneOf: [{
type: 'array',
nullable: true,
optional: false,
items: {
type: 'string',
format: 'id',
nullable: false,
optional: false,
},
items: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
}, {
type: 'null',
}],
},
createdAt: {
type: 'string',
nullable: false, optional: false,
format: 'date-time',
},
updatedAt: {
oneOf: [{
type: 'string',
nullable: true, optional: false,
format: 'date-time',
}, {
type: 'null',
}],
},
lastFetchedAt: {
oneOf: [{
type: 'string',
nullable: true, optional: false,
format: 'date-time',
}, {
type: 'null',
}],
},
bannerUrl: {
oneOf: [{
type: 'string',
format: 'url',
nullable: true, optional: false,
}, {
type: 'null',
}],
},
bannerBlurhash: {
type: 'string',
nullable: true, optional: false,
type: ['string', 'null'],
},
isLocked: {
type: 'boolean',
nullable: false, optional: false,
},
isSilenced: {
type: 'boolean',
nullable: false, optional: false,
},
isSuspended: {
type: 'boolean',
nullable: false, optional: false,
example: false,
examples: false,
},
description: {
type: 'string',
nullable: true, optional: false,
example: 'Hi masters, I am Ai!',
type: ['string', 'null'],
examples: 'Hi masters, I am Ai!',
},
location: {
type: 'string',
nullable: true, optional: false,
type: ['string', 'null'],
},
birthday: {
type: 'string',
nullable: true, optional: false,
example: '2018-03-12',
type: ['string', 'null'],
examples: '2018-03-12',
},
lang: {
type: 'string',
nullable: true, optional: false,
example: 'ja-JP',
type: ['string', 'null'],
examples: 'ja-JP',
},
fields: {
type: 'array',
nullable: false, optional: false,
maxLength: 4,
items: {
type: 'object',
nullable: false, optional: false,
properties: {
name: {
type: 'string',
nullable: false, optional: false,
},
value: {
type: 'string',
nullable: false, optional: false,
},
},
maxLength: 4,
required: ['name', 'value'],
},
},
followersCount: {
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',
},
items: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
},
pinnedNotes: {
type: 'array',
nullable: false, optional: false,
items: {
type: 'object',
nullable: false, optional: false,
ref: 'Note',
},
items: { $ref: 'https://misskey-hub.net/api/schemas/Note' },
},
pinnedPageId: {
type: 'string',
nullable: true, optional: false,
type: ['string', 'null'],
},
pinnedPage: {
type: 'object',
nullable: true, optional: false,
ref: 'Page',
oneOf: [{
$ref: 'https://misskey-hub.net/api/schemas/Page',
}, {
type: 'null',
}],
},
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
},
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: {
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;
required: [
'isFollowing',
'isFollowed',
'hasPendingFollowRequestFromYou',
'hasPendingFollowRequestToYou',
'isBlocking',
'isBlocked',
'isMuted',
'isRenoteMuted',
'memo',
],
},
},
} as const satisfies JSONSchema7Definition;
export const packedMeDetailedOnlySchema = {
type: 'object',