From 931cea75b6da1eb11a2da54552b58631ae523aec Mon Sep 17 00:00:00 2001 From: tamaina Date: Mon, 29 May 2023 16:47:49 +0000 Subject: [PATCH] serial --- packages/misskey-js/src/endpoints.ts | 3 + packages/misskey-js/src/entities.ts | 65 ++++++++++------------ packages/misskey-js/src/schemas.ts | 4 ++ packages/misskey-js/src/schemas/sign-in.ts | 30 ++++++++++ 4 files changed, 67 insertions(+), 35 deletions(-) create mode 100644 packages/misskey-js/src/schemas/sign-in.ts diff --git a/packages/misskey-js/src/endpoints.ts b/packages/misskey-js/src/endpoints.ts index fe0692733..d6237b3dc 100644 --- a/packages/misskey-js/src/endpoints.ts +++ b/packages/misskey-js/src/endpoints.ts @@ -1650,6 +1650,9 @@ export const endpoints = { } }], }, + 'admin/show-user': { + + }, } as const satisfies { [x: string]: IEndpointMeta; }; /** diff --git a/packages/misskey-js/src/entities.ts b/packages/misskey-js/src/entities.ts index 1f7b8db32..b1c6b7d6a 100644 --- a/packages/misskey-js/src/entities.ts +++ b/packages/misskey-js/src/entities.ts @@ -1,3 +1,4 @@ +import { Serialized } from "schema-type"; import { Packed } from "./schemas"; export type ID = Packed<'Id'>; @@ -6,21 +7,21 @@ export type DateString = string; type TODO = Record; // NOTE: 極力この型を使うのは避け、UserLite か UserDetailed か明示するように -export type User = Packed<'User'>; +export type User = Serialized>; -export type UserLite = Packed<'UserLite'>; -export type UserDetailed = Packed<'UserDetailed'>; -export type UserList = Packed<'UserList'>; -export type MeDetailed = Packed<'MeDetailed'>; -export type DriveFile = Packed<'DriveFile'>; -export type DriveFolder = Packed<'DriveFolder'>; -export type GalleryPost = Packed<'GalleryPost'>; -export type Note = Packed<'Note'>; -export type NoteReaction = Packed<'NoteReaction'>; -export type NoteFavorite = Packed<'NoteFavorite'>; -export type Notification = Packed<'NotificationStrict'>; -export type CustomEmoji = Packed<'EmojiSimple'> | Packed<'EmojiDetailed'>; -export type Page = Packed<'Page'>; +export type UserLite = Serialized>; +export type UserDetailed = Serialized>; +export type UserList = Serialized>; +export type MeDetailed = Serialized>; +export type DriveFile = Serialized>; +export type DriveFolder = Serialized>; +export type GalleryPost = Serialized>; +export type Note = Serialized>; +export type NoteReaction = Serialized>; +export type NoteFavorite = Serialized>; +export type Notification = Serialized>; +export type CustomEmoji = Serialized | Packed<'EmojiDetailed'>>; +export type Page = Serialized>; export type PageEvent = { pageId: Page['id']; @@ -30,19 +31,19 @@ export type PageEvent = { user: User; }; -export type Announcement = Packed<'Announcement'>; -export type Antenna = Packed<'Antenna'>; -export type App = Packed<'App'>; -export type Ad = Packed<'Ad'>; -export type Clip = Packed<'Clip'>; -export type Channel = Packed<'Channel'>; -export type Following = Packed<'Following'>; -export type Blocking = Packed<'Blocking'>; -export type Relay = Packed<'Relay'>; -export type Role = Packed<'Role'>; -export type RoleAssign = Packed<'RoleAssign'>; -export type RolePolicy = Packed<'RolePolicy'>; -export type RoleCondFormula = Packed<'RoleCondFormula'>; +export type Announcement = Serialized>; +export type Antenna = Serialized>; +export type App = Serialized>; +export type Ad = Serialized>; +export type Clip = Serialized>; +export type Channel = Serialized>; +export type Following = Serialized>; +export type Blocking = Serialized>; +export type Relay = Serialized>; +export type Role = Serialized>; +export type RoleAssign = Serialized>; +export type RolePolicy = Serialized>; +export type RoleCondFormula = Serialized>; export type LiteInstanceMetadata = { maintainerName: string | null; @@ -106,7 +107,7 @@ export type DetailedInstanceMetadata = LiteInstanceMetadata & { export type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata; -export type ServerInfo = Packed<'ServerInfo'>; +export type ServerInfo = Selialized>; export type Stats = { notesCount: number; @@ -167,13 +168,7 @@ export type Instance = { infoUpdatedAt: DateString | null; }; -export type Signin = { - id: ID; - createdAt: DateString; - ip: string; - headers: Record; - success: boolean; -}; +export type Signin = Serialized>; export type UserSorting = | '+follower' diff --git a/packages/misskey-js/src/schemas.ts b/packages/misskey-js/src/schemas.ts index b5c859063..d4557df29 100644 --- a/packages/misskey-js/src/schemas.ts +++ b/packages/misskey-js/src/schemas.ts @@ -51,6 +51,9 @@ import { ServerInfoSchema, ServerInfoAdminSchema, } from './schemas/server-info.js'; +import { + SignInSchema, +} from './schemas/sign-in.js'; import { packedModerationLogSchema } from './schemas/moderation-log.js'; import { Error, ApiError } from './schemas/error.js'; import type { JSONSchema7, JSONSchema7Definition, GetDef, GetRefs, GetKeys, UnionToArray } from 'schema-type'; @@ -103,6 +106,7 @@ export const refs = { ServerInfo: ServerInfoSchema, ServerInfoAdmin: ServerInfoAdminSchema, ModerationLog: packedModerationLogSchema, + SignIn: SignInSchema, Error: Error, ApiError: ApiError, diff --git a/packages/misskey-js/src/schemas/sign-in.ts b/packages/misskey-js/src/schemas/sign-in.ts new file mode 100644 index 000000000..1fa5624a8 --- /dev/null +++ b/packages/misskey-js/src/schemas/sign-in.ts @@ -0,0 +1,30 @@ +import type { JSONSchema7Definition } from 'schema-type'; + +export const SignInSchema = { + $id: 'https://misskey-hub.net/api/schemas/SignIn', + + type: 'object', + properties: { + id: { $ref: 'https://misskey-hub.net/api/schemas/Id' }, + createdAt: { + type: 'string', + format: 'date-time', + }, + ip: { + type: 'string', + }, + headers: { + type: 'object', + }, + success: { + type: 'boolean', + }, + }, + required: [ + 'id', + 'createdAt', + 'ip', + 'headers', + 'success', + ], +} as const satisfies JSONSchema7Definition;